From bec6ad9fb30f1c7037014fdab1d107a2173b8bc0 Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@destailleur.fr>
Date: Fri, 9 Jun 2017 10:22:07 +0200
Subject: [PATCH] Fix bad position of hook

---
 htdocs/product/index.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/htdocs/product/index.php b/htdocs/product/index.php
index 56508616edd..c882390a56a 100644
--- a/htdocs/product/index.php
+++ b/htdocs/product/index.php
@@ -119,11 +119,11 @@ $prodser[0][0]=$prodser[0][1]=$prodser[1][0]=$prodser[1][1]=0;
 $sql = "SELECT COUNT(p.rowid) as total, p.fk_product_type, p.tosell, p.tobuy";
 $sql.= " FROM ".MAIN_DB_PREFIX."product as p";
 $sql.= ' WHERE p.entity IN ('.getEntity($product_static->element, 1).')';
-$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
 // Add where from hooks
 $parameters=array();
 $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters);    // Note that $action and $object may have been modified by hook
 $sql.=$hookmanager->resPrint;
+$sql.= " GROUP BY p.fk_product_type, p.tosell, p.tobuy";
 $result = $db->query($sql);
 while ($objp = $db->fetch_object($result))
 {
-- 
GitLab