Fixes for auto billing

This commit is contained in:
David Bomba 2021-09-03 19:30:44 +10:00
parent 592387874e
commit 0f6af65f53

View File

@ -56,8 +56,8 @@ class AutoBillCron
nlog($auto_bill_partial_invoices->count(). " partial invoices to auto bill");
$auto_bill_partial_invoices->cursor()->each(function ($invoice){
$this->runAutoBiller($invoice);
$auto_bill_partial_invoices->cursor()->each(function ($invoice) use($db){
$this->runAutoBiller($invoice, $db);
});
$auto_bill_invoices = Invoice::whereDate('due_date', '<=', now())
@ -69,8 +69,8 @@ class AutoBillCron
nlog($auto_bill_invoices->count(). " full invoices to auto bill");
$auto_bill_invoices->cursor()->each(function ($invoice){
$this->runAutoBiller($invoice);
$auto_bill_invoices->cursor()->each(function ($invoice) use($db){
$this->runAutoBiller($invoice, $db);
});
@ -110,7 +110,7 @@ class AutoBillCron
}
}
private function runAutoBiller(Invoice $invoice)
private function runAutoBiller(Invoice $invoice, $db)
{
info("Firing autobill for {$invoice->company_id} - {$invoice->number}");