1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Change sequence for settings auto bill for recurring invoices

This commit is contained in:
David Bomba 2023-01-13 00:41:54 +11:00
parent 1974f0e5f3
commit d1078e1ba1

View File

@ -66,13 +66,6 @@ class SendRecurring implements ShouldQueue
// Generate Standard Invoice // Generate Standard Invoice
$invoice = RecurringInvoiceToInvoiceFactory::create($this->recurring_invoice, $this->recurring_invoice->client); $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'); $invoice->date = date('Y-m-d');
nlog("Recurring Invoice Date Set on Invoice = {$invoice->date} - ". now()->format('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(); ->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); $invoice = $this->createRecurringInvitations($invoice);
/* 09-01-2022 ensure we create the PDFs at this point in time! */ /* 09-01-2022 ensure we create the PDFs at this point in time! */