2
0
forked from Wavyzz/dolibarr

ajoute la possibilité de visualiser la description des produits dans la langue du client lors de l'jout de lignes dans les commandes/propales/factures

This commit is contained in:
Christophe Battarel
2012-01-13 16:53:28 +01:00
parent 66bfaf8530
commit 69c9edbeb3
6 changed files with 77 additions and 6 deletions

View File

@@ -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']))?"<br>\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']))?"<br />\n":"\n") : "";
$desc.= $_POST['np_desc'];
$type = $prod->type;
}

View File

@@ -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']))?"<br>\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']))?"<br />\n":"\n") : "";
$desc.= $_POST['np_desc'];
$type = $prod->type;
}

View File

@@ -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']))?"<br>\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']))?"<br>\n":"\n") : "";
$desc.= $_POST['np_desc'];
if (! empty($prod->customcode) || ! empty($prod->country_code))
{

View File

@@ -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).<br>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

View File

@@ -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).<br>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

View File

@@ -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 '</td>';
print '</tr>';
print '</form>';
// Visualiser description produit dans la langue du client
$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="viewProdDescInClientLanguage">';
print '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ViewProductDescInClientLanguageAbility").'</td>';
print '<td width="60" align="right">';
print $form->selectyesno("activate_viewProdDescInClientLanguage",$conf->global->PRODUIT_DESC_IN_CLIENT_LANGUAGE,1);
print '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</td>';
print '</tr>';
print '</form>';
if ($conf->global->PRODUCT_CANVAS_ABILITY)
{
// Add canvas feature