From 44d270da186703a33196e519b98cda9776f1ec41 Mon Sep 17 00:00:00 2001 From: tianshujie Date: Tue, 23 Aug 2022 15:48:20 +0800 Subject: [PATCH] * Finish task #65808. --- module/bug/model.php | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/module/bug/model.php b/module/bug/model.php index bc5ce9a7f1..a4017942dc 100644 --- a/module/bug/model.php +++ b/module/bug/model.php @@ -486,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('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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() @@ -510,7 +510,7 @@ class bugModel extends model public function getPlanBugs($planID, $status = 'all', $orderBy = 'id_desc', $pager = null) { if(strpos($orderBy, 'pri_') !== false and strpos($orderBy, 'priOrder_') === false) $orderBy = str_replace('pri_', 'priOrder_', $orderBy); - $bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder')->from(TABLE_BUG) + $bugs = $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `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() @@ -1745,7 +1745,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, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1') + return $this->dao->select("t1.*,t2.name as productName, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder, IF(t1.`severity` = 0, {$this->config->maxPriValue}, 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') @@ -1845,7 +1845,7 @@ class bugModel extends model $bugQuery = $this->getBugQuery($this->session->projectBugQuery); - $bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + $bugs = $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where($bugQuery) ->andWhere('project')->eq((int)$projectID) ->andWhere('deleted')->eq(0) @@ -1858,7 +1858,7 @@ class bugModel extends model } else { - $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') + $bugs = $this->dao->select("t1.*, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder, IF(t1.`severity` = 0, {$this->config->maxPriValue}, 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() @@ -1916,7 +1916,7 @@ class bugModel extends model $bugQuery = $this->getBugQuery($this->session->executionBugQuery); - $bugs = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + $bugs = $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where($bugQuery) ->andWhere('execution')->eq((int)$executionID) ->andWhere('deleted')->eq(0) @@ -1929,7 +1929,7 @@ class bugModel extends model } else { - $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') + $bugs = $this->dao->select("t1.*, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder, IF(t1.`severity` = 0, {$this->config->maxPriValue}, 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() @@ -2551,7 +2551,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, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder')->from(TABLE_BUG)->alias('t1') + $bugs = $this->dao->select("t1.*, t2.title as planTitle, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder, IF(t1.`severity` = 0, {$this->config->maxPriValue}, 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)) @@ -2582,7 +2582,7 @@ class bugModel extends model */ public function getByAssigntome($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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() @@ -2609,7 +2609,7 @@ class bugModel extends model */ public function getByOpenedbyme($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*,IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*,IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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() @@ -2636,7 +2636,7 @@ class bugModel extends model */ public function getByResolvedbyme($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*,IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*,IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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() @@ -2664,7 +2664,7 @@ class bugModel extends model public function getByAssigntonull($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where('assignedTo')->eq('') ->andWhere('product')->in($productIDList) ->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi() @@ -2691,7 +2691,7 @@ class bugModel extends model */ public function getUnconfirmed($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where('product')->in($productIDList) ->andWhere('execution')->in(array_keys($executions)) ->andWhere('deleted')->eq(0) @@ -2719,7 +2719,7 @@ class bugModel extends model */ public function getOverdueBugs($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where('product')->in($productIDList) ->andWhere('execution')->in(array_keys($executions)) ->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi() @@ -2749,7 +2749,7 @@ class bugModel extends model */ public function getByStatus($productIDList, $branch, $modules, $executions, $status, $orderBy, $pager, $projectID) { - return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where('product')->in($productIDList) ->andWhere('execution')->in(array_keys($executions)) ->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi() @@ -2780,7 +2780,7 @@ 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->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where('lastEditedDate')->lt($lastEditedDate) ->andWhere('product')->in($productIDList) ->andWhere('execution')->in(array_keys($executions)) @@ -2808,7 +2808,7 @@ class bugModel extends model */ public function getByPostponedbugs($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - return $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `severity`) as severityOrder")->from(TABLE_BUG) ->where('resolution')->eq('postponed') ->andWhere('product')->in($productIDList) ->beginIF($branch !== 'all')->andWhere('branch')->in($branch)->fi() @@ -2835,7 +2835,7 @@ class bugModel extends model */ public function getByNeedconfirm($productIDList, $branch, $modules, $executions, $orderBy, $pager, $projectID) { - 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') + return $this->dao->select("t1.*, t2.title AS storyTitle, IF(t1.`pri` = 0, {$this->config->maxPriValue}, t1.`pri`) as priOrder, IF(t1.`severity` = 0, {$this->config->maxPriValue}, 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) @@ -2867,7 +2867,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('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG) + return $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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() @@ -2939,7 +2939,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('*, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)->where($bugQuery) + $bugs = $this->dao->select("*, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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() @@ -2971,7 +2971,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, IF(`pri` = 0, 999, `pri`) as priOrder, IF(`severity` = 0, 999, `severity`) as severityOrder')->from(TABLE_BUG)->alias('t1') + $bugs = $this->dao->select("t1.*, t2.title as planTitle, IF(`pri` = 0, {$this->config->maxPriValue}, `pri`) as priOrder, IF(`severity` = 0, {$this->config->maxPriValue}, `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))