From 19f0244fa1ad5b7559108534e23b5d0de31da334 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 4 May 2023 05:18:12 +0000 Subject: [PATCH 1/2] * Rename getByList to getByIdList. --- module/bug/control.php | 4 ++-- module/bug/model.php | 6 +++--- module/bug/test/bug.class.php | 16 ++++++++-------- .../model/{getbylist.php => getbyidlist.php} | 0 module/build/control.php | 4 ++-- module/execution/model.php | 2 +- module/my/control.php | 2 +- module/productplan/model.php | 2 +- module/projectrelease/control.php | 2 +- module/release/control.php | 2 +- module/repo/model.php | 2 +- module/task/control.php | 2 +- module/testreport/control.php | 2 +- 13 files changed, 23 insertions(+), 23 deletions(-) rename module/bug/test/model/{getbylist.php => getbyidlist.php} (100%) diff --git a/module/bug/control.php b/module/bug/control.php index f69e1cf777..22c6b16217 100755 --- a/module/bug/control.php +++ b/module/bug/control.php @@ -1466,7 +1466,7 @@ class bug extends control { $bugIDList = $this->post->bugIDList; $bugIDList = array_unique($bugIDList); - $oldBugs = $this->bug->getByList($bugIDList); + $oldBugs = $this->bug->getByIdList($bugIDList); $skipBugIDList = ''; unset($_POST['bugIDList']); @@ -2035,7 +2035,7 @@ class bug extends control $_POST = array(); $closedBugs = array(); - $bugs = $this->bug->getByList($bugIDList); + $bugs = $this->bug->getByIdList($bugIDList); foreach($bugs as $bugID => $bug) { if($bug->status != 'resolved') diff --git a/module/bug/model.php b/module/bug/model.php index edcd49377e..aa15daa66c 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -309,8 +309,8 @@ class bugModel extends model } /** - * Get bug list by browse type. * 根据浏览类型获取bug列表。 + * Get bug list by browse type. * * @param string $browseType * @param int|array $productIdList @@ -422,15 +422,15 @@ class bugModel extends model } /** - * Get bugs by ID list. * 获取指定字段的bug列表。 + * Get bugs by ID list. * * @param int|array|string $bugIDList * @param string $fields * @access public * @return array */ - public function getByList(int|array|string $bugIDList = 0, string $fields = '*'): array + public function getByIdList(int|array|string $bugIDList = 0, string $fields = '*'): array { return $this->dao->select($fields)->from(TABLE_BUG) ->where('deleted')->eq('0') diff --git a/module/bug/test/bug.class.php b/module/bug/test/bug.class.php index f3aa1221f3..0be72507e8 100644 --- a/module/bug/test/bug.class.php +++ b/module/bug/test/bug.class.php @@ -670,9 +670,9 @@ class bugTest * @access public * @return array */ - public function getByListTest($bugIDList) + public function getByIdListTest($bugIDList) { - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); foreach($bugs as $bug) { @@ -972,7 +972,7 @@ class bugTest { $this->objectModel->batchConfirm($bugIDList); - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); $confirm = ''; foreach($bugs as $bug) $confirm .= ',' . $bug->confirmed; @@ -1035,7 +1035,7 @@ class bugTest */ public function batchChangeBranchTest($bugIDList, $branchID, $bugID) { - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); $object = $this->objectModel->batchChangeBranch($bugIDList, $branchID, $bugs); @@ -1060,7 +1060,7 @@ class bugTest */ public function batchChangeModuleTest($bugIDList, $moduleID, $bugID) { - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); $object = $this->objectModel->batchChangeModule($bugIDList, $moduleID, $bugs); @@ -1178,7 +1178,7 @@ class bugTest */ public function processBuildForBugsTest($bugIDList) { - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); $array = $this->objectModel->processBuildForBugs($bugs); if(dao::isError()) @@ -1200,7 +1200,7 @@ class bugTest */ public function extractAccountsFromListTest($bugIDList) { - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); $array = $this->objectModel->extractAccountsFromList($bugs); if(dao::isError()) @@ -1861,7 +1861,7 @@ class bugTest */ public function formCustomedBugsTest($bugIDList) { - $bugs = $this->objectModel->getByList($bugIDList); + $bugs = $this->objectModel->getByIdList($bugIDList); $array = $this->objectModel->formCustomedBugs($bugs); if(dao::isError()) diff --git a/module/bug/test/model/getbylist.php b/module/bug/test/model/getbyidlist.php similarity index 100% rename from module/bug/test/model/getbylist.php rename to module/bug/test/model/getbyidlist.php diff --git a/module/build/control.php b/module/build/control.php index e394fc78d9..00adc6156e 100644 --- a/module/build/control.php +++ b/module/build/control.php @@ -723,7 +723,7 @@ class build extends control $build = $this->build->getByID($buildID); $oldBranch = $build->branch; $buildStories = $build->allStories ? $this->loadModel('story')->getByList($build->allStories) : array(); - $buildBugs = $build->allBugs ? $this->loadModel('bug')->getByList($build->allBugs) : array(); + $buildBugs = $build->allBugs ? $this->loadModel('bug')->getByIdList($build->allBugs) : array(); $branchPairs = $this->loadModel('branch')->getPairs($build->product); $typeName = $this->lang->product->branchName[$build->productType]; @@ -798,7 +798,7 @@ class build extends control } $build = $this->build->getByID($buildID); $planStories = $build->allStories ? $this->loadModel('story')->getByList($build->allStories) : ''; - $planBugs = $build->allBugs ? $this->loadModel('bug')->getByList($build->allBugs) : ''; + $planBugs = $build->allBugs ? $this->loadModel('bug')->getByIdList($build->allBugs) : ''; if($oldBranch) { foreach($planStories as $storyID => $story) diff --git a/module/execution/model.php b/module/execution/model.php index 7e43506415..e24c9c56cc 100755 --- a/module/execution/model.php +++ b/module/execution/model.php @@ -3032,7 +3032,7 @@ class executionModel extends model $requiredFields = trim($requiredFields, ','); $bugToTasks = fixer::input('post')->get(); - $bugs = $this->bug->getByList(array_keys($bugToTasks->import)); + $bugs = $this->bug->getByIdList(array_keys($bugToTasks->import)); foreach($bugToTasks->import as $key => $value) { $bug = zget($bugs, $key, ''); diff --git a/module/my/control.php b/module/my/control.php index f3fb45f883..5dca80336c 100755 --- a/module/my/control.php +++ b/module/my/control.php @@ -1174,7 +1174,7 @@ EOF; if($feedback->solution == 'totask') $taskIdList[] = $feedback->result; if($feedback->solution == 'ticket') $ticketIdList[] = $feedback->result; } - $bugs = $bugIdList ? $this->loadModel('bug')->getByList($bugIdList) : array(); + $bugs = $bugIdList ? $this->loadModel('bug')->getByIdList($bugIdList) : array(); $stories = $storyIdList ? $this->loadModel('story')->getByList($storyIdList) : array(); $todos = $todoIdList ? $this->loadModel('todo')->getByList($todoIdList) : array(); $tasks = $taskIdList ? $this->loadModel('task')->getByList($taskIdList) : array(); diff --git a/module/productplan/model.php b/module/productplan/model.php index 16d40746e6..3e6faad7ec 100644 --- a/module/productplan/model.php +++ b/module/productplan/model.php @@ -1058,7 +1058,7 @@ class productplanModel extends model $this->loadModel('story'); $this->loadModel('action'); - $bugs = $this->loadModel('bug')->getByList($this->post->bugs); + $bugs = $this->loadModel('bug')->getByIdList($this->post->bugs); foreach($this->post->bugs as $bugID) { if(!isset($bugs[$bugID])) continue; diff --git a/module/projectrelease/control.php b/module/projectrelease/control.php index 2462a83b3b..ce3b0032f7 100644 --- a/module/projectrelease/control.php +++ b/module/projectrelease/control.php @@ -757,7 +757,7 @@ class projectrelease extends control } $this->view->allBugs = $allBugs; - $this->view->releaseBugs = empty($releaseBugs) ? array() : $this->bug->getByList($releaseBugs); + $this->view->releaseBugs = empty($releaseBugs) ? array() : $this->bug->getByIdList($releaseBugs); $this->view->release = $release; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->browseType = $browseType; diff --git a/module/release/control.php b/module/release/control.php index edc2bbe131..06001be094 100644 --- a/module/release/control.php +++ b/module/release/control.php @@ -674,7 +674,7 @@ class release extends control } $this->view->allBugs = $allBugs; - $this->view->releaseBugs = empty($releaseBugs) ? array() : $this->bug->getByList($releaseBugs); + $this->view->releaseBugs = empty($releaseBugs) ? array() : $this->bug->getByIdList($releaseBugs); $this->view->release = $release; $this->view->users = $this->loadModel('user')->getPairs('noletter'); $this->view->browseType = $browseType; diff --git a/module/repo/model.php b/module/repo/model.php index 7d996f2a0a..71bca9ab07 100644 --- a/module/repo/model.php +++ b/module/repo/model.php @@ -2806,7 +2806,7 @@ class repoModel extends model } } $stories = empty($storyIDs) ? array() : $this->loadModel('story')->getByList($storyIDs); - $bugs = empty($bugIDs) ? array() : $this->loadModel('bug')->getByList($bugIDs); + $bugs = empty($bugIDs) ? array() : $this->loadModel('bug')->getByIdList($bugIDs); $tasks = empty($taskIDs) ? array() : $this->loadModel('task')->getByList($taskIDs); $titleList = array(); diff --git a/module/task/control.php b/module/task/control.php index f59e4a0ce8..a64ba89fb1 100755 --- a/module/task/control.php +++ b/module/task/control.php @@ -2148,7 +2148,7 @@ class task extends control } } - $bugs = $this->loadModel('bug')->getByList($relatedBugIdList); + $bugs = $this->loadModel('bug')->getByIdList($relatedBugIdList); foreach($tasks as $task) { if($this->post->fileType == 'csv') diff --git a/module/testreport/control.php b/module/testreport/control.php index 29e9d061e9..a6fc8af407 100644 --- a/module/testreport/control.php +++ b/module/testreport/control.php @@ -549,7 +549,7 @@ class testreport extends control $this->view->report = $report; $this->view->execution = $execution; $this->view->stories = $stories; - $this->view->bugs = $report->bugs ? $this->bug->getByList($report->bugs) : array(); + $this->view->bugs = $report->bugs ? $this->bug->getByIdList($report->bugs) : array(); $this->view->builds = $builds; $this->view->cases = $this->testreport->getTaskCases($tasks, $report->begin, $report->end, $report->cases, $pager); $this->view->users = $this->user->getPairs('noletter|noclosed|nodeleted'); From 7ba870036810130c0520617cf184d6bb24cdf737 Mon Sep 17 00:00:00 2001 From: xieqiyu Date: Thu, 4 May 2023 05:27:49 +0000 Subject: [PATCH 2/2] * Modify test. --- module/bug/test/model/getbyidlist.php | 28 +++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/module/bug/test/model/getbyidlist.php b/module/bug/test/model/getbyidlist.php index 385c04d084..7772bad759 100755 --- a/module/bug/test/model/getbyidlist.php +++ b/module/bug/test/model/getbyidlist.php @@ -31,17 +31,17 @@ $fieldsList = array('*', 'id,title,status,plan,module,story', 'title,status', 't $bug = new bugTest(); -r($bug->getByListTest($bugIDList[0], $fieldsList[0])) && p('1:title') && e('BUG1'); // 查询id为1的bug title -r($bug->getByListTest($bugIDList[0], $fieldsList[1])) && p('2:status') && e('active'); // 查询id为2的bug status -r($bug->getByListTest($bugIDList[0], $fieldsList[1])) && p('2:module') && e('1'); // 查询id为2的bug module -r($bug->getByListTest($bugIDList[0], $fieldsList[1])) && p('3:plan') && e('2'); // 查询id为2的bug plan -r($bug->getByListTest($bugIDList[0], $fieldsList[1])) && p('3:story') && e('2'); // 查询id为2的bug story -r($bug->getByListTest($bugIDList[0], $fieldsList[2])) && p('3:title') && e('BUG3'); // 查询id为3的bug title -r($bug->getByListTest($bugIDList[0], $fieldsList[3])) && p('1:title') && e('BUG1'); // 查询id为1的bug title -r($bug->getByListTest($bugIDList[1], $fieldsList[0])) && p('4:title') && e('BUG4'); // 查询id为4的bug title -r($bug->getByListTest($bugIDList[1], $fieldsList[1])) && p('4:status') && e('resolved'); // 查询id为4的bug status -r($bug->getByListTest($bugIDList[1], $fieldsList[3])) && p('1:title') && e('BUG1'); // 查询id为1的bug title -r($bug->getByListTest($bugIDList[2], $fieldsList[0])) && p('2:title') && e('BUG2'); // 查询id为2的bug title -r($bug->getByListTest($bugIDList[2], $fieldsList[1])) && p('2:status') && e('active'); // 查询id为2的bug status -r($bug->getByListTest($bugIDList[2], $fieldsList[2])) && p('7:status') && e('resolved'); // 查询id为7的bug title -r($bug->getByListTest($bugIDList[3], $fieldsList[0])) && p('') && e('0'); // 查询不存在的ID +r($bug->getByIdListTest($bugIDList[0], $fieldsList[0])) && p('1:title') && e('BUG1'); // 查询id为1的bug title +r($bug->getByIdListTest($bugIDList[0], $fieldsList[1])) && p('2:status') && e('active'); // 查询id为2的bug status +r($bug->getByIdListTest($bugIDList[0], $fieldsList[1])) && p('2:module') && e('1'); // 查询id为2的bug module +r($bug->getByIdListTest($bugIDList[0], $fieldsList[1])) && p('3:plan') && e('2'); // 查询id为2的bug plan +r($bug->getByIdListTest($bugIDList[0], $fieldsList[1])) && p('3:story') && e('2'); // 查询id为2的bug story +r($bug->getByIdListTest($bugIDList[0], $fieldsList[2])) && p('3:title') && e('BUG3'); // 查询id为3的bug title +r($bug->getByIdListTest($bugIDList[0], $fieldsList[3])) && p('1:title') && e('BUG1'); // 查询id为1的bug title +r($bug->getByIdListTest($bugIDList[1], $fieldsList[0])) && p('4:title') && e('BUG4'); // 查询id为4的bug title +r($bug->getByIdListTest($bugIDList[1], $fieldsList[1])) && p('4:status') && e('resolved'); // 查询id为4的bug status +r($bug->getByIdListTest($bugIDList[1], $fieldsList[3])) && p('1:title') && e('BUG1'); // 查询id为1的bug title +r($bug->getByIdListTest($bugIDList[2], $fieldsList[0])) && p('2:title') && e('BUG2'); // 查询id为2的bug title +r($bug->getByIdListTest($bugIDList[2], $fieldsList[1])) && p('2:status') && e('active'); // 查询id为2的bug status +r($bug->getByIdListTest($bugIDList[2], $fieldsList[2])) && p('7:status') && e('resolved'); // 查询id为7的bug title +r($bug->getByIdListTest($bugIDList[3], $fieldsList[0])) && p('') && e('0'); // 查询不存在的ID