From b6b733b22f9e9f38786166c1274b135a99bce02a Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 20 Jun 2015 16:50:52 -0400 Subject: Close all subtasks when a task is closed --- app/Model/Subtask.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'app/Model/Subtask.php') diff --git a/app/Model/Subtask.php b/app/Model/Subtask.php index 65fa0f0c..a869ae91 100644 --- a/app/Model/Subtask.php +++ b/app/Model/Subtask.php @@ -227,6 +227,18 @@ class Subtask extends Base return $result; } + /** + * Close all subtasks of a task + * + * @access public + * @param integer $task_id + * @return boolean + */ + public function closeAll($task_id) + { + return $this->db->table(self::TABLE)->eq('task_id', $task_id)->update(array('status' => self::STATUS_DONE)); + } + /** * Get subtasks with consecutive positions * -- cgit v1.2.3