diff --git a/module/build/control.php b/module/build/control.php index 50a6307618..54adc1462a 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -72,7 +72,7 @@ class build extends control if($this->app->tab == 'project') { $this->project->setMenu($projectID); - $executions = $this->execution->getPairs($projectID, 'all', 'stagefilter'); + $executions = $this->execution->getPairs($projectID, 'all', 'stagefilter|leaf'); $executionID = empty($executionID) ? key($executions) : $executionID; $productGroups = $executionID ? $this->product->getProducts($executionID) : array(); $branchGroups = $executionID ? $this->project->getBranchesByProject($executionID) : array(); @@ -81,7 +81,7 @@ class build extends control elseif($this->app->tab == 'execution') { $execution = $this->execution->getByID($executionID); - $executions = $this->execution->getPairs($execution->project); + $executions = $this->execution->getPairs($execution->project, 'all', 'leaf'); $projectID = $execution->project; $productGroups = $this->product->getProducts($executionID); $branchGroups = $this->project->getBranchesByProject($executionID); @@ -92,7 +92,7 @@ class build extends control { $execution = $this->execution->getByID($executionID); $projectID = $execution ? $execution->project : 0; - $executions = $this->execution->getPairs($projectID); + $executions = $this->execution->getPairs($projectID, 'all', 'leaf'); $productGroups = $this->product->getProducts($executionID); $branchGroups = $this->project->getBranchesByProject($executionID); } diff --git a/module/execution/model.php b/module/execution/model.php index 0dcb765c03..8693a170a7 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1287,7 +1287,7 @@ class executionModel extends model * * @param int $projectID * @param string $type all|sprint|stage|kanban - * @param string $mode all|noclosed|stagefilter|withdelete|multiple or empty + * @param string $mode all|noclosed|stagefilter|withdelete|multiple|leaf or empty * @access public * @return array */ @@ -1324,16 +1324,34 @@ class executionModel extends model ->orderBy($orderBy) ->fetchAll(); + /* If mode == leaf, only show leaf executions. */ + $allExecutions = $this->dao->select('id,name,parent')->from(TABLE_EXECUTION) + ->where('type')->notin(array('program', 'project')) + ->beginIf($projectId)->andWhere('project')->eq($projectID)->fi() + ->fetchAll('id'); + + $parents = array(); + foreach($allExecutions as $exec) + { + $parents[$exec->parent] = true; + } + $pairs = array(); $noMultiples = array(); foreach($executions as $execution) { + if(strpos($mode, 'leaf') !== false and isset($parents[$execution->id])) continue; // Only show leaf. if(strpos($mode, 'noclosed') !== false and ($execution->status == 'done' or $execution->status == 'closed')) continue; if(strpos($mode, 'stagefilter') !== false and isset($executionModel) and $executionModel == 'waterfall' and in_array($execution->attribute, array('request', 'design', 'review'))) continue; // Some stages of waterfall not need. if(empty($execution->multiple)) $noMultiples[$execution->id] = $execution->project; - $pairs[$execution->id] = $execution->name; + /* Set execution name. */ + $paths = array_slice(explode(',', trim($execution->path, ',')), 1); + $executionName = ''; + foreach($paths as $path) $executionName .= '/' . $allExecutions[$path]->name; + + $pairs[$execution->id] = $executionName; } if($noMultiples)