diff --git a/module/bug/control.php b/module/bug/control.php index ed4c37eebb..9ef85ec620 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -152,6 +152,7 @@ class bug extends control $this->view->position = $position; $this->view->productID = $productID; $this->view->productName = $this->products[$productID]; + $this->view->builds = $this->loadModel('build')->getProductBuildPairs($productID); $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink')); $this->view->browseType = $browseType; $this->view->bugs = $bugs; @@ -669,7 +670,7 @@ class bug extends control } /** - * Batch confirm. + * Batch confirm bugs. * * @access public * @return void @@ -729,9 +730,25 @@ class bug extends control $this->display(); } - public function batchResolve() + /** + * Batch resolve bugs. + * + * @param string $resolution + * @param string $resolvedBuild + * @access public + * @return void + */ + public function batchResolve($resolution, $resolvedBuild = '') { - + $bugIDList = $this->post->bugIDList ? $this->post->bugIDList : die(js::locate($this->session->bugList, 'parent')); + $this->bug->batchResolve($bugIDList, $resolution, $resolvedBuild); + if(dao::isError()) die(js::error(dao::getError())); + foreach($bugIDList as $bugID) + { + $actionID = $this->action->create('bug', $bugID, 'Resolved', '', $resolution); + $this->sendmail($bugID, $actionID); + } + die(js::locate($this->session->bugList, 'parent')); } /** diff --git a/module/bug/model.php b/module/bug/model.php index 787a00a799..ea6a08c3fb 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -451,6 +451,38 @@ class bugModel extends model ->exec(); } + /** + * Batch resolve bugs. + * + * @param array $bugIDList + * @param string $resolution + * @param string $resolvedBuild + * @access public + * @return void + */ + public function batchResolve($bugIDList, $resolution, $resolvedBuild) + { + $now = helper::now(); + foreach($bugIDList as $bugID) + { + $oldBug = $this->getById($bugID); + if($oldBug->status != 'active') continue; + $bug = new stdClass(); + $bug->resolution = $resolution; + $bug->resolvedBuild = $resolution == 'fixed' ? $resolvedBuild : ''; + $bug->resolvedBy = $this->app->user->account; + $bug->resolvedDate = $now; + $bug->status = 'resolved'; + $bug->confirmed = 1; + $bug->assignedTo = $oldBug->openedBy; + $bug->assignedDate = $now; + $bug->lastEditedBy = $this->app->user->account; + $bug->lastEditedDate = $now; + + $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec(); + } + } + /** * Activate a bug. * diff --git a/module/bug/view/browse.html.php b/module/bug/view/browse.html.php index cbfef527bc..e7a25d3d58 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -230,9 +230,31 @@ js::set('customed', $customed); unset($lang->bug->resolutionList['duplicate']); foreach($lang->bug->resolutionList as $key => $resolution) { - $actionLink = $this->createLink('story', 'batchResolve', "resolution=$key"); + $actionLink = $this->createLink('bug', 'batchResolve', "resolution=$key"); echo "
  • "; - echo html::a('#', $resolution, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\""); + if($key == 'fixed') + { + echo html::a('#', $resolution, '', "onmouseover=toggleSubMenu(this.id,'right',2) id='fixedItem'"); + } + else + { + echo html::a('#', $resolution, '', "onclick=\"setFormAction('$actionLink','hiddenwin')\""); + } + echo "
  • "; + } + ?> + + + +