diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index 4741fb2e74..9908fe65d9 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -360,6 +360,12 @@ class addressbook_sql extends so_sql_cf $table = $matches[1] == $this->extra_value ? $this->extra_table : $this->table_name; $extra_cols[] = $table.'.'.$matches[1]; $extra_cols[] = $table.'.'.$matches[1]."<>''"; + //_debug_array($matches[1]); + if (!empty($order_by) && $matches[1] != 'extra_order.contact_value' && stripos($matches[1],'.')===false) // postgres requires explizit order by + { + $order_by = str_replace($matches[1],'egw_addressbook.'.$matches[1],$order_by); + } + //_debug_array($order_by); } } // 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)