mirror of
https://github.com/grocy/grocy.git
synced 2025-08-19 03:40:10 +00:00
Added the possibility to undo a task (closes #252)
This commit is contained in:
@@ -26,6 +26,22 @@ class TasksService extends BaseService
|
||||
return true;
|
||||
}
|
||||
|
||||
public function UndoTask($taskId)
|
||||
{
|
||||
if (!$this->TaskExists($taskId))
|
||||
{
|
||||
throw new \Exception('Task does not exist');
|
||||
}
|
||||
|
||||
$taskRow = $this->Database->tasks()->where('id = :1', $taskId)->fetch();
|
||||
$taskRow->update(array(
|
||||
'done' => 0,
|
||||
'done_timestamp' => null
|
||||
));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function TaskExists($taskId)
|
||||
{
|
||||
$taskRow = $this->Database->tasks()->where('id = :1', $taskId)->fetch();
|
||||
|
Reference in New Issue
Block a user