Fix: use label instead libelle

This commit is contained in:
Regis Houssin 2012-08-25 12:07:18 +02:00
parent 6fe631378b
commit d88abe8df0
9 changed files with 28 additions and 28 deletions

View File

@ -2613,7 +2613,7 @@ abstract class CommonObject
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $line->product_label; $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $line->product_label;
} }
else else
{ {

View File

@ -57,7 +57,7 @@ function doc_getlinedesc($line,$outputlangs,$hideref=0,$hidedesc=0,$issupplierli
// If a predefined product and multilang and on other lang, we renamed label with label translated // If a predefined product and multilang and on other lang, we renamed label with label translated
if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang)) if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang))
{ {
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["libelle"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["libelle"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"];
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"];
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"];
} }

View File

@ -813,7 +813,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
global $db, $conf, $langs; global $db, $conf, $langs;
$idprod=(! empty($object->lines[$i]->fk_product)?$object->lines[$i]->fk_product:false); $idprod=(! empty($object->lines[$i]->fk_product)?$object->lines[$i]->fk_product:false);
$label=(! empty($object->lines[$i]->label)?$object->lines[$i]->label:(! empty($object->lines[$i]->libelle)?$object->lines[$i]->libelle:'')); $label=(! empty($object->lines[$i]->label)?$object->lines[$i]->label:(! empty($object->lines[$i]->product_label)?$object->lines[$i]->product_label:''));
$desc=(! empty($object->lines[$i]->desc)?$object->lines[$i]->desc:(! empty($object->lines[$i]->description)?$object->lines[$i]->description:'')); $desc=(! empty($object->lines[$i]->desc)?$object->lines[$i]->desc:(! empty($object->lines[$i]->description)?$object->lines[$i]->description:''));
$ref_supplier=(! empty($object->lines[$i]->ref_supplier)?$object->lines[$i]->ref_supplier:(! empty($object->lines[$i]->ref_fourn)?$object->lines[$i]->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders $ref_supplier=(! empty($object->lines[$i]->ref_supplier)?$object->lines[$i]->ref_supplier:(! empty($object->lines[$i]->ref_fourn)?$object->lines[$i]->ref_fourn:'')); // TODO Not yet saved for supplier invoices, only supplier orders
$note=(! empty($object->lines[$i]->note)?$object->lines[$i]->note:''); $note=(! empty($object->lines[$i]->note)?$object->lines[$i]->note:'');
@ -825,9 +825,9 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
{ {
$prodser->fetch($idprod); $prodser->fetch($idprod);
// If a predefined product and multilang and on other lang, we renamed label with label translated // If a predefined product and multilang and on other lang, we renamed label with label translated
if ($conf->global->MAIN_MULTILANGS && ($outputlangs->defaultlang != $langs->defaultlang)) if (! empty($conf->global->MAIN_MULTILANGS) && ($outputlangs->defaultlang != $langs->defaultlang))
{ {
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["libelle"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["libelle"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["label"]) && $label == $prodser->label) $label=$prodser->multilangs[$outputlangs->defaultlang]["label"];
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["description"]) && $desc == $prodser->description) $desc=$prodser->multilangs[$outputlangs->defaultlang]["description"];
if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"]; if (! empty($prodser->multilangs[$outputlangs->defaultlang]["note"]) && $note == $prodser->note) $note=$prodser->multilangs[$outputlangs->defaultlang]["note"];
} }
@ -837,7 +837,7 @@ function pdf_getlinedesc($object,$i,$outputlangs,$hideref=0,$hidedesc=0,$issuppl
$libelleproduitservice=$label; $libelleproduitservice=$label;
// Description long of product line // Description long of product line
if ($desc && ($desc != $label)) if (! empty($desc) && ($desc != $label))
{ {
if ($libelleproduitservice && empty($hidedesc)) if ($libelleproduitservice && empty($hidedesc))
{ {

View File

@ -204,7 +204,7 @@ function show_list_sending_receive($origin,$origin_id,$filter='')
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product; $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product;
} }
else else
{ {

View File

@ -1202,7 +1202,7 @@ else
{ {
$prod = new Product($db); $prod = new Product($db);
$prod->fetch($lines[$i]->fk_product); $prod->fetch($lines[$i]->fk_product);
$label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $lines[$i]->product_label; $label = ( ! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $lines[$i]->product_label;
} }
else else
$label = $lines[$i]->product_label; $label = $lines[$i]->product_label;

View File

@ -420,7 +420,7 @@ if ($id > 0 || ! empty($ref))
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($prod->multilangs[$outputlangs->defaultlang]["libelle"])) ? $prod->multilangs[$outputlangs->defaultlang]["libelle"] : $objp->product_label; $label = (! empty($prod->multilangs[$outputlangs->defaultlang]["label"])) ? $prod->multilangs[$outputlangs->defaultlang]["label"] : $objp->product_label;
} }
else else
$label = $objp->product_label; $label = $objp->product_label;

View File

@ -343,7 +343,7 @@ if ($_GET["action"] == 'create')
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($product->multilangs[$outputlangs->defaultlang]["libelle"])) ? $product->multilangs[$outputlangs->defaultlang]["libelle"] : $product->libelle; $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $product->libelle;
} }
else else
$label = $product->libelle; $label = $product->libelle;
@ -584,7 +584,7 @@ else
$outputlangs->setDefaultLang($newlang); $outputlangs->setDefaultLang($newlang);
} }
$label = (! empty($product->multilangs[$outputlangs->defaultlang]["libelle"])) ? $product->multilangs[$outputlangs->defaultlang]["libelle"] : $delivery->lines[$i]->product_label; $label = (! empty($product->multilangs[$outputlangs->defaultlang]["label"])) ? $product->multilangs[$outputlangs->defaultlang]["label"] : $delivery->lines[$i]->product_label;
} }
else else
$label = $delivery->lines[$i]->product_label; $label = $delivery->lines[$i]->product_label;

View File

@ -705,7 +705,7 @@ class Product extends CommonObject
if ($this->db->num_rows($result)) // si aucune ligne dans la base if ($this->db->num_rows($result)) // si aucune ligne dans la base
{ {
$sql2 = "UPDATE ".MAIN_DB_PREFIX."product_lang"; $sql2 = "UPDATE ".MAIN_DB_PREFIX."product_lang";
$sql2.= " SET label='".$this->db->escape($this->multilangs["$key"]["libelle"])."',"; $sql2.= " SET label='".$this->db->escape($this->multilangs["$key"]["label"])."',";
$sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."',"; $sql2.= " description='".$this->db->escape($this->multilangs["$key"]["description"])."',";
$sql2.= " note='".$this->db->escape($this->multilangs["$key"]["note"])."'"; $sql2.= " note='".$this->db->escape($this->multilangs["$key"]["note"])."'";
$sql2.= " WHERE fk_product=".$this->id." AND lang='".$key."'"; $sql2.= " WHERE fk_product=".$this->id." AND lang='".$key."'";
@ -713,13 +713,13 @@ class Product extends CommonObject
else else
{ {
$sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description, note)"; $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."product_lang (fk_product, lang, label, description, note)";
$sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["libelle"]); $sql2.= " VALUES(".$this->id.",'".$key."','". $this->db->escape($this->multilangs["$key"]["label"]);
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"]); $sql2.= "','".$this->db->escape($this->multilangs["$key"]["description"]);
$sql2.= "','".$this->db->escape($this->multilangs["$key"]["note"])."')"; $sql2.= "','".$this->db->escape($this->multilangs["$key"]["note"])."')";
} }
// on ne sauvegarde pas des champs vides // on ne sauvegarde pas des champs vides
if ( $this->multilangs["$key"]["libelle"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] ) if ( $this->multilangs["$key"]["label"] || $this->multilangs["$key"]["description"] || $this->multilangs["$key"]["note"] )
if (!$this->db->query($sql2)) return -1; if (!$this->db->query($sql2)) return -1;
} }
} }
@ -750,12 +750,12 @@ class Product extends CommonObject
//print 'lang='.$obj->lang.' current='.$current_lang.'<br>'; //print 'lang='.$obj->lang.' current='.$current_lang.'<br>';
if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courante on les charge en infos principales. if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courante on les charge en infos principales.
{ {
$this->libelle = $obj->label; $this->label = $obj->label;
$this->description = $obj->description; $this->description = $obj->description;
$this->note = $obj->note; $this->note = $obj->note;
} }
$this->multilangs["$obj->lang"]["libelle"] = $obj->label; $this->multilangs["$obj->lang"]["label"] = $obj->label;
$this->multilangs["$obj->lang"]["description"] = $obj->description; $this->multilangs["$obj->lang"]["description"] = $obj->description;
$this->multilangs["$obj->lang"]["note"] = $obj->note; $this->multilangs["$obj->lang"]["note"] = $obj->note;
} }

View File

@ -67,13 +67,13 @@ $cancel != $langs->trans("Cancel") &&
// update de l'objet // update de l'objet
if ( $_POST["forcelangprod"] == $current_lang ) if ( $_POST["forcelangprod"] == $current_lang )
{ {
$product->libelle = $_POST["libelle"]; $product->label = $_POST["libelle"];
$product->description = dol_htmlcleanlastbr($_POST["desc"]); $product->description = dol_htmlcleanlastbr($_POST["desc"]);
$product->note = dol_htmlcleanlastbr($_POST["note"]); $product->note = dol_htmlcleanlastbr($_POST["note"]);
} }
else else
{ {
$product->multilangs[$_POST["forcelangprod"]]["libelle"] = $_POST["libelle"]; $product->multilangs[$_POST["forcelangprod"]]["label"] = $_POST["libelle"];
$product->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]); $product->multilangs[$_POST["forcelangprod"]]["description"] = dol_htmlcleanlastbr($_POST["desc"]);
$product->multilangs[$_POST["forcelangprod"]]["note"] = dol_htmlcleanlastbr($_POST["note"]); $product->multilangs[$_POST["forcelangprod"]]["note"] = dol_htmlcleanlastbr($_POST["note"]);
} }
@ -103,13 +103,13 @@ $cancel != $langs->trans("Cancel") &&
{ {
if ( $key == $current_lang ) if ( $key == $current_lang )
{ {
$product->libelle = $_POST["libelle-".$key]; $product->lable = $_POST["libelle-".$key];
$product->description = dol_htmlcleanlastbr($_POST["desc-".$key]); $product->description = dol_htmlcleanlastbr($_POST["desc-".$key]);
$product->note = dol_htmlcleanlastbr($_POST["note-".$key]); $product->note = dol_htmlcleanlastbr($_POST["note-".$key]);
} }
else else
{ {
$product->multilangs[$key]["libelle"] = $_POST["libelle-".$key]; $product->multilangs[$key]["label"] = $_POST["libelle-".$key];
$product->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]); $product->multilangs[$key]["description"] = dol_htmlcleanlastbr($_POST["desc-".$key]);
$product->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]); $product->multilangs[$key]["note"] = dol_htmlcleanlastbr($_POST["note-".$key]);
} }
@ -174,7 +174,7 @@ if ($action == 'edit')
{ {
print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>"; print "<br><b><u>".$langs->trans('Language_'.$key)." :</u></b><br>";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["libelle"].'"></td></tr>'; print '<tr><td valign="top" width="15%" class="fieldrequired">'.$langs->trans('Label').'</td><td><input name="libelle-'.$key.'" size="40" value="'.$product->multilangs[$key]["label"].'"></td></tr>';
print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>'; print '<tr><td valign="top" width="15%">'.$langs->trans('Description').'</td><td>';
$doleditor = new DolEditor("desc-$key", $product->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80); $doleditor = new DolEditor("desc-$key", $product->multilangs[$key]["description"], '', 160, 'dolibarr_notes', '', false, true, $conf->global->FCKEDITOR_ENABLE_PRODUCTDESC, 3, 80);
@ -210,7 +210,7 @@ else
$s=picto_from_langcode($key); $s=picto_from_langcode($key);
print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>"; print "<br>".($s?$s.' ':'')." <b>".$langs->trans('Language_'.$key).":</b><br>";
print '<table class="border" width="100%">'; print '<table class="border" width="100%">';
print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$product->multilangs[$key]["libelle"].'</td></tr>'; print '<tr><td width="15%">'.$langs->trans('Label').'</td><td>'.$product->multilangs[$key]["label"].'</td></tr>';
print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$product->multilangs[$key]["description"].'</td></tr>'; print '<tr><td width="15%">'.$langs->trans('Description').'</td><td>'.$product->multilangs[$key]["description"].'</td></tr>';
print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$product->multilangs[$key]["note"].'</td></tr>'; print '<tr><td width="15%">'.$langs->trans('Note').'</td><td>'.$product->multilangs[$key]["note"].'</td></tr>';
print '</table>'; print '</table>';