From 1d3cda8818eb447d6fb02e7edb97ed0dab249ec6 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 31 Mar 2006 13:20:02 +0000 Subject: [PATCH] =?UTF-8?q?d=E9but=20ajout=20possibilit=E9=20de=20d=E9term?= =?UTF-8?q?iner=20si=20le=20contenu=20d'une=20cat=E9gorie=20sera=20visible?= =?UTF-8?q?=20ou=20=20non=20dans=20la=20liste=20des=20produits/services,?= =?UTF-8?q?=20ceci=20afin=20de=20pouvoir=20cacher=20les=20sous-produits=20?= =?UTF-8?q?=20par=20exemple.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/product/stats/index.php | 57 +++++++++++++++++++++++++++++++--- 1 file changed, 53 insertions(+), 4 deletions(-) diff --git a/htdocs/product/stats/index.php b/htdocs/product/stats/index.php index 4e7aef8a110..ea17190ee0c 100644 --- a/htdocs/product/stats/index.php +++ b/htdocs/product/stats/index.php @@ -39,14 +39,38 @@ $mesg = ''; * * */ -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product WHERE fk_product_type = 0"; +$sql = "SELECT count(*)"; +$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c"; +} +$sql .= " WHERE p.fk_product_type = 0"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= " AND cp.fk_product = p.rowid"; + $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1"; +} if ($db->query($sql)) { $row = $db->fetch_row(0); $nbproduct = $row[0]; } $db->free(); -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product WHERE envente = 0 AND fk_product_type = 0"; +$sql = "SELECT count(*)"; +$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c"; +} +$sql .= " WHERE p.envente = 0 AND p.fk_product_type = 0"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= " AND cp.fk_product = p.rowid"; + $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1"; +} if ($db->query($sql)) { $row = $db->fetch_row(0); @@ -72,14 +96,39 @@ print ""; print 'Nb de produit dans le catalogue qui ne sont pas en vente'; print ''.$nbhv.''; -$sql = "SELECT count(*) FROM llx_product WHERE fk_product_type = 1"; +$sql = "SELECT count(*)"; +$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c"; +} +$sql .= " WHERE p.fk_product_type = 1"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= " AND cp.fk_product = p.rowid"; + $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1"; +} if ($db->query($sql)) { $row = $db->fetch_row(0); $nbproduct = $row[0]; } $db->free(); -$sql = "SELECT count(*) FROM ".MAIN_DB_PREFIX."product WHERE envente = 0 AND fk_product_type = 1"; +$sql = "SELECT count(*)"; +$sql .= " FROM ".MAIN_DB_PREFIX."product as p"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; + $sql .= ", ".MAIN_DB_PREFIX."categorie as c"; +} +$sql .= " WHERE p.envente = 0 AND p.fk_product_type = 1"; +if ($conf->categorie->enabled && !$user->rights->categorie->voir) +{ + $sql .= " AND cp.fk_product = p.rowid"; + $sql .= " AND cp.fk_categorie = c.rowid AND c.visible = 1"; +} + if ($db->query($sql)) { $row = $db->fetch_row(0);