diff --git a/app/DataMapper/FreeCompanySettings.php b/app/DataMapper/FreeCompanySettings.php index 9f18d759972c..9ddfaf34de9c 100644 --- a/app/DataMapper/FreeCompanySettings.php +++ b/app/DataMapper/FreeCompanySettings.php @@ -45,7 +45,7 @@ class FreeCompanySettings extends BaseSettings public $military_time = false; public $payment_number_pattern = ''; public $payment_number_counter = 1; - public $payment_terms = -1; + public $payment_terms = ""; public $payment_type_id = '0'; public $portal_design_id = '1'; public $quote_design_id = 'VolejRejNm'; @@ -112,7 +112,7 @@ class FreeCompanySettings extends BaseSettings 'custom_value4' => 'string', 'inclusive_taxes' => 'bool', 'name' => 'string', - 'payment_terms' => 'integer', + 'payment_terms' => 'string', 'payment_type_id' => 'string', 'phone' => 'string', 'postal_code' => 'string', diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 10b6ba0a8438..714b2727ea05 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -161,11 +161,9 @@ class InvoiceService /* One liners */ public function setDueDate() { - if($this->invoice->due_date != '') + if($this->invoice->due_date != '' || $this->invoice->client->getSetting('payment_terms') == '') return $this; - //$this->invoice->due_date = Carbon::now()->addDays($this->invoice->client->getSetting('payment_terms')); - $this->invoice->due_date = Carbon::parse($this->invoice->date)->addDays($this->invoice->client->getSetting('payment_terms')); return $this; diff --git a/config/ninja.php b/config/ninja.php index 0fd26a26c041..c2703bac8091 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -56,7 +56,7 @@ return [ 'datetime_format_id' => env('DEFAULT_DATETIME_FORMAT_ID', '1'), 'locale' => env('DEFAULT_LOCALE', 'en'), 'map_zoom' => env('DEFAULT_MAP_ZOOM', 10), - 'payment_terms' => env('DEFAULT_PAYMENT_TERMS', "-1"), + 'payment_terms' => env('DEFAULT_PAYMENT_TERMS', ""), 'military_time' => env('MILITARY_TIME', 0), 'first_day_of_week' => env('FIRST_DATE_OF_WEEK', 0), 'first_month_of_year' => env('FIRST_MONTH_OF_YEAR', '2000-01-01')