From 1810433a93439c1a292c928ef69d21f91e50786f Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 18 Sep 2013 23:24:09 +0200 Subject: [PATCH] Fix: bad condition --- htdocs/societe/societe.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/societe/societe.php b/htdocs/societe/societe.php index f27de1eb33a..67d2d7bb46b 100644 --- a/htdocs/societe/societe.php +++ b/htdocs/societe/societe.php @@ -78,7 +78,7 @@ if ($mode == 'search') $sql = "SELECT s.rowid"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s"; - if ($search_sale || !$user->rights->societe->client->voir && !$socid) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " WHERE s.entity IN (".getEntity('societe', 1).")"; @@ -127,7 +127,7 @@ if ($mode == 'search') { $sql.= "AND s.barcode LIKE '".$db->escape($crit)."'"; } - + $result=$db->query($sql); if ($result) { @@ -201,7 +201,7 @@ if ($search_categ) $sql .= ", cs.fk_categorie, cs.fk_societe"; $sql.= " FROM ".MAIN_DB_PREFIX."societe as s,"; $sql.= " ".MAIN_DB_PREFIX."c_stcomm as st"; // We'll need this table joined to the select in order to filter by sale -if ($search_sale || !$user->rights->societe->client->voir) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; +if ($search_sale || (!$user->rights->societe->client->voir && !$socid)) $sql.= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; // We'll need this table joined to the select in order to filter by categ if ($search_categ) $sql.= ", ".MAIN_DB_PREFIX."categorie_societe as cs"; $sql.= " WHERE s.fk_stcomm = st.id";