diff --git a/db/update4.3.sql b/db/update4.3.sql index 5c74da0efd..743ee51395 100644 --- a/db/update4.3.sql +++ b/db/update4.3.sql @@ -5,6 +5,8 @@ CREATE TABLE IF NOT EXISTS `zt_custom` ( `section` varchar(30) NOT NULL, `key` varchar(60) NOT NULL, `value` text NOT NULL, + `system` enum('0','1') NOT NULL default '1', PRIMARY KEY (`id`), UNIQUE KEY `lang` (`lang`,`module`,`section`,`key`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; + diff --git a/framework/router.class.php b/framework/router.class.php index 249c752779..e2fde411c1 100755 --- a/framework/router.class.php +++ b/framework/router.class.php @@ -1465,15 +1465,14 @@ class router } /* Merge from the db lang. */ - if($moduleName != 'common' and isset($lang->db->custom)) + if($moduleName != 'common' and isset($lang->db->custom[$moduleName])) { - foreach($lang->db->custom as $record) + foreach($lang->db->custom[$moduleName] as $section => $fields) { - if($moduleName == $record->module) + foreach($fields as $key => $value) { - if(!$record->key) continue; - unset($lang->{$record->module}->{$record->section}[$record->key]); - $lang->{$record->module}->{$record->section}[$record->key] = $record->value; + unset($lang->{$moduleName}->{$section}[$key]); + $lang->{$moduleName}->{$section}[$key] = $value; } } } diff --git a/module/bug/control.php b/module/bug/control.php index a11d47db41..17a0f4d7d5 100644 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -61,7 +61,7 @@ class bug extends control * @access public * @return void */ - public function browse($productID = 0, $browseType = 'byModule', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) + public function browse($productID = 0, $browseType = 'all', $param = 0, $orderBy = '', $recTotal = 0, $recPerPage = 20, $pageID = 1) { /* Set browseType, productID, moduleID and queryID. */ $browseType = strtolower($browseType); @@ -148,21 +148,21 @@ class bug extends control $position[] = html::a($this->createLink('bug', 'browse', "productID=$productID"), $this->products[$productID]); $position[] = $this->lang->bug->common; - $this->view->title = $title; - $this->view->position = $position; - $this->view->productID = $productID; - $this->view->productName = $this->products[$productID]; - $this->view->moduleTree = $this->tree->getTreeMenu($productID, $viewType = 'bug', $startModuleID = 0, array('treeModel', 'createBugLink')); - $this->view->browseType = $browseType; - $this->view->bugs = $bugs; - $this->view->users = $users; - $this->view->pager = $pager; - $this->view->param = $param; - $this->view->orderBy = $orderBy; - $this->view->moduleID = $moduleID; - $this->view->customed = $customed; - $this->view->customFields= explode(',', str_replace(' ', '', trim($customFields))); - $this->view->treeClass = $browseType == 'bymodule' ? '' : 'hidden'; + $this->view->title = $title; + $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; + $this->view->users = $users; + $this->view->pager = $pager; + $this->view->param = $param; + $this->view->orderBy = $orderBy; + $this->view->moduleID = $moduleID; + $this->view->customed = $customed; + $this->view->customFields = explode(',', str_replace(' ', '', trim($customFields))); $this->display(); } @@ -670,6 +670,25 @@ class bug extends control $this->view->actions = $this->action->getList('bug', $bugID); $this->display(); } + + /** + * Batch confirm bugs. + * + * @access public + * @return void + */ + public function batchConfirm() + { + $bugIDList = $this->post->bugIDList ? $this->post->bugIDList : die(js::locate($this->session->bugList, 'parent')); + $this->bug->batchConfirm($bugIDList); + if(dao::isError()) die(js::error(dao::getError())); + foreach($bugIDList as $bugID) + { + $actionID = $this->action->create('bug', $bugID, 'bugConfirmed'); + $this->sendmail($bugID, $actionID); + } + die(js::locate($this->session->bugList, 'parent')); + } /** * Resolve a bug. @@ -713,6 +732,27 @@ class bug extends control $this->display(); } + /** + * 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')); + } + /** * Activate a bug. * diff --git a/module/bug/js/browse.js b/module/bug/js/browse.js index 55f6788f5d..f2938ef993 100644 --- a/module/bug/js/browse.js +++ b/module/bug/js/browse.js @@ -1,13 +1,3 @@ -/* Browse by module. */ -function browseByModule(active) -{ - $('#treebox').removeClass('hidden'); - $('.divider').removeClass('hidden'); - $('#bymoduleTab').addClass('active'); - $('#querybox').addClass('hidden'); - $('#' + active + 'Tab').removeClass('active'); -} - $(document).ready(function() { $("a.customFields").colorbox({width:540, height:340, iframe:true, transition:'none'}); diff --git a/module/bug/lang/en.php b/module/bug/lang/en.php index c35cfa613a..3c1cb69661 100644 --- a/module/bug/lang/en.php +++ b/module/bug/lang/en.php @@ -73,12 +73,14 @@ $lang->bug->index = 'Index'; $lang->bug->create = 'Create Bug'; $lang->bug->batchCreate = 'Batch create'; $lang->bug->confirmBug = 'Confirm Bug'; +$lang->bug->batchConfirm = 'Batch confirm'; $lang->bug->edit = 'Edit Bug'; $lang->bug->batchEdit = 'Batch edit'; $lang->bug->assignTo = 'Assign'; $lang->bug->browse = 'Browse Bug'; $lang->bug->view = 'Bug Info'; $lang->bug->resolve = 'Resolve'; +$lang->bug->barchResolve = 'batchResolve'; $lang->bug->close = 'Close'; $lang->bug->activate = 'Activate'; $lang->bug->reportChart = 'Report'; diff --git a/module/bug/lang/zh-cn.php b/module/bug/lang/zh-cn.php index 2c0a2c4f11..d89714dc2f 100644 --- a/module/bug/lang/zh-cn.php +++ b/module/bug/lang/zh-cn.php @@ -73,16 +73,18 @@ $lang->bug->index = '首页'; $lang->bug->create = '提Bug'; $lang->bug->batchCreate = '批量添加'; $lang->bug->confirmBug = '确认'; +$lang->bug->batchConfirm = '批量确认'; $lang->bug->edit = '编辑'; $lang->bug->batchEdit = '批量编辑'; $lang->bug->assignTo = '指派'; $lang->bug->browse = 'Bug列表'; $lang->bug->view = 'Bug详情'; $lang->bug->resolve = '解决'; +$lang->bug->batchResolve = '批量解决'; $lang->bug->close = '关闭'; $lang->bug->activate = '激活'; $lang->bug->reportChart = '报表统计'; -$lang->bug->export = '导出'; +$lang->bug->export = '导出数据'; $lang->bug->delete = '删除'; $lang->bug->saveTemplate = '保存模板'; $lang->bug->deleteTemplate = '删除模板'; diff --git a/module/bug/model.php b/module/bug/model.php index c2b54c6153..ea6a08c3fb 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -393,6 +393,31 @@ class bugModel extends model $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec(); } + /** + * Batch confirm bugs. + * + * @param array $bugIDList + * @access public + * @return void + */ + public function batchConfirm($bugIDList) + { + $now = helper::now(); + foreach($bugIDList as $bugID) + { + $oldBug = $this->getById($bugID); + if($oldBug->confirmed) continue; + + $bug = new stdclass(); + $bug->assignedTo = $this->app->user->account; + $bug->lastEditedBy = $this->app->user->account; + $bug->lastEditedDate = $now; + $bug->confirmed = 1; + + $this->dao->update(TABLE_BUG)->data($bug)->where('id')->eq($bugID)->exec(); + } + } + /** * Resolve a bug. * @@ -426,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 b0ef9656cd..e7a25d3d58 100644 --- a/module/bug/view/browse.html.php +++ b/module/bug/view/browse.html.php @@ -14,6 +14,7 @@ include '../../common/view/header.html.php'; include '../../common/view/treeview.html.php'; include '../../common/view/colorize.html.php'; +include '../../common/view/dropmenu.html.php'; js::set('browseType', $browseType); js::set('moduleID', $moduleID); js::set('customed', $customed); @@ -22,7 +23,7 @@ js::set('customed', $customed);