Merge branch 'znetaopms_263_bug#30265' into 'master'

* Fix bug #30265.

See merge request easycorp/zentaopms!6381
This commit is contained in:
王怡栋
2022-11-25 05:02:58 +00:00
5 changed files with 11 additions and 24 deletions
+2 -2
View File
@@ -74,8 +74,8 @@ class build extends control
$this->project->setMenu($projectID);
$executions = $this->execution->getPairs($projectID, 'all', 'stagefilter');
$executionID = empty($executionID) ? key($executions) : $executionID;
$productGroups = $this->product->getProducts($executionID);
$branchGroups = $this->project->getBranchesByProject($executionID);
$productGroups = $executionID ? $this->product->getProducts($executionID) : array();
$branchGroups = $executionID ? $this->project->getBranchesByProject($executionID) : array();
$this->session->set('project', $projectID);
}
elseif($this->app->tab == 'execution')
+7 -3
View File
@@ -7,9 +7,10 @@ $().ready(function()
$(document).on('change', '#product, #branch', function()
{
var projectID = $('#project').val();
var productID = $('#product').val();
var branch = $('#branch').length > 0 ? $('#branch').val() : '';
$.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + window.projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,singled&extra=multiple'), function(data)
$.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,singled&extra=multiple'), function(data)
{
if(data) $('#buildBox').html(data);
$('#builds').attr('data-placeholder', multipleSelect).chosen();
@@ -18,17 +19,19 @@ $().ready(function()
$('input[name=isIntegrated]').change(function()
{
var projectID = $('#project').val();
var executionID = $('#execution').val();
if($(this).val() == 'no')
{
$('#execution').closest('tr').show();
$('#buildBox').closest('tr').hide();
loadProducts($('#execution').val());
loadProducts(executionID);
}
else
{
$('#execution').closest('tr').hide();
$('#buildBox').closest('tr').show();
loadProducts($('#project').val());
loadProducts(projectID);
}
});
$('#product').change();
@@ -48,6 +51,7 @@ function loadProducts(executionID)
$('#branch').remove();
$('#branch_chosen').remove();
$('#noProduct').remove();
executionID = executionID ? executionID : 0;
$.get(createLink('product', 'ajaxGetProducts', 'executionID=' + executionID), function(data)
{
if(data)
+1 -1
View File
@@ -29,7 +29,7 @@
</tr>
<tr class="<?php echo $hidden;?>">
<th class='w-120px'><?php echo $lang->build->product;?></th>
<?php if(!empty($products)):?>
<?php if(!empty($products) || !$executionID):?>
<td>
<div class='input-group' id='productBox'>
<?php echo html::select('product', $products, empty($product) ? '' : $product->id, "onchange='loadBranches(this.value);' class='form-control chosen' required");?>
+1
View File
@@ -894,6 +894,7 @@ class product extends control
public function ajaxGetProducts($executionID)
{
$this->loadModel('build');
if(!$executionID) return print(html::select('product', array(), '', "class='form-control chosen' required"));
$products = $this->product->getProductPairsByProject($executionID);
if(empty($products))
{
-18
View File
@@ -1,21 +1,3 @@
$(function()
{
$('#createBuild').click(function()
{
if(executions.length == 0)
{
var message = noDevStage;
if(allExecutions.length == 0) message = createExecution;
alert(message);
var link = createLink('execution', 'create', 'projectID=' + projectID);
window.parent.$.apps.open(link, 'execution');
return false;
}
});
});
/**
* Change product.
*