From d2f2284d4daa070c5619f2aa88a1f0298150f9ed Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 7 Oct 2021 18:56:38 +1100 Subject: [PATCH 1/2] Fixes for recurring due dates --- app/Models/RecurringInvoice.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Models/RecurringInvoice.php b/app/Models/RecurringInvoice.php index 822da29ff311..944a1038a197 100644 --- a/app/Models/RecurringInvoice.php +++ b/app/Models/RecurringInvoice.php @@ -449,6 +449,10 @@ class RecurringInvoice extends BaseModel public function calculateDueDate($date) { + //if nothing is set, assume we are using terms. + if(!$this->due_date_days) + return $this->calculateDateFromTerms($date); + switch ($this->due_date_days) { case 'terms': return $this->calculateDateFromTerms($date); From 3eb03e7ad42c957f1783a92f915229a875ce17e6 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 7 Oct 2021 19:01:10 +1100 Subject: [PATCH 2/2] Fixes for terms --- app/Services/Invoice/InvoiceService.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 918002f8dbc9..22063cc4b809 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -452,13 +452,13 @@ class InvoiceService if (! $this->invoice->design_id) $this->invoice->design_id = $this->decodePrimaryKey($settings->invoice_design_id); - if (!isset($this->invoice->footer)) + if (!isset($this->invoice->footer) || empty($this->invoice->footer)) $this->invoice->footer = $settings->invoice_footer; - if (!isset($this->invoice->terms)) + if (!isset($this->invoice->terms) || empty($this->invoice->terms)) $this->invoice->terms = $settings->invoice_terms; - if (!isset($this->invoice->public_notes)) + if (!isset($this->invoice->public_notes) || empty($this->invoice->public_notes)) $this->invoice->public_notes = $this->invoice->client->public_notes; /* If client currency differs from the company default currency, then insert the client exchange rate on the model.*/