From b2b4dc8fdaa24d41c5bec9f809fe2c09860a14ec Mon Sep 17 00:00:00 2001 From: tianshujie Date: Wed, 22 Jan 2025 10:19:52 +0800 Subject: [PATCH] * [bug#57252,done,1h] fix error problem with story drop-down range. --- module/bug/js/common.ui.js | 3 ++- module/bug/zen.php | 21 +++++++++++++++++++-- module/story/control.php | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/module/bug/js/common.ui.js b/module/bug/js/common.ui.js index 501f875f75..644af5f035 100644 --- a/module/bug/js/common.ui.js +++ b/module/bug/js/common.ui.js @@ -477,7 +477,8 @@ function loadProductStories(productID, storyID, moduleID = 0, executionID = 0) let branch = $('[name="branch"]').val(); if(typeof(branch) == 'undefined') branch = 0; - const link = $.createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=' + storyID + '&onlyOption=false&status=&limit=0&type=full&hasParent=0&executionID=' + executionID); + let oldStoryID = bug.module == moduleID ? bug.story : 0; + const link = $.createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=' + oldStoryID + '&onlyOption=false&status=active&limit=0&type=full&hasParent=0&executionID=' + executionID); $.getJSON(link, function(data) { let $storyPicker = $('[name="story"]').zui('picker'); diff --git a/module/bug/zen.php b/module/bug/zen.php index 2fe8595aab..347a42e877 100644 --- a/module/bug/zen.php +++ b/module/bug/zen.php @@ -1036,8 +1036,16 @@ class bugZen extends bug } else { - $stories = $this->story->getProductStoryPairs($productID, $branch, $moduleID, 'active,closed', 'id_desc', 0, '', 'story', false); + $moduleIdList = $moduleID; + if($moduleIdList) + { + $moduleIdList = $this->loadModel('tree')->getStoryModule($moduleIdList); + $moduleIdList = $this->tree->getAllChildID($moduleIdList); + } + + $stories = $this->story->getProductStoryPairs($productID, $branch, $moduleIdList, 'active,closed', 'id_desc', 0, '', 'story', false); } + if(!in_array($this->app->tab, array('execution', 'project')) and empty($stories)) $stories = $this->story->getProductStoryPairs($productID, $branch, 0, 'active', 'id_desc', 0, '', 'story', false); if(!isset($stories[$bug->storyID])) { @@ -1265,8 +1273,17 @@ class bugZen extends bug } else { - $stories = $this->story->getProductStoryPairs($bug->product, $bug->branch, 0, 'active,closed', 'id_desc', 0, '', 'story', false); + $moduleIdList = $bug->module; + if($moduleIdList) + { + $moduleIdList = $this->loadModel('tree')->getStoryModule($moduleIdList); + $moduleIdList = $this->tree->getAllChildID($moduleIdList); + } + + $stories = $this->story->getProductStoryPairs($bug->product, $bug->branch, $moduleIdList, 'active', 'id_desc', 0, '', 'story', false); } + if(!in_array($this->app->tab, array('execution', 'project')) and empty($stories)) $stories = $this->story->getProductStoryPairs($bug->product, $bug->branch, 0, 'active', 'id_desc', 0, '', 'story', false); + if(!isset($stories[$bug->story])) $stories[$bug->story] = $bug->story . ':' . $bug->storyTitle; $resolvedBuildPairs = $this->build->getBuildPairs(array($bug->product), $bug->branch, 'noempty'); $this->view->resolvedBuildPairs = $resolvedBuildPairs; diff --git a/module/story/control.php b/module/story/control.php index 4c0e05cf2c..912f0b0b2d 100755 --- a/module/story/control.php +++ b/module/story/control.php @@ -1620,6 +1620,11 @@ class story extends control } if(!in_array($this->app->tab, array('execution', 'project')) and empty($stories)) $stories = $this->story->getProductStoryPairs($productID, $branch, 0, $storyStatus, 'id_desc', $limit, $type, 'story', $hasParent); + if($storyID && !isset($stories[$storyID])) + { + $story = $this->story->fetchByID($storyID); + $stories[$storyID] = $story->id . ':' . $story->title; + } if($isHTML == 0) {