From 266e0a1c2ae4baeeeb70fa445d7fdeae583340e5 Mon Sep 17 00:00:00 2001 From: wangyuting Date: Thu, 25 May 2023 15:06:47 +0800 Subject: [PATCH] * Adjust confirm function to below edit function. --- module/bug/control.php | 115 +++++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 57 deletions(-) diff --git a/module/bug/control.php b/module/bug/control.php index aa2314b48f..b855d66e82 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -270,6 +270,64 @@ class bug extends control $this->bugZen->buildEditForm($bug); } + /** + * 确认 bug。 + * confirm a bug. + * + * @param int $bugID + * @param string $kanbanData fromColID=,toColID=,fromLaneID=,toLaneID=,regionID= + * @access public + * @return void + */ + public function confirm(int $bugID, string $kanbanParams = '') + { + if(!empty($_POST)) + { + /* 处理看板相关的参数。*/ + /* Process the params related to kanban. */ + $kanbanParams = str_replace(array(',', ' '), array('&', ''), $kanbanParams); + parse_str($kanbanParams, $kanbanData); + + /* 构造 bug 的表单数据。*/ + /* Structure the bug form data. */ + $bug = form::data($this->config->bug->form->confirm)->add('id', $bugID)->setDefault('confirmed', 1)->get(); + $bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->confirm['id'], $this->post->uid); + + $this->bug->confirm($bug, $kanbanData); + + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); + + /* 执行工作流的扩展动作。*/ + /* Execute extend actions.*/ + $message = $this->executeHooks($bugID); + + /* 弹窗内的返回。*/ + /* Respond in Modal. */ + if(isonlybody()) + { + $regionID = zget($kanbanData, 'regionID', 0); + $this->bugZen->responseInModal($bug->execution, '', $regionID); + } + + if(!$message) $message = $this->lang->saveSuccess; + return $this->send(array('result' => 'success', 'message' => $message, 'load' => $this->createLink('bug', 'view', "bugID=$bugID"))); + } + + $bug = $this->bug->getByID($bugID); + + /* 检查 bug 所属执行的权限。*/ + /* Check privilege for execution of the bug. */ + $this->bugZen->checkBugExecutionPriv($bug); + + $this->qa->setMenu($this->products, $bug->product, $bug->branch); + + $this->view->title = $this->products[$bug->product] . $this->lang->colon . $this->lang->bug->confirm; + $this->view->bug = $bug; + $this->view->users = $this->user->getPairs('noclosed', $bug->assignedTo); + $this->view->actions = $this->action->getList('bug', $bugID); + $this->display(); + } + /** * Bug 的统计报表。 * The report page. @@ -592,63 +650,6 @@ class bug extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true)); } - /** - * 确认 bug。 - * confirm a bug. - * - * @param int $bugID - * @param string $kanbanData fromColID=,toColID=,fromLaneID=,toLaneID=,regionID= - * @access public - * @return void - */ - public function confirm(int $bugID, string $kanbanParams = '') - { - if(!empty($_POST)) - { - /* 处理看板相关的参数。*/ - /* Process the params related to kanban. */ - $kanbanParams = str_replace(array(',', ' '), array('&', ''), $kanbanParams); - parse_str($kanbanParams, $kanbanData); - - /* 构造 bug 的表单数据。*/ - /* Structure the bug form data. */ - $bug = form::data($this->config->bug->form->confirm)->add('id', $bugID)->setDefault('confirmed', 1)->get(); - $bug = $this->loadModel('file')->processImgURL($bug, $this->config->bug->editor->confirm['id'], $this->post->uid); - - $this->bug->confirm($bug, $kanbanData); - - if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); - - /* 执行工作流的扩展动作。*/ - /* Execute extend actions.*/ - $message = $this->executeHooks($bugID); - - /* 弹窗内的返回。*/ - /* Respond in Modal. */ - if(isonlybody()) - { - $regionID = zget($kanbanData, 'regionID', 0); - $this->bugZen->responseInModal($bug->execution, '', $regionID); - } - - if(!$message) $message = $this->lang->saveSuccess; - return $this->send(array('result' => 'success', 'message' => $message, 'load' => $this->createLink('bug', 'view', "bugID=$bugID"))); - } - - $bug = $this->bug->getByID($bugID); - - /* 检查 bug 所属执行的权限。*/ - /* Check privilege for execution of the bug. */ - $this->bugZen->checkBugExecutionPriv($bug); - - $this->qa->setMenu($this->products, $bug->product, $bug->branch); - - $this->view->title = $this->products[$bug->product] . $this->lang->colon . $this->lang->bug->confirm; - $this->view->bug = $bug; - $this->view->users = $this->user->getPairs('noclosed', $bug->assignedTo); - $this->view->actions = $this->action->getList('bug', $bugID); - $this->display(); - } /** * 批量确认BUG。