From f74207493f61ff29ac21b179f28fca3efa56bf68 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 28 Mar 2007 15:02:46 +0000 Subject: [PATCH] =?UTF-8?q?Fix:=20compatibilit=E9=20avec=20php5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/compta/index.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/index.php b/htdocs/compta/index.php index 951e979e833..aa2ebdce897 100644 --- a/htdocs/compta/index.php +++ b/htdocs/compta/index.php @@ -411,8 +411,9 @@ if ($conf->facture->enabled && $conf->commande->enabled && $user->rights->comman $sql.= " s.nom, s.idp,"; $sql.= " p.rowid, p.ref, p.facture, p.fk_statut, p.total_ht, p.total_ttc"; if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", sc.fk_soc, sc.fk_user "; - $sql.= " FROM ".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."commande AS p"; - if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc"; + $sql.= " FROM (".MAIN_DB_PREFIX."societe AS s, ".MAIN_DB_PREFIX."commande AS p"; + if ($user->rights->commercial->client->voir) $sql .= ")"; + if (!$user->rights->commercial->client->voir && !$socid) $sql .= ", ".MAIN_DB_PREFIX."societe_commerciaux as sc)"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."co_fa AS co_fa ON co_fa.fk_commande = p.rowid"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."facture AS f ON co_fa.fk_facture = f.rowid"; $sql.= " WHERE p.fk_soc = s.idp";