Merged in bugfix/PMCORE-1882 (pull request #7449)
PMCORE-1882 Suggest Field doesn't show records when we use an alias in a Query Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
committed by
Julio Cesar Laura Avendaño
commit
d60dbe1e37
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
use ProcessMaker\Core\System;
|
||||
use ProcessMaker\BusinessModel\DynaForm\SuggestTrait;
|
||||
use ProcessMaker\BusinessModel\Cases;
|
||||
@@ -1044,6 +1045,16 @@ class PmDynaform
|
||||
$dt[$key]["alias"] = "";
|
||||
}
|
||||
if ($key == 0) {
|
||||
//compatibility with table name alias when uses the sentence 'AS'
|
||||
if (strtoupper($dt[$key]["alias"]) === 'AS') {
|
||||
$parser = new Parser($sql);
|
||||
if (isset($parser->statements[$key]) && isset($parser->statements[$key]->from[$key])) {
|
||||
$obj1 = $parser->statements[$key]->from[$key];
|
||||
if (!empty($obj1->alias)) {
|
||||
$dt[$key]["alias"] = $dt[$key]["alias"] . ' ' . $obj1->alias;
|
||||
}
|
||||
}
|
||||
}
|
||||
$from .= $dt[$key]["table"]
|
||||
. ($dt[$key]["table"] == $dt[$key]["alias"] ? "" : " " . $dt[$key]["alias"]);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user