forked from extern/egroupware
Add some extra handling for ambiguous columns
This commit is contained in:
parent
79dfab8005
commit
215da11fae
@ -445,6 +445,17 @@ class so_sql_cf extends so_sql
|
||||
}
|
||||
unset($criteria[$this->autoinc_id]);
|
||||
}
|
||||
// replace ambiguous column with (an exact match of) table_name.column
|
||||
elseif (is_string($name) && $val!=null && in_array($name, $this->db_cols))
|
||||
{
|
||||
$extra_columns = $this->db->get_table_definitions($app, $this->extra_table);
|
||||
if($extra_columns['fd'][array_search($name, $this->db_cols)]) {
|
||||
$filter[] = $this->db->expression($this->table_name,$this->table_name.'.',array(
|
||||
array_search($name, $this->db_cols) => $val,
|
||||
));
|
||||
unset($filter[$name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 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 &&
|
||||
@ -470,6 +481,17 @@ class so_sql_cf extends so_sql
|
||||
}
|
||||
unset($filter[$this->autoinc_id]);
|
||||
}
|
||||
// replace ambiguous column with (an exact match of) table_name.column
|
||||
elseif (is_string($name) && $val!=null && in_array($name, $this->db_cols))
|
||||
{
|
||||
$extra_columns = $this->db->get_table_definitions($app, $this->extra_table);
|
||||
if($extra_columns['fd'][array_search($name, $this->db_cols)]) {
|
||||
$filter[] = $this->db->expression($this->table_name,$this->table_name.'.',array(
|
||||
array_search($name, $this->db_cols) => $val,
|
||||
));
|
||||
unset($filter[$name]);
|
||||
}
|
||||
}
|
||||
elseif (is_string($name) && $this->is_cf($name))
|
||||
{
|
||||
if (!empty($val)) // empty -> dont filter
|
||||
|
Loading…
Reference in New Issue
Block a user