Fix for attached PDF being in the wrong language

This commit is contained in:
Hillel Coren 2016-05-22 20:26:19 +03:00
parent 371f224c24
commit 3b0feef87f

View File

@ -1185,10 +1185,17 @@
if (!isEmailValid()) { if (!isEmailValid()) {
alert("{!! trans('texts.provide_email') !!}"); alert("{!! trans('texts.provide_email') !!}");
return; return;
} 8 }
if (confirm('{!! trans("texts.confirm_email_$entityType") !!}' + '\n\n' + getSendToEmails())) { 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');
}
} }
} }