mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
fix SQL error in ranking caused by automatic added ambigous column which app code had already aliased "$table.$col AS $col"
This commit is contained in:
parent
8243f7934e
commit
26be32f33e
@ -946,7 +946,20 @@ class Base
|
||||
if (is_array($colums) && ($key = array_search('*', $colums)) !== false)
|
||||
{
|
||||
unset($colums[$key]);
|
||||
$colums = array_merge($colums, array_keys($this->db_cols));
|
||||
// don't add colums already existing incl. aliased colums (AS $name)
|
||||
$as_columns = array_map(function($col)
|
||||
{
|
||||
$as = null;
|
||||
list(, $as) = preg_split('/ +AS +/i', $col);
|
||||
return empty($as) ? $col : $as;
|
||||
}, $colums);
|
||||
foreach(array_keys($this->db_cols) as $col)
|
||||
{
|
||||
if (!in_array($col, $colums) && !in_array($col, $as_columns))
|
||||
{
|
||||
$colums[] = $col;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (is_array($colums) && ($key = array_search($this->autoinc_id, $colums)) !== false)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user