From d46871c0500601e7f6c9017845890db5c596b68e Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 24 Oct 2007 13:50:12 +0000 Subject: [PATCH] Reimplemented remove for gotomasses git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7642 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_hostActionQueue.inc | 13 ++++++++++++- plugins/addons/gotomasses/class_goto_task.inc | 2 +- plugins/addons/gotomasses/class_gotomasses.inc | 8 +++++--- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/include/class_hostActionQueue.inc b/include/class_hostActionQueue.inc index a81328d30..fd1c0fade 100644 --- a/include/class_hostActionQueue.inc +++ b/include/class_hostActionQueue.inc @@ -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])); diff --git a/plugins/addons/gotomasses/class_goto_task.inc b/plugins/addons/gotomasses/class_goto_task.inc index bbc58faed..cccb987dd 100644 --- a/plugins/addons/gotomasses/class_goto_task.inc +++ b/plugins/addons/gotomasses/class_goto_task.inc @@ -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); } } diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc index 2b304d31f..d72cb2b3f 100644 --- a/plugins/addons/gotomasses/class_gotomasses.inc +++ b/plugins/addons/gotomasses/class_gotomasses.inc @@ -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(); } -- 2.30.2