* Finish task #43907.

This commit is contained in:
tianshujie
2021-11-03 15:51:04 +08:00
parent 8b1b92bdfc
commit d297c809b3
6 changed files with 71 additions and 24 deletions
+22 -21
View File
@@ -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();
}
+28 -2
View File
@@ -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();
+1
View File
@@ -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();
+1
View File
@@ -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();
+2
View File
@@ -21,6 +21,8 @@
<?php js::set('confirmUnlinkStory', $lang->execution->confirmUnlinkStory)?>
<?php js::set('typeError', sprintf($this->lang->error->notempty, $this->lang->task->type))?>
<?php js::set('workingHourError', sprintf($this->lang->error->notempty, $this->lang->workingHour))?>
<?php js::set('linkedTaskStories', $linkedTaskStories);?>
<?php js::set('confirmStoryToTask', $lang->execution->confirmStoryToTask);?>
<style>
.btn-group a i.icon-plus, .btn-group a i.icon-link {font-size: 16px;}
.btn-group a.btn-secondary, .btn-group a.btn-primary {border-right: 1px solid rgba(255,255,255,0.2);}
+17 -1
View File
@@ -1769,7 +1769,7 @@ class storyModel extends model
/* Create tasks. */
$tasks = array();
$stories = $this->getByList($data->storyIdList);
$stories = empty($data->storyIdList) ? array() : $this->getByList($data->storyIdList);
foreach($stories as $story)
{
if(strpos('draft,closed', $story->status) !== false) continue;
@@ -2766,6 +2766,22 @@ class storyModel extends model
->fetchPairs('id', 'title');
}
/**
* Get the story ID list of the linked to task.
*
* @param int $executionID
* @access public
* @return array
*/
public function getIdListWithTask($executionID)
{
return $this->dao->select('story')->from(TABLE_TASK)
->where('execution')->eq($executionID)
->andWhere('story')->ne(0)
->andWhere('deleted')->eq(0)
->fetchPairs();
}
/**
* Get doing projects' members of a story.
*