diff --git a/module/risk/config.php b/module/risk/config.php index b688aa7ecb..5b8c889353 100644 --- a/module/risk/config.php +++ b/module/risk/config.php @@ -60,4 +60,4 @@ $config->risk->search['params']['activateBy'] = array('operator' => '=', $config->risk->search['params']['assignedTo'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); $config->risk->search['params']['cancelBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); $config->risk->search['params']['hangupBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); -$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); +$config->risk->search['params']['trackedBy'] = array('operator' => '=', 'control' => 'select', 'values' => 'users'); diff --git a/module/risk/control.php b/module/risk/control.php index 265fddeff2..916a0d0a0f 100644 --- a/module/risk/control.php +++ b/module/risk/control.php @@ -1,12 +1,23 @@ createLink('risk', 'browse', "browseType=bySearch&queryID=myQueryID"); - $this->config->risk->search['onMenuBar'] = 'yes'; + $actionURL = $this->createLink('risk', 'browse', "browseType=bysearch&queryID=myQueryID"); $this->risk->buildSearchForm($queryID, $actionURL); /* Load pager. */ @@ -14,18 +25,24 @@ class risk extends control if($this->app->getViewType() == 'mhtml') $recPerPage = 10; $pager = pager::init($recTotal, $recPerPage, $pageID); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse; - $this->view->position[] = $this->lang->risk->browse; - $this->view->risks = $this->risk->getList($browseType, $param, $orderBy, $pager); - $this->view->browseType = $browseType; - $this->view->param = $param; - $this->view->orderBy = $orderBy; - $this->view->pager = $pager; - $this->view->users = $this->loadModel('user')->getPairs('noletter'); + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->browse; + $this->view->position[] = $this->lang->risk->browse; + $this->view->risks = $this->risk->getList($browseType, $param, $orderBy, $pager); + $this->view->browseType = $browseType; + $this->view->param = $param; + $this->view->orderBy = $orderBy; + $this->view->pager = $pager; + $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->display(); } + /** + * Create risk + * + * @access public + * @return void + */ public function create() { if($_POST) @@ -46,13 +63,20 @@ class risk extends control $this->send($response); } - $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create; - $this->view->position[] = $this->lang->risk->create; + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->create; + $this->view->position[] = $this->lang->risk->create; + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); $this->display(); } + /** + * Edit risk + * + * @param int $riskID + * @access public + * @return void + */ public function edit($riskID) { if($_POST) @@ -69,25 +93,38 @@ class risk extends control } $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Edited'); - $this->action->logHistory($actionID, $changes); + if(!empty($changes)) + { + $actionID = $this->action->create('risk', $riskID, 'Edited'); + $this->action->logHistory($actionID, $changes); + } - $response['locate'] = inlink('browse'); + $response['locate'] = inlink('browse'); $this->send($response); } - $this->view->risk = $this->risk->getById($riskID); - $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit; - $this->view->position[] = $this->lang->risk->edit; + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->edit; + $this->view->position[] = $this->lang->risk->edit; + $this->view->risk = $this->risk->getById($riskID); + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); $this->display(); } + /** + * View a risk + * + * @param int $riskID + * @access public + * @return void + */ public function view($riskID) { $this->loadModel('action'); + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->view; + $this->view->position[] = $this->lang->risk->view; + $this->view->risk = $this->risk->getById($riskID); $this->view->actions = $this->action->getList('risk', $riskID); $this->view->users = $this->loadModel('user')->getPairs('noletter'); @@ -95,6 +132,46 @@ class risk extends control $this->display(); } + /** + * Batch create + * + * @access public + * @return void + */ + public function batchCreate() + { + if($_POST) + { + $this->risk->batchCreate(); + + $response['result'] = 'success'; + $response['message'] = $this->lang->saveSuccess; + if(dao::isError()) + { + $response['result'] = 'fail'; + $response['message'] = dao::getError(); + $this->send($response); + } + + $response['locate'] = inlink('browse'); + $this->send($response); + } + + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->batchCreate; + $this->view->position[] = $this->lang->risk->batchCreate; + + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); + $this->display(); + } + + /** + * Delete a risk. + * + * @param int $riskID + * @param string $confirm + * @access public + * @return void + */ public function delete($riskID, $confirm = 'no') { $risk = $this->risk->getById($riskID); @@ -112,11 +189,19 @@ class risk extends control } } + /** + * Track a risk. + * + * @param int $riskID + * @access public + * @return void + */ public function track($riskID) { if($_POST) { - $changes = $this->risk->track($riskID); + $changes = array(); + if($this->post->isChange == 1) $changes = $this->risk->track($riskID); $response['result'] = 'success'; $response['message'] = $this->lang->saveSuccess; @@ -128,20 +213,31 @@ class risk extends control } $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Tracked' . $this->post->commnet); - $this->action->logHistory($actionID, $changes); + if(!empty($changes) or $_POST['comment']) + { + $actionID = $this->action->create('risk', $riskID, 'Tracked', $_POST['comment']); + $this->action->logHistory($actionID, $changes); + } $response['locate'] = inlink('browse'); $this->send($response); } - $this->view->risk = $this->risk->getById($riskID); - $this->view->users = $this->loadModel('user')->getPairs(); + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->track; $this->view->position[] = $this->lang->risk->track; + $this->view->risk = $this->risk->getById($riskID); + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); $this->display(); } + /** + * Update assign of risk. + * + * @param int $riskID + * @access public + * @return void + */ public function assignTo($riskID) { if($_POST) @@ -150,22 +246,32 @@ class risk extends control if(dao::isError()) die(js::error(dao::getError())); $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo); - $this->action->logHistory($actionID, $changes); - + if(!empty($changes)) + { + $actionID = $this->action->create('risk', $riskID, 'Assigned', $this->post->comment, $this->post->assignedTo); + $this->action->logHistory($actionID, $changes); + } + if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('risk', 'browse'), 'parent')); } - $risk = $this->risk->getById($riskID); + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo; + $this->view->position[] = $this->lang->risk->assignedTo; + + $this->view->risk = $this->risk->getById($riskID); $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->assignedTo; - $this->view->risk = $risk; - $this->display(); } + /** + * Cancel a risk. + * + * @param int $riskID + * @access public + * @return void + */ public function cancel($riskID) { if($_POST) @@ -174,21 +280,31 @@ class risk extends control if(dao::isError()) die(js::error(dao::getError())); $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment); - $this->action->logHistory($actionID, $changes); + if(!empty($changes)) + { + $actionID = $this->action->create('risk', $riskID, 'Canceled', $this->post->comment); + $this->action->logHistory($actionID, $changes); + } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('risk', 'browse'), 'parent')); } - $risk = $this->risk->getById($riskID); - $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel; - $this->view->risk = $risk; + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->cancel; + $this->view->position[] = $this->lang->risk->cancel; + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); + $this->view->risk = $this->risk->getById($riskID); $this->display(); } + /** + * Close a risk. + * + * @param int $riskID + * @access public + * @return void + */ public function close($riskID) { if($_POST) @@ -196,22 +312,32 @@ class risk extends control $changes = $this->risk->close($riskID); if(dao::isError()) die(js::error(dao::getError())); - $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment); - $this->action->logHistory($actionID, $changes); + if(!empty($changes)) + { + $this->loadModel('action'); + $actionID = $this->action->create('risk', $riskID, 'Closed', $this->post->comment); + $this->action->logHistory($actionID, $changes); + } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('risk', 'browse'), 'parent')); } - $risk = $this->risk->getById($riskID); + + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close; + $this->view->position[] = $this->lang->risk->close; $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->close; - $this->view->risk = $risk; - + $this->view->risk = $this->risk->getById($riskID); $this->display(); } + /** + * Hangup a risk. + * + * @param int $riskID + * @access public + * @return void + */ public function hangup($riskID) { if($_POST) @@ -219,22 +345,32 @@ class risk extends control $changes = $this->risk->hangup($riskID); if(dao::isError()) die(js::error(dao::getError())); - $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment); - $this->action->logHistory($actionID, $changes); + if(!empty($changes)) + { + $this->loadModel('action'); + $actionID = $this->action->create('risk', $riskID, 'Hangup', $this->post->comment); + $this->action->logHistory($actionID, $changes); + } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('risk', 'browse'), 'parent')); } - $risk = $this->risk->getById($riskID); - $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup; - $this->view->risk = $risk; + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->hangup; + $this->view->position[] = $this->lang->risk->hangup; + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); + $this->view->risk = $this->risk->getById($riskID); $this->display(); } + /** + * Activate a risk. + * + * @param int $riskID + * @access public + * @return void + */ public function activate($riskID) { if($_POST) @@ -242,19 +378,22 @@ class risk extends control $changes = $this->risk->activate($riskID); if(dao::isError()) die(js::error(dao::getError())); - $this->loadModel('action'); - $actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment); - $this->action->logHistory($actionID, $changes); + if(!empty($changes)) + { + $this->loadModel('action'); + $actionID = $this->action->create('risk', $riskID, 'Activated', $this->post->comment); + $this->action->logHistory($actionID, $changes); + } if(isonlybody()) die(js::closeModal('parent.parent', 'this')); die(js::locate($this->createLink('risk', 'browse'), 'parent')); } - $risk = $this->risk->getById($riskID); - $this->view->users = $this->loadModel('user')->getPairs(); - $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate; - $this->view->risk = $risk; + $this->view->title = $this->lang->risk->common . $this->lang->colon . $this->lang->risk->activate; + $this->view->position[] = $this->lang->risk->activate; + $this->view->users = $this->loadModel('user')->getPairs('noclosed'); + $this->view->risk = $this->risk->getById($riskID); $this->display(); } } diff --git a/module/risk/ext/lang/zh-cn/cmmi.php b/module/risk/ext/lang/zh-cn/cmmi.php deleted file mode 100644 index 6ce5c5665a..0000000000 --- a/module/risk/ext/lang/zh-cn/cmmi.php +++ /dev/null @@ -1,7 +0,0 @@ -risk->comment = '备注'; -$lang->risk->isChanged = '风险是否有变化'; - -$lang->risk->changedList[''] = ''; -$lang->risk->changedList['1'] = '是'; -$lang->risk->changedList['2'] = '否'; diff --git a/module/risk/ext/view/assign.cmmi.html.hook.php b/module/risk/ext/view/assign.cmmi.html.hook.php deleted file mode 100644 index 847a504a11..0000000000 --- a/module/risk/ext/view/assign.cmmi.html.hook.php +++ /dev/null @@ -1,14 +0,0 @@ -app->getModuleRoot() . 'risk/ext/lang/zh-cn/cmmi.php'; -$html = "