mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fixes for base repo
This commit is contained in:
parent
2fe47f572a
commit
392a4e5ccb
@ -146,8 +146,9 @@ class BaseRepository
|
|||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
protected function alternativeSave($data, $model)
|
protected function alternativeSave($data, $model)
|
||||||
{
|
{ //$start = microtime(true);
|
||||||
if (array_key_exists('client_id', $data) && !empty($data['client_id'])) {
|
//forces the client_id if it doesn't exist
|
||||||
|
if (array_key_exists('client_id', $data)) {
|
||||||
$model->client_id = $data['client_id'];
|
$model->client_id = $data['client_id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,26 +177,27 @@ class BaseRepository
|
|||||||
|
|
||||||
if (isset($tmp_data['client_contacts'])) {
|
if (isset($tmp_data['client_contacts'])) {
|
||||||
unset($tmp_data['client_contacts']);
|
unset($tmp_data['client_contacts']);
|
||||||
|
}
|
||||||
|
|
||||||
$model->fill($tmp_data);
|
$model->fill($tmp_data);
|
||||||
|
|
||||||
$model->custom_surcharge_tax1 = $client->company->custom_surcharge_taxes1;
|
$model->custom_surcharge_tax1 = $client->company->custom_surcharge_taxes1;
|
||||||
$model->custom_surcharge_tax2 = $client->company->custom_surcharge_taxes2;
|
$model->custom_surcharge_tax2 = $client->company->custom_surcharge_taxes2;
|
||||||
$model->custom_surcharge_tax3 = $client->company->custom_surcharge_taxes3;
|
$model->custom_surcharge_tax3 = $client->company->custom_surcharge_taxes3;
|
||||||
$model->custom_surcharge_tax4 = $client->company->custom_surcharge_taxes4;
|
$model->custom_surcharge_tax4 = $client->company->custom_surcharge_taxes4;
|
||||||
|
|
||||||
if (!$model->id) {
|
if (!$model->id) {
|
||||||
$this->new_model = true;
|
$this->new_model = true;
|
||||||
|
|
||||||
if (is_array($model->line_items) && !($model instanceof RecurringInvoice)) {
|
if (is_array($model->line_items) && !($model instanceof RecurringInvoice)) {
|
||||||
$model->line_items = (collect($model->line_items))->map(function ($item) use ($model, $client) {
|
$model->line_items = (collect($model->line_items))->map(function ($item) use ($model, $client) {
|
||||||
$item->notes = Helpers::processReservedKeywords($item->notes, $client);
|
$item->notes = Helpers::processReservedKeywords($item->notes, $client);
|
||||||
|
|
||||||
return $item;
|
return $item;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$model->saveQuietly();
|
$model->saveQuietly();
|
||||||
|
|
||||||
/* Model now persisted, now lets do some child tasks */
|
/* Model now persisted, now lets do some child tasks */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user