sprint_59473

This commit is contained in:
sunjun
2022-07-05 07:39:55 +00:00
parent f1a7448b71
commit 2a28c13c7e
5 changed files with 80 additions and 2 deletions
+12 -1
View File
@@ -1525,7 +1525,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->execution->getCopyProjectPairsByProgramAndModel(empty($project->parent) ? 0 : $project->parent, 'noclosed', 'order_asc', empty($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;
@@ -1540,6 +1542,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;
@@ -3973,4 +3977,11 @@ class execution extends control
echo json_encode($date);
}
}
public function ajaxGetProjectExecutions($projectID = 0)
{
$executions = $this->execution->getList($projectID);
echo json_encode($executions);
}
}
+2
View File
@@ -30,3 +30,5 @@
#dateRange {vertical-align: top; padding-top: 13px;}
#dateRangeOption {vertical-align: top; padding-top: 13px;}
#myModalLabel {width: 20%; display: inline-block;}
.projectSelect {display: inline-block; margin: 0 auto; width:20%;}
+36 -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,34 @@ function subString(title, stringLength)
return title;
}
/**
* Load project executions.
*
* @param int $projectID
* @access public
* @return void
*/
function loadProjectExecutions(projectID)
{
$.get(createLink('execution', 'ajaxGetProjectExecutions', '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);
$.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
{
$('#copyProjects').replaceWith("<div class='alert with-icon'><i class='icon-exclamation-sign'></i><div class='content'>" + copyNoExecution + "</div>")
}
});
}
+24
View File
@@ -4322,4 +4322,28 @@ class executionModel extends model
echo '</td>';
}
}
/**
* Get copy project pairs by program and model.
*
* @param int $programID
* @param string $status
* @param string $orderBy
* @param string $model
* @access public
* @return array
*/
public function getCopyProjectPairsByProgramAndModel($programID = 0, $status = 'all', $orderBy = 'order_asc', $model = '')
{
return $this->dao->select('id, name')->from(TABLE_PROJECT)
->where('type')->eq('project')
->andWhere('deleted')->eq(0)
->andWhere('vision')->eq($this->config->vision)
->beginIF($programID !== '')->andWhere('parent')->eq($programID)->fi()
->beginIF($model)->andWhere('model')->eq($model)->fi()
->beginIF($status == 'noclosed')->andWhere('status')->ne('closed')->fi()
->beginIF(!$this->app->user->admin)->andWhere('id')->in($this->app->user->view->projects)->fi()
->orderBy($orderBy)
->fetchPairs();
}
}
+6
View File
@@ -45,6 +45,8 @@
<?php js::set('multiBranchProducts', $multiBranchProducts);?>
<?php js::set('systemMode', $config->systemMode);?>
<?php js::set('projectID', $projectID);?>
<?php js::set('copyExecutionID', $copyExecutionID);?>
<?php js::set('copyNoExecution', $lang->execution->copyNoExecution);?>
<div id='mainContent' class='main-content'>
<div class='center-block'>
<div class='main-header'>
@@ -266,6 +268,9 @@
<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>
<?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 +280,7 @@
</div>
<?php else:?>
<div id='copyProjects' class='row'>
<?php if($projectID == 0) $executions = $copyExecutions;?>
<?php foreach ($executions as $id => $execution):?>
<?php if(empty($id)):?>
<?php if($copyExecutionID != 0):?>