From e16ea584babc37640780e5dd12ba64f232f583ec Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 24 Oct 2012 15:50:48 +0000 Subject: [PATCH] Add Un-delete to context menu --- timesheet/inc/class.timesheet_ui.inc.php | 25 ++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/timesheet/inc/class.timesheet_ui.inc.php b/timesheet/inc/class.timesheet_ui.inc.php index f975d374a9..3e1bd93aa9 100644 --- a/timesheet/inc/class.timesheet_ui.inc.php +++ b/timesheet/inc/class.timesheet_ui.inc.php @@ -742,6 +742,10 @@ class timesheet_ui extends timesheet_bo $readonlys["delete[$row[ts_id]]"] = true; $row['class'] .= ' rowNoDelete '; } + if($row['ts_status'] != self::DELETED_STATUS) + { + $row['class'] .= ' rowNoUndelete '; + } if ($query['col_filter']['ts_project'] || !$query['filter2']) { unset($row['ts_project']); // dont need or want to show it @@ -976,6 +980,13 @@ class timesheet_ui extends timesheet_bo 'group' => ++$group, 'disableClass' => 'rowNoDelete', ), + 'undelete' => array( + 'caption' => 'Un-Delete', + 'confirm' => 'Recover this entry', + 'confirm_multiple' => 'Recover these entries', + 'group' => $group, + 'disableClass' => 'rowNoUndelete', + ) ); // enable additonal edit check for following actions, if they are generally available foreach(array('cat','status') as $action) @@ -1046,6 +1057,20 @@ class timesheet_ui extends timesheet_bo } } break; + case 'undelete': + $action_msg =lang('recovered'); + foreach((array)$checked as $n => $id) + { + if ($this->set_status($id,'')) + { + $success++; + } + else + { + $failed++; + } + } + break; case 'to_status': $action_msg =lang('changed status'); foreach((array)$checked as $n => $id)