* Adjust code.

This commit is contained in:
leiyong
2020-12-02 08:17:42 +08:00
parent 033a2ae97d
commit 8ad0cfa4ba
2 changed files with 52 additions and 17 deletions
+25 -8
View File
@@ -785,7 +785,7 @@ class productModel extends model
* @access public
* @return array
*/
public function getExecutionPairsByProduct($productID, $branch = 0, $orderBy = 'id_asc,path_asc')
public function getExecutionPairsByProduct($productID, $branch = 0, $orderBy = 'id_asc')
{
if(!$this->session->PRJ || !$productID) return array();
@@ -799,25 +799,42 @@ class productModel extends model
->orderBy($orderBy)
->fetchAll('id');
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
$project = $this->loadModel('program')->getPRJByID($this->session->PRJ);
$executionList = array('0' => '');
/* The waterfall project needs to show the hierarchy and remove the parent stage. */
if($project->model == 'waterfall')
{
foreach($executions as $execution)
foreach($executions as $id => $execution)
{
if($execution->parent and isset($executions[$execution->parent])) $executions[$execution->id]->name = $executions[$execution->parent]->name . '/' . $execution->name;
if($execution->grade == 2 and isset($executions[$execution->parent]))
{
$execution->name = $executions[$execution->parent]->name . '/' . $execution->name;
$executions[$execution->parent]->children[$id] = $execution->name;
unset($executions[$id]);
}
}
foreach($executions as $execution) if($execution->grade == 2) unset($executions[$execution->parent]);
foreach($executions as $execution)
{
if(isset($execution->children))
{
$executionList = array_merge($executionList, $execution->children);
continue;
}
$executionList[$execution->id] = $execution->name;
}
}
else
{
foreach($executions as $execution) $executionList[$execution->id] = $execution->name;
}
$executionList = array('0' => '');
foreach($executions as $execution) $executionList[$execution->id] = $execution->name;
return $executionList;
}
/**
* Get roadmap of a proejct
* Get roadmap of a proejct.
*
* @param int $productID
* @param int $branch
+27 -9
View File
@@ -1026,6 +1026,7 @@ class projectModel extends model
->fetchAll('id');
$project = $this->loadModel('program')->getPRJByID($projectID);
$executionList = array();
if($project->model == 'waterfall')
{
$executionProducts = $this->dao->select('t1.project,t1.product')->from(TABLE_PROJECTPRODUCT)->alias('t1')
@@ -1036,27 +1037,44 @@ class projectModel extends model
$products = $this->loadModel('product')->getProductPairsByProject($projectID);
foreach($executions as $executionID => $execution)
foreach($executions as $id => $execution)
{
if($execution->parent and isset($executions[$execution->parent])) $executions[$execution->id]->name = $executions[$execution->parent]->name . '/' . $execution->name;
if($execution->grade == 2 and isset($executions[$execution->parent]))
{
$execution->name = $executions[$execution->parent]->name . '/' . $execution->name;
$executions[$execution->parent]->children[$id] = $execution;
unset($executions[$id]);
}
}
foreach($executions as $executionID => $execution)
foreach($executions as $id => $execution)
{
if($execution->grade == 2) unset($executions[$execution->parent]);
$linkProductID = $executionProducts[$executionID];
$execution->name = $products[$linkProductID] . '/' . $execution->name;
if(isset($execution->children))
{
foreach($execution->children as $id => $execution)
{
$linkProductID = $executionProducts[$id];
$execution->name = $products[$linkProductID] . '/' . $execution->name;
$executionList[$id] = $execution;
}
}
else
{
$linkProductID = $executionProducts[$id];
$execution->name = $products[$linkProductID] . '/' . $execution->name;
$executionList[$id] = $execution;
}
}
}
if($pairs)
{
$executionPairs = array();
foreach($executions as $execution) $executionPairs[$execution->id] = $execution->name;
$executions = $executionPairs;
foreach($executionList as $execution) $executionPairs[$execution->id] = $execution->name;
$executionList = $executionPairs;
}
return $executions;
return $executionList;
}
/**