* Finish task #5104.

This commit is contained in:
Yagami
2018-11-12 14:06:19 +08:00
parent 9d5f919e3d
commit 764287bf07
3 changed files with 27 additions and 0 deletions
+20
View File
@@ -683,6 +683,7 @@ class taskModel extends model
{
if($task->status == 'done') $this->loadModel('score')->create('task', 'finish', $taskID);
if($task->status == 'closed') $this->loadModel('score')->create('task', 'close', $taskID);
if($task->parent) $this->dao->update(TABLE_TASK)->set('parent')->eq(-1)->where('id')->eq($task->parent)->exec();
$this->file->updateObjectID($this->post->uid, $taskID, 'task');
return common::createChanges($oldTask, $task);
}
@@ -1598,6 +1599,25 @@ class taskModel extends model
return $tasks;
}
/**
* Get project parent tasks pairs.
*
* @param int $projectID
* @access public
* @return array
*/
public function getParentTaskPairs($projectID)
{
$tasks = $this->dao->select('id, name')->from(TABLE_TASK)
->where('deleted')->eq(0)
->andWhere('parent')->le(0)
->andWhere('status')->notin('cancel,closed')
->andWhere('project')->eq($projectID)
->fetchPairs();
return array('' => '') + $tasks ;
}
/**
* Get tasks of a user.
*