FIX Sql error in widget of product for stock alerts

This commit is contained in:
Laurent Destailleur 2016-10-04 20:54:14 +02:00
parent 6efbae0731
commit c1e10fa4e6

View File

@ -74,7 +74,7 @@ class box_produits_alerte_stock extends ModeleBoxes
$sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0"; $sql.= " AND p.tosell = 1 AND p.seuil_stock_alerte > 0";
if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0'; if (empty($user->rights->produit->lire)) $sql.=' AND p.fk_product_type != 0';
if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1'; if (empty($user->rights->service->lire)) $sql.=' AND p.fk_product_type != 1';
$sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte"; $sql.= " GROUP BY p.rowid, p.ref, p.label, p.price, p.price_base_type, p.price_ttc, p.fk_product_type, p.tms, p.tosell, p.tobuy, p.seuil_stock_alerte, p.entity";
$sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte"; $sql.= " HAVING SUM(".$db->ifsql("s.reel IS NULL","0","s.reel").") < p.seuil_stock_alerte";
$sql.= $db->order('p.seuil_stock_alerte', 'DESC'); $sql.= $db->order('p.seuil_stock_alerte', 'DESC');
$sql.= $db->plimit($max, 0); $sql.= $db->plimit($max, 0);