Merge pull request #8505 from OPEN-DSI/fix-supplier-order-get-dispatched-line-id-add-quantity

FIX CommandeFournisseur::getDispachedLines line ID & return quantity
This commit is contained in:
Laurent Destailleur 2018-04-06 09:17:51 +02:00 committed by GitHub
commit e20585daed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1948,6 +1948,8 @@ class CommandeFournisseur extends CommonOrder
/**
* Return array of dispathed lines waiting to be approved for this order
*
* @since 8.0 Return dispatched quantity (qty).
*
* @param int $status Filter on stats (-1 = no filter, 0 = lines draft to be approved, 1 = approved lines)
* @return array Array of lines
@ -1959,7 +1961,7 @@ class CommandeFournisseur extends CommonOrder
// List of already dispatched lines
$sql = "SELECT p.ref, p.label,";
$sql.= " e.rowid as warehouse_id, e.ref as entrepot,";
$sql.= " cfd.rowid as dispatchlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
$sql.= " cfd.rowid as dispatchedlineid, cfd.fk_product, cfd.qty, cfd.eatby, cfd.sellby, cfd.batch, cfd.comment, cfd.status";
$sql.= " FROM ".MAIN_DB_PREFIX."product as p,";
$sql.= " ".MAIN_DB_PREFIX."commande_fournisseur_dispatch as cfd";
$sql.= " LEFT JOIN ".MAIN_DB_PREFIX."entrepot as e ON cfd.fk_entrepot = e.rowid";
@ -1977,7 +1979,15 @@ class CommandeFournisseur extends CommonOrder
while ($i < $num)
{
$objp = $this->db->fetch_object($resql);
if ($objp) $ret[]=array('id'=>$objp->dispatchedlineid, 'productid'=>$objp->fk_product, 'warehouseid'=>$objp->warehouse_id);
if ($objp)
{
$ret[] = array(
'id' => $objp->dispatchedlineid,
'productid' => $objp->fk_product,
'warehouseid' => $objp->warehouse_id,
'qty' => $objp->qty,
);
}
$i++;
}