diff --git a/module/bug/model.php b/module/bug/model.php index abb79377e3..43ffa1dbc5 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -2147,10 +2147,10 @@ class bugModel extends model $allProject = "`project` = 'all'"; if(strpos($bugQuery, $allProject) !== false) { - $projectIDList = $this->getAllProjectIds(); - if(is_array($projectIDList)) $projectIDList = implode(',', $projectIDList); + $projects = $this->loadModel('project')->getPairs(); + if(is_array($projects)) $projectIdList = implode(',', array_keys($projects)); $bugQuery = str_replace($allProject, '1', $bugQuery); - $bugQuery = $bugQuery . ' AND `project` in (' . $projectIDList . ')'; + $bugQuery = $bugQuery . ' AND `project` in (' . $projectIdList . ')'; } /* Fix bug #2878. */ @@ -2724,21 +2724,6 @@ class bugModel extends model ->fetchPairs(); } - /** - * Get ID list of all projects. - * - * @access public - * @return array - */ - public function getAllProjectIds() - { - return $this->dao->select('id') - ->from(TABLE_PROJECT) - ->where('type')->eq('project') - ->andWhere('deleted')->eq(0) - ->fetchPairs('id'); - } - /** * 构造详情页或列表页需要的操作菜单。 * Build action menu. diff --git a/module/bug/test/bug.class.php b/module/bug/test/bug.class.php index fde81fa834..2a7eb4035a 100644 --- a/module/bug/test/bug.class.php +++ b/module/bug/test/bug.class.php @@ -1959,26 +1959,6 @@ class bugTest } } - /** - * Test get id list of all projects. - * - * @access public - * @return array - */ - public function getAllProjectIdsTest() - { - $array = $this->objectModel->getAllProjectIds(); - - if(dao::isError()) - { - return dao::getError(); - } - else - { - return $array; - } - } - /** * Test get bug query. * diff --git a/module/bug/test/model/getallprojectids.php b/module/bug/test/model/getallprojectids.php deleted file mode 100755 index 85512f0866..0000000000 --- a/module/bug/test/model/getallprojectids.php +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env php -getAllProjectIds(); -cid=1 -pid=1 - -测试projectId为11的项目 >> 11 -测试projectId为12的项目 >> 12 -测试projectId为13的项目 >> 13 -测试projectId为41的项目 >> 41 -测试projectId为51的项目 >> 51 -测试projectId为91的项目 >> 91 - -*/ - -$projectIDList = array('11', '12', '13', '41', '51', '91'); - -$bug=new bugTest(); -r($bug->getAllProjectIdsTest()) && p("$projectIDList[0]") && e('11'); // 测试projectId为11的项目 -r($bug->getAllProjectIdsTest()) && p("$projectIDList[1]") && e('12'); // 测试projectId为12的项目 -r($bug->getAllProjectIdsTest()) && p("$projectIDList[2]") && e('13'); // 测试projectId为13的项目 -r($bug->getAllProjectIdsTest()) && p("$projectIDList[3]") && e('41'); // 测试projectId为41的项目 -r($bug->getAllProjectIdsTest()) && p("$projectIDList[4]") && e('51'); // 测试projectId为51的项目 -r($bug->getAllProjectIdsTest()) && p("$projectIDList[5]") && e('91'); // 测试projectId为91的项目 \ No newline at end of file