Fix translations in e-mail forms

This commit is contained in:
Laurent Léonard 2014-07-28 02:45:58 +02:00
parent b31bf68376
commit 0228cd9db7
8 changed files with 59 additions and 52 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -564,6 +564,7 @@ class FormMail
if (! empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
$outputlangs->load('other');
}

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;