From 8ee98b484600307100e955f6f38fe6a7d8799b8d Mon Sep 17 00:00:00 2001
From: Laurent Destailleur <eldy@users.sourceforge.net>
Date: Fri, 17 Jun 2011 18:21:02 +0000
Subject: [PATCH] Fix: BUG#33584

---
 htdocs/commande/class/commande.class.php | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php
index abfd41a9c3f..76f0f3ea9dc 100644
--- a/htdocs/commande/class/commande.class.php
+++ b/htdocs/commande/class/commande.class.php
@@ -1346,9 +1346,11 @@ class Commande extends CommonObject
 	function nb_expedition()
 	{
         $sql = 'SELECT count(*)';
-        $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e,';
-        $sql.= ' '.MAIN_DB_PREFIX."element_element as el ON el.fk_target = e.rowid AND el.targettype = 'shipping'";
-        $sql.= " WHERE el.fk_source = ".$this->id;
+        $sql.= ' FROM '.MAIN_DB_PREFIX.'expedition as e';
+        $sql.= ', '.MAIN_DB_PREFIX.'element_element as el';
+        $sql.= ' WHERE el.fk_source = '.$this->id;
+        $sql.= " AND el.fk_target = e.rowid";
+        $sql.= " AND el.targettype = 'shipping'";
 
         $resql = $this->db->query($sql);
         if ($resql)
-- 
GitLab