Merge branch 'sprint_59473' into 'master'

Sprint 59473

See merge request easycorp/zentaopms!4362
This commit is contained in:
孙广明
2022-07-06 01:13:32 +00:00
5 changed files with 78 additions and 4 deletions
+19 -1
View File
@@ -1589,7 +1589,9 @@ class execution extends control
if(!empty($this->config->user->moreLink)) $this->config->moreLinks["RD"] = $this->config->user->moreLink;
$this->loadModel('product');
$allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($projectID, 'noclosed');
$allProducts = $this->config->systemMode == 'classic' ? $this->product->getPairs('noclosed') : $this->product->getProductPairsByProject($projectID, 'noclosed');
$copyProjects = $this->loadModel('project')->getPairsByProgram(isset($project->parent) ? $project->parent : '', 'noclosed', '', 'order_asc', '', isset($project->model) ? $project->model : '');
$copyProjectID = ($projectID == 0) ? key($copyProjects) : $projectID;
$this->view->title = (($this->app->tab == 'execution') and ($this->config->systemMode == 'new')) ? $this->lang->execution->createExec : $this->lang->execution->create;
$this->view->position[] = $this->view->title;
@@ -1604,6 +1606,8 @@ class execution extends control
$this->view->team = $team;
$this->view->teams = array(0 => '') + $this->execution->getCanCopyObjects((int)$projectID);
$this->view->allProjects = array(0 => '') + $this->project->getPairsByModel('all', 0, 'noclosed');
$this->view->copyProjects = $copyProjects;
$this->view->copyExecutions = array('' => '') + $this->execution->getList($copyProjectID);
$this->view->executionID = $executionID;
$this->view->productID = $productID;
$this->view->projectID = $projectID;
@@ -4037,4 +4041,18 @@ class execution extends control
echo json_encode($date);
}
}
/**
* Ajax get copy project executions.
*
* @param int $projectID
* @access public
* @return void
*/
public function ajaxGetCopyProjectExecutions($projectID = 0)
{
$executions = $this->execution->getList($projectID);
echo json_encode($executions);
}
}
+3
View File
@@ -30,3 +30,6 @@
#dateRange {vertical-align: top; padding-top: 13px;}
#dateRangeOption {vertical-align: top; padding-top: 13px;}
#copyProjectModal .projectSelect {display: inline-block; margin-left: 10px; width: 20%;}
#copyProjectModal .titleBox{position: relative; bottom: 3px; display: inline-block;}
a.chosen-single > div > b {top: -4px !important;}
+45 -1
View File
@@ -8,7 +8,11 @@ $(function()
var heightType = $("[name='heightType']:checked").val();
setCardCount(heightType);
$('#copyProjects a').click(function(){setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide')});
$(document).on('click', '#copyProjects a', function()
{
setCopyProject($(this).data('id')); $('#copyProjectModal').modal('hide');
});
$('#begin').on('change', function()
{
$("#end").val('');
@@ -168,3 +172,43 @@ function subString(title, stringLength)
return title;
}
/**
* Load project executions.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectExecutions(projectID)
{
$.get(createLink('execution', 'ajaxGetCopyProjectExecutions', 'projectID=' + projectID + '&$copyExecutionID' + copyExecutionID), function(data)
{
if(data != '[]')
{
$('.alert').replaceWith("<div id='copyProjects' class='row'>");
$("#copyProjects > div[data-id != '']").remove();
$(".model-body").remove();
var data = JSON.parse(data);
if(copyExecutionID != 0 )
{
$('#copyProjects').append("<div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='' class='cancel'><i class='icon-ban-circle'></i>" + cancelCopy + "</a></div>");
}
$.each(data, function(id, execution)
{
var type = execution.type == 'stage' ? 'waterfall' : execution.type;
var active = copyExecutionID == id ? ' active' : '';
$('#copyProjects').append("<div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='" + id + "' class='nobr " + active + "'><i class='icon-" + type + " text-muted'></i>" + execution.name + "</a></div>");
});
}
else if(data == '[]' && copyExecutionID == 0)
{
$('#copyProjects').replaceWith("<div class='alert with-icon'><i class='icon-exclamation-sign'></i><div class='content'>" + copyNoExecution + "</div>");
}
else if(data == '[]' && copyExecutionID != 0)
{
$("#copyProjects > div[data-id != '']").remove();
$('#copyProjects').append("<div class='col-md-4 col-sm-6'><a href='javascript:;' data-id='' class='cancel'><i class='icon-ban-circle'></i>" + cancelCopy + "</a></div>");
}
});
}
+8 -1
View File
@@ -45,6 +45,9 @@
<?php js::set('multiBranchProducts', $multiBranchProducts);?>
<?php js::set('systemMode', $config->systemMode);?>
<?php js::set('projectID', $projectID);?>
<?php js::set('copyExecutionID', $copyExecutionID);?>
<?php js::set('cancelCopy', $lang->execution->cancelCopy);?>
<?php js::set('copyNoExecution', $lang->execution->copyNoExecution);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -265,7 +268,10 @@
<div class='modal-dialog mw-900px'>
<div class='modal-header'>
<button type='button' class='close' data-dismiss='modal'><i class="icon icon-close"></i></button>
<h4 class='modal-title' id='myModalLabel'><?php echo $lang->execution->copyTitle;?></h4>
<div class='titleBox'><h4 class='modal-title' id='myModalLabel'><?php echo $lang->execution->copyTitle;?></h4></div>
<?php if($this->config->systemMode == 'new'):?>
<div class='projectSelect'><?php echo html::select("project", $copyProjects, $projectID, "class='form-control chosen' required onchange='loadProjectExecutions(this.value)'");?></div>
<?php endif;?>
</div>
<div class='modal-body'>
<?php if(count($executions) == 1):?>
@@ -275,6 +281,7 @@
</div>
<?php else:?>
<div id='copyProjects' class='row'>
<?php if($config->systemMode == 'new' and $projectID == 0) $executions = $copyExecutions;?>
<?php foreach ($executions as $id => $execution):?>
<?php if(empty($id)):?>
<?php if($copyExecutionID != 0):?>
+3 -1
View File
@@ -693,10 +693,11 @@ class projectModel extends model
* @param bool $isQueryAll
* @param string $orderBy
* @param string $excludedModel
* @param string $model
* @access public
* @return object
*/
public function getPairsByProgram($programID = '', $status = 'all', $isQueryAll = false, $orderBy = 'order_asc', $excludedModel = '')
public function getPairsByProgram($programID = '', $status = 'all', $isQueryAll = false, $orderBy = 'order_asc', $excludedModel = '', $model = '')
{
if(defined('TUTORIAL')) return $this->loadModel('tutorial')->getProjectPairs();
return $this->dao->select('id, name')->from(TABLE_PROJECT)
@@ -706,6 +707,7 @@ class projectModel extends model
->beginIF($programID !== '')->andWhere('parent')->eq($programID)->fi()
->beginIF($status != 'all' and $status != 'noclosed')->andWhere('status')->eq($status)->fi()
->beginIF($excludedModel)->andWhere('model')->ne($excludedModel)->fi()
->beginIF($model)->andWhere('model')->eq($model)->fi()
->beginIF($status == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF(!$this->app->user->admin and !$isQueryAll)->andWhere('id')->in($this->app->user->view->projects)->fi()
->orderBy($orderBy)