mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 22:14:33 -04:00
Fix for saving invoice client with id/public_id
This commit is contained in:
parent
cf75a2c2d2
commit
b27505f63c
@ -16,6 +16,7 @@ class Kernel extends ConsoleKernel
|
|||||||
'App\Console\Commands\RemoveOrphanedDocuments',
|
'App\Console\Commands\RemoveOrphanedDocuments',
|
||||||
'App\Console\Commands\ResetData',
|
'App\Console\Commands\ResetData',
|
||||||
'App\Console\Commands\CheckData',
|
'App\Console\Commands\CheckData',
|
||||||
|
'App\Console\Commands\PruneData',
|
||||||
'App\Console\Commands\SendRenewalInvoices',
|
'App\Console\Commands\SendRenewalInvoices',
|
||||||
'App\Console\Commands\ChargeRenewalInvoices',
|
'App\Console\Commands\ChargeRenewalInvoices',
|
||||||
'App\Console\Commands\SendReminders',
|
'App\Console\Commands\SendReminders',
|
||||||
|
@ -33,17 +33,17 @@ class InvoiceService extends BaseService
|
|||||||
public function save($data, $checkSubPermissions = false)
|
public function save($data, $checkSubPermissions = false)
|
||||||
{
|
{
|
||||||
if (isset($data['client'])) {
|
if (isset($data['client'])) {
|
||||||
$can_save_client = !$checkSubPermissions;
|
$canSaveClient = !$checkSubPermissions;
|
||||||
if(!$can_save_client){
|
if( ! $canSaveClient){
|
||||||
if(empty($data['client']['public_id']) || $data['client']['public_id']=='-1'){
|
$clientPublicId = array_get($data, 'client.public_id') ?: array_get($data, 'client.id');
|
||||||
$can_save_client = Client::canCreate();
|
if (empty($clientPublicId) || $clientPublicId == '-1') {
|
||||||
}
|
$canSaveClient = Client::canCreate();
|
||||||
else{
|
} else {
|
||||||
$can_save_client = Client::wherePublicId($data['client']['public_id'])->first()->canEdit();
|
$canSaveClient = Client::scope($clientPublicId)->first()->canEdit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($can_save_client){
|
if ($canSaveClient) {
|
||||||
$client = $this->clientRepo->save($data['client']);
|
$client = $this->clientRepo->save($data['client']);
|
||||||
$data['client_id'] = $client->id;
|
$data['client_id'] = $client->id;
|
||||||
}
|
}
|
||||||
|
@ -63,10 +63,11 @@ class AddPageSize extends Migration
|
|||||||
$table->boolean('is_early_access');
|
$table->boolean('is_early_access');
|
||||||
});
|
});
|
||||||
|
|
||||||
Schema::dropIfExists('expense_categories');
|
|
||||||
|
|
||||||
Schema::table('expenses', function ($table) {
|
Schema::table('expenses', function ($table) {
|
||||||
|
$table->dropForeign('expenses_expense_category_id_foreign');
|
||||||
$table->dropColumn('expense_category_id');
|
$table->dropColumn('expense_category_id');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Schema::dropIfExists('expense_categories');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
@ -710,7 +710,7 @@ function calculateAmounts(invoice) {
|
|||||||
total += roundToTwo(invoice.custom_value2);
|
total += roundToTwo(invoice.custom_value2);
|
||||||
}
|
}
|
||||||
|
|
||||||
invoice.total_amount = roundToTwo(total) - (roundToTwo(invoice.amount) - roundToTwo(invoice.balance));
|
invoice.total_amount = roundToTwo(roundToTwo(total) - (roundToTwo(invoice.amount) - roundToTwo(invoice.balance)));
|
||||||
invoice.discount_amount = discount;
|
invoice.discount_amount = discount;
|
||||||
invoice.tax_amount1 = taxAmount1;
|
invoice.tax_amount1 = taxAmount1;
|
||||||
invoice.tax_amount2 = taxAmount2;
|
invoice.tax_amount2 = taxAmount2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user