Merge pull request #6539 from turbo124/v5-develop

Fixes for auto billing
This commit is contained in:
David Bomba 2021-09-02 09:26:58 +10:00 committed by GitHub
commit 6648abdc68
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View File

@ -69,6 +69,7 @@ class AutoBillCron
} else { } else {
//multiDB environment, need to //multiDB environment, need to
foreach (MultiDB::$dbs as $db) { foreach (MultiDB::$dbs as $db) {
MultiDB::setDB($db); MultiDB::setDB($db);
$auto_bill_partial_invoices = Invoice::whereDate('partial_due_date', '<=', now()) $auto_bill_partial_invoices = Invoice::whereDate('partial_due_date', '<=', now())
@ -96,6 +97,12 @@ class AutoBillCron
private function runAutoBiller(Invoice $invoice) private function runAutoBiller(Invoice $invoice)
{ {
info("Firing autobill for {$invoice->company_id} - {$invoice->number}"); info("Firing autobill for {$invoice->company_id} - {$invoice->number}");
$invoice->service()->autoBill()->save();
try{
$invoice->service()->autoBill()->save();
}
catch(\Exception $e) {
nlog("Failed to capture payment for {$invoice->company_id} - {$invoice->number} ->" . $e->getMessage());
}
} }
} }

View File

@ -129,7 +129,7 @@ class SendRecurring implements ShouldQueue
} }
}); });
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $this->recurring_invoice->auto_bill_enabled) { if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
nlog("attempting to autobill {$invoice->number}"); nlog("attempting to autobill {$invoice->number}");
$invoice->service()->autoBill()->save(); $invoice->service()->autoBill()->save();
} }

View File

@ -64,7 +64,7 @@ class SupportMessageSent extends Mailable
$db = str_replace("db-ninja-", "", $company->db); $db = str_replace("db-ninja-", "", $company->db);
if(Ninja::isHosted()) if(Ninja::isHosted())
$subject = "{$priority}Hosted-{$db} :: {$plan} :: ".date('M jS, g:ia'); $subject = "{$priority}Hosted-{$db}-[{$company->is_large}] :: {$plan} :: ".date('M jS, g:ia');
else else
$subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia'); $subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia');