From c2f59f89458f04728d749e68dc7366b5c2ac8351 Mon Sep 17 00:00:00 2001 From: sunguangming Date: Thu, 15 Jan 2026 11:07:19 +0000 Subject: [PATCH 1/3] * [bug] unlink story plan when change product. --- module/story/model.php | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/module/story/model.php b/module/story/model.php index 27c63f2c80..9f30c1edf3 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -887,12 +887,29 @@ class storyModel extends model if($story->product != $oldStory->product || $story->branch != $oldStory->branch) { + $this->loadModel('productplan'); + $oldPlans = explode(',', $oldStory->plan); + foreach($oldPlans as $oldPlanID) + { + if(!$oldPlanID) continue; + $this->productplan->unlinkStory($storyID, (int)$oldPlanID); + } + $this->dao->update(TABLE_PROJECTSTORY)->set('product')->eq($story->product)->where('story')->eq($storyID)->exec(); - $childStories = $this->getAllChildId($storyID, false); - $story->id = $storyID; - foreach($childStories as $childStoryID) + $childStories = $this->getAllChildId($storyID, false); + $childStoryAndPlan = $this->dao->select('id,plan')->from(TABLE_STORY)->where('id')->in($childStories)->fetchPairs(); + $story->id = $storyID; + foreach($childStoryAndPlan as $childStoryID => $planIDList) { $this->updateStoryProduct($childStoryID, $story, $story->product); + + /* 切换产品后,移除子需求与原产品下计划的关联。*/ + $plans = explode(',', $planIDList); + foreach($plans as $planID) + { + if(!$planID) continue; + $this->productplan->unlinkStory($childStoryID, (int)$planID); + } } } if($story->grade != $oldStory->grade) $this->syncGrade($oldStory, $story); @@ -1000,6 +1017,7 @@ class storyModel extends model ->set('product')->eq($parent->product) ->set('branch')->eq($parent->branch) ->set('module')->eq(0) + ->set('plan')->eq('') ->set('root')->eq($parent->id) ->set('path')->eq($childPath) ->where('id')->eq($storyID) From 060324ff344e8610e4412cb5992280394cc5099a Mon Sep 17 00:00:00 2001 From: sunguangming Date: Fri, 16 Jan 2026 00:55:06 +0000 Subject: [PATCH 2/3] * [misc] modify version. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c22c3f4cf2..493789a36a 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -21.7.8 \ No newline at end of file +22.0.beta From 006a45a58504d7c3ddb165829455fbb400fe075f Mon Sep 17 00:00:00 2001 From: sunguangming Date: Fri, 16 Jan 2026 01:02:51 +0000 Subject: [PATCH 3/3] * [misc] modify unittest. --- module/story/test/model/update.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/module/story/test/model/update.php b/module/story/test/model/update.php index fb8b74e706..b21232123c 100755 --- a/module/story/test/model/update.php +++ b/module/story/test/model/update.php @@ -1,5 +1,6 @@ #!/usr/bin/env php update(); @@ -10,12 +11,12 @@ cid=18593 - 属性title @编辑后的名称1 - 属性pri @1 - 属性sourceNote @来源备注1 - - 属性estimate @1 + - 属性estimate @1.00 - 编辑需求,判断返回的信息 - 属性title @编辑后的名称2 - 属性pri @2 - 属性sourceNote @来源备注2 - - 属性estimate @2 + - 属性estimate @2.00 */ include dirname(__FILE__, 5) . '/test/lib/init.php'; @@ -36,5 +37,5 @@ $story = new storyModelTest(); $result1 = $story->updateTest(1, $params1); $result2 = $story->updateTest(2, $params2); -r($result1) && p('title,pri,sourceNote,estimate') && e('编辑后的名称1,1,来源备注1,1'); // 编辑需求,判断返回的信息 -r($result2) && p('title,pri,sourceNote,estimate') && e('编辑后的名称2,2,来源备注2,2'); // 编辑需求,判断返回的信息 +r($result1) && p('title,pri,sourceNote,estimate') && e('编辑后的名称1,1,来源备注1,1.00'); // 编辑需求,判断返回的信息 +r($result2) && p('title,pri,sourceNote,estimate') && e('编辑后的名称2,2,来源备注2,2.00'); // 编辑需求,判断返回的信息 \ No newline at end of file