From 4a4c61f1cf9bc85134f0ccf92e1dc391e55ceda2 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 6 Oct 2020 15:11:48 +1100 Subject: [PATCH] recurring --- app/DataMapper/CompanySettings.php | 3 +++ app/Services/Recurring/ApplyNumber.php | 25 +++++++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index ca48a17faf..90149618bd 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -78,6 +78,9 @@ class CompanySettings extends BaseSettings public $invoice_number_pattern = ''; public $invoice_number_counter = 1; + public $recurring_invoice_number_pattern = ''; + public $recurring_invoice_number_counter = 1; + public $quote_number_pattern = ''; public $quote_number_counter = 1; diff --git a/app/Services/Recurring/ApplyNumber.php b/app/Services/Recurring/ApplyNumber.php index abef623d13..97e6a77f4a 100644 --- a/app/Services/Recurring/ApplyNumber.php +++ b/app/Services/Recurring/ApplyNumber.php @@ -30,23 +30,28 @@ class ApplyNumber extends AbstractService $this->recurring_entity = $recurring_entity; } + /* Recurring numbers are set when saved */ public function run() { if ($this->recurring_entity->number != '') { return $this->recurring_entity; } - switch ($this->client->getSetting('counter_number_applied')) { - case 'when_saved': - $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); - break; - case 'when_sent': - break; - default: - $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); - break; - } + $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); + + + // switch ($this->client->getSetting('counter_number_applied')) { + // case 'when_saved': + // $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); + // break; + // case 'when_sent': + // break; + + // default: + // $this->recurring_entity->number = $this->getNextRecurringInvoiceNumber($this->client); + // break; + // } return $this->recurring_entity; }