* Fix build create

This commit is contained in:
lanzongjun
2022-12-08 15:45:36 +08:00
parent d8a5944a84
commit 1b4791f74b
5 changed files with 22 additions and 11 deletions
+7 -6
View File
@@ -71,15 +71,16 @@ function loadProducts(executionID)
$('#productBox').append(data);
$('#product').chosen();
$.get(createLink('product', 'ajaxGetProductById', 'produtID=' + $("#product").val()), function(data)
{
$('#branchBox').closest('tr').find('th').text(data.branchName);
}, 'json');
loadBranches($("#product").val());
}
});
$.get(createLink('product', 'ajaxGetProductById', 'produtID=' + $("#product").val()), function(data)
{
$('#branchBox').closest('tr').find('th').text(data.branchName);
}, 'json');
loadLastBuild();
}
@@ -94,7 +95,7 @@ function loadLastBuild()
var isIntegrated = $('input[name=isIntegrated]:checked').val();
var projectID = $('#project').val();
var executionID = $('#execution').val();
if(isIntegrated == 'yes') executionID = 0;
if(isIntegrated == 'yes') executionID = 0;
$.get(createLink('build', 'ajaxGetLastBuild', 'projectID=' + projectID + '&executionID=' + executionID), function(data)
{
$('#lastBuildBox').html(data);
+2 -2
View File
@@ -407,7 +407,7 @@ class buildModel extends model
}
$product = $this->loadModel('product')->getByID($build->product);
if($product->type != 'normal' and $this->post->isIntegrated == 'no' and !isset($_POST['branch']))
if(!empty($product) and $product->type != 'normal' and $this->post->isIntegrated == 'no' and !isset($_POST['branch']))
{
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
dao::$errors['branch'] = sprintf($this->lang->error->notempty, $this->lang->product->branch);
@@ -456,7 +456,7 @@ class buildModel extends model
->get();
$product = $this->loadModel('product')->getByID($build->product);
if($product->type != 'normal' and $this->post->isIntegrated == 'no' and !isset($_POST['branch']))
if(!empty($product) and $product->type != 'normal' and $this->post->isIntegrated == 'no' and !isset($_POST['branch']))
{
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
dao::$errors['branch'] = sprintf($this->lang->error->notempty, $this->lang->product->branch);
+7 -2
View File
@@ -45,10 +45,15 @@
<td></td>
</tr>
<tr class='<?php if((!empty($product) and $product->type == 'normal') or empty($product)) echo 'hidden'?>'>
<th class='w-120px'><?php echo $product->type == 'normal' ? '' : $lang->product->branchName[$product->type]?></th>
<?php
if(empty($product)) $product = new stdclass();
$productType = zget($product, 'type', 'normal');
$productBranches = zget($product, 'branches', array());
?>
<th class='w-120px'><?php echo $productType == 'normal' ? '' : $lang->product->branchName[$productType]?></th>
<td>
<div class='input-group' id='branchBox'>
<?php echo html::select('branch[]', $branches, key($product->branches), "class='form-control chosen' multiple required"); ?>
<?php echo html::select('branch[]', $branches, key($productBranches), "class='form-control chosen' multiple required"); ?>
</div>
</td>
</tr>
+5
View File
@@ -38,6 +38,11 @@
</tr>
<tr>
<tr class='<?php if((!empty($product) and $product->type == 'normal') or empty($product)) echo 'hidden'?>'>
<?php
if(empty($product)) $product = new stdclass();
$productType = zget($product, 'type', 'normal');
$productBranches = zget($product, 'branches', array());
?>
<th class='w-120px'><?php echo $product->type == 'normal' ? '' : $lang->product->branchName[$product->type]?></th>
<td>
<div class='input-group' id='branchBox'>
+1 -1
View File
@@ -204,7 +204,7 @@ class projectrelease extends control
$this->view->title = $this->view->product->name . $this->lang->colon . $this->lang->release->edit;
$this->view->position[] = $this->lang->release->edit;
$this->view->release = $release;
$this->view->builds = $builds;
$this->view->builds = $builds;a($builds);exit;
$this->view->users = $this->loadModel('user')->getPairs('noclosed');
$this->display();