diff --git a/module/bug/control.php b/module/bug/control.php index eb6b86c45f..b0651b9bb2 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1822,11 +1822,6 @@ class bug extends control if(!isset($users[$assignedTo])) $assignedTo = $this->bug->getModuleOwner($bug->module, $productID); unset($this->lang->bug->resolutionList['tostory']); - $product = $this->loadModel('product')->getById($productID); - $branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : ''; - $productBugs = $this->bug->getProductBugPairs($productID, $branch); - unset($productBugs[$bugID]); - $this->bug->checkBugExecutionPriv($bug); $this->qa->setMenu($this->products, $productID, $bug->branch); @@ -1834,7 +1829,6 @@ class bug extends control $this->view->bug = $bug; $this->view->users = $users; $this->view->assignedTo = $assignedTo; - $this->view->productBugs = $productBugs; $this->view->executions = $this->loadModel('product')->getExecutionPairsByProduct($productID, $bug->branch ? "0,{$bug->branch}" : 0, 'id_desc', $projectID, 'stagefilter'); $this->view->builds = $this->loadModel('build')->getBuildPairs($productID, $bug->branch, 'withbranch,noreleased'); $this->view->actions = $this->action->getList('bug', $bugID); @@ -2476,6 +2470,24 @@ class bug extends control return print(html::select('assignedTo', $productMembers, $selectedUser, 'class="form-control"')); } + /** + * Ajax get product bugs. + * + * @param int $productID + * @param int $bugID + * @access public + * @return string + */ + public function ajaxGetProductBugs($productID, $bugID) + { + $product = $this->loadModel('product')->getById($productID); + $branch = $product->type == 'branch' ? ($bug->branch > 0 ? $bug->branch . ',0' : '0') : ''; + $productBugs = $this->bug->getProductBugPairs($productID, $branch); + unset($productBugs[$bugID]); + + return print(html::select('duplicateBug', $productBugs, '', "class='form-control' placeholder='{$this->lang->bug->duplicateTip}'")); + } + /** * Ajax get project team members. * diff --git a/module/bug/js/resolve.js b/module/bug/js/resolve.js index 8afea5743c..2dc1d67371 100644 --- a/module/bug/js/resolve.js +++ b/module/bug/js/resolve.js @@ -2,6 +2,18 @@ function setDuplicate(resolution) { if(resolution == 'duplicate') { + $.ajaxSettings.async = false; + $.get(createLink('bug', 'ajaxGetProductBugs', 'projectID=' + productID + '&bugID=' + bugID),function(data) + { + $('#duplicateBug').replaceWith(data); + $('#pk_duplicateBug-search').parent().parent().remove(); + $('#duplicateBug').picker( + { + disableEmptySearch : true, + dropWidth : 'auto' + }); + }); + $.ajaxSettings.async = true; $('#duplicateBugBox').show(); } else diff --git a/module/bug/view/resolve.html.php b/module/bug/view/resolve.html.php index 78ed516c22..b7b04261b1 100644 --- a/module/bug/view/resolve.html.php +++ b/module/bug/view/resolve.html.php @@ -16,6 +16,7 @@ product); +js::set('bugID', $bug->id); js::set('released', $lang->build->released); ?>