1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Improvements to check data script

This commit is contained in:
Hillel Coren 2017-07-12 23:34:57 +03:00
parent 756fca49fe
commit e4a7f4c614
2 changed files with 5 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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);
}
/**