From 39de719c2c22f4b6551a7b2326a32eb62169de36 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 25 Feb 2008 09:35:29 +0000 Subject: [PATCH] Fixed Tagging. -Department generic can set and remove the UniTag again. git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@9097 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_plugin.inc | 9 +++++++++ .../admin/departments/class_departmentGeneric.inc | 14 ++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/include/class_plugin.inc b/include/class_plugin.inc index c02a3b86c..a6e3da710 100644 --- a/include/class_plugin.inc +++ b/include/class_plugin.inc @@ -88,6 +88,7 @@ class plugin /* Save unit tags */ var $gosaUnitTag= ""; + var $skipTagging= FALSE; /*! \brief Used standard values @@ -902,6 +903,14 @@ class plugin function tag_attrs($at, $dn= "", $tag= "", $show= false) { + /* Skip tagging? + If this is called from departmentGeneric, we have to skip this + tagging procedure. + */ + if($this->skipTagging){ + return; + } + /* No dn? Self-operation... */ if ($dn == ""){ $dn= $this->dn; diff --git a/plugins/admin/departments/class_departmentGeneric.inc b/plugins/admin/departments/class_departmentGeneric.inc index 18f8db4ab..0dc9495fa 100644 --- a/plugins/admin/departments/class_departmentGeneric.inc +++ b/plugins/admin/departments/class_departmentGeneric.inc @@ -33,6 +33,7 @@ class department extends plugin var $orig_dn= ""; var $is_administrational_unit= false; var $gosaUnitTag= ""; + var $initially_was_tagged = FALSE; var $rec_dst=false; // Destination for recursive move var $rec_src=false; // Source for recursive move @@ -79,6 +80,7 @@ class department extends plugin /* Is administrational Unit? */ if ($dn != "new" && in_array_ics('gosaAdministrativeUnit', $this->attrs['objectClass'])){ $this->is_administrational_unit= true; + $this->initially_was_tagged = TRUE; } } @@ -260,9 +262,10 @@ class department extends plugin /* Add tag objects if needed */ if ($this->is_administrational_unit){ - if(!in_array_ics("gosaAdministrativeUnit",$this->objectclasses)){ + if(!$this->initially_was_tagged){ $this->objectclasses[]= "gosaAdministrativeUnit"; $this->gosaUnitTag= ""; + $this->initially_was_tagged = TRUE; } if ($this->gosaUnitTag == ""){ @@ -289,7 +292,8 @@ class department extends plugin } } - plugin::save(); + $this->skipTagging = TRUE; + plugin::save(); /* Remove tag information if needed */ if (!$this->is_administrational_unit){ @@ -306,10 +310,8 @@ class department extends plugin } } $this->attrs['objectClass']= $tmp; - - if(!$has_unit_tag && isset($this->attrs['gosaUnitTag'])){ - $this->attrs['gosaUnitTag']= array(); - } + $this->attrs['gosaUnitTag']= array(); + $this->gosaUnitTag = ""; } /* Write back to ldap */ -- 2.30.2