diff --git a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl index 9bbc2204f..8e396f129 100644 --- a/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/controllers/access/helpers/form/form.tpl @@ -122,15 +122,16 @@ var perm = tout[1]; var id_profile = tout[2]; var enabled = $(this).is(':checked') ? 1 : 0; + var enabled_attr = $(this).is(':checked') ? true : false; var table = 'table#table_module_'+id_profile; if (id_module == -1) $(table+' .ajax-ma-'+perm).each(function(key, value) { - $(this).attr("checked", enabled); + $(this).attr("checked", enabled_attr); }); else if (!enabled) $(table+' #ajax-ma-'+perm+'-master').each(function(key, value) { - $(this).attr("checked", enabled); + $(this).attr("checked", enabled_attr); }); $.ajax({ diff --git a/admin-dev/themes/default/template/controllers/modules/filters.tpl b/admin-dev/themes/default/template/controllers/modules/filters.tpl index 13a728344..da2fd53b0 100644 --- a/admin-dev/themes/default/template/controllers/modules/filters.tpl +++ b/admin-dev/themes/default/template/controllers/modules/filters.tpl @@ -24,7 +24,7 @@ * International Registered Trademark & Property of PrestaShop SA *} - +{if $add_permission eq '1'} {if isset($logged_on_addons)} @@ -70,7 +70,7 @@ {/if} {/if} - +{/if} diff --git a/admin-dev/themes/default/template/controllers/modules/header.tpl b/admin-dev/themes/default/template/controllers/modules/header.tpl index 087911213..21d3a1ddc 100644 --- a/admin-dev/themes/default/template/controllers/modules/header.tpl +++ b/admin-dev/themes/default/template/controllers/modules/header.tpl @@ -28,14 +28,17 @@
+

Module : {l s='List of modules'}

@@ -43,7 +46,7 @@
- +{if $add_permission eq '1'}
{l s='Add a new module'} {l s='Add a new module'} @@ -63,5 +66,5 @@

- +{/if} diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index 391432cfe..925b8b66b 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -881,15 +881,26 @@ class AdminModulesControllerCore extends AdminController return $return; } - public function initModulesList($modules) + public function initModulesList(&$modules) { - foreach ($modules as $module) + foreach ($modules as $k => $module) { - if (!in_array($module->name, $this->list_natives_modules)) - $this->serial_modules .= $module->name.' '.$module->version.'-'.($module->active ? 'a' : 'i')."\n"; - $module_author = $module->author; - if (!empty($module_author) && ($module_author != '')) - $this->modules_authors[strtolower($module_author)] = 'notselected'; + // Check add permissions, if add permissions not set, addons modules and non installed modules will not be displayed + if ($this->tabAccess['add'] !== '1' && isset($module->type) && ($module->type != 'addonsNative' || $module->type != 'addonsBought')) + unset($modules[$k]); + else if ($this->tabAccess['add'] !== '1' && (!isset($module->id) || $module->id < 1)) + unset($modules[$k]); + else if ($module->id && !Module::getPermissionStatic($module->id, 'view') && !Module::getPermissionStatic($module->id, 'configure')) + unset($modules[$k]); + else + { + // Init serial and modules author list + if (!in_array($module->name, $this->list_natives_modules)) + $this->serial_modules .= $module->name.' '.$module->version.'-'.($module->active ? 'a' : 'i')."\n"; + $module_author = $module->author; + if (!empty($module_author) && ($module_author != '')) + $this->modules_authors[strtolower($module_author)] = 'notselected'; + } } $this->serial_modules = urlencode($this->serial_modules); } @@ -913,11 +924,6 @@ class AdminModulesControllerCore extends AdminController public function isModuleFiltered($module) { - // Beware $module could be an instance of Module or stdClass, that expflain the static call - if ($module->id && !Module::getPermissionStatic($module->id, 'view') && !Module::getPermissionStatic($module->id, 'configure')) - return true; - - // If action on module, we display it if (Tools::getValue('module_name') != '' && Tools::getValue('module_name') == $module->name) return false; @@ -1168,6 +1174,8 @@ class AdminModulesControllerCore extends AdminController $tpl_vars['check_url_fopen'] = (ini_get('allow_url_fopen') ? 'ok' : 'ko'); $tpl_vars['check_openssl'] = (extension_loaded('openssl') ? 'ok' : 'ko'); + $tpl_vars['add_permission'] = $this->tabAccess['add']; + if ($this->logged_on_addons) { $tpl_vars['logged_on_addons'] = 1; diff --git a/modules/productcomments/config.xml b/modules/productcomments/config.xml index d2ca5525e..de86f72ec 100755 --- a/modules/productcomments/config.xml +++ b/modules/productcomments/config.xml @@ -1,9 +1,9 @@ productcomments - + - + 1 diff --git a/modules/statsforecast/config.xml b/modules/statsforecast/config.xml index 622e353e4..b59200e4a 100755 --- a/modules/statsforecast/config.xml +++ b/modules/statsforecast/config.xml @@ -1,7 +1,7 @@ statsforecast - + diff --git a/modules/themeinstallator/config.xml b/modules/themeinstallator/config.xml index 7fbf70958..7d6515827 100755 --- a/modules/themeinstallator/config.xml +++ b/modules/themeinstallator/config.xml @@ -1,9 +1,9 @@ themeinstallator - + - + 1