// update getProductRealQuantities method
This commit is contained in:
1 parent
827751e120
commit
a99653fce1
1 file changed
+2
@@ -415,12 +415,14 @@ class StockManagerCore implements StockManagerInterface
|
|||||||
$query->leftjoin('orders o ON o.id_order = od.id_order');
|
$query->leftjoin('orders o ON o.id_order = od.id_order');
|
||||||
$query->where('od.product_id = '.(int)$id_product.' AND od.product_attribute_id = '.(int)$id_product_attribute);
|
$query->where('od.product_id = '.(int)$id_product.' AND od.product_attribute_id = '.(int)$id_product_attribute);
|
||||||
$query->where('o.delivery_number = 0');
|
$query->where('o.delivery_number = 0');
|
||||||
|
$query->where('o.valid = 1');
|
||||||
$clients_orders_qty = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
$clients_orders_qty = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
|
||||||
|
|
||||||
// Gets {physical OR usable}_qty
|
// Gets {physical OR usable}_qty
|
||||||
$qty = $this->getProductPhysicalQuantities($id_product, $id_product_attribute, $warehouses_id, $usable);
|
$qty = $this->getProductPhysicalQuantities($id_product, $id_product_attribute, $warehouses_id, $usable);
|
||||||
|
|
||||||
// Returns real_qty = qty - clients_orders_qty
|
// Returns real_qty = qty - clients_orders_qty
|
||||||
|
// @TODO include suplliers orders in the calcul when they will be implemented
|
||||||
return ($qty - $clients_orders_qty);
|
return ($qty - $clients_orders_qty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user