From e4a7f4c61435b1e26aee959f5fe21be74bef3430 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Wed, 12 Jul 2017 23:34:57 +0300 Subject: [PATCH] Improvements to check data script --- app/Console/Commands/CheckData.php | 6 +++--- app/Models/Invoice.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/Console/Commands/CheckData.php b/app/Console/Commands/CheckData.php index 43e5e164785a..fd3f8543df1a 100644 --- a/app/Console/Commands/CheckData.php +++ b/app/Console/Commands/CheckData.php @@ -76,7 +76,7 @@ class CheckData extends Command $this->checkDraftSentInvoices(); } - //$this->checkInvoices(); + $this->checkInvoices(); $this->checkBalances(); $this->checkContacts(); $this->checkUserAccounts(); @@ -148,14 +148,14 @@ class CheckData extends Command ->get(['id', 'balance']); foreach ($invoices as $invoice) { - $link = $invoice->getInvitationLink(); + $link = $invoice->getInvitationLink('view', true, true); $this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance); $result = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_balances=true&phantomjs_secret=' . env('PHANTOMJS_SECRET')); $result = floatval(strip_tags($result)); $this->logMessage('Result: ' . $result); if ($result && $result != $invoice->balance) { - $this->logMessage("Amounts do not match - PHP: {$invoice->balance}, JS: {$result}"); + $this->logMessage("Amounts do not match {$link} - PHP: {$invoice->balance}, JS: {$result}"); $this->isValid = false; } } diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index b4dbbbf8fa05..db771b4b7539 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -699,13 +699,13 @@ class Invoice extends EntityModel implements BalanceAffecting return self::calcLink($this); } - public function getInvitationLink($type = 'view', $forceOnsite = false) + public function getInvitationLink($type = 'view', $forceOnsite = false, $forcePlain = false) { if (! $this->relationLoaded('invitations')) { $this->load('invitations'); } - return $this->invitations[0]->getLink($type, $forceOnsite); + return $this->invitations[0]->getLink($type, $forceOnsite, $forcePlain); } /**