* finish task #2877.

This commit is contained in:
chenfeiCF
2017-01-13 13:22:28 +08:00
parent eb24478bd0
commit 2d60b14e21
6 changed files with 136 additions and 12 deletions
+45 -9
View File
@@ -1111,19 +1111,55 @@ class bugModel extends model
/**
* Get bugs of a project.
*
* @param int $projectID
* @param string $orderBy
* @param object $pager
* @param int $projectID
* @param int $build
* @param string $type
* @param int $param
* @param string $orderBy
* @param object $pager
* @access public
* @return array
*/
public function getProjectBugs($projectID, $orderBy = 'id_desc', $pager = null, $build = 0)
public function getProjectBugs($projectID, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $pager = null)
{
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where('deleted')->eq(0)
->beginIF(empty($build))->andWhere('project')->eq($projectID)->fi()
->beginIF($build)->andWhere("CONCAT(',', openedBuild, ',') like '%,$build,%'")->fi()
->orderBy($orderBy)->page($pager)->fetchAll();
if($type == 'bySearch')
{
$queryID = (int)$param;
$products = $this->loadModel('project')->getProducts($projectID);
if($this->session->projectBugQuery == false) $this->session->set('projectBugQuery', ' 1 = 1');
if($queryID)
{
$query = $this->loadModel('search')->getQuery($queryID);
if($query)
{
$this->session->set('projectBugQuery', $query->sql);
$this->session->set('projectBugForm', $query->form);
}
}
$allProduct = "`product` = 'all'";
$bugQuery = $this->session->projectBugQuery;
if(strpos($this->session->projectBugQuery, $allProduct) !== false)
{
$bugQuery = str_replace($allProduct, '1', $this->session->projectBugQuery);
}
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where($bugQuery)
->andWhere('project')->eq((int)$projectID)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
}
else
{
$bugs = $this->dao->select('*')->from(TABLE_BUG)
->where('deleted')->eq(0)
->beginIF(empty($build))->andWhere('project')->eq($projectID)->fi()
->beginIF($build)->andWhere("CONCAT(',', openedBuild, ',') like '%,$build,%'")->fi()
->orderBy($orderBy)->page($pager)->fetchAll();
}
$this->loadModel('common')->saveQueryCondition($this->dao->get(), 'bug');