* Add a param for story-getBySearch.

This commit is contained in:
songchenxuan
2023-08-04 11:05:59 +08:00
parent 60a752b4fb
commit 01fd8cc08c
6 changed files with 12 additions and 9 deletions

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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
{

View File

@@ -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);