* [refac] Fix Integrity constraint violatioin: 1052 Column 'xxx' in ORDER BY is ambiguous.
This commit is contained in:
@@ -375,6 +375,9 @@ class storyModel extends model
|
||||
|
||||
$branchParam = ($type == 'bybranch' and $param !== '') ? $param : (string)$this->cookie->storyBranchParam;
|
||||
|
||||
if(strpos($orderBy, 'version_') !== false) $orderBy = str_replace('id_', 't2.version_', $orderBy);
|
||||
if(strpos($orderBy, 'id_') !== false) $orderBy = str_replace('id_', 't2.id_', $orderBy);
|
||||
|
||||
$stories = $this->dao->select("distinct t1.*, t2.`path`, t2.`plan`, t2.*, IF(t2.`pri` = 0, {$this->config->maxPriValue}, 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')
|
||||
|
||||
@@ -400,6 +400,9 @@ class storyTao extends storyModel
|
||||
$hasExecution = strpos($storyQuery, 't2.`execution`') !== false;
|
||||
if($hasExecution) $storyQuery = str_replace('t2.`execution`', 't1.`project`', $storyQuery);
|
||||
|
||||
if(strpos($orderBy, 'version_') !== false) $orderBy = str_replace('id_', 't2.version_', $orderBy);
|
||||
if(strpos($orderBy, 'id_') !== false) $orderBy = str_replace('id_', 't2.id_', $orderBy);
|
||||
|
||||
return $this->dao->select("distinct t1.*, t2.*, IF(t2.`pri` = 0, {$this->config->maxPriValue}, 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')
|
||||
|
||||
@@ -140,6 +140,10 @@ class testcaseModel extends model
|
||||
{
|
||||
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getCases();
|
||||
|
||||
if(strpos($orderBy, 'id_') !== false) $orderBy = str_replace('id_', 't2.id_', $orderBy);
|
||||
if(strpos($orderBy, 'order_') !== false) $orderBy = str_replace('order_', 't2.order_', $orderBy);
|
||||
if(strpos($orderBy, 'version_') !== false) $orderBy = str_replace('version_', 't2.version_', $orderBy);
|
||||
|
||||
if($browseType == 'needconfirm')
|
||||
{
|
||||
return $this->dao->select('distinct t1.*, t2.*')->from(TABLE_PROJECTCASE)->alias('t1')
|
||||
|
||||
Reference in New Issue
Block a user