Merge pull request '* Rename getByList to getByIdList.' (#26) from master_xieqiyu_code into master
Reviewed-on: https://git.zcorp.cc/easycorp/zentaopms/pulls/26
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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())
|
||||
|
||||
Executable
+47
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/bug.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=bugModel->getByList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
function initData()
|
||||
{
|
||||
$bug = zdTable('bug');
|
||||
$bug->id->range('1-10');
|
||||
$bug->status->range("resolved,active,closed");
|
||||
$bug->title->prefix("BUG")->range('1-10');
|
||||
$bug->plan->range('0,1,2');
|
||||
$bug->module->range('0,1,2');
|
||||
$bug->story->range('0,1,2');
|
||||
|
||||
$bug->gen(10);
|
||||
}
|
||||
|
||||
initData();
|
||||
|
||||
$bugIDList = array('1,2,3', '1,4', '2,7', '1000001');
|
||||
$fieldsList = array('*', 'id,title,status,plan,module,story', 'title,status', 'title');
|
||||
|
||||
$bug = new bugTest();
|
||||
|
||||
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
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . "/test/lib/init.php";
|
||||
include dirname(__FILE__, 2) . '/bug.class.php';
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=bugModel->getByList();
|
||||
cid=1
|
||||
pid=1
|
||||
|
||||
*/
|
||||
function initData()
|
||||
{
|
||||
$bug = zdTable('bug');
|
||||
$bug->id->range('1-10');
|
||||
$bug->status->range("resolved,active,closed");
|
||||
$bug->title->prefix("BUG")->range('1-10');
|
||||
$bug->plan->range('0,1,2');
|
||||
$bug->module->range('0,1,2');
|
||||
$bug->story->range('0,1,2');
|
||||
|
||||
$bug->gen(10);
|
||||
}
|
||||
|
||||
initData();
|
||||
|
||||
$bugIDList = array('1,2,3', '1,4', '2,7', '1000001');
|
||||
$fieldsList = array('*', 'id,title,status,plan,module,story', 'title,status', 'title');
|
||||
|
||||
$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
|
||||
@@ -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)
|
||||
|
||||
@@ -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, '');
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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')
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user