Fix: pgsql
This commit is contained in:
parent
7cd88b8fce
commit
e0d8fae676
@ -127,21 +127,15 @@ else
|
||||
$sql.= ' p.fk_product_type, p.tms as datem,';
|
||||
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
|
||||
$sql.= ' MIN(pfp.unitprice) as minsellprice';
|
||||
$sql.= ' FROM ('.MAIN_DB_PREFIX.'product as p';
|
||||
$sql.= ' FROM (';
|
||||
// We'll need this table joined to the select in order to filter by categ
|
||||
if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_product as cp";
|
||||
if ($search_categ) $sql.= MAIN_DB_PREFIX."categorie_product as cp, ";
|
||||
$sql.= MAIN_DB_PREFIX.'product as p';
|
||||
$sql.= ') ';
|
||||
//if ($fourn_id > 0) // The DISTINCT is used to avoid duplicate from this link
|
||||
//{
|
||||
//$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur as pf ON p.rowid = pf.fk_product";
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
//}
|
||||
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."product_fournisseur_price as pfp ON p.rowid = pfp.fk_product";
|
||||
$sql.= ' WHERE p.entity IN ('.getEntity('product', 1).')';
|
||||
if ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
|
||||
if ($sall)
|
||||
{
|
||||
$sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
||||
}
|
||||
if ($sall) $sql.= " AND (p.ref LIKE '%".$db->escape($sall)."%' OR p.label LIKE '%".$db->escape($sall)."%' OR p.description LIKE '%".$db->escape($sall)."%' OR p.note LIKE '%".$db->escape($sall)."%')";
|
||||
// if the type is not 1, we show all products (type = 0,2,3)
|
||||
if (dol_strlen($type))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user