1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

Merge pull request #6773 from turbo124/v5-develop

Additional logging for auto billing
This commit is contained in:
David Bomba 2021-10-05 08:18:09 +11:00 committed by GitHub
commit 10dadf8ca3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 245 additions and 178 deletions

View File

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

View File

@ -25,6 +25,8 @@ class AutoBillCron
public $tries = 1;
private $counter = 1;
/**
* Create a new job instance.
*
@ -56,6 +58,7 @@ class AutoBillCron
->whereHas('company', function ($query) {
$query->where('is_disabled',0);
})
->orderBy('id', 'DESC')
->with('company');
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
@ -72,6 +75,7 @@ class AutoBillCron
->whereHas('company', function ($query) {
$query->where('is_disabled',0);
})
->orderBy('id', 'DESC')
->with('company');
nlog($auto_bill_invoices->count(). " full invoices to auto bill");
@ -95,6 +99,7 @@ class AutoBillCron
->whereHas('company', function ($query) {
$query->where('is_disabled',0);
})
->orderBy('id', 'DESC')
->with('company');
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill db = {$db}");
@ -111,19 +116,23 @@ class AutoBillCron
->whereHas('company', function ($query) {
$query->where('is_disabled',0);
})
->orderBy('id', 'DESC')
->with('company');
nlog($auto_bill_invoices->count(). " full invoices to auto bill db = {$db}");
$auto_bill_invoices->cursor()->each(function ($invoice) use($db){
nlog($this->counter);
AutoBill::dispatch($invoice, $db);
$this->counter++;
});
}
nlog("fine");
nlog("Auto Bill - fine");
}
}

View File

@ -309,10 +309,6 @@ class BaseRepository
/* Perform model specific tasks */
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)) {

406
composer.lock generated

File diff suppressed because it is too large Load Diff