1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-14 15:13:29 +01:00

Add check for invoice JS amounts

This commit is contained in:
Hillel Coren 2017-07-03 15:09:55 +03:00
parent 561407f3cc
commit 2786aae871

View File

@ -76,7 +76,7 @@ class CheckData extends Command
$this->checkDraftSentInvoices(); $this->checkDraftSentInvoices();
} }
$this->checkInvoices(); //$this->checkInvoices();
$this->checkBalances(); $this->checkBalances();
$this->checkContacts(); $this->checkContacts();
$this->checkUserAccounts(); $this->checkUserAccounts();
@ -142,8 +142,7 @@ class CheckData extends Command
$date = new Carbon(); $date = new Carbon();
$date = $date->subDays(1)->format('Y-m-d'); $date = $date->subDays(1)->format('Y-m-d');
$invoices = Invoice::withTrashed() $invoices = Invoice::with('invitations')
->with('invitations')
->where('created_at', '>', $date) ->where('created_at', '>', $date)
->orderBy('id') ->orderBy('id')
->get(['id', 'balance']); ->get(['id', 'balance']);
@ -155,7 +154,7 @@ class CheckData extends Command
$result = floatval(strip_tags($result)); $result = floatval(strip_tags($result));
$this->logMessage('Result: ' . $result); $this->logMessage('Result: ' . $result);
if ($result != $invoice->balance) { if ($result && $result != $invoice->balance) {
$this->logMessage("Amounts do not match - PHP: {$invoice->balance}, JS: {$result}"); $this->logMessage("Amounts do not match - PHP: {$invoice->balance}, JS: {$result}");
$this->isValid = false; $this->isValid = false;
} }