From 9fd3bff97d34dba911bc6e0845f89cb3bebf1c07 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 8 Jul 2021 11:48:11 +1000 Subject: [PATCH] Autoarchive quotes on convert --- app/Exceptions/Handler.php | 3 +-- app/Jobs/Util/Import.php | 3 +++ app/Services/Quote/QuoteService.php | 9 +++++---- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index f4c9b129ab..3a3969a3c8 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -120,8 +120,7 @@ class Handler extends ExceptionHandler } } - // if(config('ninja.expanded_logging')) - parent::report($exception); + parent::report($exception); } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index f629806aec..7b4f0f19a3 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -190,6 +190,9 @@ class Import implements ShouldQueue { set_time_limit(0); + nlog("Starting Migration"); + nlog($this->user->email); + auth()->login($this->user, false); auth()->user()->setCompany($this->company); diff --git a/app/Services/Quote/QuoteService.php b/app/Services/Quote/QuoteService.php index 3c8cc9e2dd..8d2435ae65 100644 --- a/app/Services/Quote/QuoteService.php +++ b/app/Services/Quote/QuoteService.php @@ -51,6 +51,11 @@ class QuoteService $this->quote->fresh(); + if ($this->quote->client->getSetting('auto_archive_quote')) { + $quote_repo = new QuoteRepository(); + $quote_repo->archive($this->quote); + } + return $this; } @@ -129,10 +134,6 @@ class QuoteService public function convertToInvoice() { - //to prevent circular references we need to explicit call this here. - // $mark_approved = new MarkApproved($this->quote->client); - // $this->quote = $mark_approved->run($this->quote); - $this->convert(); $this->invoice->service()->createInvitations();