From 0228cd9db7576dbb33fa69cf49c72b169e5920d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20L=C3=A9onard?= Date: Mon, 28 Jul 2014 02:45:58 +0200 Subject: [PATCH] Fix translations in e-mail forms --- htdocs/comm/propal.php | 16 ++++++++-------- htdocs/commande/fiche.php | 17 +++++++++-------- htdocs/compta/facture.php | 17 +++++++++-------- htdocs/core/class/html.formmail.class.php | 1 + htdocs/expedition/fiche.php | 15 ++++++++------- htdocs/fichinter/fiche.php | 15 ++++++++------- htdocs/fourn/commande/fiche.php | 15 ++++++++------- htdocs/fourn/facture/fiche.php | 15 ++++++++------- 8 files changed, 59 insertions(+), 52 deletions(-) diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index 010c623cafb..5174568f5ae 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -2270,15 +2270,15 @@ if ($action == 'create') { if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('commercial'); + } // Build document if it not exists if (! $file || ! is_readable($file)) { - - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = propale_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); @@ -2307,9 +2307,9 @@ if ($action == 'create') { $formmail->withtocc = $liste; $formmail->withtoccc = (! empty($conf->global->MAIN_EMAIL_USECCC) ? $conf->global->MAIN_EMAIL_USECCC : false); if (empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendPropalRef', '__PROPREF__'); + $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendPropalRef', '__PROPREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendPropalRef', '__PROPREF__(__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index 52cc27a42ef..3cebef8567c 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -2411,14 +2411,15 @@ if ($action == 'create' && $user->rights->commande->creer) { if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('commercial'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = commande_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); @@ -2447,9 +2448,9 @@ if ($action == 'create' && $user->rights->commande->creer) { $formmail->withtocc = $liste; $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; if (empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendOrderRef', '__ORDERREF__'); + $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $langs->trans('SendOrderRef', '__ORDERREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->trans('SendOrderRef', '__ORDERREF__(__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index f9200f6f984..4693f4ee1fa 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -3672,14 +3672,15 @@ if ($action == 'create') if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('bills'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - - if (! empty($newlang)) { - $outputlangs = new Translate("", $conf); - $outputlangs->setDefaultLang($newlang); - } - $result = facture_pdf_create($db, $object, GETPOST('model') ? GETPOST('model') : $object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { dol_print_error($db, $result); @@ -3709,9 +3710,9 @@ if ($action == 'create') $formmail->withtocc = $liste; // List suggested for CC $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; if (empty($object->ref_client)) { - $formmail->withtopic = $langs->transnoentities($topicmail, '__FACREF__'); + $formmail->withtopic = $outputlangs->transnoentities($topicmail, '__FACREF__'); } else if (! empty($object->ref_client)) { - $formmail->withtopic = $langs->transnoentities($topicmail, '__FACREF__(__REFCLIENT__)'); + $formmail->withtopic = $outputlangs->transnoentities($topicmail, '__FACREF__(__REFCLIENT__)'); } $formmail->withfile = 2; $formmail->withbody = 1; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 75f6e80c111..fd1d90b1aef 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -564,6 +564,7 @@ class FormMail if (! empty($newlang)) { $outputlangs = new Translate("", $conf); $outputlangs->setDefaultLang($newlang); + $outputlangs->load('other'); } diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index c2a2036c25f..406ba0ebc5d 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1590,15 +1590,16 @@ else if ($id || $ref) if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('sendings'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=expedition_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -1626,7 +1627,7 @@ else if ($id || $ref) $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendShippingRef','__SHIPPINGREF__'); + $formmail->withtopic=$outputlangs->trans('SendShippingRef','__SHIPPINGREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/fichinter/fiche.php b/htdocs/fichinter/fiche.php index 637591d0606..d459b20767b 100644 --- a/htdocs/fichinter/fiche.php +++ b/htdocs/fichinter/fiche.php @@ -1645,15 +1645,16 @@ else if ($id > 0 || ! empty($ref)) if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('interventions'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=fichinter_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -1681,7 +1682,7 @@ else if ($id > 0 || ! empty($ref)) $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendInterventionRef','__FICHINTERREF__'); + $formmail->withtopic=$outputlangs->trans('SendInterventionRef','__FICHINTERREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/fourn/commande/fiche.php b/htdocs/fourn/commande/fiche.php index b576a10b1bb..e536c81f21c 100644 --- a/htdocs/fourn/commande/fiche.php +++ b/htdocs/fourn/commande/fiche.php @@ -1998,15 +1998,16 @@ elseif (! empty($object->id)) if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('commercial'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=supplier_order_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -2035,7 +2036,7 @@ elseif (! empty($object->id)) $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=(! empty($conf->global->MAIN_EMAIL_USECCC)?$conf->global->MAIN_EMAIL_USECCC:false); - $formmail->withtopic=$langs->trans('SendOrderRef','__ORDERREF__'); + $formmail->withtopic=$outputlangs->trans('SendOrderRef','__ORDERREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1; diff --git a/htdocs/fourn/facture/fiche.php b/htdocs/fourn/facture/fiche.php index 277d38c3d70..9c862bc5791 100644 --- a/htdocs/fourn/facture/fiche.php +++ b/htdocs/fourn/facture/fiche.php @@ -2264,15 +2264,16 @@ else if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang = $object->client->default_lang; + if (!empty($newlang)) + { + $outputlangs = new Translate('', $conf); + $outputlangs->setDefaultLang($newlang); + $outputlangs->load('bills'); + } + // Build document if it not exists if (! $file || ! is_readable($file)) { - if (! empty($newlang)) - { - $outputlangs = new Translate("",$conf); - $outputlangs->setDefaultLang($newlang); - } - $result=supplier_invoice_pdf_create($db, $object, GETPOST('model')?GETPOST('model'):$object->modelpdf, $outputlangs, $hidedetails, $hidedesc, $hideref); if ($result <= 0) { @@ -2300,7 +2301,7 @@ else $formmail->withto=GETPOST("sendto")?GETPOST("sendto"):$liste; $formmail->withtocc=$liste; $formmail->withtoccc=$conf->global->MAIN_EMAIL_USECCC; - $formmail->withtopic=$langs->trans('SendBillRef','__FACREF__'); + $formmail->withtopic=$outputlangs->trans('SendBillRef','__FACREF__'); $formmail->withfile=2; $formmail->withbody=1; $formmail->withdeliveryreceipt=1;