From a9104c64b0aa61d83a5700738c46591c776fa044 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Tue, 29 Aug 2017 22:13:02 +0300 Subject: [PATCH] Add check for PHP/JS balances --- resources/views/invoices/edit.blade.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index a714bfd79c..31ecf7d7b4 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -863,6 +863,13 @@ } } model.invoice().addItem(); // add blank item + + // check amounts are correct + var phpBalance = invoice.balance; + var jsBalance = model.invoice().totals.rawTotal(); + if (phpBalance != jsBalance) { + window.onerror('Balances do not match | PHP: ' + phpBalance + ', JS: ' + jsBalance); + } @else // set the default account tax rate @if ($account->invoice_taxes)