From 271a81da3e1db93e6666da1629725c6b2283acc7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 12 Oct 2022 12:55:11 +1100 Subject: [PATCH] Clean up for preload --- app/Services/Invoice/InvoiceService.php | 6 +++++- app/Services/Invoice/UpdateReminder.php | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index c20594a03e3a..3e1d220ae4e4 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -268,7 +268,11 @@ class InvoiceService return $this; } - $this->invoice->due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); + //12-10-2022 + if($this->invoice->partial > 0 && !$this->invoice->partial_due_date) + $this->invoice->partial_due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); + else + $this->invoice->due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); return $this; } diff --git a/app/Services/Invoice/UpdateReminder.php b/app/Services/Invoice/UpdateReminder.php index 642c36b53283..24a4409b5e32 100644 --- a/app/Services/Invoice/UpdateReminder.php +++ b/app/Services/Invoice/UpdateReminder.php @@ -28,6 +28,7 @@ class UpdateReminder extends AbstractService $this->settings = $settings; } + /* We only support setting reminders based on the due date, not the partial due date */ public function run() { if (! $this->settings) {