From f6686c7df5ed17371c1e3767f243c6322b5b9333 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 8 Feb 2022 21:18:41 +1100 Subject: [PATCH] Allow draft quotes to be approved if accessed directly --- app/Http/Controllers/ClientPortal/QuoteController.php | 2 +- app/Services/Invoice/InvoiceService.php | 2 +- resources/views/portal/ninja2020/quotes/show.blade.php | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/ClientPortal/QuoteController.php b/app/Http/Controllers/ClientPortal/QuoteController.php index 1b0fa8214428..b58dd13b3425 100644 --- a/app/Http/Controllers/ClientPortal/QuoteController.php +++ b/app/Http/Controllers/ClientPortal/QuoteController.php @@ -160,7 +160,7 @@ class QuoteController extends Controller $quotes = Quote::whereIn('id', $ids) ->where('client_id', auth('contact')->user()->client->id) ->where('company_id', auth('contact')->user()->client->company_id) - ->where('status_id', Quote::STATUS_SENT) + ->whereIn('status_id', [Quote::STATUS_DRAFT, Quote::STATUS_SENT]) ->withTrashed() ->get(); diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index a38464c89a1d..50e7249d0b05 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -79,7 +79,7 @@ class InvoiceService public function setExchangeRate() { - if($this->invoice->exchange_rate != 0) + if($this->invoice->exchange_rate != 1) return $this; $client_currency = $this->invoice->client->getSetting('currency_id'); diff --git a/resources/views/portal/ninja2020/quotes/show.blade.php b/resources/views/portal/ninja2020/quotes/show.blade.php index 7d805fbab895..7a9b506338d1 100644 --- a/resources/views/portal/ninja2020/quotes/show.blade.php +++ b/resources/views/portal/ninja2020/quotes/show.blade.php @@ -21,14 +21,12 @@ @endcomponent @endif - @if($quote->status_id === \App\Models\Quote::STATUS_SENT) + @if(in_array($quote->status_id, [\App\Models\Quote::STATUS_SENT, \App\Models\Quote::STATUS_DRAFT]))
@include('portal.ninja2020.quotes.includes.actions', ['quote' => $quote])
@elseif($quote->status_id === \App\Models\Quote::STATUS_APPROVED)

{{ ctrans('texts.approved') }}

- @else -

{{ ctrans('texts.quotes_with_status_sent_can_be_approved') }}

@endif @include('portal.ninja2020.components.entity-documents', ['entity' => $quote])