diff --git a/app/DataMapper/CompanySettings.php b/app/DataMapper/CompanySettings.php index 049f807d5743..d9ffe3792038 100644 --- a/app/DataMapper/CompanySettings.php +++ b/app/DataMapper/CompanySettings.php @@ -139,6 +139,8 @@ class CompanySettings extends BaseSettings public $payment_type_id = '0'; //@TODO where do we use this? // public $invoice_fields = ''; //@TODO is this redundant, we store this in the custom_fields on the company? + public $valid_until = ''; //@implemented + public $show_accept_invoice_terms = false; //@TODO ben to confirm public $show_accept_quote_terms = false; //@TODO ben to confirm public $require_invoice_signature = false; //@TODO ben to confirm @@ -430,6 +432,7 @@ class CompanySettings extends BaseSettings 'show_accept_quote_terms' => 'bool', 'show_accept_invoice_terms' => 'bool', 'timezone_id' => 'string', + 'valid_until' => 'string', 'date_format_id' => 'string', 'military_time' => 'bool', 'language_id' => 'string', diff --git a/app/Services/Quote/MarkSent.php b/app/Services/Quote/MarkSent.php index aebe2d4b35a2..d91617324708 100644 --- a/app/Services/Quote/MarkSent.php +++ b/app/Services/Quote/MarkSent.php @@ -14,6 +14,7 @@ namespace App\Services\Quote; use App\Events\Quote\QuoteWasMarkedSent; use App\Models\Quote; use App\Utils\Ninja; +use Carbon\Carbon; class MarkSent { @@ -37,6 +38,13 @@ class MarkSent $this->quote->markInvitationsSent(); + if ($this->quote->due_date != '' || $this->quote->client->getSetting('valid_until') == '') { + + } + else{ + $this->quote->due_date = Carbon::parse($this->quote->date)->addDays($this->quote->client->getSetting('valid_until')); + } + event(new QuoteWasMarkedSent($this->quote, $this->quote->company, Ninja::eventVars())); $this->quote