From 38f0f04693b7ef54bbfd35fb3c3bb745a4a9eaf4 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Wed, 14 Jul 2021 14:38:25 +0800 Subject: [PATCH 1/8] * Fix bug #13628. --- module/gitlab/view/edit.html.php | 3 ++- module/gitlab/view/importissue.html.php | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/module/gitlab/view/edit.html.php b/module/gitlab/view/edit.html.php index 81d37d99f6..c3ae150608 100644 --- a/module/gitlab/view/edit.html.php +++ b/module/gitlab/view/edit.html.php @@ -36,7 +36,8 @@ - + + goback, '', 'class="btn btn-wide"'); ?> diff --git a/module/gitlab/view/importissue.html.php b/module/gitlab/view/importissue.html.php index 98ca018d8f..9cf632623c 100644 --- a/module/gitlab/view/importissue.html.php +++ b/module/gitlab/view/importissue.html.php @@ -43,7 +43,7 @@ save);?> - + goback, '', 'class="btn btn-wide"'); ?> From 49892661bf90277b4735351ceb4151a9403445bc Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Wed, 14 Jul 2021 14:41:43 +0800 Subject: [PATCH 2/8] * Fix product dynamic error. --- module/action/model.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/action/model.php b/module/action/model.php index c90296cd75..769f2cd639 100755 --- a/module/action/model.php +++ b/module/action/model.php @@ -64,7 +64,7 @@ class actionModel extends model /* Get product project and execution for this object. */ $relation = $this->getRelatedFields($action->objectType, $objectID, $actionType, $extra); - $action->product = (int)$relation['product']; + $action->product = $relation['product']; $action->project = (int)$relation['project']; $action->execution = (int)$relation['execution']; From c29583f980e399f53ecfa8d7f23a641bf8fcb97e Mon Sep 17 00:00:00 2001 From: zenggang Date: Wed, 14 Jul 2021 14:44:48 +0800 Subject: [PATCH 3/8] * finish task #40111 --- module/execution/control.php | 2 +- module/execution/model.php | 3 ++- module/project/control.php | 2 +- module/project/model.php | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/module/execution/control.php b/module/execution/control.php index a563257356..a4f501513b 100644 --- a/module/execution/control.php +++ b/module/execution/control.php @@ -1433,7 +1433,7 @@ class execution extends control $position[] = $this->lang->execution->edit; $allProducts = array(0 => ''); - $executionProsucts = $this->execution->getProducts($execution->project); + $executionProsucts = $this->execution->getProducts($execution->project, true, 'noclosed'); foreach($executionProsucts as $product) $allProducts[$product->id] = $product->name; $linkedProducts = $this->execution->getProducts($execution->id); diff --git a/module/execution/model.php b/module/execution/model.php index 5ff8526817..d589bd5496 100644 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -1579,7 +1579,7 @@ class executionModel extends model * @access public * @return array */ - public function getProducts($executionID, $withBranch = true) + public function getProducts($executionID, $withBranch = true, $status = 'all') { if(defined('TUTORIAL')) { @@ -1592,6 +1592,7 @@ class executionModel extends model ->on('t1.product = t2.id') ->where('t1.project')->eq((int)$executionID) ->andWhere('t2.deleted')->eq(0) + ->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() ->beginIF(!$this->app->user->admin)->andWhere('t2.id')->in($this->app->user->view->products)->fi(); if(!$withBranch) return $query->fetchPairs('id', 'name'); return $query->fetchAll('id'); diff --git a/module/project/control.php b/module/project/control.php index 9b0badd995..6a7a9423d2 100644 --- a/module/project/control.php +++ b/module/project/control.php @@ -441,7 +441,7 @@ class project extends control $linkedBranches = array(); $productPlans = array(0 => ''); $allProducts = $this->program->getProductPairs($project->parent, 'assign', 'noclosed'); - $linkedProducts = $this->project->getProducts($projectID); + $linkedProducts = $this->project->getProducts($projectID, true, 'noclosed'); $parentProject = $this->program->getByID($project->parent); /* If the story of the product which linked the project, you don't allow to remove the product. */ diff --git a/module/project/model.php b/module/project/model.php index fb71107d25..3c2f0fcbe3 100644 --- a/module/project/model.php +++ b/module/project/model.php @@ -490,11 +490,12 @@ class projectModel extends model * @access public * @return array */ - public function getProducts($projectID, $withBranch = true) + public function getProducts($projectID, $withBranch = true, $status = 'all') { $query = $this->dao->select('t2.id, t2.name, t2.type, t1.branch, t1.plan')->from(TABLE_PROJECTPRODUCT)->alias('t1') ->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id') ->where('t1.project')->eq((int)$projectID) + ->beginIF(strpos($status, 'noclosed') !== false)->andWhere('status')->ne('closed')->fi() ->beginIF(!$this->app->user->admin)->andWhere('t1.product')->in($this->app->user->view->products)->fi() ->andWhere('t2.deleted')->eq(0); if(!$withBranch) return $query->fetchPairs('id', 'name'); From 2e94758c6a66ffe3f5819577ea3495ac54ad5278 Mon Sep 17 00:00:00 2001 From: lichengjun Date: Wed, 14 Jul 2021 14:45:09 +0800 Subject: [PATCH 4/8] *Add English language. --- module/gitlab/lang/en.php | 60 +++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index dd8b436308..650b74a652 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -1,22 +1,46 @@ jenkins->common = 'Jenkins'; -$lang->jenkins->browse = 'Jenkins'; -$lang->jenkins->create = 'Create Jenkins'; -$lang->jenkins->edit = 'Edit Jenkins'; -$lang->jenkins->delete = 'Delete'; -$lang->jenkins->confirmDelete = 'Do you want to delete this Jenkins server?'; +$lang->gitlab = new stdclass; +$lang->gitlab->common = 'Gitlab'; +$lang->gitlab->browse = 'gitlab'; +$lang->gitlab->create = 'Create Gitlab'; +$lang->gitlab->edit = 'Edit Gitlab'; +$lang->gitlab->bindUser = 'Bind User'; +$lang->gitlab->webhook = 'webhook'; +$lang->gitlab->bindProduct = 'Import Product'; +$lang->gitlab->importIssue = 'Import Issue'; +$lang->gitlab->delete = 'Delete'; +$lang->gitlab->confirmDelete = 'Do you want to delete this Gitlab server?'; +$lang->gitlab->gitlabAccount = 'Gitlab Account'; +$lang->gitlab->zentaoAccount = 'Zentao Account'; -$lang->jenkins->browseAction = 'Jenkins List'; -$lang->jenkins->deleteAction = 'Delete Jenkins'; +$lang->gitlab->browseAction = 'Gitlab List'; +$lang->gitlab->deleteAction = 'Delete Gitlab'; +$lang->gitlab->gitlabProject = "{$lang->gitlab->common}project"; +$lang->gitlab->gitlabIssue = "{$lang->gitlab->common}issue"; +$lang->gitlab->zentaoProduct = 'Zentao Product'; +$lang->gitlab->objectType = 'Type'; // task, bug, story -$lang->jenkins->id = 'ID'; -$lang->jenkins->name = 'Name'; -$lang->jenkins->url = 'URL'; -$lang->jenkins->token = 'Token'; -$lang->jenkins->account = 'Username'; -$lang->jenkins->password = 'Password'; +$lang->gitlab->id = 'ID'; +$lang->gitlab->name = "{$lang->gitlab->common}name"; +$lang->gitlab->url = 'Gitlab Url'; +$lang->gitlab->token = 'Token'; +$lang->gitlab->defaultProject = 'Default Project'; +$lang->gitlab->private = 'MD5 Verify'; + +$lang->gitlab->lblCreate = 'Create Gitlab Server'; +$lang->gitlab->desc = 'Description'; +$lang->gitlab->tokenFirst = 'When the Token is not empty, the Token will be used first'; +$lang->gitlab->tips = 'When using a password, please disable the "Prevent cross-site request forgery" option in the GitLab global security settings.'; + +$lang->gitlab->placeholder = new stdclass; +$lang->gitlab->placeholder->name = ''; +$lang->gitlab->placeholder->url = "Please fill in the access address of the Gitlab Server homepage, as :https://gitlab.zentao.net."; +$lang->gitlab->placeholder->token = "Please fill in the access token of an account with admin privileges."; + +$lang->gitlab->noImportableIssues = "There are currently no issues available for import."; +$lang->gitlab->tokenError = "The current token is not admin rights."; +$lang->gitlab->hostError = "Invalid Gitlab service address."; +$lang->gitlab->bindUserError = "Cannot bind users repeatedly %s"; +$lang->gitlab->importIssueError = "The execution to which this issue belongs is not selected."; +$lang->gitlab->importIssueWarn = "There is a problem of import failure, you can try to import again."; -$lang->jenkins->lblCreate = 'Create Jenkins Server'; -$lang->jenkins->desc = 'Description'; -$lang->jenkins->tokenFirst = 'Use token if not empty.'; -$lang->jenkins->tips = 'Cancel "Prevent Cross Site Request Forgery exploits" when using password.'; From fd9a5711e0be116d6d3355b1186c6761130bc1aa Mon Sep 17 00:00:00 2001 From: lichengjun Date: Wed, 14 Jul 2021 14:55:34 +0800 Subject: [PATCH 5/8] *Fix gitlab english lang. --- module/gitlab/lang/en.php | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index 650b74a652..e51a46ee5f 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -1,20 +1,20 @@ gitlab = new stdclass; -$lang->gitlab->common = 'Gitlab'; +$lang->gitlab->common = 'GitLab'; $lang->gitlab->browse = 'gitlab'; -$lang->gitlab->create = 'Create Gitlab'; -$lang->gitlab->edit = 'Edit Gitlab'; +$lang->gitlab->create = 'Create GitLab'; +$lang->gitlab->edit = 'Edit GitLab'; $lang->gitlab->bindUser = 'Bind User'; $lang->gitlab->webhook = 'webhook'; $lang->gitlab->bindProduct = 'Import Product'; $lang->gitlab->importIssue = 'Import Issue'; $lang->gitlab->delete = 'Delete'; -$lang->gitlab->confirmDelete = 'Do you want to delete this Gitlab server?'; -$lang->gitlab->gitlabAccount = 'Gitlab Account'; +$lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?'; +$lang->gitlab->gitlabAccount = 'GitLab Account'; $lang->gitlab->zentaoAccount = 'Zentao Account'; -$lang->gitlab->browseAction = 'Gitlab List'; -$lang->gitlab->deleteAction = 'Delete Gitlab'; +$lang->gitlab->browseAction = 'GitLab List'; +$lang->gitlab->deleteAction = 'Delete GitLab'; $lang->gitlab->gitlabProject = "{$lang->gitlab->common}project"; $lang->gitlab->gitlabIssue = "{$lang->gitlab->common}issue"; $lang->gitlab->zentaoProduct = 'Zentao Product'; @@ -22,24 +22,24 @@ $lang->gitlab->objectType = 'Type'; // task, bug, story $lang->gitlab->id = 'ID'; $lang->gitlab->name = "{$lang->gitlab->common}name"; -$lang->gitlab->url = 'Gitlab Url'; +$lang->gitlab->url = 'GitLab Url'; $lang->gitlab->token = 'Token'; $lang->gitlab->defaultProject = 'Default Project'; $lang->gitlab->private = 'MD5 Verify'; -$lang->gitlab->lblCreate = 'Create Gitlab Server'; +$lang->gitlab->lblCreate = 'Create GitLab Server'; $lang->gitlab->desc = 'Description'; $lang->gitlab->tokenFirst = 'When the Token is not empty, the Token will be used first'; $lang->gitlab->tips = 'When using a password, please disable the "Prevent cross-site request forgery" option in the GitLab global security settings.'; $lang->gitlab->placeholder = new stdclass; $lang->gitlab->placeholder->name = ''; -$lang->gitlab->placeholder->url = "Please fill in the access address of the Gitlab Server homepage, as :https://gitlab.zentao.net."; +$lang->gitlab->placeholder->url = "Please fill in the access address of the GitLab Server homepage, as :https://gitlab.zentao.net."; $lang->gitlab->placeholder->token = "Please fill in the access token of an account with admin privileges."; $lang->gitlab->noImportableIssues = "There are currently no issues available for import."; $lang->gitlab->tokenError = "The current token is not admin rights."; -$lang->gitlab->hostError = "Invalid Gitlab service address."; +$lang->gitlab->hostError = "Invalid GitLab service address."; $lang->gitlab->bindUserError = "Cannot bind users repeatedly %s"; $lang->gitlab->importIssueError = "The execution to which this issue belongs is not selected."; $lang->gitlab->importIssueWarn = "There is a problem of import failure, you can try to import again."; From 6342f7403137d59a96e381626269ad59ff293e16 Mon Sep 17 00:00:00 2001 From: lichengjun Date: Wed, 14 Jul 2021 14:59:48 +0800 Subject: [PATCH 6/8] *Fix code format. --- module/gitlab/lang/en.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index e51a46ee5f..a0b78ad0e2 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -1,7 +1,7 @@ gitlab = new stdclass; $lang->gitlab->common = 'GitLab'; -$lang->gitlab->browse = 'gitlab'; +$lang->gitlab->browse = 'GitLab'; $lang->gitlab->create = 'Create GitLab'; $lang->gitlab->edit = 'Edit GitLab'; $lang->gitlab->bindUser = 'Bind User'; From 04467052dcfeb5d3a623ebfb2ec9dc6a77c6f795 Mon Sep 17 00:00:00 2001 From: dingguodong Date: Wed, 14 Jul 2021 15:00:35 +0800 Subject: [PATCH 7/8] * Optimize back button for bug #13628. --- module/gitlab/view/binduser.html.php | 4 ++-- module/gitlab/view/create.html.php | 4 ++-- module/repo/view/edit.html.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/module/gitlab/view/binduser.html.php b/module/gitlab/view/binduser.html.php index a0cf0dd17f..e634429c64 100644 --- a/module/gitlab/view/binduser.html.php +++ b/module/gitlab/view/binduser.html.php @@ -51,8 +51,8 @@ - save);?> - + + goback, '', 'class="btn btn-wide"'); ?> diff --git a/module/gitlab/view/create.html.php b/module/gitlab/view/create.html.php index 1675041925..ad6e54f62c 100644 --- a/module/gitlab/view/create.html.php +++ b/module/gitlab/view/create.html.php @@ -36,8 +36,8 @@ - - + + goback, '', 'class="btn btn-wide"'); ?> diff --git a/module/repo/view/edit.html.php b/module/repo/view/edit.html.php index cda78336be..fe9d4a2117 100644 --- a/module/repo/view/edit.html.php +++ b/module/repo/view/edit.html.php @@ -106,7 +106,7 @@ - + goback, '', 'class="btn btn-wide"'); ?> From 49844b90e698b76e3e8957f05db12f16286be945 Mon Sep 17 00:00:00 2001 From: lichengjun Date: Wed, 14 Jul 2021 15:05:27 +0800 Subject: [PATCH 8/8] *Fix code format. --- module/gitlab/lang/en.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/module/gitlab/lang/en.php b/module/gitlab/lang/en.php index a0b78ad0e2..d8a12a1798 100644 --- a/module/gitlab/lang/en.php +++ b/module/gitlab/lang/en.php @@ -1,14 +1,14 @@ gitlab = new stdclass; $lang->gitlab->common = 'GitLab'; -$lang->gitlab->browse = 'GitLab'; +$lang->gitlab->browse = 'GitLab Browse'; $lang->gitlab->create = 'Create GitLab'; $lang->gitlab->edit = 'Edit GitLab'; $lang->gitlab->bindUser = 'Bind User'; $lang->gitlab->webhook = 'webhook'; $lang->gitlab->bindProduct = 'Import Product'; $lang->gitlab->importIssue = 'Import Issue'; -$lang->gitlab->delete = 'Delete'; +$lang->gitlab->delete = 'Delete GitLab'; $lang->gitlab->confirmDelete = 'Do you want to delete this GitLab server?'; $lang->gitlab->gitlabAccount = 'GitLab Account'; $lang->gitlab->zentaoAccount = 'Zentao Account';