dbut ajout possibilit de dterminer si le contenu d'une catgorie sera visible ou

non dans la liste des produits/services, ceci afin de pouvoir cacher les sous-produits
 par exemple.
This commit is contained in:
Regis Houssin 2006-03-31 16:04:12 +00:00
parent cc8ecc8349
commit 39630b28da
4 changed files with 31 additions and 4 deletions

View File

@ -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)

View File

@ -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)
{

View File

@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
* 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)
{

View File

@ -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)
{