From e60df0949576cb99f4dc4d2f4c9d28939e7b0e0c Mon Sep 17 00:00:00 2001 From: dMetzger Date: Tue, 14 Aug 2012 07:46:42 +0000 Subject: [PATCH] // Code cleaning git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16837 b9a71923-0436-4b27-9f14-aed3839534dd --- modules/loyalty/loyalty.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/modules/loyalty/loyalty.php b/modules/loyalty/loyalty.php index f18f0d0fe..219e1da2a 100644 --- a/modules/loyalty/loyalty.php +++ b/modules/loyalty/loyalty.php @@ -487,15 +487,13 @@ class Loyalty extends Module include_once(dirname(__FILE__).'/LoyaltyModule.php'); $totalPrice = 0; - $details = OrderReturn::getOrdersReturnDetail((int)($params['orderReturn']->id)); + $details = OrderReturn::getOrdersReturnDetail((int)$params['orderReturn']->id); foreach ($details AS $detail) { - $price_wt = Db::getInstance()->getValue(' - SELECT product_price * (1 + (tax_rate / 100)) price + $totalPrice += Db::getInstance()->getValue(' + SELECT ROUND(total_price_tax_incl, 2) FROM '._DB_PREFIX_.'order_detail od - WHERE id_order_detail = '.(int)($detail['id_order_detail'])); - - $totalPrice += number_format($price_wt, 2, '.', '') * $detail['product_quantity']; + WHERE id_order_detail = '.(int)$detail['id_order_detail']); } $loyaltyNew = new LoyaltyModule(); @@ -643,7 +641,7 @@ class Loyalty extends Module return false; $loyaltyNew = new LoyaltyModule(); - $loyaltyNew->points = -1 * LoyaltyModule::getNbPointsByPrice(number_format($orderDetail->product_price * (1 + $orderDetail->tax_rate / 100), 2, '.', '')) * $orderDetail->product_quantity; + $loyaltyNew->points = -1 * LoyaltyModule::getNbPointsByPrice(number_format($orderDetail->total_price_tax_incl, 2, '.', '')); $loyaltyNew->id_loyalty_state = (int)LoyaltyStateModule::getCancelId(); $loyaltyNew->id_order = (int)$params['order']->id; $loyaltyNew->id_customer = (int)$loyalty->id_customer;