mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-01 03:54:36 -04:00
Code cleanup for baserepo
This commit is contained in:
parent
f63323e4e2
commit
cbeeeef1c4
@ -74,9 +74,7 @@ class BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
$entity->delete();
|
$entity->delete();
|
||||||
|
|
||||||
info("archived");
|
|
||||||
|
|
||||||
$className = $this->getEventClass($entity, 'Archived');
|
$className = $this->getEventClass($entity, 'Archived');
|
||||||
|
|
||||||
if (class_exists($className)) {
|
if (class_exists($className)) {
|
||||||
@ -286,10 +284,9 @@ class BaseRepository
|
|||||||
}
|
}
|
||||||
|
|
||||||
$model = $model->calc()->getInvoice();
|
$model = $model->calc()->getInvoice();
|
||||||
|
|
||||||
$state['finished_amount'] = $model->amount;
|
$state['finished_amount'] = $model->amount;
|
||||||
|
|
||||||
info("finished amount = {$model->amount}");
|
|
||||||
|
|
||||||
$model = $model->service()->applyNumber()->save();
|
$model = $model->service()->applyNumber()->save();
|
||||||
|
|
||||||
if ($model->company->update_products !== false) {
|
if ($model->company->update_products !== false) {
|
||||||
@ -299,7 +296,7 @@ class BaseRepository
|
|||||||
if ($class->name == Invoice::class) {
|
if ($class->name == Invoice::class) {
|
||||||
|
|
||||||
if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) {
|
if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) {
|
||||||
info("inside ledger updating");
|
|
||||||
$model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount']));
|
$model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount']));
|
||||||
$model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save();
|
$model->client->service()->updateBalance(($state['finished_amount'] - $state['starting_amount']))->save();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user