début ajout possibilité de déterminer si le contenu d'une catégorie 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:
parent
cc8ecc8349
commit
39630b28da
@ -90,13 +90,16 @@ class Client extends Societe
|
|||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
$sql = "SELECT count(s.idp) as nb, s.client";
|
$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";
|
$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)";
|
$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";
|
$sql.= " GROUP BY s.client";
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
|
|||||||
@ -172,13 +172,16 @@ class Fournisseur extends Societe
|
|||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
$sql = "SELECT count(s.idp) as nb";
|
$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";
|
$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";
|
$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);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2001-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2006 Laurent Destailleur <eldy@users.sourceforge.net>
|
* 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>
|
* Copyright (C) 2006 Andre Cianfarani <acianfa@free.fr>
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* 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
|
* 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()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
$sql = "SELECT count(p.rowid) as nb";
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$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";
|
$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);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -200,13 +200,23 @@ class Service
|
|||||||
*/
|
*/
|
||||||
function load_state_board()
|
function load_state_board()
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf, $user;
|
||||||
|
|
||||||
$this->nb=array();
|
$this->nb=array();
|
||||||
|
|
||||||
$sql = "SELECT count(p.rowid) as nb";
|
$sql = "SELECT count(p.rowid) as nb";
|
||||||
$sql.= " FROM ".MAIN_DB_PREFIX."product as p";
|
$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";
|
$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);
|
$resql=$this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user