[-] BO: fix the checkbox of shop activation on modules configuration

This commit is contained in:
Rémi Gaillard
2013-10-30 14:57:15 +01:00
parent 8953c55b7f
commit c56e8471c2
2 changed files with 13 additions and 1 deletions

View File

@@ -1576,6 +1576,18 @@ abstract class ModuleCore
return Cache::retrieve('Module::isInstalled'.$module_name);
}
public function isEnabledForShopContext()
{
$shop_list = Shop::getContextListShopID();
return (bool)Db::getInstance()->getValue('
SELECT COUNT(*) n
FROM `'._DB_PREFIX_.'module_shop`
WHERE id_module='.(int)$this->id.' AND id_shop IN ('.implode(',', array_map('intval', Shop::getContextListShopID())).')
GROUP BY id_module
HAVING n='.(int)count(Shop::getContextListShopID())
);
}
public static function isEnabled($module_name)
{
if (!Cache::isStored('Module::isEnabled'.$module_name))