Code

Reverted changes from 3871 on. They did not work - even if I
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Jun 2006 14:54:18 +0000 (14:54 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Jun 2006 14:54:18 +0000 (14:54 +0000)
use departments without commata inside.

Please use smaller commits. I can't follow this ones which
exchange hundreds of lines.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3874 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_plugin.inc
include/class_tabs.inc
plugins/admin/departments/class_departmentGeneric.inc
plugins/admin/departments/class_departmentManagement.inc
plugins/admin/departments/tabs_department.inc

index 006631879985df05849eb920db8de34b735f8c13..23fa324cabd8b83b8e481602d16f12d0a4877965 100644 (file)
@@ -729,11 +729,20 @@ class plugin
     /* Adapt naming attribute */
     $dst_name= preg_replace("/^([^=]+)=.*$/", "\\1", $dst_dn);
     $dst_val = preg_replace("/^[^=]+=([^,+]+).*,.*$/", "\\1", $dst_dn);
-    $new[$dst_name]= str_replace("\\","", ldap::fix($dst_val));
+    $new[$dst_name]= $dst_val;
+
+    /* Check if this is a department.
+     * If it is a dep. && there is a , override in his ou 
+     *  change \2C to , again, else this entry can't be saved ...
+     */
+    if((isset($new['ou'])) &&( preg_match("/\\\\2C/",$new['ou']))){
+      $new['ou'] = preg_replace("/\\\\2C/",",",$new['ou']);
+    }
 
     /* Save copy */
     $ldap->connect();
     $ldap->cd($this->config->current['BASE']);
+    
     $ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $dst_dn));
 
     /* FAIvariable=.../..., cn=.. 
@@ -744,7 +753,7 @@ class plugin
     }
     $ldap->cd($dst_dn);
     $ldap->add($new);
-  
+
     if ($ldap->error != "Success"){
       trigger_error("Trying to save $dst_dn failed.",
           E_USER_WARNING);
index 6a9959e1ac9198736ab9ec1739c2e51beefb278b..e0e8dbe422b0bf555c7fe25940a04bdf3b5aa0bf 100644 (file)
@@ -240,7 +240,6 @@ class tabs
                } else {
                        $obj->remove_from_parent();
                }
-               $this->by_object[$key]= $obj;
        }
        return (0);
   }
index 8a2528b275edbe523cfd858d1a697e5281c9286d..c508b614e36e58bf38aaf886ef284381c48e5d72 100644 (file)
@@ -43,6 +43,7 @@ class department extends plugin
   var $MustBeMoved              = "";
   var $MoveDestination          = "";
   var $MoveSource               = "";
+  var $MoveOu                   = "";
 
        /* attribute list for save action */
        var $attributes               = array("ou", "description", "businessCategory", "st", 
@@ -241,7 +242,7 @@ class department extends plugin
 
 
        /* Save to LDAP */
-       function save($skipSave = false)
+       function save()
        {
                $ldap= $this->config->get_ldap_link();
 
@@ -284,9 +285,7 @@ class department extends plugin
                        $this->gosaUnitTag= "";
                }
 
-    if(!$skipSave){
-                 plugin::save();
-    }
+               plugin::save();
 
                /* Remove tag information if needed */
                if (!$this->is_administrational_unit){
@@ -304,25 +303,24 @@ class department extends plugin
                        }
                }
 
-    if(!$skipSave){
-      /* 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)){
-        $this->cleanup();
-        $ldap->modify ($this->attrs); 
-
-        $this->handle_post_events('modify');
-      } else {
-        $ldap->add($this->attrs);
-        $this->handle_post_events('add');
-      }
+               /* 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)){
+                       $this->cleanup();
+                       $ldap->modify ($this->attrs); 
+
+                       $this->handle_post_events('modify');
+               } else {
+                       $ldap->add($this->attrs);
+                       $this->handle_post_events('add');
+               }
+
+       show_ldap_error($ldap->get_error(), _("Saving department failed"));
 
-      show_ldap_error($ldap->get_error(), _("Saving department failed"));
-    }
     /* The parameter forces only to set must_be_tagged, and don't touch any objects 
         This will be done later */
     $this->tag_objects(true);
index 5185e3e7b9b4b0018f9dcaf249c265fc224f665e..dbfcab0b4ad7a6797c2b7799ede3d4ab4b4a02e4 100644 (file)
@@ -218,7 +218,7 @@ class departmentManagement extends plugin
 
         /* Save current changes */
         if(!$this->AfterSaveProcedure){
-          $this->deptabs->save();
+          $this->deptabs->save(true);
         }
 
         /* Check if we have to tag this department */
index b966f7e9d30e083597c259f8f6ab827024d236ff..deccb02c48f732e3ffea8468f18590d76b0d116e 100644 (file)
@@ -36,18 +36,18 @@ class deptabs extends tabs
         $this->by_object['department']->MustBeMoved      = true;
         $this->by_object['department']->MoveDestination  = $new_dn;
         $this->by_object['department']->MoveSource       = $this->dn;
+        $this->by_object['department']->MoveOu           = $ou;
+        $this->dn                           = $this->dn;
+        $baseobject->dn                     = $this->dn;
         $this->by_object['department']->ou  = $baseobject->attrs['ou'][0];
-        $ret              = tabs::save(TRUE);
-        $this->by_object['department']->save(true);
-        return($ret);
+        $this->by_object['department']      = $baseobject;
+        return(tabs::save(TRUE));
       }
     }else{
-      $this->dn         = $new_dn;
-      $baseobject->dn   = $this->dn;
-      $ret              = tabs::save(TRUE);
-      $baseobject->save(true);
+      $this->dn= $new_dn;
+      $baseobject->dn= $this->dn;
       $this->by_object['department']= $baseobject;
-      return($ret);
+      return(tabs::save(TRUE));
     }
   }
 }