This commit is contained in:
tianshujie98
2021-02-20 16:02:03 +08:00
102 changed files with 1175 additions and 269 deletions
+22 -6
View File
@@ -276,12 +276,18 @@ class projectModel extends model
*/
public function saveState($executionID, $executions)
{
/* When the cookie and session do not exist, get it from the database. */
if(empty($executionID) && isset($this->config->project->lastExecution) && isset($executions[$this->config->project->lastExecution]))
{
$this->session->set('project', $this->config->project->lastExecution);
return $this->session->project;
}
if($executionID > 0) $this->session->set('project', (int)$executionID);
if($executionID == 0 and $this->cookie->lastProject)
{
/* Project link is project-task. */
$executionID = (int)$this->cookie->lastProject;
$executions = $this->getExecutionPairs($this->session->PRJ);
$executionID = in_array($executionID, array_keys($executions)) ? $executionID : key($executions);
$this->session->set('project', $executionID);
}
@@ -3594,7 +3600,7 @@ class projectModel extends model
->beginIF(!$this->app->user->admin)->andWhere('t1.project')->in($this->app->user->view->projects)->fi()
->andWhere('t1.status')->ne('closed')
->andWhere('t1.deleted')->eq('0')
->orderBy('id_desc')
->orderBy('project_desc, id_desc')
->fetchAll();
/* Get the project or product to which the execution belongs. */
@@ -3602,19 +3608,29 @@ class projectModel extends model
$stageIdList = array();
foreach($executions as $execution)
{
if($execution->type == 'stage') $stageIdList[$execution->id] = $execution->id;
if($execution->type == 'sprint') $projectIdList[$execution->project] = $execution->project;
if($execution->type == 'stage') $stageIdList[$execution->id] = $execution->id;
$projectIdList[$execution->project] = $execution->project;
}
$projectPairs = $this->loadModel('program')->getPRJPairsByIdList($projectIdList);
$productPairs = $this->getStageLinkProductPairs($stageIdList);
$recentExecutions = isset($this->config->project->recentExecutions) ? explode(',', $this->config->project->recentExecutions) : array();
$allExecution = array('recent' => array(), 'mine' => array());
foreach($executions as $execution)
{
if($execution->type == 'stage') $execution->name = zget($productPairs, $execution->id) . '/' . $execution->name;
if($execution->type == 'stage') $execution->name = zget($projectPairs, $execution->project) . '/' . zget($productPairs, $execution->id) . '/' . $execution->name;
if($execution->type == 'sprint') $execution->name = zget($projectPairs, $execution->project) . '/' . $execution->name;
if(in_array($execution->id, $recentExecutions))
{
$index = array_search($execution->id, $recentExecutions);
$allExecution['recent'][$index] = $execution;
continue;
}
$allExecution['mine'][] = $execution;
}
return $executions;
ksort($allExecution['recent']);
return $allExecution;
}
/**