From 39630b28daf5c5f95882750fcfa5bc323ff6ef28 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 31 Mar 2006 16:04:12 +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/client.class.php | 5 ++++- htdocs/fourn/fournisseur.class.php | 5 ++++- htdocs/product.class.php | 13 ++++++++++++- htdocs/service.class.php | 12 +++++++++++- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/htdocs/client.class.php b/htdocs/client.class.php index 6676e5f1573..487728a6009 100644 --- a/htdocs/client.class.php +++ b/htdocs/client.class.php @@ -90,13 +90,16 @@ class Client extends Societe */ function load_state_board() { - global $conf; + global $conf, $user; $this->nb=array(); $sql = "SELECT count(s.idp) as nb, s.client"; + if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.client in (1,2)"; + if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $sql.= " GROUP BY s.client"; $resql=$this->db->query($sql); if ($resql) diff --git a/htdocs/fourn/fournisseur.class.php b/htdocs/fourn/fournisseur.class.php index 721afaf68f7..dd3e9c4ff65 100644 --- a/htdocs/fourn/fournisseur.class.php +++ b/htdocs/fourn/fournisseur.class.php @@ -172,13 +172,16 @@ class Fournisseur extends Societe */ function load_state_board() { - global $conf; + global $conf, $user; $this->nb=array(); $sql = "SELECT count(s.idp) as nb"; + if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", sc.fk_soc, sc.fk_user"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; + if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql.= " WHERE s.fournisseur = 1"; + if (!$user->rights->commercial->client->voir && !$user->societe_id) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id; $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 02f866ca061..f8a04335fd9 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -1,6 +1,7 @@ * Copyright (C) 2004-2006 Laurent Destailleur + * Copyright (C) 2005-2006 Regis Houssin * Copyright (C) 2006 Andre Cianfarani * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1941,13 +1942,23 @@ function get_each_prod() */ function load_state_board() { - global $conf; + global $conf, $user; $this->nb=array(); $sql = "SELECT count(p.rowid) as nb"; $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 ca"; + } $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 = ca.rowid AND ca.visible = 1"; + } $resql=$this->db->query($sql); if ($resql) { diff --git a/htdocs/service.class.php b/htdocs/service.class.php index 1a9c3339162..fb28eabcf36 100644 --- a/htdocs/service.class.php +++ b/htdocs/service.class.php @@ -200,13 +200,23 @@ class Service */ function load_state_board() { - global $conf; + global $conf, $user; $this->nb=array(); $sql = "SELECT count(p.rowid) as nb"; $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 ca"; + } $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 = ca.rowid AND ca.visible = 1"; + } $resql=$this->db->query($sql); if ($resql) {