Code

Made add and selftag work
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Mar 2008 14:05:55 +0000 (14:05 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 10 Mar 2008 14:05:55 +0000 (14:05 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9594 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/plugins/admin/departments/class_departmentGeneric.inc
gosa-core/plugins/admin/departments/tabs_department.inc

index fc808e028976954813300647351b1fe8ef177690..c3a15fdb7000ccc0f3903c0f730ff64a5aabf449 100644 (file)
@@ -324,34 +324,37 @@ class department extends plugin
     $this->skipTagging = TRUE;
     plugin::save();
 
-    $this->attrs['gosaUnitTag'] = $this->gosaUnitTag;
-
     /* Remove tag information if needed */
     if (!$this->is_administrational_unit){
       $tmp= array();
 
       /* Remove gosaAdministrativeUnit from this plugin */
-      $has_unit_tag= false;
       foreach($this->attrs['objectClass'] as $oc){
         if (!preg_match("/^gosaAdministrativeUnit$/i", $oc)){
           $tmp[]= $oc;
         }
-        if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
-          $has_unit_tag= true;
-        }
       }
       $this->attrs['objectClass']= $tmp;
-      $this->attrs['gosaUnitTag']= array();
-      $this->gosaUnitTag = "";
+    }
+
+    /* Do we need to remove the tag itself? */
+    $has_unit_tag= false;
+    foreach($this->attrs['objectClass'] as $oc){
+      if (preg_match("/^gosaAdministrativeUnitTag$/i", $oc)){
+        $has_unit_tag= true;
+      }
+    }
+    if ($has_unit_tag == false && $this->is_administrational_unit == false){
+      unset ($this->attrs['gosaUnitTag']);
+    } else {
+      $this->attrs['gosaUnitTag']= $this->gosaUnitTag;
     }
 
                /* Write back to ldap */
-               $ldap= $this->config->get_ldap_link();
                $ldap->cat($this->dn, array('dn'));
-               $a= $ldap->fetch();
                $ldap->cd($this->dn);
 
-               if (count($a)){
+               if ($ldap->count()){
                        $this->cleanup();
                        $ldap->modify ($this->attrs); 
       new log("modify","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
@@ -362,7 +365,7 @@ class department extends plugin
       new log("create","department/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
                }
     if (!$ldap->success()){
-      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, LDAP_DEL, get_class()));
+      msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class()));
     }
 
     /* The parameter forces only to set must_be_tagged, and don't touch any objects 
index c7a75dbc51555602b3f38140e8542c70a52e20a1..ef0360892321b3a3dd74649c1b7701cbe3e14acd 100644 (file)
@@ -31,6 +31,7 @@ class deptabs extends tabs
 
     /* Add references/acls/snapshots */
     $this->addSpecialTabs();
+    $this->by_object['acl']->skipTagging= TRUE;;
   }
 
   function check($ignore_account= FALSE)
@@ -63,7 +64,9 @@ class deptabs extends tabs
     $this->dn= $new_dn;
     $baseobject->dn= $this->dn;
     $this->by_object['department']= $baseobject;
-    return(tabs::save(TRUE));
+    if (!$ignore_account){
+      tabs::save(TRUE);
+    }
   }