From ffd10a75608eebad55ae782323fe9fc9b5b622f7 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 21 Apr 2016 02:38:49 +0200 Subject: [PATCH] Complete function loadExpedition to add filter on fk_product --- htdocs/commande/class/commande.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/class/commande.class.php b/htdocs/commande/class/commande.class.php index ae7c18ac077..dc3a3c254a4 100644 --- a/htdocs/commande/class/commande.class.php +++ b/htdocs/commande/class/commande.class.php @@ -1844,13 +1844,13 @@ class Commande extends CommonOrder /** * Load array this->expeditions of lines of shipments with nb of products sent for each order line - * + * Note: For a dedicated shipment, the fetch_lines load the qty_asked and qty_shipped. This function return qty_shipped cuulated for order + * * @param int $filtre_statut Filter on status + * @param int $fk_product Filter on a product * @return int <0 if KO, Nb of lines found if OK - * - * TODO deprecate, move to Shipping class */ - function loadExpeditions($filtre_statut=-1) + function loadExpeditions($filtre_statut=-1, $fk_product=0) { $this->expeditions = array(); @@ -1863,6 +1863,7 @@ class Commande extends CommonOrder if ($filtre_statut >= 0) $sql.= ' ed.fk_expedition = e.rowid AND'; $sql.= ' ed.fk_origin_line = cd.rowid'; $sql.= ' AND cd.fk_commande =' .$this->id; + if ($this->fk_product > 0) $sql.= ' AND cd.fk_product = '.$this->fk_product; if ($filtre_statut >= 0) $sql.=' AND e.fk_statut >= '.$filtre_statut; $sql.= ' GROUP BY cd.rowid, cd.fk_product'; //print $sql;