diff --git a/app/Http/Controllers/ClientPortalController.php b/app/Http/Controllers/ClientPortalController.php index 8cbb1b1dfafe..e276867b0a6a 100644 --- a/app/Http/Controllers/ClientPortalController.php +++ b/app/Http/Controllers/ClientPortalController.php @@ -142,9 +142,6 @@ class ClientPortalController extends BaseController } $showApprove = $invoice->quote_invoice_id ? false : true; - if ($invoice->due_date) { - $showApprove = time() < strtotime($invoice->getOriginal('due_date')); - } if ($invoice->invoice_status_id >= INVOICE_STATUS_APPROVED) { $showApprove = false; } diff --git a/app/Http/Controllers/QuoteController.php b/app/Http/Controllers/QuoteController.php index 630c4b8f18a0..93ee5f599b06 100644 --- a/app/Http/Controllers/QuoteController.php +++ b/app/Http/Controllers/QuoteController.php @@ -149,6 +149,13 @@ class QuoteController extends BaseController $invitation = Invitation::with('invoice.invoice_items', 'invoice.invitations')->where('invitation_key', '=', $invitationKey)->firstOrFail(); $invoice = $invitation->invoice; + if ($invoice->due_date) { + $carbonDueDate = \Carbon::parse($invoice->due_date); + if (! $carbonDueDate->isToday() && ! $carbonDueDate->isFuture()) { + return redirect("view/{$invitationKey}")->withError(trans('texts.quote_has_expired')); + } + } + $invitationKey = $this->invoiceService->approveQuote($invoice, $invitation); Session::flash('message', trans('texts.quote_is_approved')); diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index ea9582f1ce96..276995ae7719 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -2608,6 +2608,7 @@ $LANG = array( 'inclusive_taxes_warning' => 'Warning: existing invoices will need to be resaved', 'copy_shipping' => 'Copy Shipping', 'copy_billing' => 'Copy Billing', + 'quote_has_expired' => 'The quote has expired, please contact the merchant.', );