From ae06366f2ac39dbdaae06f0ec8250072dfeec017 Mon Sep 17 00:00:00 2001 From: liyuchun <563917701@qq.com> Date: Fri, 15 Jul 2022 05:09:12 +0000 Subject: [PATCH 1/2] * Fix bug #25283. --- module/ci/model.php | 8 +++++++- module/repo/model.php | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/module/ci/model.php b/module/ci/model.php index 2f5bf854b0..96e962551e 100644 --- a/module/ci/model.php +++ b/module/ci/model.php @@ -26,7 +26,13 @@ class ciModel extends model } common::setMenuVars('devops', $this->session->repoID); - $this->lang->switcherMenu = $this->loadModel('repo')->getSwitcher($this->session->repoID); + if($this->session->repoID) + { + $repo = $this->loadModel('repo')->getRepoByID($repoID); + if($repo->SCM != 'Gitlab') unset($this->lang->devops->menu->mr); + + $this->lang->switcherMenu = $this->loadModel('repo')->getSwitcher($this->session->repoID); + } } /** diff --git a/module/repo/model.php b/module/repo/model.php index 99fe05dee8..f8ffb801c3 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -38,6 +38,9 @@ class repoModel extends model if(empty($repoID)) $repoID = $this->session->repoID ? $this->session->repoID : key($repos); if(!isset($repos[$repoID])) $repoID = key($repos); + /* Init switcher menu. */ + $this->lang->switcherMenu = ''; + /* Check the privilege. */ if($repoID) { From 07f8b57e68ec7d871a094c2206fada500a551a7e Mon Sep 17 00:00:00 2001 From: liyuchun <563917701@qq.com> Date: Fri, 15 Jul 2022 05:28:09 +0000 Subject: [PATCH 2/2] * Fix bug #25153. --- config/zentaopms.php | 1 + module/action/config.php | 3 ++- module/action/lang/de.php | 1 + module/action/lang/en.php | 1 + module/action/lang/fr.php | 1 + module/action/lang/vi.php | 1 + module/action/lang/zh-cn.php | 1 + module/action/lang/zh-tw.php | 1 + module/repo/control.php | 6 +----- 9 files changed, 10 insertions(+), 6 deletions(-) diff --git a/config/zentaopms.php b/config/zentaopms.php index 1c33bb6d96..3ecf24e31e 100644 --- a/config/zentaopms.php +++ b/config/zentaopms.php @@ -377,6 +377,7 @@ $config->objectTables['gitlab'] = TABLE_PIPELINE; $config->objectTables['jebkins'] = TABLE_PIPELINE; $config->objectTables['stage'] = TABLE_STAGE; $config->objectTables['apistruct'] = TABLE_APISTRUCT; +$config->objectTables['repo'] = TABLE_REPO; $config->newFeatures = array('introduction', 'tutorial', 'youngBlueTheme', 'visions'); diff --git a/module/action/config.php b/module/action/config.php index cc841bc007..000cdcd5cf 100755 --- a/module/action/config.php +++ b/module/action/config.php @@ -46,6 +46,7 @@ $config->action->objectNameFields['gitlab'] = 'name'; $config->action->objectNameFields['gitea'] = 'name'; $config->action->objectNameFields['stage'] = 'name'; $config->action->objectNameFields['apistruct'] = 'name'; +$config->action->objectNameFields['repo'] = 'name'; $config->action->commonImgSize = 870; @@ -61,7 +62,7 @@ $config->action->majorList['execution'] = array('opened', 'edited'); $config->action->needGetProjectType = 'build,task,bug,case,testcase,caselib,testtask,testsuite,testreport,doc,issue,release,risk,design,opportunity,trainplan,gapanalysis,researchplan,researchreport,'; $config->action->needGetRelateField = ',story,productplan,release,task,build,bug,testcase,case,testtask,testreport,doc,doclib,issue,risk,opportunity,trainplan,gapanalysis,team,whitelist,researchplan,researchreport,meeting,kanbanlane,kanbancolumn,module,'; -$config->action->noLinkModules = ',doclib,module,webhook,gitlab,gitea,sonarqube,pipeline,jenkins,kanban,kanbanspace,kanbancolumn,kanbanlane,kanbanregion,kanbancard,execution,project,traincategory,apistruct,program,product,user,entry,'; +$config->action->noLinkModules = ',doclib,module,webhook,gitlab,gitea,sonarqube,pipeline,jenkins,kanban,kanbanspace,kanbancolumn,kanbanlane,kanbanregion,kanbancard,execution,project,traincategory,apistruct,program,product,user,entry,repo,'; $config->action->preferredTypeNum = 10; diff --git a/module/action/lang/de.php b/module/action/lang/de.php index 9d6dc7ae54..a98ee3c3c0 100644 --- a/module/action/lang/de.php +++ b/module/action/lang/de.php @@ -144,6 +144,7 @@ $lang->action->objectTypes['sonarqube'] = 'SonarQube Server'; $lang->action->objectTypes['sonarqubeproject'] = 'SonarQube Project'; $lang->action->objectTypes['stage'] = 'Stage'; $lang->action->objectTypes['patch'] = 'Patch'; +$lang->action->objectTypes['repo'] = 'Repo'; /* Used to describe operation history. */ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/en.php b/module/action/lang/en.php index cca3731b9f..26fecace0b 100755 --- a/module/action/lang/en.php +++ b/module/action/lang/en.php @@ -144,6 +144,7 @@ $lang->action->objectTypes['sonarqube'] = 'SonarQube Server'; $lang->action->objectTypes['sonarqubeproject'] = 'SonarQube Project'; $lang->action->objectTypes['stage'] = 'Stage'; $lang->action->objectTypes['patch'] = 'Patch'; +$lang->action->objectTypes['repo'] = 'Repo'; /* Used to describe operation history. */ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/fr.php b/module/action/lang/fr.php index 098e2d0cdc..2d4a6ca759 100644 --- a/module/action/lang/fr.php +++ b/module/action/lang/fr.php @@ -144,6 +144,7 @@ $lang->action->objectTypes['sonarqube'] = 'SonarQube Server'; $lang->action->objectTypes['sonarqubeproject'] = 'SonarQube Project'; $lang->action->objectTypes['stage'] = 'Stage'; $lang->action->objectTypes['patch'] = 'Patch'; +$lang->action->objectTypes['repo'] = 'Repo'; /* Used to describe operation history. */ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/vi.php b/module/action/lang/vi.php index 7e7aa0909a..56a4ac1674 100644 --- a/module/action/lang/vi.php +++ b/module/action/lang/vi.php @@ -122,6 +122,7 @@ $lang->action->objectTypes['sonarqube'] = 'SonarQube Server'; $lang->action->objectTypes['sonarqubeproject'] = 'SonarQube Project'; $lang->action->objectTypes['stage'] = 'Stage'; $lang->action->objectTypes['patch'] = 'Patch'; +$lang->action->objectTypes['repo'] = 'Repo'; /* Used to describe operation history. */ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/zh-cn.php b/module/action/lang/zh-cn.php index 38dee71117..8efd487286 100755 --- a/module/action/lang/zh-cn.php +++ b/module/action/lang/zh-cn.php @@ -144,6 +144,7 @@ $lang->action->objectTypes['sonarqube'] = 'SonarQube服务器'; $lang->action->objectTypes['sonarqubeproject'] = 'SonarQube项目'; $lang->action->objectTypes['stage'] = '阶段'; $lang->action->objectTypes['patch'] = '补丁'; +$lang->action->objectTypes['repo'] = '代码库'; /* 用来描述操作历史记录。*/ $lang->action->desc = new stdclass(); diff --git a/module/action/lang/zh-tw.php b/module/action/lang/zh-tw.php index 04ebfaedf6..dbdac896d3 100755 --- a/module/action/lang/zh-tw.php +++ b/module/action/lang/zh-tw.php @@ -134,6 +134,7 @@ $lang->action->objectTypes['kanbanregion'] = '看板區域'; $lang->action->objectTypes['kanbanlane'] = '看板泳道'; $lang->action->objectTypes['kanbancolumn'] = '看板列'; $lang->action->objectTypes['kanbancard'] = '看板卡片'; +$lang->action->objectTypes['repo'] = '代码库'; /* 用來描述操作歷史記錄。*/ $lang->action->desc = new stdclass(); diff --git a/module/repo/control.php b/module/repo/control.php index 2e53ea1a3e..65a8c65312 100644 --- a/module/repo/control.php +++ b/module/repo/control.php @@ -237,11 +237,7 @@ class repo extends control if($error) return print(js::alert($error)); - $this->dao->delete()->from(TABLE_REPO)->where('id')->eq($repoID)->exec(); - $this->dao->delete()->from(TABLE_REPOHISTORY)->where('repo')->eq($repoID)->exec(); - $this->dao->delete()->from(TABLE_REPOFILES)->where('repo')->eq($repoID)->exec(); - $this->dao->delete()->from(TABLE_REPOBRANCH)->where('repo')->eq($repoID)->exec(); - + $this->repo->delete(TABLE_REPO, $repoID); if(dao::isError()) return print(js::error(dao::getError())); echo js::reload('parent'); }