* 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
+1
View File
@@ -341,6 +341,7 @@ class task extends control
$this->view->position[] = $this->lang->task->common;
$this->view->position[] = $this->lang->task->edit;
$this->view->stories = $this->story->getProjectStoryPairs($this->view->project->id);
$this->view->tasks = $this->task->getParentTaskPairs($this->view->project->id);
$this->view->users = $this->loadModel('user')->getPairs('nodeleted', "{$this->view->task->openedBy},{$this->view->task->canceledBy},{$this->view->task->closedBy}");
$this->view->modules = $this->tree->getTaskOptionMenu($this->view->task->project);
$this->display();
+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.
*
+6
View File
@@ -103,6 +103,12 @@
<td><span id="storyIdBox"><?php echo html::select('story', $stories, $task->story, "class='form-control chosen'");?></span></td>
</tr>
<?php endif;?>
<?php if($task->parent == 0):?>
<tr>
<th><?php echo $lang->task->parent;?></th>
<td><?php echo html::select('parent', $tasks, $task->parent, "class='form-control chosen'");?></td>
</tr>
<?php endif;?>
<tr>
<th><?php echo $lang->task->assignedTo;?></th>
<td><span id="assignedToIdBox"><?php echo html::select('assignedTo', $members, $task->assignedTo, "class='form-control chosen'");?></span></td>