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)
|
public function updatedInvoice(InvoiceWasUpdated $event)
|
||||||
{
|
{
|
||||||
|
if (! $event->invoice->isChanged()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')
|
$backupInvoice = Invoice::with('invoice_items', 'client.account', 'client.contacts')
|
||||||
->withTrashed()
|
->withTrashed()
|
||||||
->find($event->invoice->id);
|
->find($event->invoice->id);
|
||||||
|
@ -190,6 +190,15 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return floatval($this->amount) - floatval($this->getOriginal('amount'));
|
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
|
* @param bool $calculate
|
||||||
* @return int|mixed
|
* @return int|mixed
|
||||||
|
Loading…
x
Reference in New Issue
Block a user