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 532b87e80..72beec990 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 @@ -49,8 +49,10 @@ if (perm == 'all' && $(this).parent().parent().hasClass('parent')) { - checked = enabled ? 'checked': ''; - $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', checked); + if (enabled) + $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', 'checked'); + else + $(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').removeAttr('checked'); $.ajax({ url: "{$link->getAdminLink('AdminAccess')|addslashes}", cache: false, @@ -68,15 +70,12 @@ }, success : function(res,textStatus,jqXHR) { - try - { + try { if (res == 'ok') showSuccessMessage("{l s='Update successful'}"); else showErrorMessage("{l s='Update error'}"); - } - catch(e) - { + } catch(e) { jAlert('Technical error'); } } diff --git a/controllers/admin/AdminAccessController.php b/controllers/admin/AdminAccessController.php index 9f636c25b..543a3b5d2 100644 --- a/controllers/admin/AdminAccessController.php +++ b/controllers/admin/AdminAccessController.php @@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController $join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)'; } - if ($id_tab == -1 && $perm == 'all' && $enabled == 0) - $sql = ' + if ($id_tab == -1) + { + if ($perm == 'all') + $sql = ' UPDATE `'._DB_PREFIX_.'access` a SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile; - else if ($id_tab == -1 && $perm == 'all') - $sql = ' - UPDATE `'._DB_PREFIX_.'access` a - SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' - WHERE `id_profile` = '.(int)$id_profile; - else if ($id_tab == -1) - $sql = ' + else + $sql = ' UPDATE `'._DB_PREFIX_.'access` a SET `'.bqSQL($perm).'` = '.(int)$enabled.' WHERE `id_profile` = '.(int)$id_profile; - else if ($perm == 'all') - $sql = ' - UPDATE `'._DB_PREFIX_.'access` a - '.$join.' - SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' - WHERE '.$where.' = '.(int)$id_tab.' - AND `id_profile` = '.(int)$id_profile; + } else - $sql = ' - UPDATE `'._DB_PREFIX_.'access` a - '.$join.' + { + if ($perm == 'all') + $sql = ' + UPDATE `'._DB_PREFIX_.'access` a '.$join.' + SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.' + WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile; + else + $sql = ' + UPDATE `'._DB_PREFIX_.'access` a '.$join.' SET `'.bqSQL($perm).'` = '.(int)$enabled.' - WHERE '.$where.' = '.(int)$id_tab.' - AND `id_profile` = '.(int)$id_profile; + WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile; + } $res = Db::getInstance()->execute($sql) ? 'ok' : 'error'; diff --git a/controllers/admin/AdminTrackingController.php b/controllers/admin/AdminTrackingController.php index 8ba7265a4..4510d998c 100644 --- a/controllers/admin/AdminTrackingController.php +++ b/controllers/admin/AdminTrackingController.php @@ -154,8 +154,6 @@ class AdminTrackingControllerCore extends AdminController $this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:')); - - return $this->renderList(); }