From a4cc3fd11aa6b531fb1eed2d5fda08e959407f7c Mon Sep 17 00:00:00 2001 From: wangyuting <851424971@qq.com> Date: Fri, 25 Nov 2022 03:25:52 +0000 Subject: [PATCH] * Fix bug #30265. --- module/build/control.php | 4 ++-- module/build/js/create.js | 10 +++++++--- module/build/view/create.html.php | 2 +- module/product/control.php | 1 + module/project/js/build.js | 18 ------------------ 5 files changed, 11 insertions(+), 24 deletions(-) diff --git a/module/build/control.php b/module/build/control.php index f885587167..a479bdba7e 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -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') diff --git a/module/build/js/create.js b/module/build/js/create.js index 94b83f3e2b..b84d711c00 100644 --- a/module/build/js/create.js +++ b/module/build/js/create.js @@ -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) diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index 1c772f2144..543af32def 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -29,7 +29,7 @@