diff --git a/module/execution/control.php b/module/execution/control.php index ff422d0e42..dc9d109154 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -771,7 +771,7 @@ class execution extends control $storyBugs = $this->loadModel('bug')->getStoryBugCounts($storyIdList, $executionID); $storyCases = $this->loadModel('testcase')->getStoryCaseCounts($storyIdList); - $plans = $this->execution->getPlans($products); + $plans = $this->execution->getPlans($products, true, true); $allPlans = array('' => ''); if(!empty($plans)) { diff --git a/module/execution/model.php b/module/execution/model.php index fec5d73cf0..79c404459c 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3667,14 +3667,14 @@ class executionModel extends model * Get plans by $productID. * * @param int|array $productID - * + * @param bool $skipParent * @return mixed */ - public function getPlans($products) + public function getPlans($products, $skipParent = false, $withMainPlan = false) { $this->loadModel('productplan'); - $branchIDList = array(); + $branchIDList = $withMainPlan ? array(BRANCH_MAIN) : array(); foreach($products as $product) { foreach($product->branches as $branchID) $branchIDList[$branchID] = $branchID; @@ -3684,6 +3684,7 @@ class executionModel extends model ->where('product')->in(array_keys($products)) ->andWhere('deleted')->eq(0) ->andWhere('branch')->in($branchIDList)->fi() + ->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi() ->orderBy('begin desc') ->fetchAll('id');