From 22ac0c05a42baa6998f817e42730b87ce000cec9 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Thu, 26 Oct 2017 22:18:56 +0300 Subject: [PATCH] Use partial due date in email templates --- app/Services/TemplateService.php | 2 +- resources/views/emails/design2_html.blade.php | 4 ++-- resources/views/emails/design3_html.blade.php | 4 ++-- resources/views/partials/email_templates.blade.php | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Services/TemplateService.php b/app/Services/TemplateService.php index d25665277e38..087d3e122d24 100644 --- a/app/Services/TemplateService.php +++ b/app/Services/TemplateService.php @@ -45,7 +45,7 @@ class TemplateService '$emailSignature' => $account->getEmailFooter(), '$client' => $client->getDisplayName(), '$account' => $account->getDisplayName(), - '$dueDate' => $account->formatDate($invoice->due_date), + '$dueDate' => $account->formatDate($invoice->partial_due_date ?: $invoice->due_date), '$invoiceDate' => $account->formatDate($invoice->invoice_date), '$contact' => $contact->getDisplayName(), '$firstName' => $contact->first_name, diff --git a/resources/views/emails/design2_html.blade.php b/resources/views/emails/design2_html.blade.php index f4a6e3b48414..ebc2922e9eef 100644 --- a/resources/views/emails/design2_html.blade.php +++ b/resources/views/emails/design2_html.blade.php @@ -26,9 +26,9 @@ {{ strtoupper(trans('texts.valid_until')) }} {{ $account->formatDate($invoice->due_date) }} @else @if ($account->hasCustomLabel('due_date')) - {{ $account->getLabel('due_date') }} {{ $account->formatDate($invoice->due_date) }} + {{ $account->getLabel('due_date') }} {{ $account->formatDate($invoice->partial_due_date ?: $invoice->due_date) }} @else - {{ utrans('texts.due_by', ['date' => $account->formatDate($invoice->due_date)]) }} + {{ utrans('texts.due_by', ['date' => $account->formatDate($invoice->partial_due_date ?: $invoice->due_date)]) }} @endif @endif
diff --git a/resources/views/emails/design3_html.blade.php b/resources/views/emails/design3_html.blade.php index a2f76e709895..dd5c084b9d58 100644 --- a/resources/views/emails/design3_html.blade.php +++ b/resources/views/emails/design3_html.blade.php @@ -26,9 +26,9 @@ {{ strtoupper(trans('texts.valid_until')) }} {{ $account->formatDate($invoice->due_date) }} @else @if ($account->hasCustomLabel('due_date')) - {{ $account->getLabel('due_date') }} {{ $account->formatDate($invoice->due_date) }} + {{ $account->getLabel('due_date') }} {{ $account->formatDate($invoice->partial_due_date ?: $invoice->due_date) }} @else - {{ utrans('texts.due_by', ['date' => $account->formatDate($invoice->due_date)]) }} + {{ utrans('texts.due_by', ['date' => $account->formatDate($invoice->partial_due_date ?: $invoice->due_date)]) }} @endif @endif
diff --git a/resources/views/partials/email_templates.blade.php b/resources/views/partials/email_templates.blade.php index 89e74dee1b06..06475be36f17 100644 --- a/resources/views/partials/email_templates.blade.php +++ b/resources/views/partials/email_templates.blade.php @@ -17,7 +17,7 @@ 'footer': {!! json_encode($account->getEmailFooter()) !!}, 'emailSignature': {!! json_encode($account->getEmailFooter()) !!}, 'account': "{{ $account->getDisplayName() }}", - 'dueDate': invoice ? invoice.due_date : "{{ $account->formatDate($account->getDateTime()) }}", + 'dueDate': invoice ? invoice.partial_due_date || invoice.due_date : "{{ $account->formatDate($account->getDateTime()) }}", 'invoiceDate': invoice ? invoice.invoice_date : "{{ $account->formatDate($account->getDateTime()) }}", 'client': invoice ? getClientDisplayName(invoice.client) : "{{ trans('texts.client_name') }}", 'amount': invoice ? formatMoneyInvoice(parseFloat(invoice.partial) || parseFloat(invoice.balance_amount), invoice) : formatMoneyAccount(100, account),