Code

Simplified save() routine, replaced foreach with gosa_array_merge
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 13 Sep 2007 09:26:33 +0000 (09:26 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 13 Sep 2007 09:26:33 +0000 (09:26 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7287 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc

index eb4d40a8fe4218e862e2a7088a4e8d0d14d3ba9f..47dd20c517adc7de44330e857ac973e9059d537f 100644 (file)
@@ -243,7 +243,7 @@ class plugin
     /* Get current objectClasses in order to add the required ones */
     $ldap->cat($this->dn);
     $tmp= $ldap->fetch ();
-      $oc= array();
+    $oc= array();
     if (isset($tmp['objectClass'])){
       $oc= $tmp['objectClass'];
       unset($oc['count']);
@@ -319,22 +319,18 @@ class plugin
     $ldap->cat($this->dn);
     
     $tmp= $ldap->fetch ();
-    
+
+    $oc= array();
     if (isset($tmp['objectClass'])){
       $oc= $tmp["objectClass"];
       $this->is_new= FALSE;
+      unset($oc['count']);
     } else {
-      $oc= array("count" => 0);
       $this->is_new= TRUE;
     }
 
     /* Load (minimum) attributes, add missing ones */
-    $this->attrs['objectClass']= $this->objectclasses;
-    for ($i= 0; $i<$oc["count"]; $i++){
-      if (!in_array_ics($oc[$i], $this->objectclasses)){
-        $this->attrs['objectClass'][]= $oc[$i];
-      }
-    }
+    $this->attrs['objectClass']= gosa_array_merge($oc,$this->objectclasses);
 
     /* Copy standard attributes */
     foreach ($this->attributes as $val){