diff -BNaur '--exclude=CVS' '--exclude=*.patch' '--exclude=.#*' '--exclude=*~' '--exclude=*.rej' '--exclude=*.orig' '--exclude=*.bak' '--exclude=conf.php' '--exclude=documents' /home/bobby/eclipse/workspace/dolibarr3/htdocs/commande/class/commande.class.php /home/bobby/eclipse/workspace/dolibarrPatch/htdocs/commande/class/commande.class.php --- /home/bobby/eclipse/workspace/dolibarr3/htdocs/commande/class/commande.class.php 2011-03-16 07:37:40.000000000 -0400 +++ /home/bobby/eclipse/workspace/dolibarrPatch/htdocs/commande/class/commande.class.php 2011-06-16 14:35:00.000000000 -0400 @@ -24,7 +24,7 @@ * \file htdocs/commande/class/commande.class.php * \ingroup commande * \brief Fichier des classes de commandes - * \version $Id: commande.class.php,v 1.62.2.2 2011/03/16 11:37:40 eldy Exp $ + * \version $Id: commande.class.php,v 1.62.2.4 2011/04/19 22:16:34 eldy Exp $ */ require_once(DOL_DOCUMENT_ROOT."/core/class/commonobject.class.php"); require_once(DOL_DOCUMENT_ROOT."/product/class/product.class.php"); @@ -812,7 +812,7 @@ 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,18 @@ */ 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.= ' INNER JOIN '.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]; + } + else dol_print_error($this->db); } /**