mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-02-20 13:46:52 +01:00
Ajout possibilit d'avoir les descriptions
des produits et services en plusieurs langues - merci Nicolas pour ce patch
This commit is contained in:
parent
e3693349ba
commit
5cea8665ef
|
|
@ -134,6 +134,20 @@ else if ($_GET["action"] == 'disable_sousproduits')
|
|||
exit;
|
||||
}
|
||||
|
||||
// Multilangs
|
||||
if ($_GET['action'] == 'enable_multilangs')
|
||||
{
|
||||
dolibarr_set_const($db, "PRODUIT_MULTILANGS", "1");
|
||||
Header("Location: produit.php");
|
||||
|
||||
}
|
||||
else if ($_GET['action'] == 'disable_multilangs')
|
||||
{
|
||||
dolibarr_del_const($db, "PRODUIT_MULTILANGS");
|
||||
Header("Location: produit.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Affiche page
|
||||
|
|
@ -237,6 +251,29 @@ print '</tr>';
|
|||
print '</table>';
|
||||
print '</form>';
|
||||
|
||||
// multilangs activation/desactivation
|
||||
print '<br />';
|
||||
print '<table class="noborder" width="100%">';
|
||||
print '<tr class="liste_titre">';
|
||||
print '<td width="140">'.$langs->trans("Name").'</td>';
|
||||
print '<td align="center"> </td>';
|
||||
print '<td align="center">'.$langs->trans("Active").'</td>';
|
||||
print "</tr>\n";
|
||||
print "<tr ".$bc[false].">";
|
||||
print '<td width="80%">'.$langs->trans("MultilangsAbility").'</td>';
|
||||
print '<td align="center">';
|
||||
if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
print img_tick();
|
||||
print '</td>';
|
||||
print "<td align=\"center\">";
|
||||
if($conf->global->PRODUIT_MULTILANGS == 0)
|
||||
print '<a href="produit.php?action=enable_multilangs">'.$langs->trans("Activate").'</a>';
|
||||
else if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
print '<a href="produit.php?action=disable_multilangs">'.$langs->trans("Disable").'</a>';
|
||||
print "</td>";
|
||||
print '</tr>';
|
||||
print '</table>';
|
||||
|
||||
|
||||
$db->close();
|
||||
|
||||
|
|
|
|||
|
|
@ -594,6 +594,20 @@ class Form
|
|||
if ($limit) $sql.= " LIMIT $limit";
|
||||
|
||||
$result=$this->db->query($sql);
|
||||
|
||||
// Multilang : on construit une liste des traductions des produits listés
|
||||
$sqld = "SELECT d.fk_product, d.label";
|
||||
$sqld.= " FROM ".MAIN_DB_PREFIX."product as p, ".MAIN_DB_PREFIX."product_det as d ";
|
||||
$sqld.= " WHERE d.fk_product=p.rowid AND p.envente=1 AND d.lang='". $langs->getDefaultLang() ."'";
|
||||
$sqld.= " ORDER BY p.nbvente DESC";
|
||||
|
||||
// inutile de faire la requete si l'option n'est pas active
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
$resultd = $this->db->query($sqld);
|
||||
if ( $resultd ) $objtp = $this->db->fetch_object($resultd);
|
||||
}
|
||||
|
||||
if ($result)
|
||||
{
|
||||
print '<select class="flat" name="'.$htmlname.'">';
|
||||
|
|
@ -604,8 +618,17 @@ class Form
|
|||
while ($i < $num)
|
||||
{
|
||||
$objp = $this->db->fetch_object($result);
|
||||
|
||||
// Multilangs : modification des donnée si une traduction existe
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
if ( $objp->rowid == $objtp->fk_product ) // si on a une traduction
|
||||
{
|
||||
if ( $objtp->label != '') $objp->label = $objtp->label;
|
||||
if ( $resultd ) $objtp = $this->db->fetch_object($resultd); // on charge la traduction suivante
|
||||
}
|
||||
$opt = '<option value="'.$objp->rowid.'">'.$objp->ref.' - ';
|
||||
$opt.= dolibarr_trunc($objp->label,36).' - ';
|
||||
$opt.= dolibarr_trunc($objp->label,40).' - ';
|
||||
|
||||
//multiprix
|
||||
if($price_level > 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class box_produits extends ModeleBoxes {
|
|||
*/
|
||||
function loadBox($max=5)
|
||||
{
|
||||
global $user, $langs, $db;
|
||||
global $user, $langs, $db, $conf;
|
||||
$langs->load("boxes");
|
||||
|
||||
$this->info_box_head = array('text' => $langs->trans("BoxTitleLastProducts",$max));
|
||||
|
|
@ -78,6 +78,21 @@ class box_produits extends ModeleBoxes {
|
|||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active
|
||||
{
|
||||
$sqld = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sqld.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sqld.= " LIMIT 1";
|
||||
|
||||
$resultd = $db->query($sqld);
|
||||
if ($resultd)
|
||||
{
|
||||
$objtp = $db->fetch_object($resultd);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class box_services_vendus extends ModeleBoxes {
|
|||
|
||||
if ($user->rights->produit->lire)
|
||||
{
|
||||
$sql = "SELECT s.nom, s.idp, c.rowid, cd.rowid as cdid, p.label, p.fk_product_type";
|
||||
$sql = "SELECT s.nom, s.idp, c.rowid, cd.rowid as cdid, p.rowid as pid, p.label, p.fk_product_type";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."contrat as c, ".MAIN_DB_PREFIX."contratdet as cd, ".MAIN_DB_PREFIX."product as p";
|
||||
$sql .= " WHERE s.idp = c.fk_soc AND c.rowid = cd.fk_contrat AND cd.fk_product = p.rowid";
|
||||
if($user->societe_id)
|
||||
|
|
@ -85,6 +85,21 @@ class box_services_vendus extends ModeleBoxes {
|
|||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active
|
||||
{
|
||||
$sqld = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sqld.= " WHERE fk_product=".$objp->pid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sqld.= " LIMIT 1";
|
||||
|
||||
$resultd = $db->query($sqld);
|
||||
if ($resultd)
|
||||
{
|
||||
$objtp = $db->fetch_object($resultd);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$this->info_box_contents[$i][0] = array('align' => 'left',
|
||||
'logo' => ($objp->fk_product_type?'object_service':'object_product'),
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ class Product
|
|||
var $stats_commande=array();
|
||||
var $stats_contrat=array();
|
||||
var $stats_facture=array();
|
||||
var $multilangs=array();
|
||||
|
||||
var $typeprodserv;
|
||||
var $error;
|
||||
|
|
@ -201,7 +202,7 @@ class Product
|
|||
*/
|
||||
function update($id, $user)
|
||||
{
|
||||
global $langs;
|
||||
global $langs, $conf;
|
||||
$langs->load("main");
|
||||
$langs->load("products");
|
||||
|
||||
|
|
@ -225,7 +226,14 @@ class Product
|
|||
|
||||
if ( $this->db->query($sql) )
|
||||
{
|
||||
return 1;
|
||||
// Multilangs
|
||||
if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
if ( $this->setMultiLangs() < 0)
|
||||
{
|
||||
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
||||
return -2;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -242,6 +250,89 @@ class Product
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief : update ou crée les traductions des infos produits
|
||||
*/
|
||||
function setMultiLangs()
|
||||
{
|
||||
global $langs;
|
||||
$langs_available = $langs->get_available_languages();
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
foreach ($langs_available as $value)
|
||||
{
|
||||
if ($value == $current_lang)
|
||||
{
|
||||
$sqlU = "UPDATE ".MAIN_DB_PREFIX."product_det";
|
||||
$sqlU.= " SET label='".$this->libelle."'";
|
||||
$sqlU.= " description='".$this->description."'";
|
||||
$sqlU.= " note='".$this->note."'";
|
||||
$sqlU.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
|
||||
|
||||
$sqlI = "INSERT INTO ".MAIN_DB_PREFIX."product_det (fk_product, lang, label, description, note)";
|
||||
$sqlI.= " VALUES(".$this->id.",'".$value."','". $this->libelle;
|
||||
$sqlI.= "','".$this->description;
|
||||
$sqlI.= "','".$this->note."')";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$sqlU = "UPDATE ".MAIN_DB_PREFIX."product_det";
|
||||
$sqlU.= " SET label='".$this->multilangs["$value"]["libelle"]."'";
|
||||
$sqlU.= " description='".$this->multilangs["$value"]["libelle"]."'";
|
||||
$sqlU.= " note='".$this->multilangs["$value"]["note"]."'";
|
||||
$sqlU.= " WHERE fk_product=".$this->id." AND lang='".$value."'";
|
||||
|
||||
$sqlI = "INSERT INTO ".MAIN_DB_PREFIX."product_det (fk_product, lang, label, description, note)";
|
||||
$sqlI.= " VALUES(".$this->id.",'".$value."','". $this->multilangs["$value"]["libelle"];
|
||||
$sqlI.= "','".$this->multilangs["$value"]["description"];
|
||||
$sqlI.= "','".$this->multilangs["$value"]["note"]."')";
|
||||
|
||||
}
|
||||
|
||||
if (!$this->db->query($sqlU)) // si aucun champ n'est mis a jour
|
||||
if (!$this->db->query($sqlI)) return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \ brief Charge toutes les traductions du produit
|
||||
*/
|
||||
function getMultiLangs()
|
||||
{
|
||||
global $langs;
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
$sql = "SELECT lang, label, description, note";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$this->id;
|
||||
|
||||
$result = $this->db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
while ( $obj = $this->db->fetch_object($result) )
|
||||
{
|
||||
$this->multilangs["$obj->lang"]["libelle"] = $obj->label;
|
||||
$this->multilangs["$obj->lang"]["description"] = $obj->description;
|
||||
$this->multilangs["$obj->lang"]["note"] = $obj->note;
|
||||
|
||||
if( $obj->lang == $current_lang ) // si on a les traduct. dans la langue courant on les charge en infos principales.
|
||||
{
|
||||
$this->libelle = $obj->label;
|
||||
$this->description = $obj->description;
|
||||
$this->note = $obj->note;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->error=$langs->trans("Error")." : ".$this->db->error()." - ".$sql;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* \brief Ajoute un changement de prix en base dans l'historique des prix
|
||||
|
|
@ -580,6 +671,10 @@ class Product
|
|||
}
|
||||
|
||||
$this->db->free();
|
||||
// multilangs
|
||||
if( $conf->global->PRODUIT_MULTILANGS == 1 ) $this->getMultiLangs();
|
||||
|
||||
|
||||
// multiprix
|
||||
if($conf->global->PRODUIT_MULTIPRICES == 1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,6 +87,32 @@ if ($_POST["action"] == 'add' && $user->rights->produit->creer)
|
|||
$product->multiprices["$i"] = "";
|
||||
}
|
||||
}
|
||||
|
||||
if ( $value != $current_lang )
|
||||
|
||||
// MultiLangs
|
||||
if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
$langs_available=$langs->get_available_languages();
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
foreach ($langs_available as $value)
|
||||
{
|
||||
if ($value == $current_lang)
|
||||
{
|
||||
$product->multilangs["$value"]["libelle"] = $product->libelle;
|
||||
$product->multilangs["$value"]["description"] = $product->description;
|
||||
$product->multilangs["$value"]["note"] = $product->note;
|
||||
}
|
||||
else
|
||||
{
|
||||
$product->multilangs["$value"]["libelle"] = stripslashes($_POST["libelle-".$value]);
|
||||
$product->multilangs["$value"]["description"] = stripslashes($_POST["desc-".$value]);
|
||||
$product->multilangs["$value"]["note"] = stripslashes($_POST["note-".$value]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$e_product = $product;
|
||||
|
||||
$id = $product->create($user);
|
||||
|
|
@ -127,6 +153,29 @@ if ($_POST["action"] == 'update' &&
|
|||
$product->duration_value = $_POST["duration_value"];
|
||||
$product->duration_unit = $_POST["duration_unit"];
|
||||
|
||||
// MultiLangs
|
||||
if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
$langs_available=$langs->get_available_languages();
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
|
||||
foreach ($langs_available as $value)
|
||||
{
|
||||
if ($value == $current_lang)
|
||||
{
|
||||
$product->multilangs["$value"]["libelle"] = $product->libelle;
|
||||
$product->multilangs["$value"]["description"] = $product->description;
|
||||
$product->multilangs["$value"]["note"] = $product->note;
|
||||
}
|
||||
else
|
||||
{
|
||||
$product->multilangs["$value"]["libelle"] = stripslashes($_POST["libelle-".$value]);
|
||||
$product->multilangs["$value"]["description"] = stripslashes($_POST["desc-".$value]);
|
||||
$product->multilangs["$value"]["note"] = stripslashes($_POST["note-".$value]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($product->check())
|
||||
{
|
||||
if ($product->update($product->id, $user) > 0)
|
||||
|
|
@ -379,7 +428,25 @@ if ($_GET["action"] == 'create' && $user->rights->produit->creer)
|
|||
print '<textarea name="note" rows="8" cols="50">';
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
print '<tr><td colspan="2" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
// Gestion multilingue
|
||||
if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td valign="top" colspan="3" class="liste_titre">'.$langs->trans("language").'</td></tr>';
|
||||
|
||||
$langs_available=$langs->get_available_languages();
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
foreach ($langs_available as $value)
|
||||
if ( $value != $current_lang )
|
||||
{
|
||||
print '<tr><td valign="top" rowspan="3">'.$value.'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td><td><input name="libelle-'.$value.'" size="40" value="'.$product->libelle.'"></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td valign="top"><textarea name="desc-'.$value.'" rows="4" cols="50"></textarea></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td valign="top"><textarea name="note-'.$value.'" rows="8" cols="50"></textarea></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Create").'"></td></tr>';
|
||||
print '</table>';
|
||||
print '</form>';
|
||||
}
|
||||
|
|
@ -593,6 +660,23 @@ if ($_GET["id"] || $_GET["ref"])
|
|||
// Note
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td>'.nl2br($product->note).'</td></tr>';
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
print "</table>\n";
|
||||
print '<table class="border" width="100%">';
|
||||
$langs_available=$langs->get_available_languages();
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
foreach ($langs_available as $value)
|
||||
if ( $value != $current_lang )
|
||||
{
|
||||
print '<tr><td valign="top" rowspan="3" width="50">'.$value.'</td>';
|
||||
print '<td valign="top" width="10%">'.$langs->trans("Label").'</td><td>'.$product->multilangs[$value]['libelle'].'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td valign="top">'.$product->multilangs[$value]['description'].'</td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td valign="top">'.$product->multilangs[$value]['note'].'</td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print "</table>\n";
|
||||
|
||||
print "</div>\n";
|
||||
|
|
@ -672,6 +756,24 @@ if ($_GET["id"] || $_GET["ref"])
|
|||
print '<textarea name="note" rows="8" cols="50">';
|
||||
print $product->note;
|
||||
print "</textarea></td></tr>";
|
||||
|
||||
// Gestion multilingue
|
||||
if($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
print '<table class="border" width="100%">';
|
||||
print '<tr><td valign="top" colspan="3" class="liste_titre">'.$langs->trans("language").'</td></tr>';
|
||||
|
||||
$langs_available=$langs->get_available_languages();
|
||||
$current_lang = $langs->getDefaultLang();
|
||||
foreach ($langs_available as $value)
|
||||
if ( $value != $current_lang )
|
||||
{
|
||||
print '<tr><td valign="top" rowspan="3">'.$value.'</td>';
|
||||
print '<td>'.$langs->trans("Label").'</td><td><input name="libelle-'.$value.'" size="40" value="'.$product->multilangs[$value]["libelle"].'"></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Description").'</td><td valign="top"><textarea name="desc-'.$value.'" rows="4" cols="50">'.$product->multilangs[$value]["description"].'</textarea></td></tr>';
|
||||
print '<tr><td valign="top">'.$langs->trans("Note").'</td><td valign="top"><textarea name="note-'.$value.'" rows="8" cols="50">'.$product->multilangs[$value]["note"].'</textarea></td></tr>';
|
||||
}
|
||||
}
|
||||
|
||||
print '<tr><td colspan="3" align="center"><input type="submit" class="button" value="'.$langs->trans("Save").'"> ';
|
||||
print '<input type="submit" class="button" name="cancel" value="'.$langs->trans("Cancel").'"></td></tr>';
|
||||
|
|
|
|||
|
|
@ -138,6 +138,20 @@ if ($result)
|
|||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
//Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1)
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$resultd = $db->query($sql);
|
||||
if ($resultd)
|
||||
{
|
||||
$objtp = $db->fetch_object($resultd);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td nowrap="nowrap"><a href="fiche.php?id='.$objp->rowid.'">';
|
||||
|
|
|
|||
|
|
@ -75,9 +75,9 @@ if (isset($_REQUEST['catid']))
|
|||
|
||||
$title=$langs->trans("ProductsAndServices");
|
||||
|
||||
$sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem,';
|
||||
$sql = 'SELECT distinct(p.rowid), p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate('p.tms').' as datem,';
|
||||
$sql.= ' p.duration, p.envente as statut';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
|
||||
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p, '.MAIN_DB_PREFIX.'product_det as d';
|
||||
|
||||
if ($catid)
|
||||
{
|
||||
|
|
@ -223,6 +223,21 @@ if ($resql)
|
|||
while ($i < min($num,$limit))
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]><td>";
|
||||
print "<a href=\"fiche.php?id=$objp->rowid\">";
|
||||
|
|
|
|||
|
|
@ -83,6 +83,21 @@ if ($result)
|
|||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($result);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->label = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
print '<td><a href="'.DOL_URL_ROOT.'/product/stats/fiche.php?id='.$objp->rowid.'">';
|
||||
|
|
|
|||
|
|
@ -288,6 +288,22 @@ else
|
|||
while ($i < $num)
|
||||
{
|
||||
$objp = $db->fetch_object($resql);
|
||||
|
||||
// Multilangs
|
||||
if ($conf->global->PRODUIT_MULTILANGS == 1) // si l'option est active
|
||||
{
|
||||
$sql = "SELECT label FROM ".MAIN_DB_PREFIX."product_det";
|
||||
$sql.= " WHERE fk_product=".$objp->rowid." AND lang='". $langs->getDefaultLang() ."'";
|
||||
$sql.= " LIMIT 1";
|
||||
|
||||
$result = $db->query($sql);
|
||||
if ($result)
|
||||
{
|
||||
$objtp = $db->fetch_object($result);
|
||||
if ($objtp->label != '') $objp->produit = $objtp->label;
|
||||
}
|
||||
}
|
||||
|
||||
$var=!$var;
|
||||
print "<tr $bc[$var]>";
|
||||
//print '<td>'.dolibarr_print_date($objp->datem).'</td>';
|
||||
|
|
|
|||
|
|
@ -66,4 +66,14 @@ create table llx_expedition_model_pdf
|
|||
nom varchar(50) PRIMARY KEY,
|
||||
libelle varchar(255),
|
||||
description text
|
||||
)type=innodb;
|
||||
|
||||
create table llx_product_det
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_product integer DEFAULT 0 NOT NULL,
|
||||
fk_lang integer DEFAULT 0 NOT NULL,
|
||||
label varchar(128),
|
||||
description varchar(255),
|
||||
note text
|
||||
)type=innodb;
|
||||
31
mysql/tables/llx_product_det.sql
Normal file
31
mysql/tables/llx_product_det.sql
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
-- ============================================================================
|
||||
-- Copyright (C) 2002-2003 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
--
|
||||
-- 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
|
||||
-- the Free Software Foundation; either version 2 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program; if not, write to the Free Software
|
||||
-- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
--
|
||||
-- $Id$
|
||||
-- $Source$
|
||||
--
|
||||
-- ============================================================================
|
||||
|
||||
create table llx_product_det
|
||||
(
|
||||
rowid integer AUTO_INCREMENT PRIMARY KEY,
|
||||
fk_product integer DEFAULT 0 NOT NULL,
|
||||
fk_lang integer DEFAULT 0 NOT NULL,
|
||||
label varchar(128),
|
||||
description varchar(255),
|
||||
note text
|
||||
)type=innodb;
|
||||
Loading…
Reference in New Issue
Block a user