From dc981a4a05ed574b1e9abd314dc2b063d22e98de Mon Sep 17 00:00:00 2001 From: dingguodong Date: Tue, 24 Aug 2021 08:26:13 +0800 Subject: [PATCH] * Update function for editing MR. --- module/mr/control.php | 14 ++++++++++---- module/mr/model.php | 3 ++- module/mr/view/edit.html.php | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/module/mr/control.php b/module/mr/control.php index 94bec9ea71..1a04cd649e 100644 --- a/module/mr/control.php +++ b/module/mr/control.php @@ -55,13 +55,19 @@ class mr extends control if($_POST) { $result = $this->mr->update($MRID); - return $result; + return $this->send($result); } $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. */ + + $branchList = $this->loadModel('gitlab')->getBranches($MR->gitlabID, $MR->targetProject); + $targetBranchList = array(); + foreach($branchList as $branch) $targetBranchList[$branch] = $branch; + + $this->view->MR = $MR; + $this->view->targetBranchList = $targetBranchList; + $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 cffb6f28ce..7729d55de6 100644 --- a/module/mr/model.php +++ b/module/mr/model.php @@ -178,7 +178,8 @@ class mrModel extends model $newMR->targetBranch = $MR->targetBranch; $oldMR = $this->getByID($MRID); - $this->apiUpdateMR($oldMR->gitlabID, $oldMR->sourceProject, $oldMR->mriid, $newMR); + + $this->apiUpdateMR($oldMR->gitlabID, $oldMR->targetProject, $oldMR->mriid, $newMR); /* Update MR in Zentao database. */ $this->dao->update(TABLE_MR)->data($MR) diff --git a/module/mr/view/edit.html.php b/module/mr/view/edit.html.php index 0df56316f7..d47637b8b4 100644 --- a/module/mr/view/edit.html.php +++ b/module/mr/view/edit.html.php @@ -37,7 +37,7 @@
loadModel('gitlab')->apiGetSingleProject($MR->gitlabID, $MR->targetProject)->name_with_namespace;?> mr->targetBranch ?> - loadModel('gitlab')->getBranches($MR->gitlabID, $MR->targetProject), '', "class='form-control chosen'");?> + targetBranch, "class='form-control chosen'");?>