From 7edfc6d6c8a4da314fbb86b55cec1378293970de Mon Sep 17 00:00:00 2001 From: wangjianhua Date: Sun, 9 Oct 2022 09:43:57 +0800 Subject: [PATCH] * Add lang item and fix codes format. --- module/project/control.php | 12 ++++++------ module/project/lang/de.php | 1 + module/project/lang/en.php | 1 + module/project/lang/fr.php | 1 + module/project/lang/vi.php | 1 + module/project/lang/zh-cn.php | 1 + module/project/lang/zh-tw.php | 1 + module/project/model.php | 1 - 8 files changed, 12 insertions(+), 7 deletions(-) diff --git a/module/project/control.php b/module/project/control.php index d8470437de..c280944493 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -2246,7 +2246,7 @@ class project extends control } /** - * Link project and repo. + * Link projects and code repositories. * * @param int $projectID * @access public @@ -2261,17 +2261,17 @@ class project extends control $postData = fixer::input('post')->setDefault('repos', array())->get(); $this->project->updateRepoRelations($projectID, $postData->repos); + if(dao::isError()) return $this->send(array('result' => 'fail', 'message' => $this->lang->project->linkRepoFailed)); $locateLink = inLink('manageRepo', "projectID=$projectID"); return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $locateLink)); } - $this->view->title = $this->lang->project->manageRepo; - - $this->view->allRepos = $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq(0)->fetchPairs('id', 'name'); - $this->view->linkedRepos = $this->project->linkedRepoPairs($projectID); - + $this->view->title = $this->lang->project->manageRepo; + $this->view->allRepos = $this->dao->select('*')->from(TABLE_REPO)->where('deleted')->eq(0)->fetchPairs('id', 'name'); + $this->view->linkedRepos = $this->project->linkedRepoPairs($projectID); $this->view->unlinkedRepos = array(); + foreach($this->view->allRepos as $repoID => $repoName) if(!isset($this->view->linkedRepos[$repoID])) $this->view->unlinkedRepos[$repoID] = $repoName; $this->display(); diff --git a/module/project/lang/de.php b/module/project/lang/de.php index 2c6fab5503..0d257a9aa0 100644 --- a/module/project/lang/de.php +++ b/module/project/lang/de.php @@ -209,6 +209,7 @@ $lang->project->productTip = 'After clicking New Product, the projec $lang->project->noDevStage = 'There is no R&D stage under this project, or you do not have access permissions. The creation of builds is not supported at the moment.'; $lang->project->budgetOverrun = "The project's budget exceeds the remaining budget of the parent program:"; $lang->project->disabledInputTip = 'Please cancel %s first'; +$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.'; $lang->project->tenThousand = ''; $lang->project->hundredMillion = 'Hundred Million'; diff --git a/module/project/lang/en.php b/module/project/lang/en.php index cec1c0ce23..84271b9448 100644 --- a/module/project/lang/en.php +++ b/module/project/lang/en.php @@ -209,6 +209,7 @@ $lang->project->productTip = 'After clicking New Product, the projec $lang->project->noDevStage = 'There is no R&D stage under this project, or you do not have access permissions. The creation of builds is not supported at the moment.'; $lang->project->budgetOverrun = "The project's budget exceeds the remaining budget of the parent program:"; $lang->project->disabledInputTip = 'Please cancel %s first'; +$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.'; $lang->project->tenThousand = 'Ten Thousand'; $lang->project->hundredMillion = 'Hundred Million'; diff --git a/module/project/lang/fr.php b/module/project/lang/fr.php index 24eff873ec..4e0fecfc8f 100644 --- a/module/project/lang/fr.php +++ b/module/project/lang/fr.php @@ -209,6 +209,7 @@ $lang->project->productTip = 'After clicking New Product, the projec $lang->project->noDevStage = "Il n'y a pas de phase R&D dans ce projet, ou vous n'avez pas la permission d'accès. La version ne peut pas être créée pour le moment."; $lang->project->budgetOverrun = "Le budget du projet a dépassé le budget restant du programme parent:"; $lang->project->disabledInputTip = 'Please cancel %s first'; +$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.'; $lang->project->tenThousand = ''; $lang->project->hundredMillion = 'Hundred Million'; diff --git a/module/project/lang/vi.php b/module/project/lang/vi.php index 22388d2f2b..b8abfa84d2 100644 --- a/module/project/lang/vi.php +++ b/module/project/lang/vi.php @@ -127,6 +127,7 @@ $lang->project->multiLinkedProductsTip = 'The following products linked to this $lang->project->linkStoryByPlanTips = "This action will associate all {$lang->SRCommon} under the selected plan to this project"; $lang->project->createExecution = "There is no {$lang->executionCommon} under this project, please create {$lang->executionCommon} first"; $lang->project->noDevStage = 'There is no R&D stage under this project, or you do not have access permissions. The creation of builds is not supported at the moment.'; +$lang->project->linkRepoFailed = 'Failed to link projects and code repositories.'; $lang->project->tenThousand = ''; diff --git a/module/project/lang/zh-cn.php b/module/project/lang/zh-cn.php index c41bca8c2b..63ff06c5a8 100644 --- a/module/project/lang/zh-cn.php +++ b/module/project/lang/zh-cn.php @@ -209,6 +209,7 @@ $lang->project->productTip = '点击新建产品后,项目将不 $lang->project->noDevStage = '该项目下没有研发类型的阶段,或者您没有权限访问,暂时不支持创建版本。'; $lang->project->budgetOverrun = '项目的预算超出了父项目集的剩余预算:'; $lang->project->disabledInputTip = '请先取消%s'; +$lang->project->linkRepoFailed = '关联代码库失败'; $lang->project->tenThousand = '万'; $lang->project->hundredMillion = '亿'; diff --git a/module/project/lang/zh-tw.php b/module/project/lang/zh-tw.php index 7f4b7b3cc7..454946432b 100644 --- a/module/project/lang/zh-tw.php +++ b/module/project/lang/zh-tw.php @@ -58,6 +58,7 @@ $lang->project->copyTeamTitle = '選擇一個項目團隊來複制'; $lang->project->manageRepo = '關聯代碼庫'; $lang->project->linkedRepo = '已關聯代碼庫'; $lang->project->unlinkedRepo = '未關聯代碼庫'; +$lang->project->linkRepoFailed = '關聯代碼庫失敗。'; /* Fields. */ $lang->project->common = '項目'; diff --git a/module/project/model.php b/module/project/model.php index df03a84c87..a3ceb17ede 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -2889,7 +2889,6 @@ class projectModel extends model ->andWhere('BType')->eq('repo') ->fetchPairs('BID', 'BID'); - $repos = $this->dao->select('*')->from(TABLE_REPO) ->where('deleted')->eq(0) ->andWhere('id')->in($repoIDList)