mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Fix for check data
This commit is contained in:
parent
42b25bffe3
commit
5f9b2aafb5
@ -139,7 +139,7 @@ class CheckData extends Command
|
|||||||
|
|
||||||
private function checkInvoices()
|
private function checkInvoices()
|
||||||
{
|
{
|
||||||
if (! env('PHANTOMJS_BIN_PATH')) {
|
if (! env('PHANTOMJS_BIN_PATH') || ! Utils::isNinjaProd()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,17 +154,19 @@ class CheckData extends Command
|
|||||||
$invoices = Invoice::with('invitations')
|
$invoices = Invoice::with('invitations')
|
||||||
->where('created_at', '>', $date)
|
->where('created_at', '>', $date)
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->get(['id', 'balance']);
|
->get();
|
||||||
|
|
||||||
foreach ($invoices as $invoice) {
|
foreach ($invoices as $invoice) {
|
||||||
$link = $invoice->getInvitationLink('view', true, true);
|
$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 = CurlUtils::phantom('GET', $link . '?phantomjs=true&phantomjs_balances=true&phantomjs_secret=' . env('PHANTOMJS_SECRET'));
|
||||||
$result = floatval(strip_tags($result));
|
$result = floatval(strip_tags($result));
|
||||||
|
$invoice = $invoice->fresh();
|
||||||
|
|
||||||
|
//$this->logMessage('Checking invoice: ' . $invoice->id . ' - ' . $invoice->balance);
|
||||||
//$this->logMessage('Result: ' . $result);
|
//$this->logMessage('Result: ' . $result);
|
||||||
|
|
||||||
if ($result && $result != $invoice->balance) {
|
if ($result && $result != $invoice->balance) {
|
||||||
$this->logMessage("PHP/JS amounts do not match {$link} - PHP: {$invoice->balance}, JS: {$result}");
|
$this->logMessage("PHP/JS amounts do not match {$link}?silent=true | PHP: {$invoice->balance}, JS: {$result}");
|
||||||
$this->isValid = $isValid = false;
|
$this->isValid = $isValid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user