* Solve the problem that the project field of the pending task list is 0.

This commit is contained in:
tianshujie
2022-03-04 09:04:02 +08:00
parent 740e692205
commit 6dc0d7a70d
4 changed files with 28 additions and 39 deletions
+26 -16
View File
@@ -408,13 +408,23 @@ EOF;
/* Get tasks. */
$tasks = $this->loadModel('task')->getUserTasks($this->app->user->account, $type, 0, $pager, $sort);
$parents = array();
$parents = array();
$executionIDList = 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')
{
$projectPairs = $this->dao->select('t2.id,t1.name')->from(TABLE_PROJECT)->alias('t1')
->leftJoin(TABLE_EXECUTION)->alias('t2')->on('t1.id=t2.parent')
->where('t2.id')->in($executionIDList)
->fetchPairs();
}
foreach($tasks as $task)
{
if($task->parent > 0)
@@ -436,21 +446,21 @@ EOF;
$this->app->loadLang('story');
/* Assign. */
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->task;
$this->view->position[] = $this->lang->my->task;
$this->view->tabID = 'task';
$this->view->tasks = $tasks;
$this->view->summary = $this->loadModel('execution')->summary($tasks);
$this->view->type = $type;
$this->view->kanbanList = $this->execution->getPairs(0, 'kanban');
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->orderBy = $orderBy;
$this->view->projects = $this->loadModel('project')->getPairsByProgram();
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->pager = $pager;
$this->view->mode = 'task';
$this->view->title = $this->lang->my->common . $this->lang->colon . $this->lang->my->task;
$this->view->position[] = $this->lang->my->task;
$this->view->tabID = 'task';
$this->view->tasks = $tasks;
$this->view->summary = $this->loadModel('execution')->summary($tasks);
$this->view->type = $type;
$this->view->kanbanList = $this->execution->getPairs(0, 'kanban');
$this->view->recTotal = $recTotal;
$this->view->recPerPage = $recPerPage;
$this->view->pageID = $pageID;
$this->view->orderBy = $orderBy;
$this->view->users = $this->loadModel('user')->getPairs('noletter');
$this->view->pager = $pager;
$this->view->mode = 'task';
$this->view->projectPairs = isset($projectPairs) ? $projectPairs : array();
if($this->app->viewType == 'json') $this->view->tasks = array_values($this->view->tasks);
$this->display();
+1 -1
View File
@@ -100,7 +100,7 @@
<?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'):?>
<td class='c-project' title="<?php echo $task->projectName;?>"><?php echo html::a($this->createLink('project', 'index', "projectID=$task->project"), $task->projectName);?></td>
<td class='c-project' title="<?php echo zget($projectPairs, $task->execution, '');?>"><?php echo html::a($this->createLink('project', 'index', "projectID=$task->project"), zget($projectPairs, $task->execution, ''));?></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'): ?>
+1 -1
View File
@@ -326,7 +326,7 @@ class taskModel extends model
$data[$i]->openedBy = $this->app->user->account;
$data[$i]->openedDate = $now;
$data[$i]->parent = $tasks->parent[$i];
$data[$i]->vision = isset($tasks->vision[$i]) ? $tasks->vision[$i] : 'common';
$data[$i]->vision = isset($tasks->vision[$i]) ? $tasks->vision[$i] : 'rnd';
if($story) $data[$i]->storyVersion = $this->loadModel('story')->getVersion($data[$i]->story);
if($assignedTo) $data[$i]->assignedDate = $now;
if(strpos($this->config->task->create->requiredFields, 'estStarted') !== false and empty($estStarted)) $data[$i]->estStarted = '';
-21
View File
@@ -461,7 +461,6 @@ class upgradeModel extends model
}
$this->deletePatch();
$this->adjustPRJ4Task();
return true;
}
@@ -5959,24 +5958,4 @@ class upgradeModel extends model
}
file_put_contents($filePath, $content);
}
/**
* Adjust the project field of the zt_task.
*
* @access public
* @return bool
*/
public function adjustPRJ4Task()
{
$executionPairs = $this->dao->select('id,project')->from(TABLE_PROJECT)->where('type')->in('sprint,stage,kanban')->fetchPairs();
$noProjectTasks = $this->dao->select('*')->from(TABLE_TASK)->where('project')->eq(0)->fetchAll('id');
foreach($noProjectTasks as $taskID => $task)
{
if(!$task->execution) continue;
$projectID = zget($executionPairs, $task->execution, 0);
$this->dao->update(TABLE_TASK)->set('project')->eq($projectID)->where('id')->eq($taskID)->exec();
}
return true;
}
}