FIX: Show product image on getNomUrl()

This commit is contained in:
fmarcet 2015-10-29 12:28:28 +01:00
parent b6b8a9e0f0
commit 310ecb1e09
15 changed files with 39 additions and 18 deletions

View File

@ -1317,7 +1317,7 @@ else
$sql.= " cd.date_fin_validite as date_fin, cd.date_cloture as date_fin_reelle,";
$sql.= " cd.commentaire as comment, cd.fk_product_fournisseur_price as fk_fournprice, cd.buy_price_ht as pa_ht,";
$sql.= " cd.fk_unit,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM ".MAIN_DB_PREFIX."contratdet as cd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON cd.fk_product = p.rowid";
$sql.= " WHERE cd.rowid = ".$object->lines[$cursorline-1]->id;
@ -1352,6 +1352,7 @@ else
$productstatic->id=$objp->fk_product;
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
$text = $productstatic->getNomUrl(1,'',20);
if ($objp->label)
{
@ -1485,6 +1486,7 @@ else
$productstatic->id=$objp->fk_product;
$productstatic->type=$objp->ptype;
$productstatic->ref=$objp->pref;
$productstatic->entity=$objp->pentity;
print $productstatic->getNomUrl(1,'',20);
print $objp->label?' - '.dol_trunc($objp->label,16):'';
print '<br>';

View File

@ -371,7 +371,7 @@ print '<br>';
$sql = "SELECT c.ref, c.fk_soc, ";
$sql.= " cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat, cd.date_fin_validite,";
$sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -413,6 +413,7 @@ if ($resql)
$productstatic->id=$obj->fk_product;
$productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20);
}
else
@ -449,7 +450,7 @@ print '<br>';
// Not activated services
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
$sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -493,6 +494,7 @@ if ($resql)
$productstatic->id=$obj->fk_product;
$productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20);
}
else
@ -528,7 +530,7 @@ print '<br>';
// Expired services
$sql = "SELECT c.ref, c.fk_soc, cd.rowid as cid, cd.statut, cd.label, cd.fk_product, cd.description as note, cd.fk_contrat,";
$sql.= " s.nom as name,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype";
$sql.= " p.rowid as pid, p.ref as pref, p.label as plabel, p.fk_product_type as ptype, p.entity as pentity";
$sql.= " FROM (".MAIN_DB_PREFIX."contrat as c";
$sql.= ", ".MAIN_DB_PREFIX."societe as s";
if (!$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
@ -573,6 +575,7 @@ if ($resql)
$productstatic->id=$obj->fk_product;
$productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20);
}
else

View File

@ -98,7 +98,7 @@ llxHeader();
$sql = "SELECT c.rowid as cid, c.ref, c.statut as cstatut,";
$sql.= " s.rowid as socid, s.nom as name,";
$sql.= " cd.rowid, cd.description, cd.statut,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype,";
$sql.= " p.rowid as pid, p.ref as pref, p.label as label, p.fk_product_type as ptype, p.entity as pentity,";
if (!$user->rights->societe->client->voir && !$socid) $sql .= " sc.fk_soc, sc.fk_user,";
$sql.= " cd.date_ouverture_prevue,";
$sql.= " cd.date_ouverture,";
@ -225,6 +225,7 @@ if ($resql)
$productstatic->id=$obj->pid;
$productstatic->type=$obj->ptype;
$productstatic->ref=$obj->pref;
$productstatic->entity=$obj->pentity;
print $productstatic->getNomUrl(1,'',20);
print $obj->label?' - '.dol_trunc($obj->label,16):'';
if (! empty($obj->description) && ! empty($conf->global->PRODUCT_DESC_IN_LIST)) print '<br>'.dol_nl2br($obj->description);

View File

@ -64,7 +64,7 @@ class box_produits extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire)
{
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression";
$sql = "SELECT p.rowid, p.label, p.ref, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.fk_price_expression, p.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= ' WHERE p.entity IN ('.getEntity($productstatic->element, 1).')';
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
@ -103,6 +103,7 @@ class box_produits extends ModeleBoxes
$productstatic->ref = $objp->ref;
$productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label;
$productstatic->entity = $objp->entity;
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',

View File

@ -66,7 +66,7 @@ class box_produits_alerte_stock extends ModeleBoxes
if ($user->rights->produit->lire || $user->rights->service->lire)
{
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,";
$sql = "SELECT p.rowid, p.label, p.price, p.ref, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte,p.entity,";
$sql.= " SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") as total_stock";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_stock as s on p.rowid = s.fk_product";
@ -110,6 +110,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$productstatic->ref = $objp->ref;
$productstatic->type = $objp->fk_product_type;
$productstatic->label = $objp->label;
$productstatic->entity = $objp->entity;
$this->info_box_contents[$line][] = array(
'td' => 'align="left"',

View File

@ -337,7 +337,7 @@ if ($object->id > 0)
//Query from product/liste.php
$sql = 'SELECT p.rowid, p.ref, p.label, pfp.tms,';
$sql.= ' p.fk_product_type';
$sql.= ' p.fk_product_type, p.entity';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product_fournisseur_price as pfp';
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product as p ON p.rowid = pfp.fk_product";
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
@ -361,6 +361,7 @@ if ($object->id > 0)
$productstatic->ref = $objp->ref;
$productstatic->label = $objp->label;
$productstatic->type = $objp->fk_product_type;
$productstatic->entity = $objp->entity;
print "<tr ".$bc[$var].">";
print '<td class="nowrap">';

View File

@ -86,7 +86,7 @@ if ($fourn_id)
$supplier->fetch($fourn_id);
}
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type,";
$sql = "SELECT p.rowid, p.label, p.ref, p.fk_product_type, p.entity,";
$sql.= " ppf.fk_soc, ppf.ref_fourn, ppf.price as price, ppf.quantity as qty, ppf.unitprice,";
$sql.= " s.rowid as socid, s.nom as name";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
@ -212,6 +212,7 @@ if ($resql)
$productstatic->id=$objp->rowid;
$productstatic->ref=$objp->ref;
$productstatic->type=$objp->fk_product_type;
$productstatic->entity=$objp->entity;
print $productstatic->getNomUrl(1,'supplier');
print '</td>';

View File

@ -341,7 +341,7 @@ class ActionsCardProduct
$sql = 'SELECT DISTINCT ';
// Fields requiered
$sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte';
$sql.= 'p.rowid, p.price_base_type, p.fk_product_type, p.seuil_stock_alerte, p.entity';
// Fields not requiered
foreach($this->field_list as $field)
@ -417,6 +417,7 @@ class ActionsCardProduct
$this->id = $obj->rowid;
$this->ref = $obj->$alias;
$this->type = $obj->fk_product_type;
$this->entity = $obj->entity;
$datas[$alias] = $this->getNomUrl(1,'',24);
}
else if ($alias == 'stock')

View File

@ -2768,7 +2768,8 @@ class Product extends CommonObject
'type'=>$type, // Nb of units that compose parent product
'desiredstock'=>$this->desiredstock,
'level'=>$level,
'incdec'=>$incdec
'incdec'=>$incdec,
'entity'=>$this->entity
);
// Recursive call if there is childs to child
@ -2850,7 +2851,7 @@ class Product extends CommonObject
*/
function getFather()
{
$sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec";
$sql = "SELECT p.rowid, p.label as label, p.ref as ref, pa.fk_product_pere as id, p.fk_product_type, pa.qty, pa.incdec, p.entity";
$sql.= " FROM ".MAIN_DB_PREFIX."product_association as pa,";
$sql.= " ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE p.rowid = pa.fk_product_pere";
@ -2868,6 +2869,7 @@ class Product extends CommonObject
$prods[$record['id']]['qty'] = $record['qty'];
$prods[$record['id']]['incdec'] = $record['incdec'];
$prods[$record['id']]['fk_product_type'] = $record['fk_product_type'];
$prods[$record['id']]['entity'] = $record['entity'];
}
return $prods;
}

View File

@ -139,7 +139,7 @@ if ($action == 'search')
{
$current_lang = $langs->getDefaultLang();
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem';
if (! empty($conf->global->MAIN_MULTILANGS)) $sql.= ', pl.label as labelm, pl.description as descriptionm';
$sql.= ' FROM '.MAIN_DB_PREFIX.'product as p';
@ -278,6 +278,7 @@ if ($id > 0 || ! empty($ref))
$productstatic->type=$value["fk_product_type"];
$productstatic->ref=$value['ref'];
$productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
$class=($class=='impair')?'pair':'impair';
print '<tr class="'.$class.'">';
@ -334,6 +335,7 @@ if ($id > 0 || ! empty($ref))
$productstatic->id=$value['id'];
$productstatic->type=$value['type'];
$productstatic->label=$value['label'];
$productstatic->entity=$value['entity'];
if ($value['level'] <= 1)
{
@ -542,6 +544,7 @@ if ($id > 0 || ! empty($ref))
$productstatic->ref=$objp->ref;
$productstatic->label=$objp->label;
$productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
print '<td>'.$productstatic->getNomUrl(1,'',24).'</td>';
$labeltoshow=$objp->label;

View File

@ -133,7 +133,7 @@ else
// Add what we are searching for
if (! empty($sall)) $texte.= " - ".$sall;
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
$sql = 'SELECT DISTINCT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type, p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' MIN(pfp.unitprice) as minsellprice';
@ -431,6 +431,7 @@ else
$product_static->ref = $objp->ref;
$product_static->label = $objp->label;
$product_static->type = $objp->fk_product_type;
$product_static->entity = $objp->entity;
print $product_static->getNomUrl(1,'',24);
print "</td>\n";

View File

@ -101,7 +101,7 @@ $htmlother=new FormOther($db);
$title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' SUM(s.reel) as stock_physique';
@ -307,6 +307,7 @@ if ($resql)
$product_static->id=$objp->rowid;
$product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
print $product_static->getNomUrl(1,'',16);
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>';

View File

@ -104,7 +104,7 @@ $htmlother=new FormOther($db);
$title=$langs->trans("ProductsAndServices");
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,';
$sql = 'SELECT p.rowid, p.ref, p.label, p.barcode, p.price, p.price_ttc, p.price_base_type,p.entity,';
$sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell as statut, p.tobuy, p.seuil_stock_alerte, p.desiredstock,';
$sql.= ' s.fk_entrepot,';
@ -324,6 +324,7 @@ if ($resql)
$product_static->id=$objp->rowid;
$product_static->label = $objp->label;
$product_static->type=$objp->fk_product_type;
$product_static->entity=$objp->entity;
print $product_static->getNomUrl(1,'',16);
//if ($objp->stock_theorique < $objp->seuil_stock_alerte) print ' '.img_warning($langs->trans("StockTooLow"));
print '</td>';

View File

@ -394,7 +394,7 @@ else
$totalunit=0;
$totalvalue=$totalvaluesell=0;
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc,";
$sql = "SELECT p.rowid as rowid, p.ref, p.label as produit, p.fk_product_type as type, p.pmp as ppmp, p.price, p.price_ttc, p.entity,";
$sql.= " ps.pmp, ps.reel as value";
$sql.= " FROM ".MAIN_DB_PREFIX."product_stock as ps, ".MAIN_DB_PREFIX."product as p";
$sql.= " WHERE ps.fk_product = p.rowid";
@ -438,6 +438,7 @@ else
$productstatic->ref = $objp->ref;
$productstatic->label = $objp->produit;
$productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
print $productstatic->getNomUrl(1,'stock',16);
print '</td>';
print '<td>'.$objp->produit.'</td>';

View File

@ -164,7 +164,7 @@ $form=new Form($db);
$formother=new FormOther($db);
$formproduct=new FormProduct($db);
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type,";
$sql = "SELECT p.rowid, p.ref as product_ref, p.label as produit, p.fk_product_type as type, p.entity,";
$sql.= " e.label as stock, e.rowid as entrepot_id, e.lieu,";
$sql.= " m.rowid as mid, m.value, m.datem, m.fk_user_author, m.label, m.inventorycode, m.fk_origin, m.origintype,";
$sql.= " m.batch,m.eatby,m.sellby,";
@ -575,6 +575,7 @@ if ($resql)
$productstatic->ref=$objp->product_ref;
$productstatic->label=$objp->produit;
$productstatic->type=$objp->type;
$productstatic->entity=$objp->entity;
print $productstatic->getNomUrl(1,'',16);
print "</td>\n";
// Product label