From 31891fe1b733ef28a26cf854fd850124a71ac591 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 8 Jan 2017 12:23:02 +0200 Subject: [PATCH] Track more changes on self hosts --- app/Models/Invoice.php | 31 ++++++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index fe6879efa2..b2a6eef636 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -192,11 +192,36 @@ class Invoice extends EntityModel implements BalanceAffecting public function isChanged() { - $dirty = $this->getDirty(); + if (Utils::isNinja()) { + if ($this->getRawAdjustment() != 0) { + return true; + } + + foreach ([ + 'invoice_number', + 'po_number', + 'invoice_date', + 'due_date', + 'terms', + 'public_notes', + 'invoice_footer', + 'partial', + ] as $field) { + if ($this->$field != $this->getOriginal($field)) { + return true; + } + } - unset($dirty['invoice_status_id']); + return false; + } else { + $dirty = $this->getDirty(); - return count($dirty) > 0; + unset($dirty['invoice_status_id']); + unset($dirty['client_enable_auto_bill']); + unset($dirty['quote_invoice_id']); + + return count($dirty) > 0; + } } /**