From 28929404e1c29c39a565d8588c5489833e38226d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 31 Aug 2024 14:03:28 +0200 Subject: [PATCH] Fix filter on product/service depending on permission --- htdocs/product/index.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 130ff51a6d5..7d77567519f 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -317,6 +317,13 @@ if ((isModEnabled("product") || isModEnabled("service")) && ($user->hasRight("pr /*if ($type != '') { $sql .= " AND p.fk_product_type = ".((int) $type); }*/ + if (!$user->hasRight("produit", "lire")) { + $sql .= " AND p.fk_product_type <> ".((int) Product::TYPE_PRODUCT); + } + if (!$user->hasRight("service", "lire")) { + $sql .= " AND p.fk_product_type <> ".((int) Product::TYPE_SERVICE); + } + // Add where from hooks $parameters = array(); $reshook = $hookmanager->executeHooks('printFieldListWhere', $parameters, $product_static); // Note that $action and $object may have been modified by hook