Code

Added list footer
[gosa.git] / gosa-core / include / class_plugin.inc
index 4e3b0a9af128bd3176e22d54deb8811b90a0691d..2e10d7215e84e4a0291045348bb438b59a0bbc38 100644 (file)
@@ -153,13 +153,13 @@ class plugin
     $this->acl_base= $dn;
 
     /* Get LDAP descriptor */
-    $ldap= $this->config->get_ldap_link();
     if ($dn !== NULL){
 
       /* Load data to 'attrs' and save 'dn' */
       if ($parent !== NULL){
         $this->attrs= $parent->attrs;
       } else {
+        $ldap= $this->config->get_ldap_link();
         $ldap->cat ($dn);
         $this->attrs= $ldap->fetch();
       }
@@ -224,6 +224,9 @@ class plugin
 
         unset($this->saved_attributes["$index"]["count"]);
       }
+      if(isset($this->attrs['gosaUnitTag'])){
+        $this->saved_attributes['gosaUnitTag'] = $this->attrs['gosaUnitTag'][0];
+      }
     }
 
     /* Save initial account state */
@@ -368,7 +371,7 @@ class plugin
   function cleanup()
   {
     foreach ($this->attrs as $index => $value){
-
+      
       /* Convert arrays with one element to non arrays, if the saved
          attributes are no array, too */
       if (is_array($this->attrs[$index]) && 
@@ -1007,7 +1010,7 @@ class plugin
         }
       }
     }
-
+  
     /* Remove tags that may already be here... */
     remove_objectClass("gosaAdministrativeUnitTag", $at);
     if (isset($at['gosaUnitTag'])){
@@ -1019,6 +1022,15 @@ class plugin
       add_objectClass("gosaAdministrativeUnitTag", $at);
       $at['gosaUnitTag']= $tag;
     }
+
+    /* Initially this object was tagged. 
+       - But now, it is no longer inside a tagged department. 
+       So force the remove of the tag.
+       (objectClass was already removed obove)
+     */
+    if($tag == "" && $this->gosaUnitTag){
+      $at['gosaUnitTag'] = array();
+    }
   }