From 33d032aa2b15883a8bf5aec32b48e3d8133289a0 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 27 Sep 2007 06:57:13 +0000 Subject: [PATCH] Updated category removement in group->apps git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7418 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/groups/class_groupApplication.inc | 34 +++++++++++++------ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/plugins/admin/groups/class_groupApplication.inc b/plugins/admin/groups/class_groupApplication.inc index fcc9d391c..bd15fa0c4 100644 --- a/plugins/admin/groups/class_groupApplication.inc +++ b/plugins/admin/groups/class_groupApplication.inc @@ -511,18 +511,32 @@ class appgroup extends plugin } } - /* Remove category entry */ - 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) && !$only_once){ + $only_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