Additional logging for auto bill

This commit is contained in:
David Bomba 2021-10-05 08:17:41 +11:00
parent d562630957
commit 491d5e9f89
3 changed files with 8 additions and 5 deletions

View File

@ -51,6 +51,8 @@ class AutoBill
try{ try{
nlog("autobill {$this->invoice->id}");
$this->invoice->service()->autoBill()->save(); $this->invoice->service()->autoBill()->save();
} }

View File

@ -25,6 +25,8 @@ class AutoBillCron
public $tries = 1; public $tries = 1;
private $counter = 1;
/** /**
* Create a new job instance. * Create a new job instance.
* *
@ -120,14 +122,17 @@ class AutoBillCron
nlog($auto_bill_invoices->count(). " full invoices to auto bill db = {$db}"); nlog($auto_bill_invoices->count(). " full invoices to auto bill db = {$db}");
$auto_bill_invoices->cursor()->each(function ($invoice) use($db){ $auto_bill_invoices->cursor()->each(function ($invoice) use($db){
nlog($this->counter);
AutoBill::dispatch($invoice, $db); AutoBill::dispatch($invoice, $db);
$this->counter++;
}); });
} }
nlog("fine"); nlog("Auto Bill - fine");
} }
} }

View File

@ -310,10 +310,6 @@ class BaseRepository
/* Perform model specific tasks */ /* Perform model specific tasks */
if ($model instanceof Invoice) { if ($model instanceof Invoice) {
nlog("Finished amount = " . $state['finished_amount']);
nlog("Starting amount = " . $state['starting_amount']);
nlog("Diff = " . ($state['finished_amount'] - $state['starting_amount']));
if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) { if (($state['finished_amount'] != $state['starting_amount']) && ($model->status_id != Invoice::STATUS_DRAFT)) {
$model->service()->updateStatus()->save(); $model->service()->updateStatus()->save();