mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Clean up invoice activity records
This commit is contained in:
parent
06d5509805
commit
84ac76cff1
@ -127,6 +127,10 @@ class ActivityListener
|
||||
*/
|
||||
public function updatedInvoice(InvoiceWasUpdated $event)
|
||||
{
|
||||
if (! $event->invoice->isChanged()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')
|
||||
->withTrashed()
|
||||
->find($event->invoice->id);
|
||||
|
@ -190,6 +190,15 @@ class Invoice extends EntityModel implements BalanceAffecting
|
||||
return floatval($this->amount) - floatval($this->getOriginal('amount'));
|
||||
}
|
||||
|
||||
public function isChanged()
|
||||
{
|
||||
$dirty = $this->getDirty();
|
||||
|
||||
unset($dirty['invoice_status_id']);
|
||||
|
||||
return count($dirty) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $calculate
|
||||
* @return int|mixed
|
||||
|
Loading…
x
Reference in New Issue
Block a user