* code for task #71609.
This commit is contained in:
+1
-13
@@ -487,24 +487,13 @@ EOF;
|
||||
$tasks = $this->task->getUserTasks($this->app->user->account, $type, 0, $pager, $sort, $queryID);
|
||||
}
|
||||
|
||||
$parents = array();
|
||||
$executionIDList = array();
|
||||
$parents = array();
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($this->config->systemMode == 'new') $executionIDList[$task->execution] = $task->execution;
|
||||
if($task->parent > 0) $parents[$task->parent] = $task->parent;
|
||||
}
|
||||
$parents = $this->dao->select('*')->from(TABLE_TASK)->where('id')->in($parents)->fetchAll('id');
|
||||
|
||||
if($this->config->systemMode == 'new')
|
||||
{
|
||||
$projects = $this->dao->select('t1.id,t1.name,t2.id as execution')->from(TABLE_PROJECT)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.id=t2.project')
|
||||
->where('t2.id')->in($executionIDList)
|
||||
->andWhere('t1.type')->eq('project')
|
||||
->fetchAll('execution');
|
||||
}
|
||||
|
||||
foreach($tasks as $task)
|
||||
{
|
||||
if($task->parent > 0)
|
||||
@@ -543,7 +532,6 @@ EOF;
|
||||
$this->view->users = $this->loadModel('user')->getPairs('noletter');
|
||||
$this->view->pager = $pager;
|
||||
$this->view->mode = 'task';
|
||||
$this->view->projects = isset($projects) ? $projects : array();
|
||||
|
||||
if($this->app->viewType == 'json') $this->view->tasks = array_values($this->view->tasks);
|
||||
$this->display();
|
||||
|
||||
+5
-7
@@ -337,8 +337,9 @@ class myModel extends model
|
||||
if($objectType == 'task')
|
||||
{
|
||||
$orderBy = strpos($orderBy, 'pri_') !== false ? str_replace('pri_', 'priOrder_', $orderBy) : 't1.' . $orderBy;
|
||||
$objectList = $this->dao->select("t1.*, t2.name as executionName, t2.type as executionType, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")->from($this->config->objectTables[$module])->alias('t1')
|
||||
$objectList = $this->dao->select("t1.*, t3.id as project, t2.name as executionName, t2.multiple as executionMultiple, t3.name as projectName, t2.type as executionType, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")->from($this->config->objectTables[$module])->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on("t1.execution = t2.id")
|
||||
->leftJoin(TABLE_PROJECT)->alias('t3')->on("t2.project = t3.id")
|
||||
->where('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
->andWhere('t1.id')->in(array_keys($objectIDList))
|
||||
@@ -571,11 +572,11 @@ class myModel extends model
|
||||
$query = str_replace('t1.`project`', 't2.`project`', $query);
|
||||
|
||||
$orderBy = str_replace('pri_', 'priOrder_', $orderBy);
|
||||
$tasks = $this->dao->select("t1.*, t2.id as executionID, t2.name as executionName, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
|
||||
$tasks = $this->dao->select("t1.*, t4.id as project, t2.id as executionID, t2.name as executionName, t2.multiple as executionMultiple, t4.name as projectName, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on("t1.execution = t2.id")
|
||||
->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on("t1.project = t4.id")
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on("t2.project = t4.id")
|
||||
->leftJoin(TABLE_TASKTEAM)->alias('t5')->on("t1.id = t5.task")
|
||||
->where($query)
|
||||
->andWhere('t1.deleted')->eq(0)
|
||||
@@ -602,10 +603,7 @@ class myModel extends model
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', false);
|
||||
|
||||
$taskTeam = $this->dao->select('*')->from(TABLE_TASKTEAM)->where('task')->in(array_keys($tasks))->fetchGroup('task');
|
||||
if(!empty($taskTeam))
|
||||
{
|
||||
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
|
||||
}
|
||||
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
|
||||
|
||||
if($tasks) return $this->loadModel('task')->processTasks($tasks);
|
||||
return array();
|
||||
|
||||
@@ -69,12 +69,8 @@
|
||||
</th>
|
||||
<th class='c-pri' title=<?php echo $lang->task->pri;?>><?php common::printOrderLink('pri', $orderBy, $vars, $lang->priAB);?></th>
|
||||
<th class='c-name'><?php common::printOrderLink('name', $orderBy, $vars, $lang->task->name);?></th>
|
||||
<?php if($config->systemMode == 'new'):?>
|
||||
<th class='c-project'><?php common::printOrderLink('project', $orderBy, $vars, $lang->my->projects);?></th>
|
||||
<th class='c-project'><?php common::printOrderLink('execution', $orderBy, $vars, $lang->task->execution);?></th>
|
||||
<?php else:?>
|
||||
<th class='c-project'><?php common::printOrderLink('execution', $orderBy, $vars, $lang->my->executions);?></th>
|
||||
<?php endif;?>
|
||||
<?php if($type != 'openedBy'): ?>
|
||||
<th class='c-user-short'><?php common::printOrderLink('openedBy', $orderBy, $vars, $lang->openedByAB);?></th>
|
||||
<?php endif;?>
|
||||
@@ -122,14 +118,12 @@
|
||||
?>
|
||||
<?php if(!empty($task->children)) echo '<a class="task-toggle" data-id="' . $task->id . '"><i class="icon icon-angle-double-right"></i></a>';?>
|
||||
</td>
|
||||
<?php if($config->systemMode == 'new'):?>
|
||||
<?php $projectName = isset($projects[$task->execution]->name) ? $projects[$task->execution]->name : '';?>
|
||||
<?php $projectID = isset($projects[$task->execution]->id) ? $projects[$task->execution]->id : 0;?>
|
||||
<td class='c-project' title="<?php echo $projectName?>">
|
||||
<?php echo ($projectName and $projectID) ? html::a($this->createLink('project', 'index', "projectID=$projectID"), $projectName) : '';?>
|
||||
<td class='c-project' title="<?php echo $task->projectName?>">
|
||||
<?php echo ($task->projectName and $task->project) ? html::a($this->createLink('project', 'index', "projectID=$task->project"), $task->projectName) : '';?>
|
||||
</td>
|
||||
<td class='c-project' title="<?php if($task->executionMultiple) echo $task->executionName;?>">
|
||||
<?php if($task->executionMultiple) echo html::a($this->createLink('execution', 'task', "executionID=$task->execution"), $task->executionName, '');?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class='c-project' title="<?php echo $task->executionName;?>"><?php echo html::a($this->createLink('execution', 'task', "executionID=$task->execution"), $task->executionName, '');?></td>
|
||||
<?php if($type != 'openedBy'): ?>
|
||||
<td class='c-user'><?php echo zget($users, $task->openedBy);?></td>
|
||||
<?php endif;?>
|
||||
@@ -199,14 +193,12 @@
|
||||
<?php if($child->parent > 0) echo '<span class="label label-badge label-light">' . $this->lang->task->childrenAB . '</span> ';?>
|
||||
<?php echo html::a($this->createLink('task', 'view', "taskID=$child->id", '', '', $child->project), $child->name, null, "style='color: $child->color'");?>
|
||||
</td>
|
||||
<?php if($config->systemMode == 'new'):?>
|
||||
<?php $projectName = isset($projects[$child->execution]->name) ? $projects[$child->execution]->name : '';?>
|
||||
<?php $projectID = isset($projects[$child->execution]->id) ? $projects[$child->execution]->id : 0;?>
|
||||
<td class='c-project' title="<?php echo $projectName;?>">
|
||||
<?php echo ($projectName and $projectID) ? html::a($this->createLink('project', 'view', "projectID=$projectID"), $projectName) : '';?>
|
||||
<td class='c-project' title="<?php echo $task->projectName;?>">
|
||||
<?php echo ($task->projectName and $task->project) ? html::a($this->createLink('project', 'view', "projectID=$task->project"), $task->projectName) : '';?>
|
||||
</td>
|
||||
<td class='c-project' title="<?php if($child->executionMultiple) echo $child->projectName;?>">
|
||||
<?php if($child->executionMultiple) echo html::a($this->createLink('execution', 'task', "executionID=$child->project"), $child->executionName, '');?>
|
||||
</td>
|
||||
<?php endif;?>
|
||||
<td class='c-project' title="<?php echo $child->projectName;?>"><?php echo html::a($this->createLink('execution', 'task', "executionID=$child->project"), $child->executionName, '');?></td>
|
||||
<?php if($type != 'openedBy'): ?>
|
||||
<td class='c-user'><?php echo zget($users, $child->openedBy);?></td>
|
||||
<?php endif;?>
|
||||
|
||||
+3
-11
@@ -2595,11 +2595,11 @@ class taskModel extends model
|
||||
{
|
||||
if(!$this->loadModel('common')->checkField(TABLE_TASK, $type)) return array();
|
||||
$orderBy = str_replace('pri_', 'priOrder_', $orderBy);
|
||||
$tasks = $this->dao->select("t1.*, t2.id as executionID, t2.name as executionName, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
|
||||
$tasks = $this->dao->select("t1.*, t4.id as project, t2.id as executionID, t2.name as executionName, t4.name as projectName, t2.multiple as executionMultiple, t2.type as executionType, t3.id as storyID, t3.title as storyTitle, t3.status AS storyStatus, t3.version AS latestStoryVersion, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder")
|
||||
->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_EXECUTION)->alias('t2')->on("t1.execution = t2.id")
|
||||
->leftJoin(TABLE_STORY)->alias('t3')->on('t1.story = t3.id')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on("t1.project = t4.id")
|
||||
->leftJoin(TABLE_PROJECT)->alias('t4')->on("t2.project = t4.id")
|
||||
->leftJoin(TABLE_TASKTEAM)->alias('t5')->on("t5.task = t1.id and t5.account = '{$account}'")
|
||||
->where('t1.deleted')->eq(0)
|
||||
->andWhere('t2.deleted')->eq(0)
|
||||
@@ -2625,15 +2625,7 @@ class taskModel extends model
|
||||
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'task', false);
|
||||
|
||||
$taskTeam = $this->dao->select('*')->from(TABLE_TASKTEAM)->where('task')->in(array_keys($tasks))->fetchGroup('task');
|
||||
if(!empty($taskTeam))
|
||||
{
|
||||
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
|
||||
}
|
||||
|
||||
$projectList = array();
|
||||
foreach($tasks as $task) $projectList[$task->project] = $task->project;
|
||||
$projectPairs = $this->dao->select('id,name')->from(TABLE_PROJECT)->where('id')->in($projectList)->fetchPairs('id');
|
||||
foreach($tasks as $task) $task->projectName = zget($projectPairs, $task->project);
|
||||
foreach($taskTeam as $taskID => $team) $tasks[$taskID]->team = $team;
|
||||
|
||||
if($tasks) return $this->processTasks($tasks);
|
||||
return array();
|
||||
|
||||
Reference in New Issue
Block a user