From 3b0feef87fca3ea0eba0ccb3ed366d0995129c7a Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 22 May 2016 20:26:19 +0300 Subject: [PATCH] Fix for attached PDF being in the wrong language --- resources/views/invoices/edit.blade.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/resources/views/invoices/edit.blade.php b/resources/views/invoices/edit.blade.php index a39690f613e7..699205f8cfb0 100644 --- a/resources/views/invoices/edit.blade.php +++ b/resources/views/invoices/edit.blade.php @@ -1185,10 +1185,17 @@ if (!isEmailValid()) { alert("{!! trans('texts.provide_email') !!}"); return; - } +8 } if (confirm('{!! trans("texts.confirm_email_$entityType") !!}' + '\n\n' + getSendToEmails())) { - preparePdfData('email'); + var accountLanguageId = parseInt({{ $account->language_id ?: '0' }}); + var clientLanguageId = parseInt(model.invoice().client().language_id()) || 0; + // if the client's language is different then we can't use the browser version of the PDF + if (clientLanguageId && clientLanguageId != accountLanguageId) { + submitAction('email'); + } else { + preparePdfData('email'); + } } }