Clarify expired quotes

This commit is contained in:
Hillel Coren 2017-12-06 13:44:23 +02:00
parent 2b7149cd5f
commit 6b15025092
3 changed files with 8 additions and 3 deletions

View File

@ -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;
}

View File

@ -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'));

View File

@ -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.',
);