Code

Updated departmentGeneric.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Feb 2008 09:37:04 +0000 (09:37 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 25 Feb 2008 09:37:04 +0000 (09:37 +0000)
-Tagging works again.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5-lhm@9098 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc
plugins/admin/departments/class_departmentGeneric.inc

index 9a25100ff3f3e3b25b20975f4325c4c02c8999aa..f3b6f2da34511a36be824bf07d519eeb54122397 100644 (file)
@@ -88,6 +88,7 @@ class plugin
 
   /* Save unit tags */
   var $gosaUnitTag= "";
+  var $skipTagging= FALSE;
 
   /*!
     \brief Used standard values
@@ -896,6 +897,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 */