diff --git a/module/product/control.php b/module/product/control.php index 76a023a307..0adc83f41a 100644 --- a/module/product/control.php +++ b/module/product/control.php @@ -1078,7 +1078,14 @@ class product extends control public function ajaxGetPlans($productID, $branch = 0, $planID = 0, $fieldID = '', $needCreate = false, $expired = '', $param = '') { $param = strtolower($param); - $plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false); + if(strpos($param, 'getpairsforstory') === false) + { + $plans = $this->loadModel('productplan')->getPairs($productID, $branch, $expired, strpos($param, 'skipparent') !== false); + } + else + { + $plans = $this->loadModel('productplan')->getPairsForStory($productID, $branch, $param); + } $field = $fieldID !== '' ? "plans[$fieldID]" : 'plan'; $multiple = strpos($param, 'multiple') === false ? '' : 'multiple'; $output = html::select($field, $plans, $planID, "class='form-control chosen' $multiple"); diff --git a/module/story/control.php b/module/story/control.php index 7650e1010d..8b737012d0 100644 --- a/module/story/control.php +++ b/module/story/control.php @@ -408,7 +408,7 @@ class story extends control $this->view->users = $users; $this->view->moduleID = $moduleID; $this->view->moduleOptionMenu = $moduleOptionMenu; - $this->view->plans = str_replace('2030-01-01', $this->lang->story->undetermined, $this->loadModel('productplan')->getPairsForStory($productID, $branch, 'skipParent|unexpired|noclosed')); + $this->view->plans = str_replace('2030-01-01', $this->lang->story->undetermined, $this->loadModel('productplan')->getPairsForStory($productID, $branch == 0 ? '' : $branch, 'skipParent|unexpired|noclosed')); $this->view->planID = $planID; $this->view->source = $source; $this->view->sourceNote = $sourceNote; diff --git a/module/story/js/create.js b/module/story/js/create.js index a2eb3e7f67..eab048da18 100644 --- a/module/story/js/create.js +++ b/module/story/js/create.js @@ -238,7 +238,7 @@ function loadPlanForSiblings(productID, branch, branchIndex) { /* Load plan */ if(branch == '0') branch = ''; - planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=' + branchIndex + '&needCreate=false&expired=unexpired¶m=skipParent,' + config.currentMethod); + planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=0&fieldID=' + branchIndex + '&needCreate=false&expired=unexpired¶m=skipParent|getpairsforstory,' + config.currentMethod); if(branchIndex > 0) { var $planIdBox = $('.addBranchesBox'+ branchIndex +' #planIdBox'); diff --git a/module/story/lang/de.php b/module/story/lang/de.php index 314bf9b5c6..ff6e58a01c 100644 --- a/module/story/lang/de.php +++ b/module/story/lang/de.php @@ -322,6 +322,7 @@ $lang->story->errorDuplicateStory = $lang->SRCommon . '%s not exist'; $lang->story->confirmRecallChange = "After undo the change, the story content will revert to the version before the change. Are you sure you want to undo?"; $lang->story->confirmRecallReview = "Are you sure you want to withdraw the review?"; $lang->story->noStoryToTask = "Only the activated {$lang->SRCommon} can be converted into a task!"; +$lang->story->ignoreClosedStory = "{$lang->SRCommon} %s status is closed, and the operation has been filtered."; $lang->story->form = new stdclass(); $lang->story->form->area = 'Story Bereich'; diff --git a/module/story/lang/en.php b/module/story/lang/en.php index 825b756667..738e5ed18a 100644 --- a/module/story/lang/en.php +++ b/module/story/lang/en.php @@ -322,6 +322,7 @@ $lang->story->errorDuplicateStory = $lang->SRCommon . '%s not exist'; $lang->story->confirmRecallChange = "After undo the change, the story content will revert to the version before the change. Are you sure you want to undo?"; $lang->story->confirmRecallReview = "Are you sure you want to withdraw the review?"; $lang->story->noStoryToTask = "Only the activated {$lang->SRCommon} can be converted into a task!"; +$lang->story->ignoreClosedStory = "{$lang->SRCommon} %s status is closed, and the operation has been filtered."; $lang->story->form = new stdclass(); $lang->story->form->area = 'Scope'; diff --git a/module/story/lang/fr.php b/module/story/lang/fr.php index 1635f98d77..ee9cdd0580 100644 --- a/module/story/lang/fr.php +++ b/module/story/lang/fr.php @@ -322,6 +322,7 @@ $lang->story->errorDuplicateStory = $lang->SRCommon . '%s not exist'; $lang->story->confirmRecallChange = "After undo the change, the story content will revert to the version before the change. Are you sure you want to undo?"; $lang->story->confirmRecallReview = "Are you sure you want to withdraw the review?"; $lang->story->noStoryToTask = "Only the activated {$lang->SRCommon} can be converted into a task!"; +$lang->story->ignoreClosedStory = "{$lang->SRCommon} %s status is closed, and the operation has been filtered."; $lang->story->form = new stdclass(); $lang->story->form->area = 'Périmètre'; diff --git a/module/story/lang/zh-cn.php b/module/story/lang/zh-cn.php index 4f2d5117e1..9fb868539b 100644 --- a/module/story/lang/zh-cn.php +++ b/module/story/lang/zh-cn.php @@ -322,6 +322,7 @@ $lang->story->errorDuplicateStory = $lang->SRCommon . '%s不存在'; $lang->story->confirmRecallChange = "撤销变更后,需求内容会回退至变更前的版本,您确定要撤销吗?"; $lang->story->confirmRecallReview = "您确定要撤回评审吗?"; $lang->story->noStoryToTask = "只有激活的{$lang->SRCommon}才能转为任务!"; +$lang->story->ignoreClosedStory = "{$lang->SRCommon} %s 状态为已关闭,本次操作已被过滤。"; $lang->story->form = new stdclass(); $lang->story->form->area = "该{$lang->SRCommon}所属范围"; diff --git a/module/story/model.php b/module/story/model.php index 7fd5ab255c..0ea49d9ea0 100644 --- a/module/story/model.php +++ b/module/story/model.php @@ -2542,9 +2542,15 @@ class storyModel extends model $storyIdList = $this->post->storyIdList; $assignedTo = $this->post->assignedTo; $oldStories = $this->getByList($storyIdList); + $ignoreStories = ''; foreach($storyIdList as $storyID) { $oldStory = $oldStories[$storyID]; + if($oldStory->status == 'closed') + { + $ignoreStories .= "#{$storyID},"; + continue; + } if($assignedTo == $oldStory->assignedTo) continue; $story = new stdclass(); @@ -2557,6 +2563,11 @@ class storyModel extends model $allChanges[$storyID] = common::createChanges($oldStory, $story); } + if($ignoreStories) + { + $ignoreStories = trim($ignoreStories, ','); + echo js::alert(sprintf($this->lang->story->ignoreClosedStory, $ignoreStories)); + } return $allChanges; } diff --git a/module/story/view/header.html.php b/module/story/view/header.html.php index 0603e0dc7b..0cbe4db07e 100644 --- a/module/story/view/header.html.php +++ b/module/story/view/header.html.php @@ -128,6 +128,11 @@ function loadProductBranches(productID) loadModuleForSiblings(productID, 0, 0) loadPlanForSiblings(productID, 0, 0) } + else + { + loadProductModules(productID, 0); + loadProductPlans(productID, 0); + } } else { @@ -191,7 +196,7 @@ function loadProductPlans(productID, branch) if(!branch) branch = 0; var expired = config.currentMethod == 'create' ? 'unexpired' : ''; planLink = createLink('product', 'ajaxGetPlans', 'productID=' + productID + '&branch=' + branch + '&planID=' + $('#plan').val() + '&fieldID=&needCreate=true&expired='+ expired +'¶m=skipParent,' + config.currentMethod); - var $planIdBox = $('#planIdBox'); + var $planIdBox = $('.switchBranch #planIdBox'); $planIdBox.load(planLink, function() { $planIdBox.find('#plan').chosen();