[-] FO: Fix #PSCFV-7530 bad quantity returned displayed on order detail for multiple return

This commit is contained in:
Rémi Gaillard
2013-01-31 15:10:52 +01:00
parent 9b7a2aea01
commit f9f24aef84
+3 -2
View File
@@ -225,11 +225,12 @@ class OrderReturnCore extends ObjectModel
public static function addReturnedQuantity(&$products, $id_order)
{
$details = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT od.id_order_detail, GREATEST(od.product_quantity_return, IFNULL(ord.product_quantity,0)) as qty_returned
SELECT od.id_order_detail, GREATEST(od.product_quantity_return, IFNULL(SUM(ord.product_quantity),0)) as qty_returned
FROM '._DB_PREFIX_.'order_detail od
LEFT JOIN '._DB_PREFIX_.'order_return_detail ord
ON ord.id_order_detail = od.id_order_detail
WHERE od.id_order = '.(int)$id_order
WHERE od.id_order = '.(int)$id_order.'
GROUP BY od.id_order_detail'
);
if (!$details)
return;