From 6d2a72a725c1e09ecb2d1cd5f3cec05bb5f35c6e Mon Sep 17 00:00:00 2001 From: sunguangming Date: Tue, 19 Mar 2024 15:50:14 +0800 Subject: [PATCH] * Finish task #113260. --- module/release/control.php | 5 +++-- module/release/zen.php | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/module/release/control.php b/module/release/control.php index 95cb169273..02afae870c 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -372,13 +372,14 @@ class release extends control /* Load pager. */ $this->app->loadClass('pager', true); $pager = new pager($recTotal, $recPerPage, $pageID); + $excludeStoryIdList = $this->releaseZen->getExcludeStoryIdList($release); if($browseType == 'bySearch') { - $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $executionIdList, 'story', $release->stories, 'draft,reviewing,changing', $pager); + $allStories = $this->story->getBySearch($release->product, $release->branch, $queryID, 'id', $executionIdList, 'story', $excludeStoryIdList, 'draft,reviewing,changing', $pager); } else { - $allStories = $this->story->batchGetExecutionStories(implode(',', $executionIdList), $release->product, 't1.`order`_desc', 'byBranch', $release->branch, 'story', $release->stories, $pager); + $allStories = $this->story->batchGetExecutionStories(implode(',', $executionIdList), $release->product, 't1.`order`_desc', 'byBranch', $release->branch, 'story', $excludeStoryIdList, $pager); } $this->view->allStories = $allStories; diff --git a/module/release/zen.php b/module/release/zen.php index e0a5b118af..ea3f5abf3b 100644 --- a/module/release/zen.php +++ b/module/release/zen.php @@ -155,6 +155,32 @@ class releaseZen extends release return $releaseQuery; } + /** + * 获取发布不可关联的需求ID列表。 + * Get the story id list that can not be linked to the release. + * + * @param object $release + * @access protected + * @return array + */ + public function getExcludeStoryIdList(object $release): array + { + $parentIdList = $this->dao->select('id')->from(TABLE_STORY) + ->where('product')->eq($release->product) + ->andWhere('type')->eq('story') + ->andWhere('isParent')->eq('1') + ->andWhere('status')->notIN('draft,reviewing,changing') + ->fetchPairs(); + + foreach(explode(',', $release->stories) as $storyID) + { + if(!$storyID) continue; + if(!isset($parentIdList[$storyID])) $parentIdList[$storyID] = $storyID; + } + + return $parentIdList; + } + /** * 生成的发布详情页面的需求数据。 * Generate the story data for the release view page.