Code

Bugfix for #4263
[gosa.git] / trunk / gosa-plugins / goto / admin / systems / goto / class_workstationStartup.inc
index 1460629097d3757677d1313780411bb1f15c4da3..eba1146bbf3617a2b4df9397bf74686dc25b96bd 100644 (file)
@@ -19,7 +19,7 @@ class workstartup extends plugin
 
   /* attribute list for save action */
   var $attributes           = array("gotoLdapServer", "gotoBootKernel", "gotoKernelParameters", 
-                                    "FAIclass", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
+                                    "FAIclass", "FAIstate", "FAIstatus", "gotoShare","FAIdebianMirror", "FAIrelease");
   var $objectclasses        = array("GOhard", "FAIobject");
 
   /* Share */
@@ -36,6 +36,7 @@ class workstartup extends plugin
   var $FAIclass           = array();  // The currently selected classes 
   var $FAIrelease           = "";
   var $FAIdebianMirror      = "auto";
+  var $FAIstate             = "";
   var $si_active            = FALSE;
   var $si_fai_action_failed = FALSE;
 
@@ -694,6 +695,18 @@ class workstartup extends plugin
 
   function remove_from_parent()
   {
+    /* Cancel if there's nothing to do here */
+    if ((!$this->acl_is_removeable())){
+      return;
+    }
+
+    /* Remove and write to LDAP */
+    plugin::remove_from_parent();
+    $ldap = $this->config->get_ldap_link();
+    $ldap->cd($this->dn);
+    $this->cleanup();
+    $this->attrs['gotoModules'] = array();
+    $ldap->modify($this->attrs);
     $this->handle_post_events("remove");
     new log("remove","workstation/".get_class($this),$this->dn);
   }
@@ -845,7 +858,7 @@ class workstartup extends plugin
       }
     }
 
-    if ($this->attrs['gotoBootKernel'] == "default-inherited"){
+    if ($this->gotoBootKernel == "default-inherited"){
       $this->attrs['gotoBootKernel']= array();
     }
 
@@ -989,11 +1002,16 @@ class workstartup extends plugin
   function PrepareForCopyPaste($source)
   {
     plugin::PrepareForCopyPaste($source);    
+
     $source_o = new workstartup ($this->config, $source['dn']);
     foreach(array("FAIclass","gotoModules", "gotoAutoFs", "gotoFilesystem",
-          "gotoKernelParameters","gotoShares") as $attr){
+          "FAIstate", "FAIrelease", "gotoKernelParameters","gotoShares",
+          "gotoLdapServers", "gotoLdap_inherit") as $attr){
       $this->$attr = $source_o->$attr;
     }
+    if (isset($source['FAIstate'])) {
+      $this->attrs['FAIstate'] = $source['FAIstate'];
+    }
   }