Ajout de la permission "consulter tous les clients" dans le module commercial, afin
qu'un commercial puisse voir que les clients qui lui sont affects.
This commit is contained in:
parent
31a5a97e69
commit
17bab0885c
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
/* Copyright (C) 2003-2005 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||
* Copyright (C) 2004-2005 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||
* Copyright (C) 2005-2006 Regis Houssin <regis.houssin@cap-networks.com>
|
||||
*
|
||||
* 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
|
||||
@ -50,12 +51,18 @@ print "</form></table><br />\n";
|
||||
* Expeditions à valider
|
||||
*/
|
||||
$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 0";
|
||||
if ($socidp)
|
||||
{
|
||||
$sql .= " AND c.fk_soc = $socidp";
|
||||
}
|
||||
if (!$user->rights->commercial->client->voir) //restriction
|
||||
{
|
||||
$sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
}
|
||||
$resql=$db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
@ -85,8 +92,11 @@ if ($resql)
|
||||
* Commandes à traiter
|
||||
*/
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql.= " WHERE c.fk_soc = s.idp AND c.fk_statut = 1";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql.= " ORDER BY c.rowid ASC";
|
||||
|
||||
if ( $db->query($sql) )
|
||||
@ -124,8 +134,12 @@ print '</td><td valign="top" width="70%">';
|
||||
/*
|
||||
* Commandes en traitement
|
||||
*/
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
$sql = "SELECT c.rowid, c.ref, s.nom, s.idp";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."commande as c, ".MAIN_DB_PREFIX."societe as s";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE c.fk_soc = s.idp AND c.fk_statut = 2";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$resql = $db->query($sql);
|
||||
if ( $resql )
|
||||
{
|
||||
@ -157,8 +171,11 @@ if ( $resql )
|
||||
* Expeditions à valider
|
||||
*/
|
||||
$sql = "SELECT e.rowid, e.ref, s.nom, s.idp, c.ref as commande_ref, c.rowid as commande_id";
|
||||
$sql.= " FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
$sql.= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 1";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", sc.fk_soc, sc.fk_user";
|
||||
$sql .= " FROM ".MAIN_DB_PREFIX."expedition as e, ".MAIN_DB_PREFIX."societe as s, ".MAIN_DB_PREFIX."commande as c";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc";
|
||||
$sql .= " WHERE e.fk_commande = c.rowid AND c.fk_soc = s.idp AND e.fk_statut = 1";
|
||||
if (!$user->rights->commercial->client->voir) $sql .= " AND s.idp = sc.fk_soc AND sc.fk_user = " .$user->id;
|
||||
$sql .= " ORDER BY e.date_expedition DESC";
|
||||
$sql .= $db->plimit(5, 0);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user