diff --git a/module/execution/control.php b/module/execution/control.php index f88607269c..b1d1b6373a 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1310,7 +1310,7 @@ class execution extends control ->where('t1.id')->eq($plan->product) ->fetchAll('id'); - $productPlan = $this->loadModel('productplan')->getPairsForStory($plan->product, $plan->branch, 'skipParent|unexpired'); + $productPlan = $this->loadModel('productplan')->getPairsForStory($plan->product, $plan->branch, 'skipParent|unexpired|withMainPlan'); $linkedBranches = array(); $linkedBranches[$plan->product][$plan->branch] = $plan->branch; @@ -2494,7 +2494,7 @@ class execution extends control $this->loadModel('branch'); foreach($products as $product) { - $productModules = $this->tree->getOptionMenu($product->id, 'story', 0, $branches[$product->id]); + $productModules = $this->tree->getOptionMenu($product->id, 'story', 0, array_keys($branches[$product->id])); foreach($productModules as $branch => $branchModules) { foreach($branchModules as $moduleID => $moduleName) $modules[$moduleID] = ((count($products) >= 2 and $moduleID != 0) ? $product->name : '') . $moduleName; diff --git a/module/productplan/control.php b/module/productplan/control.php index d4b9af2f32..94cd89499e 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -430,8 +430,8 @@ class productplan extends control else { $this->config->product->search['fields']['branch'] = $this->lang->product->branch; - $branch = $this->loadModel('branch')->getById($plan->branch); - $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branch->name); + $branchName = $this->loadModel('branch')->getById($plan->branch); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branchName); $this->config->product->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->product->search); @@ -573,8 +573,8 @@ class productplan extends control else { $this->config->bug->search['fields']['branch'] = $this->lang->product->branch; - $branch = $this->loadModel('branch')->getById($plan->branch); - $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branch->name); + $branchName = $this->loadModel('branch')->getById($plan->branch); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branchName); $this->config->bug->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->bug->search); diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index 3cb2786f02..e6554f8cbb 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -470,8 +470,8 @@ class projectrelease extends control $this->config->product->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=story&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); $this->config->product->search['queryID'] = $queryID; $this->config->product->search['style'] = 'simple'; - $this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product)); - $this->config->product->search['params']['module']['values'] = $this->tree->getOptionMenu($release->product, $viewType = 'story', $startModuleID = 0); + $this->config->product->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($release->product, $release->branch, 'skipParent|withMainPlan'); + $this->config->product->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, 'story', 0, $release->branch);; $this->config->product->search['params']['status'] = array('operator' => '=', 'control' => 'select', 'values' => $this->lang->story->statusList); if($release->productType == 'normal') { @@ -481,8 +481,8 @@ class projectrelease extends control else { $this->config->product->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$release->productType]); - $branches = array('' => '') + $this->loadModel('branch')->getPairs($release->product, 'noempty'); - if($release->branch) $branches = array('' => '', $release->branch => $branches[$release->branch]); + $branchName = $this->loadModel('branch')->getById($release->branch); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $release->branch => $branchName); $this->config->product->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->product->search); @@ -493,7 +493,7 @@ class projectrelease extends control } else { - $allStories = $this->story->getExecutionStories($build->execution, 0, 0, 't1.`order`_desc', 'byProduct', $release->product, 'story', $release->stories, $pager); + $allStories = $this->story->getExecutionStories($build->execution, $release->product, 0, 't1.`order`_desc', 'byBranch', $release->branch, 'story', $release->stories, $pager); } $this->view->allStories = $allStories; @@ -585,12 +585,13 @@ class projectrelease extends control $this->loadModel('bug'); $queryID = ($browseType == 'bysearch') ? (int)$param : 0; unset($this->config->bug->search['fields']['product']); + unset($this->config->bug->search['fields']['project']); $this->config->bug->search['actionURL'] = $this->createLink('projectrelease', 'view', "releaseID=$releaseID&type=$type&link=true¶m=" . helper::safe64Encode('&browseType=bySearch&queryID=myQueryID')); $this->config->bug->search['queryID'] = $queryID; $this->config->bug->search['style'] = 'simple'; - $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getForProducts(array($release->product => $release->product)); - $this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, $viewType = 'bug', $startModuleID = 0); - $this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, 0, 'id_desc', $release->project); + $this->config->bug->search['params']['plan']['values'] = $this->loadModel('productplan')->getPairsForStory($release->product, $release->branch, 'skipParent|withMainPlan'); + $this->config->bug->search['params']['module']['values'] = $this->loadModel('tree')->getOptionMenu($release->product, 'bug', 0, $release->branch); + $this->config->bug->search['params']['execution']['values'] = $this->loadModel('product')->getExecutionPairsByProduct($release->product, $release->branch, 'id_desc', $release->project); $this->config->bug->search['params']['openedBuild']['values'] = $this->loadModel('build')->getProductBuildPairs($release->product, $branch = 0, $params = ''); $this->config->bug->search['params']['resolvedBuild']['values'] = $this->config->bug->search['params']['openedBuild']['values']; if($release->productType == 'normal') @@ -601,8 +602,8 @@ class projectrelease extends control else { $this->config->bug->search['fields']['branch'] = sprintf($this->lang->product->branch, $this->lang->product->branchName[$release->productType]); - $branches = array('' => '') + $this->loadModel('branch')->getPairs($release->product, 'noempty'); - if($release->branch) $branches = array('' => '', $release->branch => $branches[$release->branch]); + $branchName = $this->loadModel('branch')->getById($release->branch); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $release->branch => $branchName); $this->config->bug->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->bug->search); diff --git a/module/release/control.php b/module/release/control.php index 3dd8430aa3..cb129661fb 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -430,19 +430,19 @@ class release extends control else { $this->config->product->search['fields']['branch'] = $this->lang->product->branch; - $branch = $this->loadModel('branch')->getById($release->branch); - $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $release->branch => $branch->name); + $branchName = $this->loadModel('branch')->getById($release->branch); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $release->branch => $branchName); $this->config->product->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->product->search); - if($browseType == 'bySearch') + if($browseType == 'bySearch' or $build->execution == 0) { $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $build->execution ? $build->execution : '', 'story', $release->stories, $pager); } else { - $allStories = $this->story->getExecutionStories($build->execution, 0, 0, 't1.`order`_desc', 'byProduct', $release->product, 'story', $release->stories, $pager); + $allStories = $this->story->getExecutionStories($build->execution, $build->product, 0, 't1.`order`_desc', 'byBranch', $release->branch, 'story', $release->stories, $pager); } $this->view->allStories = $allStories; @@ -550,8 +550,8 @@ class release extends control else { $this->config->bug->search['fields']['branch'] = $this->lang->product->branch; - $branch = $this->loadModel('branch')->getById($release->branch); - $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $release->branch => $branch->name); + $branchName = $this->loadModel('branch')->getById($release->branch); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $release->branch => $branchName); $this->config->bug->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->bug->search); diff --git a/module/story/model.php b/module/story/model.php index b486a0ee42..ef85b0498d 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2453,12 +2453,11 @@ class storyModel extends model $allBranch = "`branch` = 'all'"; if($executionID != '') { - $branches = array(); - foreach($products as $product) + $branches = array(BRANCH_MAIN => BRANCH_MAIN); + if($branch === '') { - if($product->type != 'normal') + foreach($products as $product) { - $branches[BRANCH_MAIN] = BRANCH_MAIN; foreach($product->branches as $branchID) { if($branch == BRANCH_MAIN and $branchID) continue; @@ -2466,7 +2465,13 @@ class storyModel extends model } } } + else + { + $branches[$branch] = $branch; + } $branches = join(',', $branches); + + if($this->app->moduleName == 'release') $branches = $branch; $storyQuery .= " AND `branch`" . helper::dbIN($branches); if($this->app->moduleName == 'release' or $this->app->moduleName == 'build')