Code

Fixed Tagging.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Feb 2008 09:35:29 +0000 (09:35 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Feb 2008 09:35:29 +0000 (09:35 +0000)
-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
plugins/admin/departments/class_departmentGeneric.inc

index c02a3b86c263d8b8af8c73faf535006763063b0b..a6e3da710567fc2ef77c576ce8308456eb80dee6 100644 (file)
@@ -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;
index 18f8db4abe4574ff700d5cf047b0269e92f22e02..0dc9495faec5c5be27cdf62351038a2ec8d65bbb 100644 (file)
@@ -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 */