From d6697171f619b11718c266fbcd494aa4efdcfdcf Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 14 Mar 2016 10:40:14 +0200 Subject: [PATCH] =?UTF-8?q?Show=20=E2=80=98Expired=E2=80=99=20for=20overdu?= =?UTF-8?q?e=20quotes=20in=20list=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Services/InvoiceService.php | 9 +++++---- resources/lang/en/texts.php | 3 +++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Services/InvoiceService.php b/app/Services/InvoiceService.php index c5d6f258e02c..522c1a5dffc3 100644 --- a/app/Services/InvoiceService.php +++ b/app/Services/InvoiceService.php @@ -160,8 +160,8 @@ class InvoiceService extends BaseService ], [ 'invoice_status_name', - function ($model) { - return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted'))->toHtml() : self::getStatusLabel($model); + function ($model) use ($entityType) { + return $model->quote_invoice_id ? link_to("invoices/{$model->quote_invoice_id}/edit", trans('texts.converted'))->toHtml() : self::getStatusLabel($entityType, $model); } ] ]; @@ -237,12 +237,13 @@ class InvoiceService extends BaseService ]; } - private function getStatusLabel($model) + private function getStatusLabel($entityType, $model) { // check if invoice is overdue if (Utils::parseFloat($model->balance) && $model->due_date && $model->due_date != '0000-00-00') { if (\DateTime::createFromFormat('Y-m-d', $model->due_date) < new \DateTime("now")) { - return "

".trans('texts.overdue')."

"; + $label = $entityType == ENTITY_INVOICE ? trans('texts.overdue') : trans('texts.expired'); + return "

" . $label . "

"; } } diff --git a/resources/lang/en/texts.php b/resources/lang/en/texts.php index 1e83a7821bed..84a6c70f95d0 100644 --- a/resources/lang/en/texts.php +++ b/resources/lang/en/texts.php @@ -1057,6 +1057,9 @@ $LANG = array( 'enable_portal_password_help'=>'Allows you to set a password for each contact. If a password is set, the contact will be required to enter a password before viewing invoices.', 'send_portal_password'=>'Generate password automatically', 'send_portal_password_help'=>'If no password is set, one will be generated and sent with the first invoice.', + + 'expired' => 'Expired', + ); return $LANG;