* Code for task #83947.

This commit is contained in:
Yagami
2023-02-08 10:24:01 +08:00
parent d23966be45
commit 3673d7f4b0
2 changed files with 43 additions and 2 deletions
+41
View File
@@ -1720,6 +1720,47 @@ class executionModel extends model
->beginIF($limit)->limit($limit)->fi()
->fetchAll('id');
/* Add product name and parent stage name to stage name. */
if(isset($project->model) and $project->model == 'waterfall')
{
$executionProducts = array();
if($project->hasProduct and $project->division)
{
$executionList = array();
$executionProducts = $this->dao->select('t1.project, t2.name')->from(TABLE_PROJECTPRODUCT)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product=t2.id')
->where('project')->in(array_keys($executions))
->andWhere('t2.deleted')->eq(0)
->fetchPairs();
}
$allExecutions = $this->dao->select('id,name,parent')->from(TABLE_EXECUTION)
->where('type')->eq('stage')
->andWhere('deleted')->eq('0')
->beginIf($projectID)->andWhere('project')->eq($projectID)->fi()
->fetchAll('id');
$parents = array();
foreach($allExecutions as $id => $execution) $parents[$execution->parent] = $execution->parent;
foreach($executions as $id => $execution)
{
if(isset($parents[$execution->id]))
{
unset($executions[$id]);
continue;
}
$executionName = '';
$paths = array_slice(explode(',', trim($execution->path, ',')), 1);
foreach($paths as $path) $executionName .= '/' . $allExecutions[$path]->name;
if($executionName) $execution->name = ltrim($executionName, '/');
if(isset($executionProducts[$id])) $execution->name = $executionProducts[$id] . '/' . $execution->name;
}
}
$projects = array();
if(empty($projectID))
{
+2 -2
View File
@@ -300,7 +300,7 @@ class task extends control
if(!empty($projectID))
{
$executions = $this->execution->getPairs($projectID, 'all', 'leaf');
$executions = $this->execution->getByProject($projectID, 'all', 0, true);
$executionKey = 0;
$executionModifyList = $this->execution->getByIdList(array_keys($executions));
@@ -625,7 +625,7 @@ class task extends control
if(isset($this->view->members['closed']) or $this->view->task->status == 'closed') $this->view->members['closed'] = 'Closed';
$executions = array();
if(!empty($task->project)) $executions = $this->execution->getPairs($task->project, 'all', 'leaf');
if(!empty($task->project)) $executions = $this->execution->getByProject($projectID, 'all', 0, true);
$this->view->title = $this->lang->task->edit . 'TASK' . $this->lang->colon . $this->view->task->name;
$this->view->position[] = $this->lang->task->common;