From 4a43641c011255f338e32be6e2fadc518889f926 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Fri, 10 Mar 2006 09:08:05 +0000 Subject: [PATCH] bugfix --- htdocs/comm/fiche.php | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/fiche.php b/htdocs/comm/fiche.php index 7e18bf08193..c0529840840 100644 --- a/htdocs/comm/fiche.php +++ b/htdocs/comm/fiche.php @@ -53,19 +53,18 @@ if ($user->societe_id > 0) } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp) +if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) { - $sql = "SELECT sc.fk_soc, sc.fk_user"; - $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc"; - $sql .= " WHERE sc.fk_soc = ".$socidp." AND sc.fk_user = ".$user->id; - - $resultp=$db->query($sql); - if (!$resultp) - { - accessforbidden(); - } + $sql = "SELECT fk_soc"; + $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux"; + $sql .= " WHERE fk_soc = ".$socidp." AND fk_user = ".$user->id; + + if ( $db->query($sql) ) + { + if ( $db->num_rows() == 0) accessforbidden(); + } } - + $sortorder=$_GET["sortorder"]; $sortfield=$_GET["sortfield"];