From f473dbd0e2229d5f8ede16bf1d9be22088aa38df Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 1 Sep 2021 20:54:36 +1000 Subject: [PATCH 1/2] Add is_large flag to support emails --- app/Mail/SupportMessageSent.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Mail/SupportMessageSent.php b/app/Mail/SupportMessageSent.php index 337495ab8e99..e88251389091 100644 --- a/app/Mail/SupportMessageSent.php +++ b/app/Mail/SupportMessageSent.php @@ -64,7 +64,7 @@ class SupportMessageSent extends Mailable $db = str_replace("db-ninja-", "", $company->db); 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 $subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia'); From 64d0d34a2783b7094b9659471aa762410d27f7d9 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 2 Sep 2021 09:26:09 +1000 Subject: [PATCH 2/2] Fixes for auto billing --- app/Jobs/Cron/AutoBillCron.php | 9 ++++++++- app/Jobs/RecurringInvoice/SendRecurring.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Jobs/Cron/AutoBillCron.php b/app/Jobs/Cron/AutoBillCron.php index fcd6c3c876c0..99bcdbbf21f8 100644 --- a/app/Jobs/Cron/AutoBillCron.php +++ b/app/Jobs/Cron/AutoBillCron.php @@ -69,6 +69,7 @@ class AutoBillCron } else { //multiDB environment, need to foreach (MultiDB::$dbs as $db) { + MultiDB::setDB($db); $auto_bill_partial_invoices = Invoice::whereDate('partial_due_date', '<=', now()) @@ -96,6 +97,12 @@ class AutoBillCron private function runAutoBiller(Invoice $invoice) { 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()); + } } } diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index d19ebd3847f3..e13601219aa1 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -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}"); $invoice->service()->autoBill()->save(); }