Add Un-delete to context menu

This commit is contained in:
Nathan Gray 2012-10-24 15:50:48 +00:00
parent 8c133f883d
commit e16ea584ba

View File

@ -742,6 +742,10 @@ class timesheet_ui extends timesheet_bo
$readonlys["delete[$row[ts_id]]"] = true; $readonlys["delete[$row[ts_id]]"] = true;
$row['class'] .= ' rowNoDelete '; $row['class'] .= ' rowNoDelete ';
} }
if($row['ts_status'] != self::DELETED_STATUS)
{
$row['class'] .= ' rowNoUndelete ';
}
if ($query['col_filter']['ts_project'] || !$query['filter2']) if ($query['col_filter']['ts_project'] || !$query['filter2'])
{ {
unset($row['ts_project']); // dont need or want to show it unset($row['ts_project']); // dont need or want to show it
@ -976,6 +980,13 @@ class timesheet_ui extends timesheet_bo
'group' => ++$group, 'group' => ++$group,
'disableClass' => 'rowNoDelete', '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 // enable additonal edit check for following actions, if they are generally available
foreach(array('cat','status') as $action) foreach(array('cat','status') as $action)
@ -1046,6 +1057,20 @@ class timesheet_ui extends timesheet_bo
} }
} }
break; 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': case 'to_status':
$action_msg =lang('changed status'); $action_msg =lang('changed status');
foreach((array)$checked as $n => $id) foreach((array)$checked as $n => $id)