Merge branch 'sprint/174_tianshujie_16927' into 'master'
* Fix bug #16927. See merge request easycorp/zentaopms!730
This commit is contained in:
@@ -883,6 +883,7 @@ class bug extends control
|
||||
$bug = $this->bug->getById($bugID);
|
||||
$productID = $bug->product;
|
||||
$executionID = $bug->execution;
|
||||
$projectID = $bug->project;
|
||||
$currentModuleID = $bug->module;
|
||||
$this->bug->checkBugExecutionPriv($bug);
|
||||
|
||||
@@ -928,6 +929,10 @@ class bug extends control
|
||||
{
|
||||
$openedBuilds = $this->build->getExecutionBuildPairs($executionID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
}
|
||||
elseif($projectID)
|
||||
{
|
||||
$openedBuilds = $this->build->getProjectBuildPairs($projectID, $productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
}
|
||||
else
|
||||
{
|
||||
$openedBuilds = $this->build->getProductBuildPairs($productID, $bug->branch, 'noempty,noterminate,nodone');
|
||||
|
||||
@@ -278,6 +278,7 @@ function loadProductExecutions(productID, projectID = 0)
|
||||
if(typeof(bugExecution) == 'string' && systemMode != 'classic') $('#executionIdBox').prepend("<span class='input-group-addon' style='border-left-width: 0px;'>" + bugExecution + "</span>");
|
||||
if(required) $(this).addClass('required');
|
||||
});
|
||||
loadProjectBuilds(projectID);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -393,6 +394,44 @@ function loadExecutionStories(executionID)
|
||||
$('#storyIdBox').load(link, function(){$('#story').chosen();});
|
||||
}
|
||||
|
||||
/**
|
||||
* Load builds of a project.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
function loadProjectBuilds(projectID)
|
||||
{
|
||||
var branch = $('#branch').val();
|
||||
if(typeof(branch) == 'undefined') branch = 0;
|
||||
var productID = $('#product').val();
|
||||
var oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
|
||||
|
||||
if(page == 'create')
|
||||
{
|
||||
var link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&branch=" + branch);
|
||||
$.get(link, function(data)
|
||||
{
|
||||
if(!data) data = '<select id="openedBuild" name="openedBuild" class="form-control" multiple=multiple></select>';
|
||||
$('#openedBuild').replaceWith(data);
|
||||
$('#openedBuild').val(oldOpenedBuild);
|
||||
$('#openedBuild_chosen').remove();
|
||||
$('#openedBuild').next('.picker').remove();
|
||||
$("#openedBuild").chosen();
|
||||
})
|
||||
}
|
||||
else
|
||||
{
|
||||
var link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
|
||||
$('#openedBuildBox').load(link, function(){$(this).find('select').val(oldOpenedBuild).chosen()});
|
||||
|
||||
var oldResolvedBuild = $('#resolvedBuild').val() ? $('#resolvedBuild').val() : 0;
|
||||
var link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
|
||||
$('#resolvedBuildBox').load(link, function(){$(this).find('select').val(oldResolvedBuild).chosen()});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load builds of a execution.
|
||||
*
|
||||
|
||||
@@ -380,6 +380,42 @@ class build extends control
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get builds of a project in html select.
|
||||
*
|
||||
* @param int $projectID
|
||||
* @param string $varName the name of the select object to create
|
||||
* @param string $build build to selected
|
||||
* @param string|int $branch
|
||||
* @param int $index the index of batch create bug.
|
||||
* @param bool $needCreate if need to append the link of create build
|
||||
* @param string $type get all builds or some builds belong to normal releases and executions are not done.
|
||||
* @access public
|
||||
* @return string
|
||||
*/
|
||||
public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 'all', $index = 0, $needCreate = false, $type = 'normal')
|
||||
{
|
||||
$isJsonView = $this->app->getViewType() == 'json';
|
||||
if($varName == 'openedBuild')
|
||||
{
|
||||
if(empty($projectID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$params = ($type == 'all') ? 'noempty' : 'noempty, noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
die(html::select($varName . '[]', $builds , '', 'size=4 class=form-control multiple'));
|
||||
}
|
||||
if($varName == 'resolvedBuild')
|
||||
{
|
||||
if(empty($projectID)) $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type);
|
||||
|
||||
$params = ($type == 'all') ? '' : 'noterminate, nodone';
|
||||
$builds = $this->build->getProjectBuildPairs($projectID, $productID, $branch, $params, $build);
|
||||
if($isJsonView) die(json_encode($builds));
|
||||
die(html::select($varName, $builds, $build, "class='form-control'"));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* AJAX: get builds of an execution in html select.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user