* Bug fix for editing a MR.
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
+3
-4
@@ -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;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<td class='text-left c-actions'>
|
||||
<?php
|
||||
common::printLink('mr', 'list', "mr={$mr->id}", '<i class="icon icon-review"></i>', '', "title='{$lang->mr->list}' class='btn btn-info'");
|
||||
common::printLink('mr', 'update', "mrID=$mr->id", '<i class="icon icon-edit"></i>', '', "title='{$lang->mr->edit}' class='btn btn-info'");
|
||||
common::printLink('mr', 'edit', "mrID=$mr->id", '<i class="icon icon-edit"></i>', '', "title='{$lang->mr->edit}' class='btn btn-info'");
|
||||
if(common::hasPriv('mr', 'delete')) echo html::a($this->createLink('mr', 'delete', "id=$mr->id"), '<i class="icon-trash"></i>', 'hiddenwin', "title='{$lang->mr->delete}' class='btn'");
|
||||
?>
|
||||
</td>
|
||||
|
||||
@@ -51,11 +51,11 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->mr->assignee;?></th>
|
||||
<td><?php echo html::select('assignee', array(''), $MR->assignee, "class='form-control chosen'")?></td>
|
||||
<td><?php echo html::select('assignee', $users, $MR->assignee, "class='form-control chosen'")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><?php echo $lang->mr->reviewer;?></th>
|
||||
<td><?php echo html::select('reviewer', array(''), $MR->reviewer, "class='form-control chosen'")?></td>
|
||||
<td><?php echo html::select('reviewer', $users, $MR->reviewer, "class='form-control chosen'")?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th></th>
|
||||
|
||||
Reference in New Issue
Block a user