From 7cf3b23089ffe42ba3f8152d9a63574d35a59bae Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 27 May 2019 21:56:16 +1000 Subject: [PATCH] Document tests --- app/Utils/Traits/GeneratesCounter.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Utils/Traits/GeneratesCounter.php b/app/Utils/Traits/GeneratesCounter.php index f9f443c7aa..0d83357f50 100644 --- a/app/Utils/Traits/GeneratesCounter.php +++ b/app/Utils/Traits/GeneratesCounter.php @@ -35,6 +35,7 @@ trait GeneratesCounter $pattern = $client->company->settings->invoice_number_pattern; + //Determine if we are using client_counters if(strpos($pattern, 'client_counter') === false) { $counter = $client->company->settings->invoice_number_counter; @@ -45,11 +46,13 @@ trait GeneratesCounter $is_client_counter = true; } + //Return a valid counter $counter = $this->checkEntityNumber($client, $counter, $client->company->settings->counter_padding, $client->company->settings->invoice_number_prefix); - //build number pattern + //build number pattern and replace variables in pattern $invoice_number = $this->applyNumberPattern($client, $counter, $client->company->settings->invoice_number_pattern); + //increment the corrent invoice_number Counter (company vs client) if($is_client_counter) $this->incrementCounter($client, 'invoice_number_counter'); else