Skip to content

Commit

Permalink
expédition et livraisons : affichage libellés dans la langue du client
Browse files Browse the repository at this point in the history
  • Loading branch information
altairis-tof committed Jan 17, 2012
1 parent acf95fa commit 2d79858
Show file tree
Hide file tree
Showing 4 changed files with 107 additions and 7 deletions.
26 changes: 24 additions & 2 deletions htdocs/core/lib/sendings.lib.php
Expand Up @@ -163,15 +163,37 @@ function show_list_sending_receive($origin='commande',$origin_id,$filter='')
// Description
if ($objp->fk_product > 0)
{
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$object = new $origin($db);
$object->fetch($origin_id);
$object->fetch_thirdparty();
$prod = new Product($db, $objp->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
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"] : $objp->product;
}
else
$label = $objp->product;

print '<td>';

// Show product and description
$product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->libelle=$objp->product;
$product_static->libelle=$label;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$objp->product;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text,$description,3,'','',$i);

Expand Down
22 changes: 21 additions & 1 deletion htdocs/expedition/fiche.php
Expand Up @@ -1145,14 +1145,34 @@
// Predefined product or service
if ($lines[$i]->fk_product > 0)
{
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$object->fetch_thirdparty();
$prod = new Product($db, $lines[$i]->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
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;
}
else
$label = $lines[$i]->product_label;

print '<td>';

// Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$lines[$i]->fk_product.'">';
if ($lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$lines[$i]->ref.'</a>';
$text.= ' - '.$lines[$i]->label;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($lines[$i]->description));
//print $description;
print $form->textwithtooltip($text,$description,3,'','',$i);
Expand Down
24 changes: 22 additions & 2 deletions htdocs/expedition/shipment.php
Expand Up @@ -440,16 +440,36 @@
// Product label
if ($objp->fk_product > 0)
{
// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$commande->fetch_thirdparty();
$prod = new Product($db, $objp->fk_product);
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$commande->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"] : $objp->product_label;
}
else
$label = $objp->product_label;

print '<td>';
print '<a name="'.$objp->rowid.'"></a>'; // ancre pour retourner sur la ligne

// Show product and description
$product_static->type=$objp->fk_product_type;
$product_static->id=$objp->fk_product;
$product_static->ref=$objp->ref;
$product_static->libelle=$objp->product_label;
$product_static->libelle=$label;
$text=$product_static->getNomUrl(1);
$text.= ' - '.$objp->product_label;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($objp->description));
print $form->textwithtooltip($text,$description,3,'','',$i);

Expand Down
42 changes: 40 additions & 2 deletions htdocs/livraison/fiche.php
Expand Up @@ -308,8 +308,27 @@
$product->fetch($line->fk_product);
$product->load_stock();

// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$commande->fetch_thirdparty();
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$commande->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}

$label = (! empty($product->multilangs[$outputlangs->defaultlang]["libelle"])) ? $product->multilangs[$outputlangs->defaultlang]["libelle"] : $product->libelle;
}
else
$label = $product->libelle;

print '<td>';
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$product->libelle;
print '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$line->fk_product.'">'.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.'</a> - '.$label;
if ($line->description) print nl2br($line->description);
print '</td>';
}
Expand Down Expand Up @@ -530,14 +549,33 @@
$product = new Product($db);
$product->fetch($delivery->lines[$i]->fk_product);

// Define output language
if (! empty($conf->global->MAIN_MULTILANGS) && ! empty($conf->global->PRODUIT_TEXTS_IN_THIRDPARTY_LANGUAGE))
{
$delivery->fetch_thirdparty();
$outputlangs = $langs;
$newlang='';
if (empty($newlang) && ! empty($_REQUEST['lang_id'])) $newlang=$_REQUEST['lang_id'];
if (empty($newlang)) $newlang=$delivery->client->default_lang;
if (! empty($newlang))
{
$outputlangs = new Translate("",$conf);
$outputlangs->setDefaultLang($newlang);
}

$label = (! empty($product->multilangs[$outputlangs->defaultlang]["libelle"])) ? $product->multilangs[$outputlangs->defaultlang]["libelle"] : $delivery->lines[$i]->product_label;
}
else
$label = $delivery->lines[$i]->product_label;

print '<td>';

// Affiche ligne produit
$text = '<a href="'.DOL_URL_ROOT.'/product/fiche.php?id='.$delivery->lines[$i]->fk_product.'">';
if ($delivery->lines[$i]->fk_product_type==1) $text.= img_object($langs->trans('ShowService'),'service');
else $text.= img_object($langs->trans('ShowProduct'),'product');
$text.= ' '.$delivery->lines[$i]->ref.'</a>';
$text.= ' - '.$delivery->lines[$i]->label;
$text.= ' - '.$label;
$description=($conf->global->PRODUIT_DESC_IN_FORM?'':dol_htmlentitiesbr($delivery->lines[$i]->description));
//print $description;
print $form->textwithtooltip($text,$description,3,'','',$i);
Expand Down

0 comments on commit 2d79858

Please sign in to comment.