* Fix bug #35695.
This commit is contained in:
@@ -1456,6 +1456,8 @@ class programModel extends model
|
||||
$projects = $this->getProjectList($programID, $browseType, $queryID, $orderBy, $pager, $programTitle, $involved, $queryAll);
|
||||
if(empty($projects)) return array();
|
||||
|
||||
$leftTasks = ($this->cookie->projectType and $this->cookie->projectType == 'bycard') ? $this->loadModel('project')->getProjectLeftTasks(array_keys($projects)) : array();
|
||||
|
||||
/* Get the members of project teams. */
|
||||
$teamMembers = $this->dao->select('t1.root,t1.account')->from(TABLE_TEAM)->alias('t1')
|
||||
->leftJoin(TABLE_USER)->alias('t2')->on('t1.account=t2.account')
|
||||
@@ -1465,7 +1467,7 @@ class programModel extends model
|
||||
->fetchGroup('root', 'account');
|
||||
|
||||
/* Process projects. */
|
||||
foreach($projects as $key => $project)
|
||||
foreach($projects as $projectID => $project)
|
||||
{
|
||||
if($project->end == '0000-00-00') $project->end = '';
|
||||
|
||||
@@ -1476,12 +1478,13 @@ class programModel extends model
|
||||
if($delay > 0) $project->delay = $delay;
|
||||
}
|
||||
|
||||
$project->teamMembers = isset($teamMembers[$project->id]) ? array_keys($teamMembers[$project->id]) : array();
|
||||
$project->teamMembers = isset($teamMembers[$projectID]) ? array_keys($teamMembers[$projectID]) : array();
|
||||
$project->leftTasks = isset($leftTasks[$projectID]) ? $leftTasks[$projectID]->tasks : '—';
|
||||
|
||||
/* Convert predefined HTML entities to characters. */
|
||||
$project->name = htmlspecialchars_decode($project->name, ENT_QUOTES);
|
||||
|
||||
$stats[$key] = $project;
|
||||
$stats[$projectID] = $project;
|
||||
}
|
||||
|
||||
return $stats;
|
||||
|
||||
@@ -3178,4 +3178,30 @@ class projectModel extends model
|
||||
|
||||
return $repoPairs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get project left tasks for project browseByCard view.
|
||||
*
|
||||
* @param array $projectIdList
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getProjectLeftTasks($projectIdList)
|
||||
{
|
||||
$executionIdList = $this->dao->select('id')->from(TABLE_EXECUTION)
|
||||
->where('deleted')->eq(0)
|
||||
->andWhere('project')->in($projectIdList)
|
||||
->andWhere('type')->in('sprint,stage,kanban')
|
||||
->fetchPairs('id');
|
||||
|
||||
$leftTasks = $this->dao->select('t2.parent as project, count(*) as tasks')->from(TABLE_TASK)->alias('t1')
|
||||
->leftJoin(TABLE_PROJECT)->alias('t2')->on('t1.execution = t2.id')
|
||||
->where('t1.execution')->in($executionIdList)
|
||||
->andWhere('t1.status')->notIn('cancel,closed')
|
||||
->groupBy('t2.parent')
|
||||
->fetchAll('project');
|
||||
|
||||
return $leftTasks;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@
|
||||
<div class='row'>
|
||||
<div class='col-xs-4'>
|
||||
<div><span class='statistics-title'><?php echo $lang->project->progress;?></span></div>
|
||||
<?php echo html::ring($project->hours->progress); ?>
|
||||
<?php echo html::ring($project->progress); ?>
|
||||
</div>
|
||||
<div class='col-xs-4'>
|
||||
<span class='statistics-title'><?php echo $lang->project->leftTasks;?></span>
|
||||
|
||||
Reference in New Issue
Block a user