diff --git a/htdocs/product/liste.php b/htdocs/product/liste.php index be7fb6cb44a..2b8c290a14e 100644 --- a/htdocs/product/liste.php +++ b/htdocs/product/liste.php @@ -79,11 +79,16 @@ $sql = 'SELECT p.rowid, p.ref, p.label, p.price, p.fk_product_type, '.$db->pdate $sql.= ' p.duration, p.envente as statut'; $sql.= ' FROM '.MAIN_DB_PREFIX.'product as p'; // '.MAIN_DB_PREFIX.'product_det as d'; //en attendant le debugage -if ($catid) +if ($catid || !$user->rights->categorie->voir) { $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; } +if (!$user->rights->categorie->voir) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie as c"; +} + if ($_GET["fourn_id"] > 0) { $fourn_id = $_GET["fourn_id"]; @@ -110,11 +115,18 @@ if (isset($_GET["envente"]) && strlen($_GET["envente"]) > 0) { $sql .= " AND p.envente = ".$_GET["envente"]; } -if($catid) +if($catid || !$user->rights->categorie->voir) { $sql .= " AND cp.fk_product = p.rowid"; +} +if($catid) +{ $sql .= " AND cp.fk_categorie = ".$catid; } +if (!$user->rights->categorie->voir) +{ + $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1"; +} if ($fourn_id > 0) { $sql .= " AND p.rowid = pf.fk_product AND pf.fk_soc = ".$fourn_id;