* Finish task #65807.

This commit is contained in:
liumengyi
2022-08-23 13:45:44 +08:00
parent 4e1ca8bd60
commit 617122882a
7 changed files with 26 additions and 16 deletions
+1
View File
@@ -783,6 +783,7 @@ class execution extends control
/* Append id for secend sort. */
$sort = common::appendOrder($orderBy);
if(strpos($sort, 'priOrder') === false) $sort = str_replace('pri', 'priOrder', $sort);
$queryID = ($type == 'bysearch') ? $param : 0;
$execution = $this->commonAction($executionID);
+4 -2
View File
@@ -332,15 +332,16 @@ EOF;
/* Append id for secend sort. */
$sort = common::appendOrder($orderBy);
if(strpos($sort, 'priOrder') === false) $sort = str_replace('pri', 'priOrder', $sort);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
if($type == 'assignedBy')
{
$stories = $this->loadModel('my')->getAssignedByMe($this->app->user->account, '', $pager, $orderBy, 'story');
$stories = $this->loadModel('my')->getAssignedByMe($this->app->user->account, '', $pager, $sort, 'story');
}
elseif($type == 'bysearch')
{
$stories = $this->my->getStoriesBySearch($queryID, $this->app->rawMethod, $orderBy, $pager);
$stories = $this->my->getStoriesBySearch($queryID, $this->app->rawMethod, $sort, $pager);
}
else
{
@@ -396,6 +397,7 @@ EOF;
/* Append id for secend sort. */
$sort = common::appendOrder($orderBy);
if(strpos($sort, 'priOrder') === false) $sort = str_replace('pri', 'priOrder', $sort);
$queryID = ($type == 'bysearch') ? (int)$param : 0;
if($type == 'assignedBy')
+6 -4
View File
@@ -347,13 +347,15 @@ class myModel extends model
}
elseif($objectType == 'requirement' or $objectType == 'story' or $objectType == 'bug')
{
$objectList = $this->dao->select('t1.*')->from($this->config->objectTables[$module])->alias('t1')
$orderBy = (strpos($orderBy, 'priOrder') !== false or strpos($orderBy, 'severityOrder') !== false) ? $orderBy : "t1.$orderBy";
$select = strpos($orderBy, 'severity') !== false ? 't1.*,IF(t1.`severity` = 0, 999, t1.`severity`) as severityOrder' : 't1.*,IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder';
$objectList = $this->dao->select($select)->from($this->config->objectTables[$module])->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on("t1.product = t2.id")
->where('t1.deleted')->eq(0)
->andWhere('t2.deleted')->eq(0)
->andWhere('t1.id')->in(array_keys($objectIDList))
->beginIF($objectType == 'requirement' or $objectType == 'story')->andWhere('t1.type')->eq($objectType)->fi()
->orderBy('t1.' . $orderBy)
->orderBy($orderBy)
->page($pager)
->fetchAll('id');
}
@@ -827,7 +829,7 @@ class myModel extends model
$storyIDList[$storyID] = $storyID;
}
$stories = $this->dao->select('distinct t1.*, t2.name as productTitle, t4.title as planTitle')->from(TABLE_STORY)->alias('t1')
$stories = $this->dao->select('distinct t1.*, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, t2.name as productTitle, t4.title as planTitle')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_PLANSTORY)->alias('t3')->on('t1.id = t3.plan')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t4')->on('t3.plan = t4.id')
@@ -846,7 +848,7 @@ class myModel extends model
}
else
{
$stories = $this->dao->select('distinct t1.*, t2.name as productTitle, t4.title as planTitle')->from(TABLE_STORY)->alias('t1')
$stories = $this->dao->select('distinct t1.*, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, t2.name as productTitle, t4.title as planTitle')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id')
->leftJoin(TABLE_PLANSTORY)->alias('t3')->on('t1.id = t3.plan')
->leftJoin(TABLE_PRODUCTPLAN)->alias('t4')->on('t3.plan = t4.id')
+2
View File
@@ -223,6 +223,8 @@ class product extends control
/* Append id for secend sort. */
$sort = common::appendOrder($orderBy);
if(strpos($sort, 'priOrder') === false) $sort = str_replace('pri', 'priOrder', $sort);
/* Load pager. */
$this->app->loadClass('pager', $static = true);
+2
View File
@@ -2421,6 +2421,8 @@ class productModel extends model
$this->lang->product->menu->settings['subMenu']->branch['link'] = str_replace('@branch@', $this->lang->product->branchName[$product->type], $branchLink);
$this->lang->product->branch = sprintf($this->lang->product->branch, $this->lang->product->branchName[$product->type]);
}
if(strpos($extra, 'requirement') !== false) unset($this->lang->product->moreSelects['willclose']);
}
/**
+2 -2
View File
@@ -194,8 +194,8 @@ class release extends control
if(strpos($sort, 'priOrder') === false) $sort = str_replace('pri', 'priOrder', $sort);
$storyPager = new pager($type == 'story' ? $recTotal : 0, $recPerPage, $type == 'story' ? $pageID : 1);
$stories = $this->dao->select('*')->from(TABLE_STORY)->where('id')->in($release->stories)->andWhere('deleted')->eq(0)
->beginIF($type == 'story')->orderBy($orderBy)->fi()
$stories = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder')->from(TABLE_STORY)->where('id')->in($release->stories)->andWhere('deleted')->eq(0)
->beginIF($type == 'story')->orderBy($sort)->fi()
->page($storyPager)
->fetchAll('id');
+9 -8
View File
@@ -2601,7 +2601,7 @@ class storyModel extends model
if(empty($normalProducts) and empty($branchProducts)) $productQuery .= '1 = 1';
$productQuery .= ') ';
$stories = $this->dao->select('*')->from(TABLE_STORY)
$stories = $this->dao->select('*, IF(`pri` = 0, 999, `pri`) as priOrder')->from(TABLE_STORY)
->where('product')->in($productID)
->andWhere($productQuery)
->beginIF(!$hasParent)->andWhere("parent")->ge(0)->fi()
@@ -2815,7 +2815,7 @@ class storyModel extends model
$actionIDList = array();
if($fieldName == 'assignedBy') $actionIDList = $this->dao->select('objectID')->from(TABLE_ACTION)->where('objectType')->eq('story')->andWhere('action')->eq('assigned')->andWhere('actor')->eq($fieldValue)->fetchPairs('objectID', 'objectID');
$sql = $this->dao->select('t1.*')->from(TABLE_STORY)->alias('t1');
$sql = $this->dao->select('t1.*, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder')->from(TABLE_STORY)->alias('t1');
if($fieldName == 'reviewBy') $sql = $sql->leftJoin(TABLE_STORYREVIEW)->alias('t2')->on('t1.id = t2.story and t1.version = t2.version');
$stories = $sql->where('t1.product')->in($productID)
@@ -2851,7 +2851,7 @@ class storyModel extends model
*/
public function get2BeClosed($productID, $branch, $modules, $type = 'story', $orderBy = '', $pager = null)
{
$stories = $this->dao->select('*')->from(TABLE_STORY)
$stories = $this->dao->select('*,IF(`pri` = 0, 999, `pri`) as priOrder')->from(TABLE_STORY)
->where('product')->in($productID)
->andWhere('type')->eq($type)
->beginIF($branch)->andWhere("branch")->eq($branch)->fi()
@@ -3027,7 +3027,7 @@ class storyModel extends model
}
}
$tmpStories = $this->dao->select('DISTINCT t1.*')->from(TABLE_STORY)->alias('t1')
$tmpStories = $this->dao->select('DISTINCT t1.*,IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PROJECTSTORY)->alias('t2')->on('t1.id=t2.story')
->beginIF(strpos($sql, 'result') !== false)->leftJoin(TABLE_STORYREVIEW)->alias('t3')->on('t1.id = t3.story and t1.version = t3.version')->fi()
->where($sql)
@@ -3127,7 +3127,7 @@ class storyModel extends model
}
}
$stories = $this->dao->select('distinct t1.*, t2.*, t3.type as productType, t2.version as version')->from(TABLE_PROJECTSTORY)->alias('t1')
$stories = $this->dao->select('distinct t1.*, t2.*,IF(t2.`pri` = 0, 999, t2.`pri`) as priOrder, t3.type as productType, t2.version as version')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t2.product = t3.id')
->beginIF(strpos($storyQuery, 'result') !== false)->leftJoin(TABLE_STORYREVIEW)->alias('t4')->on('t2.id = t4.story and t2.version = t4.version')->fi()
@@ -3168,7 +3168,7 @@ class storyModel extends model
$type = (strpos('bymodule|byproduct', $type) !== false and $this->session->storyBrowseType) ? $this->session->storyBrowseType : $type;
$stories = $this->dao->select('distinct t1.*, t2.*,t3.type as productType,t2.version as version')->from(TABLE_PROJECTSTORY)->alias('t1')
$stories = $this->dao->select('distinct t1.*, t2.*, IF(t2.`pri` = 0, 999, t2.`pri`) as priOrder, t3.type as productType, t2.version as version')->from(TABLE_PROJECTSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->leftJoin(TABLE_PRODUCT)->alias('t3')->on('t2.product = t3.id')
->where('t1.project')->eq((int)$executionID)
@@ -3283,7 +3283,8 @@ class storyModel extends model
}
else
{
$stories = $this->dao->select('distinct t1.story, t1.plan, t1.order, t2.*')
if(strpos($orderBy, 'priOrder') === false) $orderBy = str_replace('pri', 'priOrder', $orderBy);
$stories = $this->dao->select('distinct t1.story, t1.plan, t1.order, t2.*, IF(t2.`pri` = 0, 999, t2.`pri`) as priOrder')
->from(TABLE_PLANSTORY)->alias('t1')
->leftJoin(TABLE_STORY)->alias('t2')->on('t1.story = t2.id')
->where('t1.plan')->eq($planID)
@@ -3390,7 +3391,7 @@ class storyModel extends model
*/
public function getUserStories($account, $type = 'assignedTo', $orderBy = 'id_desc', $pager = null, $storyType = 'story', $includeLibStories = true)
{
$sql = $this->dao->select('t1.*, t2.name as productTitle')->from(TABLE_STORY)->alias('t1')
$sql = $this->dao->select('t1.*, IF(t1.`pri` = 0, 999, t1.`pri`) as priOrder, t2.name as productTitle')->from(TABLE_STORY)->alias('t1')
->leftJoin(TABLE_PRODUCT)->alias('t2')->on('t1.product = t2.id');
if($type == 'reviewBy') $sql = $sql->leftJoin(TABLE_STORYREVIEW)->alias('t3')->on('t1.id = t3.story and t1.version = t3.version');