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! */