From 6dab95a7342fb25d4dcb43b81522484dccd21592 Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Mon, 2 Aug 2021 08:01:59 +0800 Subject: [PATCH] * Adjust review codes. --- lib/scm/gitlab.class.php | 1 - lib/scm/gitrepo.class.php | 1 - module/doc/model.php | 36 +++++++++++------------------------- 3 files changed, 11 insertions(+), 27 deletions(-) diff --git a/lib/scm/gitlab.class.php b/lib/scm/gitlab.class.php index 82bf44ea1a..12193541c1 100644 --- a/lib/scm/gitlab.class.php +++ b/lib/scm/gitlab.class.php @@ -617,7 +617,6 @@ class gitlab $params->per_page = 100; $allResults = array(); - $files = array(); while(true) { $results = $this->fetch($api, $params); diff --git a/lib/scm/gitrepo.class.php b/lib/scm/gitrepo.class.php index 297adc4337..0d7cca6f6f 100644 --- a/lib/scm/gitrepo.class.php +++ b/lib/scm/gitrepo.class.php @@ -125,7 +125,6 @@ class GitRepo $list = execCmd($cmd . ' 2>&1', 'array', $result); if($result) return array(); - $branches = array(); foreach($list as $localBranch) { diff --git a/module/doc/model.php b/module/doc/model.php index 607d2ab4e3..a5f8a1f1e2 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -1257,43 +1257,29 @@ class docModel extends model $bugIdList = $testReportIdList = $caseIdList = $storyIdList = $planIdList = $releaseIdList = $executionIdList = $taskIdList = $buildIdList = $issueIdList = $meetingIdList = $designIdList = 0; - $userView = $type == 'product' ? $this->app->user->view->products : ($type == 'project' ? $this->app->user->view->projects : $this->app->user->view->sprints); + $userView = $this->app->user->view->products; + if($type == 'project') $userView = $this->app->user->view->projects; + if($type == 'execution') $userView = $this->app->user->view->sprints; - $bugPairs = $this->dao->select('id')->from(TABLE_BUG)->where($type)->eq($objectID)->andWhere('deleted')->eq('0')->andWhere($type)->in($userView)->fetchPairs('id'); - if(!empty($bugPairs)) - { - $bugIdList = array_keys($bugPairs); - $bugIdList = implode(',', $bugIdList); - } + $bugPairs = $this->dao->select('id')->from(TABLE_BUG)->where($type)->eq($objectID)->andWhere('deleted')->eq('0')->andWhere($type)->in($userView)->fetchPairs('id'); + if(!empty($bugPairs)) $bugIdList = implode(',', $bugPairs); $testReportPairs = $this->dao->select('id')->from(TABLE_TESTREPORT)->where($type)->eq($objectID)->andWhere('deleted')->eq('0')->andWhere($type)->in($userView)->fetchPairs('id'); - if(!empty($testReportPairs)) - { - $testReportIdList = array_keys($testReportPairs); - $testReportIdList = implode(',', $testReportIdList); - } + if(!empty($testReportPairs)) $testReportIdList = implode(',', $testReportPairs); $casePairs = $this->dao->select('id')->from(TABLE_CASE)->where($type)->eq($objectID)->andWhere('deleted')->eq('0')->andWhere($type)->in($userView)->fetchPairs('id'); - if(!empty($casePairs)) - { - $caseIdList = array_keys($casePairs); - $caseIdList = implode(',', $caseIdList); - } + if(!empty($casePairs)) $caseIdList = implode(',', $casePairs); $idList = array_keys($docs); $docIdList = $this->dao->select('id')->from(TABLE_DOC)->where($type)->eq($objectID)->andWhere('id')->in($idList)->get(); $searchTitle = $this->get->title; if($type == 'product') { - $storyIdList = $this->dao->select('id')->from(TABLE_STORY)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->get(); - $planIdList = $this->dao->select('id')->from(TABLE_PRODUCTPLAN)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->get(); + $storyIdList = $this->dao->select('id')->from(TABLE_STORY)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($userView)->get(); + $planIdList = $this->dao->select('id')->from(TABLE_PRODUCTPLAN)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($userView)->get(); - $releasePairs = $this->dao->select('id')->from(TABLE_RELEASE)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($this->app->user->view->products)->fetchPairs('id'); - if(!empty($releasePairs)) - { - $releaseIdList = array_keys($releasePairs); - $releaseIdList = implode(',', $releaseIdList); - } + $releasePairs = $this->dao->select('id')->from(TABLE_RELEASE)->where('product')->eq($objectID)->andWhere('deleted')->eq('0')->andWhere('product')->in($userView)->fetchPairs('id'); + if(!empty($releasePairs)) $releaseIdList = implode(',', $releasePairs); } elseif($type == 'project') {