[-] MO : Fixed double creation of vouchers in loyalty and some redirections #PNM-1317

This commit is contained in:
Damien Metzger
2013-06-07 15:52:56 +02:00
parent 1688c7b0e6
commit 26608cea48
4 changed files with 49 additions and 43 deletions
+3 -2
View File
@@ -42,7 +42,7 @@ if (!$context->customer->isLogged())
$context->controller->addJqueryPlugin(array('dimensions', 'cluetip'));
$customerPoints = (int)(LoyaltyModule::getPointsByCustomer((int)($cookie->id_customer)));
$customerPoints = (int)LoyaltyModule::getPointsByCustomer((int)$cookie->id_customer);
/* transform point into voucher if needed */
if (Tools::getValue('transform-points') == 'true' AND $customerPoints > 0)
@@ -99,7 +99,8 @@ if (Tools::getValue('transform-points') == 'true' AND $customerPoints > 0)
$cartRule->add();
/* Register order(s) which contributed to create this voucher */
LoyaltyModule::registerDiscount($cartRule);
if (!LoyaltyModule::registerDiscount($cartRule))
$cartRule->delete();
Tools::redirect('modules/loyalty/loyalty-program.php');
}