From 807ad4b4e855278f7499bdff88fff2e7c01cc9e7 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Mon, 23 Aug 2021 10:41:37 +0800 Subject: [PATCH] * Bug fix for editing a MR. --- module/mr/config.php | 4 ++-- module/mr/control.php | 11 +++++++---- module/mr/model.php | 7 +++---- module/mr/view/browse.html.php | 2 +- module/mr/view/edit.html.php | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/module/mr/config.php b/module/mr/config.php index 9a4b3d1253..b0535585c1 100644 --- a/module/mr/config.php +++ b/module/mr/config.php @@ -4,5 +4,5 @@ $config->MR->create = new stdclass(); $config->MR->create->requiredFields = 'gitlabID,projectID,mrID,title'; $config->MR->create->skippedFields = 'sourceProject,sourceBranch,targetProject,targetBranch'; -$config->MR->update = new stdclass(); -$config->MR->update->requiredFields = 'title'; +$config->MR->edit = new stdclass(); +$config->MR->edit->requiredFields = 'title'; diff --git a/module/mr/control.php b/module/mr/control.php index 8e9c38a734..305d671217 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -48,22 +48,25 @@ class mr extends control } /** - * Update/Edit MR function. + * Edit MR function. * * @access public * @return void */ - public function update($MRID) + public function edit($MRID) { if($_POST) { - $this->mr->update($MRID); + $this->mr->edit($MRID); if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => dao::getError())); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => inlink('browse'))); } - $this->view->MR = $this->mr->getByID($MRID); + $MR = $this->mr->getByID($MRID); + $this->view->MR = $MR; $this->view->title = $this->lang->mr->edit; + $this->view->users = array("" => "") + $this->loadModel('gitlab')->getUserIdRealnamePairs($MR->gitlabID); /* Get user list for assignee and reviewer. */ + $this->display(); } diff --git a/module/mr/model.php b/module/mr/model.php index 1eb7282aca..be700b5779 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -164,12 +164,12 @@ class mrModel extends model } /** - * Update MR function. + * Edit MR function. * * @access public * @return void */ - public function update($MRID) + public function edit($MRID) { /* Get MR in zentao database and do not append extra attributes in GitLab. */ $MR = $this->getByID($MRID, $process = false); @@ -189,11 +189,10 @@ class mrModel extends model /* Update MR in Zentao database. */ $this->dao->update(TABLE_MR)->data($MR) - ->batchCheck($this->config->MR->update->requiredFields, 'notempty') + ->batchCheck($this->config->MR->edit->requiredFields, 'notempty') ->autoCheck() ->exec(); if(dao::isError()) return false; - } /** diff --git a/module/mr/view/browse.html.php b/module/mr/view/browse.html.php index d1491e98fb..b924bc50a9 100644 --- a/module/mr/view/browse.html.php +++ b/module/mr/view/browse.html.php @@ -45,7 +45,7 @@ id}", '', '', "title='{$lang->mr->list}' class='btn btn-info'"); - common::printLink('mr', 'update', "mrID=$mr->id", '', '', "title='{$lang->mr->edit}' class='btn btn-info'"); + common::printLink('mr', 'edit', "mrID=$mr->id", '', '', "title='{$lang->mr->edit}' class='btn btn-info'"); if(common::hasPriv('mr', 'delete')) echo html::a($this->createLink('mr', 'delete', "id=$mr->id"), '', 'hiddenwin', "title='{$lang->mr->delete}' class='btn'"); ?> diff --git a/module/mr/view/edit.html.php b/module/mr/view/edit.html.php index ce3fb48440..63a18d337a 100644 --- a/module/mr/view/edit.html.php +++ b/module/mr/view/edit.html.php @@ -51,11 +51,11 @@ mr->assignee;?> - assignee, "class='form-control chosen'")?> + assignee, "class='form-control chosen'")?> mr->reviewer;?> - reviewer, "class='form-control chosen'")?> + reviewer, "class='form-control chosen'")?>