mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improvements to check data script
This commit is contained in:
parent
756fca49fe
commit
e4a7f4c614
@ -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();
|
||||||
@ -148,14 +148,14 @@ class CheckData extends Command
|
|||||||
->get(['id', 'balance']);
|
->get(['id', 'balance']);
|
||||||
|
|
||||||
foreach ($invoices as $invoice) {
|
foreach ($invoices as $invoice) {
|
||||||
$link = $invoice->getInvitationLink();
|
$link = $invoice->getInvitationLink('view', true, true);
|
||||||
$this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance);
|
$this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance);
|
||||||
$result = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_balances=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
|
$result = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_balances=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
|
||||||
$result = floatval(strip_tags($result));
|
$result = floatval(strip_tags($result));
|
||||||
$this->logMessage('Result: ' . $result);
|
$this->logMessage('Result: ' . $result);
|
||||||
|
|
||||||
if ($result && $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 {$link} - PHP: {$invoice->balance}, JS: {$result}");
|
||||||
$this->isValid = false;
|
$this->isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -699,13 +699,13 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
return self::calcLink($this);
|
return self::calcLink($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getInvitationLink($type = 'view', $forceOnsite = false)
|
public function getInvitationLink($type = 'view', $forceOnsite = false, $forcePlain = false)
|
||||||
{
|
{
|
||||||
if (! $this->relationLoaded('invitations')) {
|
if (! $this->relationLoaded('invitations')) {
|
||||||
$this->load('invitations');
|
$this->load('invitations');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->invitations[0]->getLink($type, $forceOnsite);
|
return $this->invitations[0]->getLink($type, $forceOnsite, $forcePlain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user