2
0
forked from Wavyzz/dolibarr

Complete function loadExpedition to add filter on fk_product

This commit is contained in:
Laurent Destailleur
2016-04-21 02:38:49 +02:00
parent fb5497f3d6
commit ffd10a7560

View File

@@ -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;