diff --git a/htdocs/compta/fiche.php b/htdocs/compta/fiche.php index edfdd818f4d..176f395ff69 100644 --- a/htdocs/compta/fiche.php +++ b/htdocs/compta/fiche.php @@ -48,11 +48,11 @@ if ($user->societe_id > 0) } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) +if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0) { $sql = "SELECT sc.fk_soc, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE fk_soc = ".$socidp." AND fk_user = ".$user->id." AND s.client = 1"; + $sql .= " WHERE fk_soc = ".$socid." AND fk_user = ".$user->id." AND s.client = 1"; if ( $db->query($sql) ) { diff --git a/htdocs/docsoc.php b/htdocs/docsoc.php index 74a74239469..86107738103 100644 --- a/htdocs/docsoc.php +++ b/htdocs/docsoc.php @@ -47,11 +47,11 @@ if ($user->societe_id > 0) } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) +if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0) { $sql = "SELECT sc.fk_soc, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE fk_soc = ".$socidp." AND fk_user = ".$user->id." AND s.client = 1"; + $sql .= " WHERE fk_soc = ".$socid." AND fk_user = ".$user->id." AND s.client = 1"; if ( $db->query($sql) ) { diff --git a/htdocs/societe/info.php b/htdocs/societe/info.php index 01847cf3d46..472613664ef 100644 --- a/htdocs/societe/info.php +++ b/htdocs/societe/info.php @@ -44,11 +44,11 @@ if ($user->societe_id > 0) } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) +if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0) { $sql = "SELECT sc.fk_soc, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE fk_soc = ".$socidp." AND fk_user = ".$user->id." AND s.client = 1"; + $sql .= " WHERE fk_soc = ".$socid." AND fk_user = ".$user->id." AND s.client = 1"; if ( $db->query($sql) ) { diff --git a/htdocs/societe/notify/fiche.php b/htdocs/societe/notify/fiche.php index 0abdf470720..20df5b40e9e 100644 --- a/htdocs/societe/notify/fiche.php +++ b/htdocs/societe/notify/fiche.php @@ -43,11 +43,11 @@ if ($user->societe_id > 0) } // Protection restriction commercial -if (!$user->rights->commercial->client->voir && $socidp && !$user->societe_id > 0) +if (!$user->rights->commercial->client->voir && $socid && !$user->societe_id > 0) { $sql = "SELECT sc.fk_soc, s.client"; $sql .= " FROM ".MAIN_DB_PREFIX."societe_commerciaux as sc, ".MAIN_DB_PREFIX."societe as s"; - $sql .= " WHERE fk_soc = ".$socidp." AND fk_user = ".$user->id." AND s.client = 1"; + $sql .= " WHERE fk_soc = ".$socid." AND fk_user = ".$user->id." AND s.client = 1"; if ( $db->query($sql) ) {