Merge branch 'zhouxin_bugtotask' into 'master'

* Finish task #55258.

See merge request easycorp/zentaopms!3875
This commit is contained in:
孙广明
2022-06-13 01:45:35 +00:00
11 changed files with 125 additions and 5 deletions
+1
View File
@@ -266,6 +266,7 @@ $lang->action->label->tostory = 'converted to Story ';
$lang->action->label->frombug = 'converted from Bug ';
$lang->action->label->fromlib = 'imported from Library ';
$lang->action->label->totask = 'converted to Task ';
$lang->action->label->converttotask = 'converted to Task ';
$lang->action->label->svncommited = 'committed SVN ';
$lang->action->label->gitcommited = 'committed Git ';
$lang->action->label->linked2plan = 'linked to Plan ';
+1
View File
@@ -266,6 +266,7 @@ $lang->action->label->tostory = "转{$lang->SRCommon}";
$lang->action->label->frombug = "转{$lang->SRCommon}";
$lang->action->label->fromlib = '从用例库导入';
$lang->action->label->totask = '转任务';
$lang->action->label->converttotask = '转任务';
$lang->action->label->svncommited = '提交代码';
$lang->action->label->gitcommited = '提交代码';
$lang->action->label->linked2plan = "关联计划";
+4
View File
@@ -880,6 +880,8 @@ class bug extends control
$product = $this->loadModel('product')->getByID($productID);
$branches = $product->type == 'normal' ? array() : $this->loadModel('branch')->getPairs($bug->product);
$projects = $this->loadModel('product')->getProjectPairsByProduct($productID, $bug->branch);
$this->executeHooks($bugID);
/* Header and positon. */
@@ -902,6 +904,8 @@ class bug extends control
$this->view->preAndNext = $this->loadModel('common')->getPreAndNextObject('bug', $bugID);
$this->view->product = $product;
$this->view->projects = array('' => '') + $projects;
$this->display();
}
+46
View File
@@ -7,3 +7,49 @@ $('#tostory').click(function()
{
if(!confirm(confrimToStory)) return false;
});
/**
* Load Product executions in html.
*
* @param int productID
* @param int projectID
* @access public
* @return void
*/
function loadProductExecutions(productID, projectID)
{
link = createLink('product', 'ajaxGetExecutions', 'productID=' + productID + '&projectID=' + projectID +'&branch=' + branchID + '&number=&executionID=0&from=bugToTask');
$('#executionBox').load(link, function()
{
$(this).find('select').chosen();
});
}
$('#toTaskButton').on('click', function()
{
var projectID = $('#taskProjects').val();
var executionID = $('#execution').val();
var executionID = executionID ? executionID : 0;
if(systemMode == 'new' && projectID && executionID != 0)
{
$('#cancelButton').click();
link = createLink('task', 'create', 'executionID=' + executionID + '&storyID=0&moduleID=0&taskID=0&todoID=0&extra=projectID=' + projectID + '&bugID=' + bugID);
window.parent.$.apps.open(link, 'execution');
}
else if(systemMode == 'classic' && executionID)
{
$('#cancelButton').click();
link = createLink('task', 'create', 'executionID=' + executionID + '&storyID=0&moduleID=0&taskID=0&todoID=0&extra=projectID=0&bugID=' + bugID);
window.parent.$.apps.open(link, 'execution');
}
else if(executionID == 0)
{
alert(errorNoExecution);
}
else
{
alert(errorNoProject);
}
});
+5
View File
@@ -95,6 +95,10 @@ $lang->bug->toCase = 'To Case';
$lang->bug->colorTag = 'Color';
$lang->bug->fixedRate = 'Fixed Rate';
$lang->bug->noticefeedbackBy = 'NoticeFeedbackBy';
$lang->bug->selectProjects = 'Select Projects';
$lang->bug->nextStep = 'Next Step';
$lang->bug->noProject = 'Haven’t chosen a project yet';
$lang->bug->noExecution = 'Haven’t chosen a execution yet';
/* Method list. */
$lang->bug->index = 'Bug Home';
@@ -405,6 +409,7 @@ $lang->bug->action = new stdclass();
$lang->bug->action->resolved = array('main' => '$date, resolved by <strong>$actor</strong> and the resolution is <strong>$extra</strong> $appendLink.', 'extra' => 'resolutionList');
$lang->bug->action->tostory = array('main' => '$date, converted by <strong>$actor</strong> to <strong>Story</strong> with ID <strong>$extra</strong>.');
$lang->bug->action->totask = array('main' => '$date, imported by <strong>$actor</strong> as <strong>Task</strong> with ID <strong>$extra</strong>.');
$lang->bug->action->converttotask = array('main' => '$date, imported by <strong>$actor</strong> as <strong>Task</strong>,with ID <strong>$extra</strong>。');
$lang->bug->action->linked2plan = array('main' => '$date, linked by <strong>$actor</strong> to Plan <strong>$extra</strong>.');
$lang->bug->action->unlinkedfromplan = array('main' => '$date, deleted by <strong>$actor</strong> from Plan <strong>$extra</strong>.');
$lang->bug->action->linked2build = array('main' => '$date, linked by <strong>$actor</strong> to Build <strong>$extra</strong>.');
+5
View File
@@ -95,6 +95,10 @@ $lang->bug->toCase = '生成用例';
$lang->bug->colorTag = '颜色标签';
$lang->bug->fixedRate = '修复率';
$lang->bug->noticefeedbackBy = '通知反馈者';
$lang->bug->selectProjects = '选择项目';
$lang->bug->nextStep = '下一步';
$lang->bug->noProject = '还没有选择项目!';
$lang->bug->noExecution = '还没有选择执行!';
/* 方法列表。*/
$lang->bug->index = '首页';
@@ -405,6 +409,7 @@ $lang->bug->action = new stdclass();
$lang->bug->action->resolved = array('main' => '$date, 由 <strong>$actor</strong> 解决,方案为 <strong>$extra</strong> $appendLink。', 'extra' => 'resolutionList');
$lang->bug->action->tostory = array('main' => '$date, 由 <strong>$actor</strong> 转为<strong> ' . $lang->SRCommon . '</strong>,编号为 <strong>$extra</strong>。');
$lang->bug->action->totask = array('main' => '$date, 由 <strong>$actor</strong> 导入为<strong>任务</strong>,编号为 <strong>$extra</strong>。');
$lang->bug->action->converttotask = array('main' => '$date, 由 <strong>$actor</strong> 转为<strong>任务</strong>,编号为 <strong>$extra</strong>。');
$lang->bug->action->linked2plan = array('main' => '$date, 由 <strong>$actor</strong> 关联到计划 <strong>$extra</strong>。');
$lang->bug->action->unlinkedfromplan = array('main' => '$date, 由 <strong>$actor</strong> 从计划 <strong>$extra</strong> 移除。');
$lang->bug->action->linked2build = array('main' => '$date, 由 <strong>$actor</strong> 关联到版本 <strong>$extra</strong>。');
+1
View File
@@ -3385,6 +3385,7 @@ class bugModel extends model
if($type == 'view' && $this->app->tab != 'product')
{
$menu .= $this->buildMenu('bug', 'toStory', $toStoryParams, $bug, $type, $this->lang->icons['story'], '', '', '', "data-app='product' id='tostory'", $this->lang->bug->toStory);
if(common::hasPriv('task', 'create')) $menu .= html::a('#toTask', "<i class='icon icon-check'></i><span class='text'>{$this->lang->bug->toTask}</span>", '', "data-app='qa' data-toggle='modal' class='btn btn-link'");
$menu .= $this->buildMenu('bug', 'createCase', $convertParams, $bug, $type, 'sitemap');
}
if($type == 'view')
+40
View File
@@ -14,6 +14,12 @@
<?php include '../../common/view/kindeditor.html.php';?>
<?php js::set('sysurl', common::getSysUrl());?>
<?php js::set('confrimToStory', $lang->bug->confirmToStory);?>
<?php js::set('systemMode', $config->systemMode);?>
<?php js::set('tab', $app->tab);?>
<?php js::set('bugID', $bug->id);?>
<?php js::set('branchID', $bug->branch);?>
<?php js::set('errorNoExecution', $lang->bug->noExecution);?>
<?php js::set('errorNoProject', $lang->bug->noProject);?>
<?php $browseLink = $app->session->bugList ? $app->session->bugList : inlink('browse', "productID=$bug->product");?>
<?php if(strpos($_SERVER["QUERY_STRING"], 'isNotice=1') === false):?>
<div id="mainMenu" class="clearfix">
@@ -425,6 +431,40 @@
<div id="mainActions" class='main-actions'>
<?php common::printPreAndNext($preAndNext);?>
</div>
<div class="modal fade" id="toTask">
<div class="modal-dialog mw-500px">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title"><?php echo $lang->bug->selectProjects;?></h4>
</div>
<div class="modal-body">
<table class='table table-form'>
<?php if($this->config->systemMode == 'new'):?>
<tr>
<th><?php echo $lang->bug->project;?></th>
<td class='required'><?php echo html::select('taskProjects', $projects, '', "class='form-control chosen' onchange='loadProductExecutions({$productID}, this.value)'");?></td>
</tr>
<tr>
<th id='executionHead'><?php echo $lang->bug->execution;?></th>
<td id='executionBox' class='required'><?php echo html::select('execution', '', '', "class='form-control chosen'");?></td>
</tr>
<?php else:?>
<tr>
<th><?php echo $lang->execution->common;?></th>
<td><?php echo html::select('execution', $projects, '', "class='form-control chosen'");?></td>
</tr>
<?php endif;?>
<tr>
<td colspan='2' class='text-center'>
<?php echo html::commonButton($lang->bug->nextStep, "id='toTaskButton'", 'btn btn-primary btn-wide');?>
<?php echo html::commonButton($lang->cancel, "id='cancelButton' data-dismiss='modal'", 'btn btn-default btn-wide');?>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<script>
function handleLinkButtonClick()
{
+4 -2
View File
@@ -983,12 +983,14 @@ class product extends control
if($execution->type == 'kanban') $projectID = $execution->project;
}
$executions = $from == 'showImport' ? $this->product->getAllExecutionPairsByProduct($productID, $branch, $projectID) : $this->product->getExecutionPairsByProduct($productID, $branch, 'id_desc', $projectID, empty($this->config->CRExecution) ? 'noclosed' : '');
$notClosed = ($from == 'bugToTask' or empty($this->config->CRExecution)) ? 'noclosed' : '';
$executions = $from == 'showImport' ? $this->product->getAllExecutionPairsByProduct($productID, $branch, $projectID) : $this->product->getExecutionPairsByProduct($productID, $branch, 'id_desc', $projectID, $notClosed);
if($this->app->getViewType() == 'json') return print(json_encode($executions));
if($number === '')
{
return print(html::select('execution', array('' => '') + $executions, $executionID, "class='form-control' onchange='loadExecutionRelated(this.value)'"));
$event = $from == 'bugToTask' ? '' : " onchange='loadExecutionRelated(this.value)'";
return print(html::select('execution', array('' => '') + $executions, $executionID, "class='form-control' $event"));
}
else
{
+11 -2
View File
@@ -38,7 +38,7 @@ class task extends control
* @access public
* @return void
*/
public function create($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $todoID = 0, $extra = '')
public function create($executionID = 0, $storyID = 0, $moduleID = 0, $taskID = 0, $todoID = 0, $extra = '', $bugID = 0)
{
if(empty($this->app->user->view->sprints) and !$executionID) $this->locate($this->createLink('execution', 'create'));
$extra = str_replace(array(',', ' '), array('&', ''), $extra);
@@ -83,6 +83,15 @@ class task extends control
$task->desc = $todo->desc;
}
if($bugID > 0)
{
$bug = $this->loadModel('bug')->getById($bugID);
$task->name = $bug->title;
$task->pri = $bug->pri;
$task->pri = !empty($bug->pri) ? $bug->pri : '3';
$task->assignedTo = array($bug->assignedTo);
}
$execution = $this->execution->getById($executionID);
$taskLink = $this->createLink('execution', 'browse', "executionID=$executionID&tab=task");
@@ -111,7 +120,7 @@ class task extends control
if($this->post->execution) $executionID = (int)$this->post->execution;
/* Create task here. */
$tasksID = $this->task->create($executionID);
$tasksID = $this->task->create($executionID, $bugID);
if(dao::isError())
{
$response['result'] = 'fail';
+7 -1
View File
@@ -20,7 +20,7 @@ class taskModel extends model
* @access public
* @return void
*/
public function create($executionID)
public function create($executionID, $bugID)
{
if((float)$this->post->estimate < 0)
{
@@ -146,6 +146,12 @@ class taskModel extends model
$taskID = $this->dao->lastInsertID();
if($bugID > 0)
{
$this->dao->update(TABLE_TASK)->set('fromBug')->eq($bugID)->where('id')->eq($taskID)->exec();
$this->loadModel('action')->create('bug', $bugID, 'converttotask', '', $taskID);
}
/* Mark design version.*/
if(isset($task->design) && !empty($task->design))
{