diff --git a/module/bug/control.php b/module/bug/control.php index 91a3e5652c..aa997300e7 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -556,12 +556,13 @@ class bug extends control * 批量变更bug的指派人。 * Batch update assign of bug. * + * @param string $assignedTo * @param int $objectID projectID|executionID * @param string $type execution|project|product|my * @access public * @return void */ - public function batchAssignTo(int $objectID, string $type = 'execution') + public function batchAssignTo(string $assignedTo, int $objectID, string $type = 'execution') { if(!empty($_POST) && isset($_POST['bugIdList'])) { @@ -570,7 +571,8 @@ class bug extends control $bug = form::data($this->config->bug->form->assignTo)->get(); foreach($bugIdList as $bugID) { - $bug->id = $bugID; + $bug->id = (int)$bugID; + $bug->assignedTo = $assignedTo; $this->bug->assign($bug); } @@ -579,7 +581,7 @@ class bug extends control if($type == 'execution') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('execution', 'bug', "executionID=$objectID"))); if($type == 'project') return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('project', 'bug', "projectID=$objectID"))); - $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true, 'closeModal' => true)); + return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true)); } /** diff --git a/module/bug/js/browse.ui.js b/module/bug/js/browse.ui.js index f50feb6378..fc4cebe2d3 100644 --- a/module/bug/js/browse.ui.js +++ b/module/bug/js/browse.ui.js @@ -1,11 +1,11 @@ -window.batchEditBugs = function(event) +$(document).on('click', '.batch-btn', function() { - const dtable = zui.DTable.query(event.target); + const dtable = zui.DTable.query($(this).target); const checkedList = dtable.$.getChecks(); if(!checkedList.length) return; const form = new FormData(); - const url = $(event.target).closest('.btn').data('url'); + const url = $(this).data('url'); checkedList.forEach((id) => form.append('bugIdList[]', id)); postAndLoadPage(url, form); -} +}); diff --git a/module/bug/model.php b/module/bug/model.php index c120f82bb2..26ef98bee8 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -562,7 +562,8 @@ class bugModel extends model ->data($bug) ->autoCheck() ->checkFlow() - ->where('id')->eq($bug->id)->exec(); + ->where('id')->eq($bug->id) + ->exec(); if(dao::isError()) return false; diff --git a/module/bug/ui/browse.html.php b/module/bug/ui/browse.html.php index 6a1af89851..bb7f5194b2 100644 --- a/module/bug/ui/browse.html.php +++ b/module/bug/ui/browse.html.php @@ -124,7 +124,7 @@ $footToolbar = array('items' => array ( array('type' => 'btn-group', 'items' => array ( - array('text' => $lang->edit, 'onClick' => jsRaw('window.batchEditBugs'), 'data-url' => createLink('bug', 'batchEdit', "productID={$product->id}&branch=$branch")), + array('text' => $lang->edit, 'className' => 'batch-btn', 'data-url' => createLink('bug', 'batchEdit', "productID={$product->id}&branch=$branch")), array('caret' => 'up', 'btnType' => 'primary', 'url' => '#navActions', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), )), array('caret' => 'up', 'text' => $lang->product->branchName[$this->session->currentProductType], 'className' => $this->session->currentProductType == 'normal' ? 'hidden' : '' ,'btnType' => 'primary', 'url' => '#navBranch', 'data-toggle' => 'dropdown', 'data-placement' => 'top-start'), @@ -147,7 +147,7 @@ menu array('text' => $lang->bug->confirm), array('text' => $lang->bug->close), array('text' => $lang->bug->activate), - array('text' => $lang->bug->resolve, 'children' => $resolveItems), + array('text' => $lang->bug->resolve, 'items' => $resolveItems), )) ); @@ -180,7 +180,7 @@ menu $assignedToItems = array(); foreach ($memberPairs as $key => $value) { - $assignedToItems[] = array('text' => $value, 'class' => 'batch-btn', 'data-url' => helper::createLink('bug', 'batchAssignTo', "productID={$productID}&type=product")); + $assignedToItems[] = array('text' => $value, 'class' => 'batch-btn', 'data-url' => helper::createLink('bug', 'batchAssignTo', "assignedTo=$key&productID={$product->id}&type=product")); } menu