diff --git a/htdocs/product/index.php b/htdocs/product/index.php index 47881c9cc61..a9909057e85 100644 --- a/htdocs/product/index.php +++ b/htdocs/product/index.php @@ -118,6 +118,13 @@ print ''; $max=15; $sql = "SELECT p.rowid, p.label, p.price, p.ref, p.fk_product_type, p.envente"; $sql.= " FROM ".MAIN_DB_PREFIX."product as p"; +if (!$user->rights->categorie->voir) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c"; + $sql .= " WHERE cp.fk_product = p.rowid"; + $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1"; +} $sql.= " ORDER BY p.datec DESC "; $sql.= $db->plimit($max,0); $result = $db->query($sql) ;