diff --git a/htdocs/comm/propal.php b/htdocs/comm/propal.php
index 42236b90473..c6a9cfd6bc4 100644
--- a/htdocs/comm/propal.php
+++ b/htdocs/comm/propal.php
@@ -747,8 +747,24 @@ if ($_POST['action'] == "addline" && $user->rights->propale->creer)
}
}
- $desc = $prod->description;
- $desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : "";
+ // Define output language
+ if ($conf->global->PRODUIT_DESC_IN_CLIENT_LANGUAGE) {
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"]))?$prod->multilangs[$outputlangs->defaultlang]["description"]:$prod->description;
+ }
+ else
+ $desc = $prod->description;
+
+ $desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : "";
$desc.= $_POST['np_desc'];
$type = $prod->type;
}
diff --git a/htdocs/commande/fiche.php b/htdocs/commande/fiche.php
index 408e1005069..536c8672ecc 100644
--- a/htdocs/commande/fiche.php
+++ b/htdocs/commande/fiche.php
@@ -552,8 +552,24 @@ if ($action == 'addline' && $user->rights->commande->creer)
}
}
- $desc = $prod->description;
- $desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : "";
+ // Define output language
+ if ($conf->global->PRODUIT_DESC_IN_CLIENT_LANGUAGE) {
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"]))?$prod->multilangs[$outputlangs->defaultlang]["description"]:$prod->description;
+ }
+ else
+ $desc = $prod->description;
+
+ $desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : "";
$desc.= $_POST['np_desc'];
$type = $prod->type;
}
diff --git a/htdocs/compta/facture.php b/htdocs/compta/facture.php
index 0659b33058f..0f8cee517dd 100644
--- a/htdocs/compta/facture.php
+++ b/htdocs/compta/facture.php
@@ -996,8 +996,24 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
}
}
- $desc = $prod->description;
- $desc.= ($prod->description && $_POST['np_desc']) ? ((dol_textishtml($prod->description) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : "";
+ // Define output language
+ if ($conf->global->PRODUIT_DESC_IN_CLIENT_LANGUAGE) {
+ $outputlangs = $langs;
+ $newlang='';
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
+ if ($conf->global->MAIN_MULTILANGS && empty($newlang)) $newlang=$object->client->default_lang;
+ if (! empty($newlang))
+ {
+ $outputlangs = new Translate("",$conf);
+ $outputlangs->setDefaultLang($newlang);
+ }
+
+ $desc = (! empty($prod->multilangs[$outputlangs->defaultlang]["description"]))?$prod->multilangs[$outputlangs->defaultlang]["description"]:$prod->description;
+ }
+ else
+ $desc = $prod->description;
+
+ $desc.= ($desc && $_POST['np_desc']) ? ((dol_textishtml($desc) || dol_textishtml($_POST['np_desc']))?"
\n":"\n") : "";
$desc.= $_POST['np_desc'];
if (! empty($prod->customcode) || ! empty($prod->country_code))
{
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index c19cfbb7712..9fc7f0e4ee6 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -1111,6 +1111,7 @@ NumberOfProductShowInSelect=Max number of products in combos select lists (0=no
ConfirmDeleteProductLineAbility=Confirmation when removing product lines in forms
ModifyProductDescAbility=Personalization of product descriptions in forms
ViewProductDescInFormAbility=Visualization of product descriptions in the forms (otherwise as popup tooltip)
+ViewProductDescInClientLanguageAbility=Visualization of product descriptions in the customer language
UseSearchToSelectProduct=Use a search form to choose a product (instead of using a list box).
Also if you have a large number of product (> 100 000), you can increase speed by setting constant PRODUCT_DONOTSEARCH_ANYWHERE to 1 in Setup->Other. Search will then be limited to start of string.
UseEcoTaxeAbility=Support Eco-Taxe (WEEE)
SetDefaultBarcodeTypeProducts=Default barcode type to use for products
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index 1cb634c03e4..950e1362240 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -1119,6 +1119,7 @@ NumberOfProductShowInSelect= Nombre de produits max dans les listes déroulantes
ConfirmDeleteProductLineAbility= Confirmation de suppression d'une ligne produit dans les formulaires
ModifyProductDescAbility= Personnalisation des descriptions produits dans les formulaires
ViewProductDescInFormAbility= Visualisation des descriptions produits dans les formulaires (sinon en tant que tooltip)
+ViewProductDescInClientLanguageAbility= Visualisation des descriptions produits dans la langue du client
UseSearchToSelectProduct= Utiliser un formulaire de recherche pour le choix d'un produit (plutôt qu'une liste déroulante).
Notez que si vous avez un nombre important de produits ou services (> 100 000), vous pouvez améliorer les performances en définissant la constante PRODUCT_DONOTSEARCH_ANYWHERE à 1 dans Configuration->Divers. La recherche sera alors limitée au début de la chaine.
UseEcoTaxeAbility= Prise en charge des éco-taxes (DEEE)
SetDefaultBarcodeTypeProducts= Type de code-barres utilisé par défaut pour les produits
diff --git a/htdocs/product/admin/produit.php b/htdocs/product/admin/produit.php
index dd911ae0bc0..45d672e0247 100644
--- a/htdocs/product/admin/produit.php
+++ b/htdocs/product/admin/produit.php
@@ -69,6 +69,11 @@ 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 == 'viewProdDescInClientLanguage')
+{
+ $view = GETPOST("activate_viewProdDescInClientLanguage");
+ $res = dolibarr_set_const($db, "PRODUIT_DESC_IN_CLIENT_LANGUAGE", $view,'chaine',0,'',$conf->entity);
+}
else if ($action == 'usesearchtoselectproduct')
{
$usesearch = GETPOST("activate_usesearchtoselectproduct");
@@ -249,6 +254,22 @@ print '';
print '';
print '';
+// Visualiser description produit dans la langue du client
+$var=!$var;
+print '