diff --git a/module/bug/model.php b/module/bug/model.php index 7ebe14adae..f20a1d0af6 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2499,7 +2499,7 @@ class bugModel extends model } $allBranch = "`branch` = 'all'"; - if($branch !== 'all' and $branch !== '' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in('$branch')"; + if($branch !== 'all' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in($branch)"; if(strpos($bugQuery, $allBranch) !== false) $bugQuery = str_replace($allBranch, '1', $bugQuery); $allProject = "`project` = 'all'"; @@ -2519,7 +2519,6 @@ 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,{$this->session->planBranch}")->fi() ->andWhere('deleted')->eq(0) ->orderBy($orderBy)->page($pager)->fetchAll(); return $bugs; diff --git a/module/product/control.php b/module/product/control.php index 520aa35e46..6fd021e776 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -226,7 +226,6 @@ class product extends control $this->session->set('currentProductType', $product->type); $productBranches = $product->type != 'normal' ? $this->loadModel('execution')->getBranchByProduct($product->id, $projectID) : array(); $branches = isset($productBranches[$product->id]) ? $productBranches[$product->id] : array(); - } $this->products = $this->product->getProducts($projectID, 'all', '', false); diff --git a/module/productplan/control.php b/module/productplan/control.php index 1e42d0b49d..751e2f822b 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -425,8 +425,7 @@ class productplan extends control if($browseType == 'bySearch') { - $this->session->set('planBranch', $plan->branch); - $allStories = $this->story->getBySearch($plan->product, '', $queryID, 'id', '', 'story', array_keys($planStories), $pager); + $allStories = $this->story->getBySearch($plan->product, $plan->branch ? "0,{$plan->branch}" : 0, $queryID, 'id', '', 'story', array_keys($planStories), $pager); } else { @@ -567,12 +566,11 @@ class productplan extends control if($browseType == 'bySearch') { - $this->session->set('planBranch', $plan->branch); - $allBugs = $this->bug->getBySearch($productID, '', $queryID, 'id_desc', array_keys($planBugs), $pager); + $allBugs = $this->bug->getBySearch($productID, $plan->branch ? "0,{$plan->branch}" : 0, $queryID, 'id_desc', array_keys($planBugs), $pager); } else { - $allBugs = $this->bug->getActiveBugs($productID, "0,$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/productplan/model.php b/module/productplan/model.php index 6f9e4bd3e7..d009c67639 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -221,6 +221,7 @@ class productplanModel extends model $plans = $this->dao->select('id,title,parent,begin,end')->from(TABLE_PRODUCTPLAN) ->where('product')->in($product) ->andWhere('deleted')->eq(0) + ->andWhere('end')->ge($date) ->beginIF($branch !== 'all' or $branch !== '')->andWhere("branch")->in($branch)->fi() ->beginIF($skipParent)->andWhere('parent')->ne(-1)->fi() ->orderBy('begin desc') diff --git a/module/story/model.php b/module/story/model.php index d89f0d511f..481d9af9b3 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2476,7 +2476,7 @@ class storyModel extends model } elseif($branch) { - if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` in('$branch')"; + if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` in($branch)"; } $storyQuery = preg_replace("/`plan` +LIKE +'%([0-9]+)%'/i", "CONCAT(',', `plan`, ',') LIKE '%,$1,%'", $storyQuery);