From 95c30de0b966e100b4e701164daeebb1c6f34a24 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 2 Jul 2012 16:12:55 +0200 Subject: [PATCH] Fix: wrong sql request --- htdocs/expedition/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/expedition/index.php b/htdocs/expedition/index.php index 619e48405f7..5c6baed4e4d 100644 --- a/htdocs/expedition/index.php +++ b/htdocs/expedition/index.php @@ -226,8 +226,8 @@ $sql = "SELECT e.rowid, e.ref"; $sql.= ", s.nom, s.rowid as socid"; $sql.= ", c.ref as commande_ref, c.rowid as commande_id"; $sql.= " FROM ".MAIN_DB_PREFIX."expedition as e"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.sourcetype IN ('commande')"; -$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.targettype IN ('shipping')"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."element_element as el ON e.rowid = el.fk_target AND el.targettype = 'shipping' AND el.sourcetype IN ('commande')"; +$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."commande as c ON el.fk_source = c.rowid AND el.sourcetype IN ('commande') AND el.targettype = 'shipping'"; $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON s.rowid = e.fk_soc"; if (! $user->rights->societe->client->voir && ! $socid) $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe_commerciaux as sc ON e.fk_soc = sc.fk_soc"; $sql.= " WHERE e.entity = ".$conf->entity;