mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-14 01:48:35 +01:00
* Preferences: Fix deleting multiple categories only removed the first
This commit is contained in:
parent
8425f380fe
commit
42600c90fa
@ -231,7 +231,7 @@ class admin_categories
|
|||||||
|
|
||||||
if ($button == 'save')
|
if ($button == 'save')
|
||||||
{
|
{
|
||||||
Framework::refresh_opener($msg, $this->appname, $content['id'], $change_color ? null : 'update', $refresh_app);
|
Framework::refresh_opener($msg, $refresh_app, $content['id'], $change_color ? null : 'update', $refresh_app);
|
||||||
Framework::window_close();
|
Framework::window_close();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -254,7 +254,7 @@ class admin_categories
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// This should probably refresh the application $this->appname in the target tab $refresh_app, but that breaks pretty much everything
|
// This should probably refresh the application $this->appname in the target tab $refresh_app, but that breaks pretty much everything
|
||||||
Framework::refresh_opener($msg, $this->appname, $content['id'], $change_color ? null : 'update', $refresh_app);
|
Framework::refresh_opener($msg, $refresh_app, $content['id'], $change_color ? null : 'update', $refresh_app);
|
||||||
}
|
}
|
||||||
$content['msg'] = $msg;
|
$content['msg'] = $msg;
|
||||||
if(!$content['appname']) $content['appname'] = $appname;
|
if(!$content['appname']) $content['appname'] = $appname;
|
||||||
@ -637,33 +637,48 @@ class admin_categories
|
|||||||
if (isset($_GET['cat_id']))
|
if (isset($_GET['cat_id']))
|
||||||
{
|
{
|
||||||
$content = array(
|
$content = array(
|
||||||
'cat_id'=>(int)$_GET['cat_id'],
|
'cat_id'=>strpos($_GET['cat_id'], ',') !== False ? explode(',',$_GET['cat_id']) : [(int)$_GET['cat_id']],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__."() \$_GET[account_id]=$_GET[account_id], \$_GET[contact_id]=$_GET[contact_id] content=".array2string($content));
|
//error_log(__METHOD__."() \$_GET[account_id]=$_GET[account_id], \$_GET[contact_id]=$_GET[contact_id] content=".array2string($content));
|
||||||
}
|
}
|
||||||
$cats = new Categories('', Categories::id2name($content['cat_id'],'appname'));
|
if($_GET['appname'])
|
||||||
if((!$cats->check_perms(Acl::DELETE, $content['cat_id']) || !self::$acl_delete) &&
|
{
|
||||||
// Only admins can delete globals
|
|
||||||
$cats->is_global($content['cat_id']) && !$GLOBALS['egw_info']['user']['apps']['admin'])
|
|
||||||
|
|
||||||
|
}
|
||||||
|
$cats = new Categories('', Categories::id2name($content['cat_id'][0],'appname'));
|
||||||
|
foreach($content['cat_id'] as $index => $cat_id)
|
||||||
|
{
|
||||||
|
if ((!$cats->check_perms(Acl::DELETE, $cat_id) || !self::$acl_delete) &&
|
||||||
|
// Only admins can delete globals
|
||||||
|
$cats->is_global($cat_id) && !$GLOBALS['egw_info']['user']['apps']['admin'])
|
||||||
|
|
||||||
|
{
|
||||||
|
unset($content['cat_id'][$index]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(count($content['cat_id']) == 0)
|
||||||
{
|
{
|
||||||
Framework::window_close(lang('Permission denied!!!'));
|
Framework::window_close(lang('Permission denied!!!'));
|
||||||
}
|
}
|
||||||
if ($content['button'])
|
if ($content['button'])
|
||||||
{
|
{
|
||||||
if($cats->check_perms(Acl::DELETE, $content['cat_id'], (boolean)$GLOBALS['egw_info']['user']['apps']['admin']))
|
$refresh_app = $this->appname == 'preferences' ? $content['appname'] : $this->appname;
|
||||||
|
foreach($content['cat_id'] as $cat_id)
|
||||||
|
{
|
||||||
|
if ($cats->check_perms(Acl::DELETE, $cat_id, (boolean)$GLOBALS['egw_info']['user']['apps']['admin']))
|
||||||
{
|
{
|
||||||
$cmd = new admin_cmd_delete_category(
|
$cmd = new admin_cmd_delete_category(
|
||||||
$content['cat_id'],
|
$cat_id,
|
||||||
key($content['button']) == 'delete_sub',
|
key($content['button']) == 'delete_sub',
|
||||||
$content['admin_cmd']
|
$content['admin_cmd']
|
||||||
);
|
);
|
||||||
$cmd->run();
|
$cmd->run();
|
||||||
Framework::refresh_opener(lang('Deleted'), 'admin', $content['cat_id'], 'delete');
|
Framework::refresh_opener(lang('Deleted'), $refresh_app, $cat_id, count($content['cat_id']) > 0 ? 'edit':'delete',$refresh_app);
|
||||||
Framework::window_close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Framework::window_close();
|
||||||
|
}
|
||||||
$tpl = new Etemplate('admin.categories.delete');
|
$tpl = new Etemplate('admin.categories.delete');
|
||||||
$tpl->exec($this->delete_link, $content, array(), array(), $content, 2);
|
$tpl->exec($this->delete_link, $content, array(), array(), $content, 2);
|
||||||
}
|
}
|
||||||
@ -709,7 +724,7 @@ class admin_categories
|
|||||||
'group' => ++$group,
|
'group' => ++$group,
|
||||||
'disableClass' => 'rowNoDelete',
|
'disableClass' => 'rowNoDelete',
|
||||||
'popup' => '450x400',
|
'popup' => '450x400',
|
||||||
'url' => 'menuaction='.$this->delete_link.'&cat_id=$id',
|
'url' => 'menuaction='.$this->delete_link.'&appname='.($this->appname == 'preferences' ? $appname : $this->appname).'&cat_id=$id',
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user