diff --git a/module/build/control.php b/module/build/control.php index c4521f736b..5455966554 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -666,7 +666,7 @@ class build extends control $executionID = $build->execution ? $build->execution : $build->project; if($browseType == 'bySearch') { - $allStories = $this->story->getBySearch($build->product, $build->branch, $queryID, 'id', $executionID, 'story', $build->allStories, $pager); + $allStories = $this->story->getBySearch($build->product, $build->branch, $queryID, 'id', $executionID, 'story', $build->allStories, '', $pager); } else { diff --git a/module/mr/control.php b/module/mr/control.php index 6d5f6e3b4d..eb88e31279 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -660,7 +660,7 @@ class mr extends control $linkedStories = $this->mr->getLinkList($MRID, $product->id, 'story'); if($browseType == 'bySearch') { - $allStories = $this->story->getBySearch($productID, 0, $queryID, 'id', '', 'story', array_keys($linkedStories), $pager); + $allStories = $this->story->getBySearch($productID, 0, $queryID, 'id', '', 'story', array_keys($linkedStories), '', $pager); } else { diff --git a/module/productplan/control.php b/module/productplan/control.php index c91f6428ca..6ca6c8a44f 100644 --- a/module/productplan/control.php +++ b/module/productplan/control.php @@ -711,7 +711,7 @@ class productplan extends control if($browseType == 'bySearch') { - $allStories = $this->story->getBySearch($plan->product, "0,{$plan->branch}", $queryID, 'id', '', 'story', array_keys($planStories), $pager); + $allStories = $this->story->getBySearch($plan->product, "0,{$plan->branch}", $queryID, 'id', '', 'story', array_keys($planStories), '', $pager); } else { @@ -858,7 +858,7 @@ class productplan extends control if($browseType == 'bySearch') { - $allBugs = $this->bug->getBySearch($productID, $plan->branch, $queryID, 'id_desc', array_keys($planBugs), $pager); + $allBugs = $this->bug->getBySearch($productID, $plan->branch, $queryID, 'id_desc', array_keys($planBugs), '', $pager); } else { diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index bb04ab8e33..edc21ae08c 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -631,7 +631,7 @@ class projectrelease extends control $allStories = array(); if($browseType == 'bySearch') { - $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $executionIdList, 'story', $release->stories, $pager); + $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $executionIdList, 'story', $release->stories, 'draft,reviewing,changing', $pager); } else { diff --git a/module/release/control.php b/module/release/control.php index b822e68dd3..2c2da63aa0 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -556,7 +556,7 @@ class release extends control if($browseType == 'bySearch') { - $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $executionIdList, 'story', $release->stories, $pager); + $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $executionIdList, 'story', $release->stories, 'draft,reviewing,changing', $pager); } else { diff --git a/module/story/model.php b/module/story/model.php index 6382f2f271..73fd82b57e 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2987,7 +2987,7 @@ class storyModel extends model if($browseType == 'bySearch') { - $stories2Link = $this->getBySearch($story->product, $story->branch, $queryID, 'id_desc', '', $tmpStoryType, $storyIDList, $pager); + $stories2Link = $this->getBySearch($story->product, $story->branch, $queryID, 'id_desc', '', $tmpStoryType, $storyIDList, '', $pager); } elseif($type != 'linkRelateSR' and $type != 'linkRelateUR') { @@ -3336,11 +3336,12 @@ class storyModel extends model * @param string $executionID * @param string $type requirement|story * @param string $excludeStories + * @param string $excludeStatus * @param object $pager * @access public * @return array */ - public function getBySearch($productID, $branch = '', $queryID = 0, $orderBy = '', $executionID = '', $type = 'story', $excludeStories = '', $pager = null) + public function getBySearch($productID, $branch = '', $queryID = 0, $orderBy = '', $executionID = '', $type = 'story', $excludeStories = '', $excludeStatus = '', $pager = null) { $this->loadModel('product'); $executionID = empty($executionID) ? 0 : $executionID; @@ -3368,6 +3369,7 @@ class storyModel extends model $storyQuery = $storyQuery . ' AND `product` ' . helper::dbIN(array_keys($products)); if($excludeStories) $storyQuery = $storyQuery . ' AND `id` NOT ' . helper::dbIN($excludeStories); + if($excludeStatus) $storyQuery = $storyQuery . ' AND `status` NOT ' . helper::dbIN($excludeStatus); if($this->app->moduleName == 'productplan') $storyQuery .= " AND `status` NOT IN ('closed') AND `parent` >= 0 "; $allBranch = "`branch` = 'all'"; if(!empty($executionID)) @@ -3411,7 +3413,7 @@ class storyModel extends model if($this->app->moduleName == 'release' or $this->app->moduleName == 'build') { - $storyQuery .= " AND `status` NOT IN ('draft', 'reviewing', 'changing')"; // Fix bug #990. + $storyQuery .= " AND `status` NOT IN ('draft')"; // Fix bug #990. } else { @@ -3428,6 +3430,7 @@ class storyModel extends model { if($branch and strpos($storyQuery, '`branch` =') === false) $storyQuery .= " AND `branch` " . helper::dbIN($branch); } + $storyQuery = preg_replace("/`plan` +LIKE +'%([0-9]+)%'/i", "CONCAT(',', `plan`, ',') LIKE '%,$1,%'", $storyQuery);