From 945bd55173f704a628b72e3cd43a4cdd75477c94 Mon Sep 17 00:00:00 2001 From: dMetzger Date: Fri, 10 Aug 2012 12:57:19 +0000 Subject: [PATCH] [-] FO : fixed country restrictions for payment modules #PSCFV-2738 --- classes/Hook.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/classes/Hook.php b/classes/Hook.php index 6159c55b7..cd73f33bc 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -258,6 +258,9 @@ class HookCore extends ObjectModel $sql->innerJoin('hook_module', 'hm', 'hm.`id_module` = m.`id_module`'); $sql->innerJoin('hook', 'h', 'hm.`id_hook` = h.`id_hook`'); $sql->where('(SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN('.implode(', ', $shop_list).')) = '.count($shop_list)); + // For payment modules, we check that they are available in the contextual country + if (Validate::isLoadedObject($context->country)) + $sql->where('(h.name != "displayPayment" OR (SELECT id_country FROM '._DB_PREFIX_.'module_country mc WHERE mc.id_module = m.id_module AND id_country = '.(int)$context->country->id.' LIMIT 1) = '.(int)$context->country->id.')'); $sql->where('hm.id_shop IN('.implode(', ', $shop_list).')'); if (isset($context->customer) && $context->customer->isLogged())