From 74579860c71e40fe1ab2658bcf874a0bfa1a4dcc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 19 Apr 2011 22:15:12 +0000 Subject: [PATCH] Fix: Update request --- htdocs/commande/class/commande.class.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index f7636f600a131..db122861052d7 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -812,7 +812,7 @@ function addline($commandeid, $desc, $pu_ht, $qty, $txtva, $txlocaltax1=0, $txlo if (empty($txtva)) $txtva=0; if (empty($txlocaltax1)) $txlocaltax1=0; if (empty($txlocaltax2)) $txlocaltax2=0; - + $remise_percent=price2num($remise_percent); $qty=price2num($qty); $pu_ht=price2num($pu_ht); @@ -1345,15 +1345,17 @@ function loadExpeditions($filtre_statut=-1) */ function nb_expedition() { - $sql = 'SELECT count(*) FROM '.MAIN_DB_PREFIX.'expedition as e'; - $sql .=" WHERE e.fk_commande = ".$this->id; - - $resql = $this->db->query($sql); - if ($resql) - { - $row = $this->db->fetch_row($resql); - return $row[0]; - } + $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; + + $resql = $this->db->query($sql); + if ($resql) + { + $row = $this->db->fetch_row($resql); + return $row[0]; + } } /**