|
|
|
@@ -384,6 +384,9 @@ class bugModel extends model
|
|
|
|
|
$browseType = ($browseType == 'bymodule' and $this->session->bugBrowseType and $this->session->bugBrowseType != 'bysearch') ? $this->session->bugBrowseType : $browseType;
|
|
|
|
|
$browseType = $browseType == 'bybranch' ? 'bymodule' : $browseType;
|
|
|
|
|
|
|
|
|
|
if(strpos($sort, 'pri') !== false and strpos($sort, 'priOrder') === false) $sort = str_replace('pri', 'priOrder', $sort);
|
|
|
|
|
if(strpos($sort, 'severity') !== false and strpos($sort, 'severityOrder') === false) $sort = str_replace('severity', 'severityOrder', $sort);
|
|
|
|
|
|
|
|
|
|
/* Get bugs by browse type. */
|
|
|
|
|
$bugs = array();
|
|
|
|
|
if($browseType == 'all') $bugs = $this->getAllBugs($productIDList, $branch, $modules, $executions, $sort, $pager, $projectID);
|
|
|
|
@@ -483,7 +486,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getModuleBugs($productIDList, $branch = 0, $moduleIdList = 0, $executions = array(), $orderBy = 'id_desc', $pager = null, $projectID = 0)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->eq($branch)->fi()
|
|
|
|
|
->beginIF(!empty($moduleIdList))->andWhere('module')->in($moduleIdList)->fi()
|
|
|
|
@@ -506,7 +509,8 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getPlanBugs($planID, $status = 'all', $orderBy = 'id_desc', $pager = null)
|
|
|
|
|
{
|
|
|
|
|
$bugs = $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
if(strpos($orderBy, 'priOrder') === false) $orderBy = str_replace('pri', 'priOrder', $orderBy);
|
|
|
|
|
$bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('plan')->eq((int)$planID)
|
|
|
|
|
->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi()
|
|
|
|
|
->beginIF($status != 'all')->andWhere('status')->in($status)->fi()
|
|
|
|
@@ -1714,6 +1718,9 @@ class bugModel extends model
|
|
|
|
|
$queryName = $moduleName . 'Query';
|
|
|
|
|
$formName = $moduleName . 'Form';
|
|
|
|
|
|
|
|
|
|
if(strpos($orderBy, 'pri') !== false and strpos($orderBy, 'priOrder') === false) $orderBy = str_replace('pri', 'priOrder', $orderBy);
|
|
|
|
|
if(strpos($orderBy, 'severity') !== false and strpos($orderBy, 'severityOrder') === false) $orderBy = str_replace('severity', 'severityOrder', $orderBy);
|
|
|
|
|
|
|
|
|
|
$bugIDList = array();
|
|
|
|
|
if($moduleName == 'contributeBug')
|
|
|
|
|
{
|
|
|
|
@@ -1742,7 +1749,7 @@ class bugModel extends model
|
|
|
|
|
$query = preg_replace('/`(\w+)`/', 't1.`$1`', $query);
|
|
|
|
|
|
|
|
|
|
if($type != 'bySearch' and !$this->loadModel('common')->checkField(TABLE_BUG, $type)) return array();
|
|
|
|
|
return $this->dao->select('t1.*,t2.name as productName')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
return $this->dao->select('t1.*,t2.name as productName, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
|
|
|
|
|
->where('t1.deleted')->eq(0)
|
|
|
|
|
->andWhere('t2.deleted')->eq('0')
|
|
|
|
@@ -1823,6 +1830,9 @@ class bugModel extends model
|
|
|
|
|
public function getProjectBugs($projectID, $productID = 0, $branchID = 0, $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $excludeBugs = '', $pager = null)
|
|
|
|
|
{
|
|
|
|
|
$type = strtolower($type);
|
|
|
|
|
if(strpos($orderBy, 'pri') !== false and strpos($orderBy, 'priOrder') === false) $orderBy = str_replace('pri', 'priOrder', $orderBy);
|
|
|
|
|
if(strpos($orderBy, 'severity') !== false and strpos($orderBy, 'severityOrder') === false) $orderBy = str_replace('severity', 'severityOrder', $orderBy);
|
|
|
|
|
|
|
|
|
|
if($type == 'bysearch')
|
|
|
|
|
{
|
|
|
|
|
$queryID = (int)$param;
|
|
|
|
@@ -1839,7 +1849,7 @@ class bugModel extends model
|
|
|
|
|
|
|
|
|
|
$bugQuery = $this->getBugQuery($this->session->projectBugQuery);
|
|
|
|
|
|
|
|
|
|
$bugs = $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
$bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where($bugQuery)
|
|
|
|
|
->andWhere('project')->eq((int)$projectID)
|
|
|
|
|
->andWhere('deleted')->eq(0)
|
|
|
|
@@ -1852,7 +1862,7 @@ class bugModel extends model
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$bugs = $this->dao->select('t1.*')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
$bugs = $this->dao->select('t1.*, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=t2.id')
|
|
|
|
|
->where('t1.deleted')->eq(0)
|
|
|
|
|
->beginIF(empty($build))->andWhere('t1.project')->eq($projectID)->fi()
|
|
|
|
@@ -1891,6 +1901,9 @@ class bugModel extends model
|
|
|
|
|
public function getExecutionBugs($executionID, $productID = 0, $branchID = 'all', $build = 0, $type = '', $param = 0, $orderBy = 'id_desc', $excludeBugs = '', $pager = null)
|
|
|
|
|
{
|
|
|
|
|
$type = strtolower($type);
|
|
|
|
|
if(strpos($orderBy, 'pri') !== false and strpos($orderBy, 'priOrder') === false) $orderBy = str_replace('pri', 'priOrder', $orderBy);
|
|
|
|
|
if(strpos($orderBy, 'severity') !== false and strpos($orderBy, 'severityOrder') === false) $orderBy = str_replace('severity', 'severityOrder', $orderBy);
|
|
|
|
|
|
|
|
|
|
if($type == 'bysearch')
|
|
|
|
|
{
|
|
|
|
|
$queryID = (int)$param;
|
|
|
|
@@ -1907,7 +1920,7 @@ class bugModel extends model
|
|
|
|
|
|
|
|
|
|
$bugQuery = $this->getBugQuery($this->session->executionBugQuery);
|
|
|
|
|
|
|
|
|
|
$bugs = $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
$bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where($bugQuery)
|
|
|
|
|
->andWhere('execution')->eq((int)$executionID)
|
|
|
|
|
->andWhere('deleted')->eq(0)
|
|
|
|
@@ -1920,7 +1933,7 @@ class bugModel extends model
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$bugs = $this->dao->select('t1.*')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
$bugs = $this->dao->select('t1.*, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`pri` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_MODULE)->alias('t2')->on('t1.module=t2.id')
|
|
|
|
|
->where('t1.deleted')->eq(0)
|
|
|
|
|
->beginIF(!empty($productID) and $branchID !== 'all')->andWhere('t1.branch')->eq($branchID)->fi()
|
|
|
|
@@ -2542,7 +2555,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getAllBugs($productIDList, $branch, $modules, $executions, $orderBy, $pager = null, $projectID = 0)
|
|
|
|
|
{
|
|
|
|
|
$bugs = $this->dao->select('t1.*, t2.title as planTitle')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
$bugs = $this->dao->select('t1.*, t2.title as planTitle, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
|
|
|
|
|
->where('t1.product')->in($productIDList)
|
|
|
|
|
->andWhere('t1.execution')->in(array_keys($executions))
|
|
|
|
@@ -2573,7 +2586,9 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getByAssigntome($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->findByAssignedTo($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->in($productIDList)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('assignedTo')->eq($this->app->user->account)
|
|
|
|
|
->andWhere('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
|
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
|
|
|
@@ -2598,7 +2613,9 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getByOpenedbyme($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->findByOpenedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->in($productIDList)
|
|
|
|
|
return $this->dao->select('*,IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('openedBy')->eq($this->app->user->account)
|
|
|
|
|
->andWhere('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
|
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
|
|
|
@@ -2623,7 +2640,9 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getByResolvedbyme($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->findByResolvedBy($this->app->user->account)->from(TABLE_BUG)->andWhere('product')->in($productIDList)
|
|
|
|
|
return $this->dao->select('*,IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('resolvedBy')->eq($this->app->user->account)
|
|
|
|
|
->andWhere('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
|
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
|
|
|
@@ -2649,7 +2668,9 @@ class bugModel extends model
|
|
|
|
|
public function getByAssigntonull($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return $this->dao->findByAssignedTo('')->from(TABLE_BUG)->andWhere('product')->in($productIDList)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('assignedTo')->eq('')
|
|
|
|
|
->andWhere('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
|
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
|
|
|
@@ -2674,7 +2695,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getUnconfirmed($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('product')->in($productIDList)
|
|
|
|
|
->andWhere('execution')->in(array_keys($executions))
|
|
|
|
|
->andWhere('deleted')->eq(0)
|
|
|
|
@@ -2702,7 +2723,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getOverdueBugs($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('product')->in($productIDList)
|
|
|
|
|
->andWhere('execution')->in(array_keys($executions))
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
@@ -2732,7 +2753,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getByStatus($productIDList, $branch, $modules, $executions, $status, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('product')->in($productIDList)
|
|
|
|
|
->andWhere('execution')->in(array_keys($executions))
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
@@ -2763,7 +2784,9 @@ class bugModel extends model
|
|
|
|
|
public function getByLonglifebugs($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
$lastEditedDate = date(DT_DATE1, time() - $this->config->bug->longlife * 24 * 3600);
|
|
|
|
|
return $this->dao->findByLastEditedDate("<", $lastEditedDate)->from(TABLE_BUG)->andWhere('product')->in($productIDList)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('lastEditedDate')->lt($lastEditedDate)
|
|
|
|
|
->andWhere('product')->in($productIDList)
|
|
|
|
|
->andWhere('execution')->in(array_keys($executions))
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
@@ -2789,7 +2812,9 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getByPostponedbugs($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->findByResolution('postponed')->from(TABLE_BUG)->andWhere('product')->in($productIDList)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('resolution')->eq('postponed')
|
|
|
|
|
->andWhere('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
|
->beginIF($projectID)->andWhere('project')->eq($projectID)->fi()
|
|
|
|
@@ -2814,7 +2839,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getByNeedconfirm($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
return $this->dao->select('t1.*, t2.title AS storyTitle')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
return $this->dao->select('t1.*, t2.title AS storyTitle, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
|
|
|
|
|
->where("t2.status = 'active'")
|
|
|
|
|
->andWhere('t1.product')->in($productIDList)
|
|
|
|
@@ -2846,7 +2871,7 @@ class bugModel extends model
|
|
|
|
|
public function getByAssignedbyme($productIDList, $branch, $modules, $executions, $sort, $pager, $projectID)
|
|
|
|
|
{
|
|
|
|
|
$actionIDList = $this->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq('bug')->andWhere('action')->eq('assigned')->andWhere('actor')->eq($this->app->user->account)->fetchPairs('objectID', 'objectID');
|
|
|
|
|
return $this->dao->select('*')->from(TABLE_BUG)
|
|
|
|
|
return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)
|
|
|
|
|
->where('product')->in($productIDList)
|
|
|
|
|
->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi()
|
|
|
|
|
->beginIF($modules)->andWhere('module')->in($modules)->fi()
|
|
|
|
@@ -2918,7 +2943,7 @@ class bugModel extends model
|
|
|
|
|
if($branch !== 'all' and strpos($bugQuery, '`branch` =') === false) $bugQuery .= " AND `branch` in('0','$branch')";
|
|
|
|
|
if(strpos($bugQuery, $allBranch) !== false) $bugQuery = str_replace($allBranch, '1', $bugQuery);
|
|
|
|
|
|
|
|
|
|
$bugs = $this->dao->select('*')->from(TABLE_BUG)->where($bugQuery)
|
|
|
|
|
$bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)->where($bugQuery)
|
|
|
|
|
->beginIF(!$this->app->user->admin)->andWhere('execution')->in('0,' . $this->app->user->view->sprints)->fi()
|
|
|
|
|
->beginIF($excludeBugs)->andWhere('id')->notIN($excludeBugs)->fi()
|
|
|
|
|
|
|
|
|
@@ -2950,7 +2975,7 @@ class bugModel extends model
|
|
|
|
|
*/
|
|
|
|
|
public function getReviewBugs($productIDList, $branch, $modules, $executions, $orderBy, $pager = null, $projectID = 0)
|
|
|
|
|
{
|
|
|
|
|
$bugs = $this->dao->select('t1.*, t2.title as planTitle')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
$bugs = $this->dao->select('t1.*, t2.title as planTitle, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)->alias('t1')
|
|
|
|
|
->leftJoin(TABLE_PRODUCTPLAN)->alias('t2')->on('t1.plan = t2.id')
|
|
|
|
|
->where('t1.product')->in($productIDList)
|
|
|
|
|
->andWhere('t1.execution')->in(array_keys($executions))
|
|
|
|
|