1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #4617 from turbo124/v5-develop

Fixes for unique taxrate constraint on update 8653cc6
This commit is contained in:
David Bomba 2021-01-04 08:23:09 +11:00 committed by GitHub
commit 7c5fbda1bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 2 deletions

View File

@ -32,6 +32,16 @@ class InvitationController extends Controller
use MakesDates;
public function router(string $entity, string $invitation_key)
{
return $this->genericRouter($entity, $invitation_key);
}
public function recurringRouter(string $invitation_key)
{
return $this->genericRouter('recurring_invoice', $invitation_key);
}
private function genericRouter(string $entity, string $invitation_key)
{
$key = $entity.'_id';

View File

@ -28,7 +28,8 @@ class UpdateTaxRateRequest extends Request
public function rules()
{
return [
'name' => 'unique:tax_rates,name,'.$this->tax_rate->name.',id,company_id,'.auth()->user()->companyId(),
// 'name' => 'unique:tax_rates,name,'.$this->tax_rate->name.',id,company_id,'.auth()->user()->companyId(),
'name' => 'unique:tax_rates,name,'.$this->id.',id,company_id,'.$this->company_id,
'rate' => 'numeric',
];
}

View File

@ -300,6 +300,9 @@ class RecurringInvoice extends BaseModel
public static function frequencyForKey(int $frequency_id) :string
{
switch ($frequency_id) {
case self::FREQUENCY_DAILY:
return ctrans('texts.freq_daily');
break;
case self::FREQUENCY_WEEKLY:
return ctrans('texts.freq_weekly');
break;

View File

@ -11,6 +11,7 @@
namespace App\Providers;
use App\Models\RecurringInvoice;
use App\Utils\Traits\MakesHash;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Route;
@ -36,6 +37,7 @@ class RouteServiceProvider extends ServiceProvider
{
//
parent::boot();
}
/**

View File

@ -34,7 +34,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
Route::get('invoices/{invoice_invitation}', 'ClientPortal\InvoiceController@show')->name('invoice.show_invitation');
Route::get('recurring_invoices', 'ClientPortal\RecurringInvoiceController@index')->name('recurring_invoices.index')->middleware('portal_enabled');
Route::get('recurring_invoices/{recurring_invoice}', 'ClientPortal\RecurringInvoiceController@show')->name('recurring_invoices.show');
Route::get('recurring_invoices/{recurring_invoice}', 'ClientPortal\RecurringInvoiceController@show')->name('recurring_invoice.show');
Route::get('recurring_invoices/{recurring_invoice}/request_cancellation', 'ClientPortal\RecurringInvoiceController@requestCancellation')->name('recurring_invoices.request_cancellation');
Route::post('payments/process', 'ClientPortal\PaymentController@process')->name('payments.process');
@ -78,6 +78,7 @@ Route::group(['middleware' => ['auth:contact', 'locale', 'check_client_existence
Route::group(['middleware' => ['invite_db'], 'prefix' => 'client', 'as' => 'client.'], function () {
/*Invitation catches*/
Route::get('recurring_invoice/{invitation_key}', 'ClientPortal\InvitationController@recurringRouter');
Route::get('{entity}/{invitation_key}', 'ClientPortal\InvitationController@router');
Route::get('invoice/{invitation_key}/download_pdf', 'InvoiceController@downloadPdf')->name('invoice.download_invitation_key');
Route::get('quote/{invitation_key}/download_pdf', 'QuoteController@downloadPdf')->name('quote.download_invitation_key');