[-] BO : fixed ajax in permissions tab #PSCFV-7442
This commit is contained in:
1 parent
2ae0e4f844
commit
12e13e275f
3 files changed
+24
-30
No files matched your search
@@ -49,8 +49,10 @@
|
|||||||
|
|
||||||
if (perm == 'all' && $(this).parent().parent().hasClass('parent'))
|
if (perm == 'all' && $(this).parent().parent().hasClass('parent'))
|
||||||
{
|
{
|
||||||
checked = enabled ? 'checked': '';
|
if (enabled)
|
||||||
$(this).parent().parent().parent().find('.child-'+id_tab+' input[type=checkbox]').attr('checked', checked);
|
$(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({
|
$.ajax({
|
||||||
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
url: "{$link->getAdminLink('AdminAccess')|addslashes}",
|
||||||
cache: false,
|
cache: false,
|
||||||
@@ -68,15 +70,12 @@
|
|||||||
},
|
},
|
||||||
success : function(res,textStatus,jqXHR)
|
success : function(res,textStatus,jqXHR)
|
||||||
{
|
{
|
||||||
try
|
try {
|
||||||
{
|
|
||||||
if (res == 'ok')
|
if (res == 'ok')
|
||||||
showSuccessMessage("{l s='Update successful'}");
|
showSuccessMessage("{l s='Update successful'}");
|
||||||
else
|
else
|
||||||
showErrorMessage("{l s='Update error'}");
|
showErrorMessage("{l s='Update error'}");
|
||||||
}
|
} catch(e) {
|
||||||
catch(e)
|
|
||||||
{
|
|
||||||
jAlert('Technical error');
|
jAlert('Technical error');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -153,35 +153,32 @@ class AdminAccessControllerCore extends AdminController
|
|||||||
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
|
$join = 'LEFT JOIN `'._DB_PREFIX_.'tab` t ON (t.`id_tab` = a.`id_tab`)';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($id_tab == -1 && $perm == 'all' && $enabled == 0)
|
if ($id_tab == -1)
|
||||||
$sql = '
|
{
|
||||||
|
if ($perm == 'all')
|
||||||
|
$sql = '
|
||||||
UPDATE `'._DB_PREFIX_.'access` a
|
UPDATE `'._DB_PREFIX_.'access` a
|
||||||
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
SET `view` = '.(int)$enabled.', `add` = '.(int)$enabled.', `edit` = '.(int)$enabled.', `delete` = '.(int)$enabled.'
|
||||||
WHERE `id_profile` = '.(int)$id_profile;
|
WHERE `id_profile` = '.(int)$id_profile;
|
||||||
else if ($id_tab == -1 && $perm == 'all')
|
else
|
||||||
$sql = '
|
$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 = '
|
|
||||||
UPDATE `'._DB_PREFIX_.'access` a
|
UPDATE `'._DB_PREFIX_.'access` a
|
||||||
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||||
WHERE `id_profile` = '.(int)$id_profile;
|
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
|
else
|
||||||
$sql = '
|
{
|
||||||
UPDATE `'._DB_PREFIX_.'access` a
|
if ($perm == 'all')
|
||||||
'.$join.'
|
$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.'
|
SET `'.bqSQL($perm).'` = '.(int)$enabled.'
|
||||||
WHERE '.$where.' = '.(int)$id_tab.'
|
WHERE '.$where.' = '.(int)$id_tab.' AND `id_profile` = '.(int)$id_profile;
|
||||||
AND `id_profile` = '.(int)$id_profile;
|
}
|
||||||
|
|
||||||
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
|
$res = Db::getInstance()->execute($sql) ? 'ok' : 'error';
|
||||||
|
|
||||||
|
|||||||
@@ -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:'));
|
$this->tpl_list_vars = array('sub_title' => $this->l('List of products with attributes but without available quantities for sale:'));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $this->renderList();
|
return $this->renderList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user