Code

Reimplemented remove for gotomasses
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 24 Oct 2007 13:50:12 +0000 (13:50 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 24 Oct 2007 13:50:12 +0000 (13:50 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7642 594d385d-05f5-0310-b6e9-bd551577e9d8

include/class_hostActionQueue.inc
plugins/addons/gotomasses/class_goto_task.inc
plugins/addons/gotomasses/class_gotomasses.inc

index a81328d30247abde985895d33fe2168d422e3c2f..fd1c0fade39dc08fe010305d770d161b810a03e9 100644 (file)
@@ -270,7 +270,7 @@ class hostActionQueue {
 
   public function update_entry($id,$entry)
   {
-    if(isset($this->a_queue[$this->id_entry_map[$id]])){
+    if(isset($this->id_entry_map[$id])){
       $this->a_queue[$this->id_entry_map[$id]] = $entry;
       return($this->_save_data());
     }else{
@@ -278,6 +278,17 @@ class hostActionQueue {
     }
   }
 
+  public function remove_entry($id)
+  {
+    if(isset($this->id_entry_map[$id])){
+      unset($this->a_queue[$this->id_entry_map[$id]]);
+      unset($this->id_entry_map[$id]);
+      return($this->_save_data());
+    }else{
+      $this->set_error(sprintf(_("Could not remove entry, entry with id '%s' not found."),$id));
+    }
+  }
+
   public function id_exists($id)
   {
     return(isset($this->id_entry_map[$id]));
index bbc58faedb3798bf085723397c0606d03b458c80..cccb987ddfc4a033abfeb787e3a2e8b9b8a15778 100644 (file)
@@ -332,7 +332,7 @@ class goto_task extends plugin
       "Action" => _("Action")       ,"Comment"=> _("Description"));
     
     foreach($tmp as $name => $desc){
-      if(empty($this->$name)){
+      if(empty($this->$name) && $this->$name != 0){
         $message[] = sprintf(_("The given value for attribute '%s' is invalid."),$desc);
       }
     }
index 2b304d31ff4f7c89ce6f5b34664a51969f190fc2..d72cb2b3f9356bbad3613719e430221a7b94fca9 100644 (file)
@@ -63,8 +63,8 @@ class gotomasses extends plugin
         $this->ids_to_remove = $this->list_get_selected_items();
         $tmp = "";
         foreach($this->ids_to_remove as $key => $id){
-          if(isset($this->tasks[$id])){
-            $task = $this->tasks[$id];
+          if($this->o_queue->id_exists($id)){
+            $task = $this->o_queue->get_entry($id);
             $tmp.= "\n".$this->target_to_string($task);
           }else{
             unset($this->ids_to_remove[$key]);
@@ -80,7 +80,9 @@ class gotomasses extends plugin
     /* Remove specified tasks */
     if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
       foreach($this->ids_to_remove as $id){
-        $this->o_queue->remove($id);    
+        if($this->o_queue->id_exists($id)){
+          $this->o_queue->remove_entry($id);
+        }
       }
       $this->save();
     }