Fix: Use bad language

This commit is contained in:
Laurent Destailleur 2012-03-14 14:48:27 +01:00
parent 84397b4735
commit 228f10669d

View File

@ -187,7 +187,7 @@ else if ($action == 'confirm_valid' && $confirm == 'yes' && $user->rights->exped
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','int')) $newlang=GETPOST('lang_id','int'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
@ -300,7 +300,7 @@ else if ($action == 'builddoc') // En get ou en post
// Define output language // Define output language
$outputlangs = $langs; $outputlangs = $langs;
$newlang=''; $newlang='';
if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id','int')) $newlang=GETPOST('lang_id','int'); if ($conf->global->MAIN_MULTILANGS && empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->client->default_lang; if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$shipment->client->default_lang;
if (! empty($newlang)) if (! empty($newlang))
{ {
@ -448,7 +448,9 @@ if ($action == 'send' && ! GETPOST('addfile','alpha') && ! GETPOST('removedfile'
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($db); $interface=new Interfaces($db);
$result=$interface->run_triggers('SHIPPING_SENTBYMAIL',$object,$user,$langs,$conf); $result=$interface->run_triggers('SHIPPING_SENTBYMAIL',$object,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; } if ($result < 0) {
$error++; $this->errors=$interface->errors;
}
// Fin appel triggers // Fin appel triggers
if ($error) if ($error)
@ -1186,6 +1188,20 @@ else
$var=false; $var=false;
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$object->fetch_thirdparty();
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id','alpha');
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
}
for ($i = 0 ; $i < $num_prod ; $i++) for ($i = 0 ; $i < $num_prod ; $i++)
{ {
print "<tr ".$bc[$var].">"; print "<tr ".$bc[$var].">";
@ -1201,18 +1217,8 @@ else
// Define output language // Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{ {
$object->fetch_thirdparty(); $prod = new Product($db);
$prod = new Product($db, $lines[$i]->fk_product); $prod->fetch($lines[$i]->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! GETPOST('lang_id','int')) $newlang=GETPOST('lang_id','int');
if (empty($newlang)) $newlang=$object->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}
$label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label;
} }
else else