mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Working on ledger balances
This commit is contained in:
parent
7328a2ff7a
commit
7325a66c47
@ -290,7 +290,7 @@ class BaseRepository
|
||||
|
||||
/* Perform model specific tasks */
|
||||
if ($model instanceof Invoice) {
|
||||
if ($model->status_id != Invoice::STATUS_DRAFT && ($state['starting_amount'] != $state['finished_amount'])) {
|
||||
if ($model->status_id != Invoice::STATUS_DRAFT) {
|
||||
$model->service()->updateStatus()->save();
|
||||
$model->client->service()->calculateBalance();
|
||||
$model->ledger()->updateInvoiceBalance(($state['finished_amount'] - $state['starting_amount']), "Update adjustment for invoice {$model->number}");
|
||||
|
@ -36,7 +36,9 @@ class LedgerService
|
||||
// $hash = sha1($adjustment.$notes.$this->entity->status_id.$this->entity->client_id.$this->entity->amount.$this->entity->balance.$this->entity->company_id.Activity::UPDATE_INVOICE);
|
||||
// $hash = sha1($hash);
|
||||
// $hash = sha1("{$this->entity->amount}.{$this->entity->balance}");
|
||||
$hash = "{$this->entity->amount}.{$this->entity->balance}";
|
||||
$hash = "{$adjustment}.{$this->entity->amount}.{$this->entity->balance}";
|
||||
|
||||
usleep(10000000);
|
||||
|
||||
$exists = CompanyLedger::query()
|
||||
->where('client_id', $this->entity->client_id)
|
||||
@ -49,6 +51,7 @@ class LedgerService
|
||||
->exists();
|
||||
|
||||
if($exists) {
|
||||
nlog("Collision {$adjustment} {$notes}");
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user