diff --git a/module/build/control.php b/module/build/control.php index f7a63aa99a..b1be966ab1 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -389,11 +389,10 @@ class build extends control * @param string|int $branch * @param int $index the index of batch create bug. * @param string $type get all builds or some builds belong to normal releases and executions are not done. - * @param string $extra * @access public * @return string */ - public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 'all', $index = 0, $type = 'normal', $extra = '') + public function ajaxGetProductBuilds($productID, $varName, $build = '', $branch = 'all', $index = 0, $type = 'normal') { $isJsonView = $this->app->getViewType() == 'json'; if($varName == 'openedBuild' ) @@ -416,11 +415,6 @@ class build extends control if($isJsonView) return print(json_encode($builds)); return print(html::select($varName, $builds, $build, "class='form-control'")); } - - $builds = $this->build->getBuildPairs($productID, $branch, $type); - if($isJsonView) return print(json_encode($builds)); - if(strpos($extra, 'multiple') !== false) $varName .= '[]'; - return print(html::select($varName, $builds, $build, "class='form-control chosen' $extra")); } /** @@ -433,10 +427,11 @@ class build extends control * @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. + * @param string $extra * @access public * @return string */ - public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 'all', $index = 0, $needCreate = false, $type = 'normal') + public function ajaxGetProjectBuilds($projectID, $productID, $varName, $build = '', $branch = 'all', $index = 0, $needCreate = false, $type = 'normal', $extra = '') { $isJsonView = $this->app->getViewType() == 'json'; if($varName == 'openedBuild') @@ -457,6 +452,12 @@ class build extends control if($isJsonView) return print(json_encode($builds)); return print(html::select($varName, $builds, $build, "class='form-control'")); } + + if(empty($projectID)) return $this->ajaxGetProductBuilds($productID, $varName, $build, $branch, $index, $type); + $builds = $this->build->getBuildPairs($productID, $branch, $type, $projectID, 'project', $build); + if(strpos($extra, 'multiple') !== false) $varName .= '[]'; + if($isJsonView) return print(json_encode($builds)); + return print(html::select($varName, $builds, $build, "class='form-control chosen' $extra")); } /** diff --git a/module/build/js/create.js b/module/build/js/create.js index 71e70a42c0..836d749f35 100644 --- a/module/build/js/create.js +++ b/module/build/js/create.js @@ -9,7 +9,7 @@ $().ready(function() { var productID = $('#product').val(); var branch = $('#branch').val(); - $.get(createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&type=noempty,notrunk,separate,noproject&extra=multiple'), function(data) + $.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,noproject&extra=multiple'), function(data) { if(data) $('#buildBox').html(data); $('#builds').chosen(); diff --git a/module/build/js/edit.js b/module/build/js/edit.js index 00d4624411..2b690e62ea 100644 --- a/module/build/js/edit.js +++ b/module/build/js/edit.js @@ -11,7 +11,7 @@ $().ready(function() { var productID = $('#product').val(); var branch = $('#branch').val(); - $.get(createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=builds&build=' + builds + '&branch=' + branch + '&index=&type=noempty,notrunk,separate,noproject&extra=multiple'), function(data) + $.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,noproject&extra=multiple'), function(data) { if(data) $('#buildBox').html(data); $('#builds').chosen();