Merge branch 'ticket-13974-MultiInvoiceWhenRefunding' into develop

This commit is contained in:
Marion Muszynski 2017-08-24 16:10:37 +02:00
commit a73f5cdf8c

View File

@ -948,7 +948,17 @@ class Sale {
$sales_order = array_keys($order);
foreach ($sales_order as $sale) {
if (!in_array($sale, $id_sales)) {
continue 2;
foreach(Db::getInstance()->executeS('
GREATEST(d.`product_quantity` - d.`product_quantity_refunded`, 0) as `p_quantity`
FROM `'._DB_PREFIX_.'product_ps_cache` c
LEFT JOIN `'._DB_PREFIX_.'order_detail` d ON (d.`product_id` = c.`id_product`)
WHERE d.`id_order` = '.(int)$key.'
AND c.id_sale = '.(int)$sale
) as $row){
if((int)$row['p_quantity'] != 0) {
continue 3;
}
}
}
}