Merge branch 'devops18_47047' into 'master'

* Finish task#47047

See merge request easycorp/zentaopms!1272
This commit is contained in:
李玉春
2022-01-06 03:00:38 +00:00
3 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -105,7 +105,7 @@ $lang->mr->apiError->createMR = "Failed to create a merge request through API. R
$lang->mr->apiError->sudo = "Unable to operate with the GitLab account bound to the current user. Reason: %s";
$lang->mr->createFailedFromAPI = "Failed to create Merge Request.";
$lang->mr->hasSameOpenedMR = "There are duplicate and unclosed merge requests.";
$lang->mr->hasSameOpenedMR = "There are duplicate and unclosed merge requests: ID%u";
$lang->mr->accessGitlabFailed = "Unable to connect to the GitLab server.";
$lang->mr->reopenSuccess = "The merge request was reopened.";
$lang->mr->closeSuccess = "Merge request closed.";
+1 -1
View File
@@ -105,7 +105,7 @@ $lang->mr->apiError->createMR = "通过API创建合并请求失败,失败原
$lang->mr->apiError->sudo = "无法以当前用户绑定的GitLab账户进行操作,失败原因:%s";
$lang->mr->createFailedFromAPI = "创建合并请求失败。";
$lang->mr->hasSameOpenedMR = "存在重复并且未关闭的合并请求。";
$lang->mr->hasSameOpenedMR = "存在重复并且未关闭的合并请求: ID%u";
$lang->mr->accessGitlabFailed = "当前无法连接到GitLab服务器。";
$lang->mr->reopenSuccess = "已重新打开合并请求。";
$lang->mr->closeSuccess = "已关闭合并请求。";
+5 -4
View File
@@ -1462,7 +1462,7 @@ class mrModel extends model
{
if(empty($sourceProject) or empty($sourceBranch) or empty($targetProject) or empty($targetBranch)) return array('result' => 'success');
$dbOpenedCount = $this->dao->select('count(*) as count')->from(TABLE_MR)
$dbOpenedID = $this->dao->select('id')->from(TABLE_MR)
->where('gitlabID')->eq($gitlabID)
->andWhere('sourceProject')->eq($sourceProject)
->andWhere('sourceBranch')->eq($sourceBranch)
@@ -1470,10 +1470,11 @@ class mrModel extends model
->andWhere('targetBranch')->eq($targetBranch)
->andWhere('status')->eq('opened')
->andWhere('deleted')->eq('0')
->fetch('count');
if($dbOpenedCount > 0) return array('result' => 'fail', 'message' => $this->lang->mr->hasSameOpenedMR);
->fetch('id');
if(!empty($dbOpenedID)) return array('result' => 'fail', 'message' => sprintf($this->lang->mr->hasSameOpenedMR, $dbOpenedID));
if($this->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch)) return array('result' => 'fail', 'message' => $this->lang->mr->hasSameOpenedMR);
$mr = $this->apiGetSameOpened($gitlabID, $sourceProject, $sourceBranch, $targetProject, $targetBranch);
if($mr) return array('result' => 'fail', 'message' => sprintf($this->lang->mr->errorLang[2], $mr->iid));
return array('result' => 'success');
}