From 2d798587d3ac595e6063a9082b814e45ba1a2da5 Mon Sep 17 00:00:00 2001 From: Christophe Battarel Date: Tue, 17 Jan 2012 12:03:05 +0100 Subject: [PATCH] =?UTF-8?q?exp=C3=A9dition=20et=20livraisons=20:=20afficha?= =?UTF-8?q?ge=20libell=C3=A9s=20dans=20la=20langue=20du=20client?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/core/lib/sendings.lib.php | 26 ++++++++++++++++++-- htdocs/expedition/fiche.php | 22 ++++++++++++++++- htdocs/expedition/shipment.php | 24 ++++++++++++++++-- htdocs/livraison/fiche.php | 42 ++++++++++++++++++++++++++++++-- 4 files changed, 107 insertions(+), 7 deletions(-) diff --git a/htdocs/core/lib/sendings.lib.php b/htdocs/core/lib/sendings.lib.php index 857bc2e4653..b7d06d10ff5 100644 --- a/htdocs/core/lib/sendings.lib.php +++ b/htdocs/core/lib/sendings.lib.php @@ -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 ''; // 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); diff --git a/htdocs/expedition/fiche.php b/htdocs/expedition/fiche.php index 2b8c8495126..fa93422cec4 100644 --- a/htdocs/expedition/fiche.php +++ b/htdocs/expedition/fiche.php @@ -1145,6 +1145,26 @@ else // 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 ''; // Affiche ligne produit @@ -1152,7 +1172,7 @@ else 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.''; - $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); diff --git a/htdocs/expedition/shipment.php b/htdocs/expedition/shipment.php index f92de82038f..e114a6a9082 100644 --- a/htdocs/expedition/shipment.php +++ b/htdocs/expedition/shipment.php @@ -440,6 +440,26 @@ if ($id > 0 || ! empty($ref)) // 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 ''; print ''; // ancre pour retourner sur la ligne @@ -447,9 +467,9 @@ if ($id > 0 || ! empty($ref)) $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); diff --git a/htdocs/livraison/fiche.php b/htdocs/livraison/fiche.php index 5e03bbec77d..797cfac9125 100644 --- a/htdocs/livraison/fiche.php +++ b/htdocs/livraison/fiche.php @@ -308,8 +308,27 @@ if ($_GET["action"] == 'create') $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 ''; - print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$product->libelle; + print ''.img_object($langs->trans("ShowProduct"),"product").' '.$product->ref.' - '.$label; if ($line->description) print nl2br($line->description); print ''; } @@ -530,6 +549,25 @@ else $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 ''; // Affiche ligne produit @@ -537,7 +575,7 @@ else 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.''; - $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);