affiche libellé produit dans la langue du client en plus de la description (variable de conf renommée en PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE

This commit is contained in:
Christophe Battarel 2012-01-16 17:12:29 +01:00
parent 5524d42ddb
commit 6a90298af0
5 changed files with 37 additions and 14 deletions

View File

@ -747,7 +747,7 @@ else if ($action == "addline" && $user->rights->propale->creer)
} }
// Define output language // 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; $outputlangs = $langs;
$newlang=''; $newlang='';

View File

@ -554,7 +554,7 @@ if ($action == 'addline' && $user->rights->commande->creer)
} }
// Define output language // 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; $outputlangs = $langs;
$newlang=''; $newlang='';

View File

@ -998,7 +998,7 @@ if (($action == 'addline' || $action == 'addline_predef') && $user->rights->fact
} }
// Define output language // 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; $outputlangs = $langs;
$newlang=''; $newlang='';

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net> /* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2005-2012 Regis Houssin <regis@dolibarr.fr>
* Copyright (C) 2010-2011 Juanjo Menent <jmenent@2byte.es> * 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 * 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 * 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 = new Product($this->db);
$product_static->type=$line->fk_product_type; // Define output language
$product_static->id=$line->fk_product; if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
$product_static->ref=$line->ref; {
$product_static->libelle=$line->product_label; $this->fetch_thirdparty();
$text=$product_static->getNomUrl(1); $prod = new Product($this->db, $line->fk_product);
$text.= ' - '.$line->product_label;
$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)); $description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($line->description));
// Use global variables + $seller and $buyer // Use global variables + $seller and $buyer

View File

@ -70,10 +70,10 @@ else if ($action == 'viewProdDescInForm')
$view = GETPOST("activate_viewProdDescInForm"); $view = GETPOST("activate_viewProdDescInForm");
$res = dolibarr_set_const($db, "PRODUIT_DESC_IN_FORM", $view,'chaine',0,'',$conf->entity); $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"); $view = GETPOST("activate_viewProdTextsInThirdpartyLanguage");
$res = dolibarr_set_const($db, "PRODUIT_DESC_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity); $res = dolibarr_set_const($db, "PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE", $view,'chaine',0,'',$conf->entity);
} }
else if ($action == 'usesearchtoselectproduct') else if ($action == 'usesearchtoselectproduct')
{ {
@ -261,11 +261,11 @@ if (! empty($conf->global->MAIN_MULTILANGS))
$var=!$var; $var=!$var;
print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">'; print '<form method="POST" action="'.$_SERVER['PHP_SELF'].'">';
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">'; 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 '<tr '.$bc[$var].'>';
print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>'; print '<td>'.$langs->trans("ViewProductDescInThirdpartyLanguageAbility").'</td>';
print '<td width="60" align="right">'; 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 '</td><td align="right">';
print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">'; print '<input type="submit" class="button" value="'.$langs->trans("Modify").'">';
print '</td>'; print '</td>';