diff --git a/module/bug/model.php b/module/bug/model.php index 5ab908f07d..489dd1e6e8 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2519,6 +2519,7 @@ class bugModel extends model ->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi() ->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi() ->beginIF($projectID)->andWhere('project')->eq($projectID)->fi() + ->beginIF($this->app->rawModule == 'productplan' and $this->app->rawMethod == 'linkbug')->andWhere('branch')->in("0,$branch")->fi() ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); return $bugs; diff --git a/module/productplan/control.php b/module/productplan/control.php index 1ebc0c861e..72ffc664e4 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -415,8 +415,8 @@ class productplan extends control else { $this->config->product->search['fields']['branch'] = $this->lang->product->branch; - $branches = array('' => '') + $this->loadModel('branch')->getPairs($plan->product); - if($plan->branch) $branches = array('' => '', $plan->branch => $branches[$plan->branch]); + $branches = $this->loadModel('branch')->getPairs($plan->product); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branches[$plan->branch]); $this->config->product->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->product->search); @@ -425,6 +425,7 @@ class productplan extends control if($browseType == 'bySearch') { + $this->session->set('planBranch', $plan->branch); $allStories = $this->story->getBySearch($plan->product, $plan->branch, $queryID, 'id', '', 'story', array_keys($planStories), $pager); } else @@ -556,8 +557,8 @@ class productplan extends control else { $this->config->bug->search['fields']['branch'] = $this->lang->product->branch; - $branches = array('' => '') + $this->loadModel('branch')->getPairs($productID); - if($plan->branch) $branches = array('' => '', $plan->branch => $branches[$plan->branch]); + $branches = $this->loadModel('branch')->getPairs($productID); + $branches = array('' => '', BRANCH_MAIN => $this->lang->branch->main, $plan->branch => $branches[$plan->branch]); $this->config->bug->search['params']['branch']['values'] = $branches; } $this->loadModel('search')->setSearchParams($this->config->bug->search); @@ -570,7 +571,7 @@ class productplan extends control } else { - $allBugs = $this->bug->getActiveBugs($this->view->product->id, $plan->branch, $executions, array_keys($planBugs), $pager); + $allBugs = $this->bug->getActiveBugs($productID, "0,$plan->branch", $executions, array_keys($planBugs), $pager); } $this->view->allBugs = $allBugs; diff --git a/module/story/model.php b/module/story/model.php index 445e006c34..d89f0d511f 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2507,6 +2507,7 @@ class storyModel extends model ->leftJoin(TABLE_PROJECTSTORY)->alias('t2')->on('t1.id=t2.story') ->where($sql) ->beginIF($productID != 'all' and $productID != '')->andWhere('t1.`product`')->eq((int)$productID)->fi() + ->beginIF($this->app->rawModule == 'productplan' and $this->app->rawMethod == 'linkstory')->andWhere('t1.`branch`')->in("0,{$this->session->planBranch}")->fi() ->andWhere('t1.deleted')->eq(0) ->andWhere('t1.type')->eq($type) ->orderBy($orderBy)