From d27f4b7dee1a0347a2d128146ec430ecfdf8c9bb Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 27 Sep 2007 06:31:22 +0000 Subject: [PATCH] Updated category deletion in group->apps git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@7416 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_groupApplication.inc | 37 ++++++++++++++----- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index a75676068..029f95932 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -436,6 +436,7 @@ class appgroup extends plugin $this->diffAppsInReleases(); $only_once = false; + $once =FALSE; foreach($_POST as $name => $value){ if((preg_match("/AddSep_/",$name))&&(!$only_once)){ @@ -474,18 +475,34 @@ class appgroup extends plugin } } } - - if(preg_match("/DelCat_/",$name)){ - $n = preg_replace("/DelCat_/","",$name); - $app = base64_decode( preg_replace("/_.*$/","",$n)); - foreach($this->Categories as $key => $cat){ - if($cat == $app){ - foreach($this->Categories as $p => $n){ - if(preg_match("/^".$key."\/.*/",$p)){ - unset($this->Categories[$p]); + + + if(preg_match("/DelCat_/",$name) && !$once){ + $once =TRUE; + $cat = preg_replace("/DelCat_/","",$name); + $cat = trim(base64_decode( preg_replace("/_.*$/","",$cat))); + + $free_apps = array(); + + if(isset($this->gosaMemberApplication[$cat]) && is_array($this->gosaMemberApplication[$cat])){ + foreach($this->gosaMemberApplication[$cat] as $app){ + $free_apps[] = $app['App']; + } + @unset($this->gosaMemberApplication[$cat]); + @unset($this->Categories[$cat]); + foreach($this->Categories as $key => $name){ + if(preg_match("/^".$cat."\/.*/",$key)){ + foreach($this->gosaMemberApplication[$key] as $app){ + $free_apps[] = $app['App']; } + @unset($this->gosaMemberApplication[$key]); + @unset($this->Categories[$key]); } - unset($this->Categories[$key]); + } + } + foreach($free_apps as $app){ + if(isset($this->used_apps[$app])){ + unset($this->used_apps[$app]); } } } -- 2.30.2