Merge branch 'ticket-fidelite' into develop

This commit is contained in:
Marion Muszynski 2016-04-22 17:01:40 +02:00
commit 2ef9fbd9ce

View File

@ -514,11 +514,12 @@ class Loyalty extends Module
FROM '._DB_PREFIX_.'order_detail od
WHERE id_order_detail = '.(int)($detail['id_order_detail']));
$totalPrice += number_format($price_wt, 2, '.', '') * ($detail['product_quantity'] - $detail['product_quantity_refunded']);
$totalPrice += number_format($price_wt, 2, '.', '') * $detail['product_quantity'];
}
$id_loyalty = LoyaltyModule::getByOrderId((int)($params['orderReturn']->id));
if ($id_loyalty) {
$loyalty = new LoyaltyModule((int)$id_loyalty);
$totalPrice = $loyalty->discount_value - $totalPrice;
$loyalty->discount_value = LoyaltyModule::getDiscountValueByPrice($totalPrice);
if ($loyalty->discount_value<=0) {
$loyalty->id_loyalty_state = (int)LoyaltyStateModule::getCancelId();
@ -679,7 +680,7 @@ class Loyalty extends Module
return false;
}
$price = ($params['order']->total_paid - $params['order']->total_shipping) - (number_format($orderDetail->product_price * (1 + $orderDetail->tax_rate / 100), 2, '.', '') * ($orderDetail->product_quantity - $orderDetail->product_quantity_refunded));
$price = $loyalty->discount_value - (number_format($orderDetail->product_price * (1 + $orderDetail->tax_rate / 100), 2, '.', '') * ($orderDetail->product_quantity - $orderDetail->product_quantity_refunded));
if ($price>0) {
$loyalty->discount_value = LoyaltyModule::getDiscountValueByPrice($price);
} else {