"Fix for PostgreSQL error, when ordering by a custom field (reported on the developer list)"

This commit is contained in:
Ralf Becker 2010-04-29 06:21:16 +00:00
parent 35ef74a4ca
commit c4dfb79175

View File

@ -323,8 +323,9 @@ class addressbook_sql extends so_sql_cf
if ($this->db->Type != 'mysql' && preg_match("/([a-zA-Z_.]+)<>''/",$order_by,$matches))
{
if (!is_array($extra_cols)) $extra_cols = $extra_cols ? explode(',',$extra_cols) : array();
$extra_cols[] = $matches[1];
$extra_cols[] = $matches[1]."<>''";
$table = $matches[1] == $this->extra_value ? $this->extra_table : $this->table_name;
$extra_cols[] = $table.'.'.$matches[1];
$extra_cols[] = $table.'.'.$matches[1]."<>''";
}
}
// add join to show only active accounts (only if accounts are shown and in sql and we not already join the accounts table, eg. used by admin)