diff --git a/module/build/control.php b/module/build/control.php index ec6d3e8bc3..f885587167 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -542,7 +542,14 @@ class build extends control public function ajaxGetLastBuild($projectID, $executionID) { $lastBuild = $this->build->getLast($executionID, $projectID); - echo "
  " . $this->lang->build->last . ": " . $lastBuild->name . "
"; + if($lastBuild) + { + echo "
  " . $this->lang->build->last . ": " . $lastBuild->name . "
"; + } + else + { + echo ''; + } } /** diff --git a/module/build/js/create.js b/module/build/js/create.js index 6b94ddf10e..94b83f3e2b 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').length > 0 ? $('#branch').val() : ''; - $.get(createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=builds&build=&branch=' + branch + '&index=&needCreate=&type=noempty,notrunk,separate,singled&extra=multiple'), function(data) + $.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) { if(data) $('#buildBox').html(data); $('#builds').attr('data-placeholder', multipleSelect).chosen(); @@ -78,10 +78,11 @@ function loadProducts(executionID) function loadLastBuild() { var isIntegrated = $('input[name=isIntegrated]:checked').val(); + var projectID = $('#project').val(); var executionID = $('#execution').val(); if(isIntegrated == 'yes') executionID = 0; $.get(createLink('build', 'ajaxGetLastBuild', 'projectID=' + projectID + '&executionID=' + executionID), function(data) { - if(data) $('#lastBuildBox').html(data); + $('#lastBuildBox').html(data); }); } diff --git a/module/build/model.php b/module/build/model.php index 4834dc63c3..f9dae4d54a 100644 --- a/module/build/model.php +++ b/module/build/model.php @@ -321,7 +321,7 @@ class buildModel extends model { return $this->dao->select('id, name')->from(TABLE_BUILD) ->where('deleted')->eq(0) - ->beginIF($executionID)->andWhere('execution')->eq((int)$executionID)->fi() + ->andWhere('execution')->eq((int)$executionID) ->beginIF($projectID)->andWhere('project')->eq((int)$projectID)->fi() ->orderBy('date DESC,id DESC') ->limit(1)