From d1078e1ba16c99d5a649a0e9b4ed2a9485cc6690 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 13 Jan 2023 00:41:54 +1100 Subject: [PATCH] Change sequence for settings auto bill for recurring invoices --- app/Jobs/RecurringInvoice/SendRecurring.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index 63f6ecc2d6..81cf7b2f7a 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -66,13 +66,6 @@ class SendRecurring implements ShouldQueue // Generate Standard Invoice $invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client); - if ($this->recurring_invoice->auto_bill === 'always') { - $invoice->auto_bill_enabled = true; - } elseif ($this->recurring_invoice->auto_bill === 'optout' || $this->recurring_invoice->auto_bill === 'optin') { - } elseif ($this->recurring_invoice->auto_bill === 'off') { - $invoice->auto_bill_enabled = false; - } - $invoice->date = date('Y-m-d'); nlog("Recurring Invoice Date Set on Invoice = {$invoice->date} - ". now()->format('Y-m-d')); @@ -94,6 +87,14 @@ class SendRecurring implements ShouldQueue ->save(); } + //12-01-2023 i moved this block after fillDefaults to handle if standard invoice auto bill config has been enabled, recurring invoice should override. + if ($this->recurring_invoice->auto_bill === 'always') { + $invoice->auto_bill_enabled = true; + } elseif ($this->recurring_invoice->auto_bill === 'optout' || $this->recurring_invoice->auto_bill === 'optin') { + } elseif ($this->recurring_invoice->auto_bill === 'off') { + $invoice->auto_bill_enabled = false; + } + $invoice = $this->createRecurringInvitations($invoice); /* 09-01-2022 ensure we create the PDFs at this point in time! */