diff --git a/module/execution/control.php b/module/execution/control.php index 3b71572c4a..ce1878dc64 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -795,27 +795,28 @@ class execution extends control $modulePairs = $showModule ? $this->tree->getModulePairs($type == 'byproduct' ? $param : 0, 'story', $showModule) : array(); /* Assign. */ - $this->view->title = $title; - $this->view->position = $position; - $this->view->productID = $productID; - $this->view->execution = $execution; - $this->view->stories = $stories; - $this->view->allPlans = $allPlans; - $this->view->summary = $this->product->summary($stories); - $this->view->orderBy = $orderBy; - $this->view->type = $this->session->executionStoryBrowseType; - $this->view->param = $param; - $this->view->moduleTree = $this->loadModel('tree')->getProjectStoryTreeMenu($executionID, $startModuleID = 0, array('treeModel', 'createStoryLink')); - $this->view->modulePairs = $modulePairs; - $this->view->tabID = 'story'; - $this->view->storyTasks = $storyTasks; - $this->view->storyBugs = $storyBugs; - $this->view->storyCases = $storyCases; - $this->view->users = $users; - $this->view->pager = $pager; - $this->view->setModule = true; - $this->view->branchGroups = $branchGroups; - $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable. + $this->view->title = $title; + $this->view->position = $position; + $this->view->productID = $productID; + $this->view->execution = $execution; + $this->view->stories = $stories; + $this->view->linkedTaskStories = $this->story->getIdListWithTask($executionID); + $this->view->allPlans = $allPlans; + $this->view->summary = $this->product->summary($stories); + $this->view->orderBy = $orderBy; + $this->view->type = $this->session->executionStoryBrowseType; + $this->view->param = $param; + $this->view->moduleTree = $this->loadModel('tree')->getProjectStoryTreeMenu($executionID, $startModuleID = 0, array('treeModel', 'createStoryLink')); + $this->view->modulePairs = $modulePairs; + $this->view->tabID = 'story'; + $this->view->storyTasks = $storyTasks; + $this->view->storyBugs = $storyBugs; + $this->view->storyCases = $storyCases; + $this->view->users = $users; + $this->view->pager = $pager; + $this->view->setModule = true; + $this->view->branchGroups = $branchGroups; + $this->view->canBeChanged = common::canModify('execution', $execution); // Determines whether an object is editable. $this->display(); } diff --git a/module/execution/js/story.js b/module/execution/js/story.js index e157d6c8c6..a78ba547fa 100644 --- a/module/execution/js/story.js +++ b/module/execution/js/story.js @@ -32,12 +32,38 @@ $(function() /* Get checked stories. */ $('#batchToTaskButton').on('click', function() { - var storyIdList = ''; + var storyIdList = ''; + var linedTaskIdList = ''; + var unlinTaskIdList = ''; $("input[name^='storyIdList']:checked").each(function() { + if(linkedTaskStories[$(this).val()]) + { + linedTaskIdList += '[' + $(this).val() +']'; + } + else + { + unlinTaskIdList += $(this).val() + ','; + } storyIdList += $(this).val() + ','; - $('#storyIdList').val(storyIdList); }); + + if(linedTaskIdList) + { + confirmStoryToTask = confirmStoryToTask.replace('%s', linedTaskIdList); + if(confirm(confirmStoryToTask)) + { + $('#storyIdList').val(storyIdList); + } + else + { + $('#storyIdList').val(unlinTaskIdList); + } + } + else + { + $('#storyIdList').val(storyIdList); + } }); $('.sorter-false a').unwrap(); diff --git a/module/execution/lang/en.php b/module/execution/lang/en.php index 916ae5454e..b909685a16 100644 --- a/module/execution/lang/en.php +++ b/module/execution/lang/en.php @@ -345,6 +345,7 @@ $lang->execution->unfinishedExecution = "This {$lang->executionCommon} h $lang->execution->unfinishedTask = "[%s] unfinished tasks. "; $lang->execution->unresolvedBug = "[%s] unresolved bugs. "; $lang->execution->projectNotEmpty = 'Project cannot be empty.'; +$lang->execution->confirmStoryToTask = $lang->SRCommon . '%s are converted to tasks in the current. Do you want to convert them anyways?'; /* Statistics. */ $lang->execution->charts = new stdclass(); diff --git a/module/execution/lang/zh-cn.php b/module/execution/lang/zh-cn.php index ce76413e38..31a16f3ea0 100644 --- a/module/execution/lang/zh-cn.php +++ b/module/execution/lang/zh-cn.php @@ -345,6 +345,7 @@ $lang->execution->unfinishedExecution = "该{$lang->executionCommon}下 $lang->execution->unfinishedTask = "[%s]个未完成的任务,"; $lang->execution->unresolvedBug = "[%s]个未解决的bug,"; $lang->execution->projectNotEmpty = '所属项目不能为空。'; +$lang->execution->confirmStoryToTask = '%s' . $lang->SRCommon . '已经在当前' . $lang->execution->common . '中转了任务,请确认是否重复转任务。'; /* 统计。*/ $lang->execution->charts = new stdclass(); diff --git a/module/execution/view/story.html.php b/module/execution/view/story.html.php index 9c3ac7aea6..5361f817f5 100644 --- a/module/execution/view/story.html.php +++ b/module/execution/view/story.html.php @@ -21,6 +21,8 @@ execution->confirmUnlinkStory)?> lang->error->notempty, $this->lang->task->type))?> lang->error->notempty, $this->lang->workingHour))?> + +execution->confirmStoryToTask);?>