Code

Made department tagging && recursive move PHP 4compatible
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Jun 2006 11:56:25 +0000 (11:56 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 23 Jun 2006 11:56:25 +0000 (11:56 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3872 594d385d-05f5-0310-b6e9-bd551577e9d8

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

index e0e8dbe422b0bf555c7fe25940a04bdf3b5aa0bf..6a9959e1ac9198736ab9ec1739c2e51beefb278b 100644 (file)
@@ -240,6 +240,7 @@ class tabs
                } else {
                        $obj->remove_from_parent();
                }
+               $this->by_object[$key]= $obj;
        }
        return (0);
   }
index c508b614e36e58bf38aaf886ef284381c48e5d72..8a2528b275edbe523cfd858d1a697e5281c9286d 100644 (file)
@@ -43,7 +43,6 @@ class department extends plugin
   var $MustBeMoved              = "";
   var $MoveDestination          = "";
   var $MoveSource               = "";
-  var $MoveOu                   = "";
 
        /* attribute list for save action */
        var $attributes               = array("ou", "description", "businessCategory", "st", 
@@ -242,7 +241,7 @@ class department extends plugin
 
 
        /* Save to LDAP */
-       function save()
+       function save($skipSave = false)
        {
                $ldap= $this->config->get_ldap_link();
 
@@ -285,7 +284,9 @@ class department extends plugin
                        $this->gosaUnitTag= "";
                }
 
-               plugin::save();
+    if(!$skipSave){
+                 plugin::save();
+    }
 
                /* Remove tag information if needed */
                if (!$this->is_administrational_unit){
@@ -303,24 +304,25 @@ class department extends plugin
                        }
                }
 
-               /* 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"));
+    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');
+      }
 
+      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 dbfcab0b4ad7a6797c2b7799ede3d4ab4b4a02e4..5185e3e7b9b4b0018f9dcaf249c265fc224f665e 100644 (file)
@@ -218,7 +218,7 @@ class departmentManagement extends plugin
 
         /* Save current changes */
         if(!$this->AfterSaveProcedure){
-          $this->deptabs->save(true);
+          $this->deptabs->save();
         }
 
         /* Check if we have to tag this department */
index deccb02c48f732e3ffea8468f18590d76b0d116e..b966f7e9d30e083597c259f8f6ab827024d236ff 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];
-        $this->by_object['department']      = $baseobject;
-        return(tabs::save(TRUE));
+        $ret              = tabs::save(TRUE);
+        $this->by_object['department']->save(true);
+        return($ret);
       }
     }else{
-      $this->dn= $new_dn;
-      $baseobject->dn= $this->dn;
+      $this->dn         = $new_dn;
+      $baseobject->dn   = $this->dn;
+      $ret              = tabs::save(TRUE);
+      $baseobject->save(true);
       $this->by_object['department']= $baseobject;
-      return(tabs::save(TRUE));
+      return($ret);
     }
   }
 }