diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php index b29a81387596f9c28be3c2ac24407a7f4c0b993c..a9f088dd77bf17df74d5b0fee870f4ae9ae1768b 100644 --- a/htdocs/comm/propal.php +++ b/htdocs/comm/propal.php @@ -747,7 +747,7 @@ else if ($action == "addline" && $user->rights->propale->creer) } // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE)) + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; $newlang=''; diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php index d0bd5f9e1f8d1dcfb19c09df9417b18a6cbe500c..69ed314b433b01d4eac1eb333f97ddd44825d43f 100644 --- a/htdocs/commande/fiche.php +++ b/htdocs/commande/fiche.php @@ -554,7 +554,7 @@ if ($action == 'addline' && $user->rights->commande->creer) } // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE)) + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; $newlang=''; diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php index eddc66d47b590036ea6685c5294ad1e11decdd05..e19cc5deaed49a79d830f205d87b945b3f6fac65 100644 --- a/htdocs/compta/facture.php +++ b/htdocs/compta/facture.php @@ -998,7 +998,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact } // Define output language - if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE)) + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) { $outputlangs = $langs; $newlang=''; diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 4168a97166fea53c4fba6067ec8615bdf7efbf13..076cd861ddbef9a709c09048d2cbd231170dcfce 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2,6 +2,7 @@ /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> + * Copyright (C) 2012 Christophe Battarel <christophe.battarel@altairis.fr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -2096,12 +2097,34 @@ abstract class CommonObject { $product_static = new Product($this->db); - $product_static->type=$line->fk_product_type; - $product_static->id=$line->fk_product; - $product_static->ref=$line->ref; - $product_static->libelle=$line->product_label; - $text=$product_static->getNomUrl(1); - $text.= ' - '.$line->product_label; + // Define output language + if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE)) + { + $this->fetch_thirdparty(); + $prod = new Product($this->db, $line->fk_product); + + $outputlangs = $langs; + $newlang=''; + if (empty($newlang) && GETPOST('lang_id')) $newlang=GETPOST('lang_id'); + if (empty($newlang)) $newlang=$this->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"] : $line->product_label; + } + else { + $label = $line->product_label; + } + + $product_static->type=$line->fk_product_type; + $product_static->id=$line->fk_product; + $product_static->ref=$line->ref; + $product_static->libelle=$label; + $text=$product_static->getNomUrl(1); + $text.= ' - '.$label; $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description)); // Use global variables + $seller and $buyer diff --git a/htdocs/product/admin/produit.php b/htdocs/product/admin/produit.php index 108b9ce87b734d7933722a25fa9de806edc1f9c8..24de62f5e991d714c462e29d5547ff2cc8523fe6 100644 --- a/htdocs/product/admin/produit.php +++ b/htdocs/product/admin/produit.php @@ -70,10 +70,10 @@ else if ($action == 'viewProdDescInForm') $view = GETPOST("activate_viewProdDescInForm"); $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $view,'chaine',0,'',$conf->entity); } -else if ($action == 'viewProdDescInThirdpartyLanguage') +else if ($action == 'viewProdTextsInThirdpartyLanguage') { - $view = GETPOST("activate_viewProdDescInThirdpartyLanguage"); - $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity); + $view = GETPOST("activate_viewProdTextsInThirdpartyLanguage"); + $res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity); } else if ($action == 'usesearchtoselectproduct') { @@ -261,11 +261,11 @@ if (! empty($conf->global->MAIN_MULTILANGS)) $var=!$var; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; - print '<input type="hidden" name="action" value="viewProdDescInThirdpartyLanguage">'; + print '<input type="hidden" name="action" value="viewProdTextsInThirdpartyLanguage">'; print '<tr '.$bc[$var].'>'; print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>'; print '<td width="60" align="right">'; - print $form->selectyesno("activate_viewProdDescInThirdpartyLanguage",$conf->global->PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE,1); + print $form->selectyesno("activate_viewProdTextsInThirdpartyLanguage",$conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE,1); print '</td><td align="right">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '</td>';