Skip to content
Snippets Groups Projects
Commit e0d8fae6 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix: pgsql

parent 7cd88b8f
No related branches found
No related tags found
No related merge requests found
...@@ -127,21 +127,15 @@ else ...@@ -127,21 +127,15 @@ else
$sql.= ' p.fk_product_type, p.tms as datem,'; $sql.= ' p.fk_product_type, p.tms as datem,';
$sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,'; $sql.= ' p.duration, p.tosell, p.tobuy, p.seuil_stock_alerte,';
$sql.= ' MIN(pfp.unitprice) as minsellprice'; $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 // 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.= ') '; $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).')'; $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 ($search_categ) $sql.= " AND p.rowid = cp.fk_product"; // Join for the needed table to filter by categ
if ($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)."%')";
{
$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 the type is not 1, we show all products (type = 0,2,3)
if (dol_strlen($type)) if (dol_strlen($type))
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment