mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-04 20:40:14 +01:00
Add some extra handling for potentially ambiguous columns in
This commit is contained in:
parent
215da11fae
commit
549626cbf9
@ -457,6 +457,15 @@ class so_sql_cf extends so_sql
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// replace ambiguous column with (an exact match of) table_name.column
|
||||||
|
if(is_array($only_keys)) {
|
||||||
|
foreach($only_keys as $key => &$col) {
|
||||||
|
if(is_numeric($key) && in_array($col, $this->db_cols)) {
|
||||||
|
$col = $this->table_name .'.'.array_search($col, $this->db_cols);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// check if we order by a custom field --> join cf table for given cf and order by it's value
|
// check if we order by a custom field --> join cf table for given cf and order by it's value
|
||||||
if (strpos($order_by,self::CF_PREFIX) !== false &&
|
if (strpos($order_by,self::CF_PREFIX) !== false &&
|
||||||
preg_match('/'.self::CF_PREFIX.'([^ ]+) (asc|desc)/i',$order_by,$matches))
|
preg_match('/'.self::CF_PREFIX.'([^ ]+) (asc|desc)/i',$order_by,$matches))
|
||||||
|
Loading…
Reference in New Issue
Block a user