diff --git a/module/branch/control.php b/module/branch/control.php index 6f1404c549..2ab2726508 100644 --- a/module/branch/control.php +++ b/module/branch/control.php @@ -51,15 +51,6 @@ class branch extends control $this->display(); } - public function ajaxGetBranches($productID) - { - $product = $this->loadModel('product')->getById($productID); - if(empty($product) or $product->type == 'normal') die(); - - $branches = $this->branch->getPairs($productID); - die(html::select('branch', $branches, '', "class='form-control' onchange='loadBranch()'")); - } - public function delete($branchID, $confirm = 'no') { if($confirm == 'no') die(js::confirm($this->lang->branch->confirmDelete, inlink('delete', "branchID=$branchID&confirm=yes"))); @@ -67,5 +58,14 @@ class branch extends control $this->branch->delete(TABLE_BRANCH, $branchID); die(js::reload('parent')); } -} + public function ajaxGetBranches($productID, $oldBranch = 0) + { + $product = $this->loadModel('product')->getById($productID); + if(empty($product) or $product->type == 'normal') die(); + + $branches = $this->branch->getPairs($productID); + if($oldBranch) $branches = array($oldBranch => $branches[$oldBranch]); + die(html::select('branch', $branches, '', "class='form-control' onchange='loadBranch()'")); + } +} diff --git a/module/bug/control.php b/module/bug/control.php index 7dd41dbfd5..632631ce3d 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -434,7 +434,7 @@ class bug extends control $this->view->stories = $stories; $this->view->builds = $builds; $this->view->users = $this->user->getPairs('nodeleted,devfirst'); - $this->view->projects = $this->product->getProjectPairs($productID, $params = 'nodeleted'); + $this->view->projects = $this->product->getProjectPairs($productID, $branch, $params = 'nodeleted'); $this->view->projectID = $projectID; $this->view->moduleOptionMenu = $this->tree->getOptionMenu($productID, $viewType = 'bug', $startModuleID = 0, $branch); $this->view->moduleID = $moduleID; diff --git a/module/build/js/common.js b/module/build/js/common.js index cd8e433c47..3be2a1b6b7 100644 --- a/module/build/js/common.js +++ b/module/build/js/common.js @@ -6,13 +6,12 @@ $(document).ready(function() function loadBranches(productID) { $('#branch').remove(); - $.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID), function(data) + $.get(createLink('branch', 'ajaxGetBranches', 'productID=' + productID + '&oldBranch=' + productGroups[productID]['branch']), function(data) { if(data) { $('#product').closest('.input-group').append(data); $('#branch').css('width', '100px'); - $('#branch').val(productGroups[productID]['branch']); } }); } diff --git a/module/build/view/create.html.php b/module/build/view/create.html.php index df18d60803..24d6c9f814 100644 --- a/module/build/view/create.html.php +++ b/module/build/view/create.html.php @@ -28,7 +28,13 @@