Fix SQL error when exporting sorted by contact_id

This commit is contained in:
Nathan Gray 2012-05-15 14:35:09 +00:00
parent c2bf63c872
commit 5b0ecf0491
2 changed files with 7 additions and 2 deletions

View File

@ -1283,7 +1283,7 @@ class addressbook_ui extends addressbook_bo
$order = "$query[order] IS NULL,$query[order] $sort,org_name $sort,n_family $sort,n_given $sort"; $order = "$query[order] IS NULL,$query[order] $sort,org_name $sort,n_family $sort,n_given $sort";
break; break;
case 'contact_id': case 'contact_id':
$order = "$query[order] $sort"; $order = "egw_addressbook.$query[order] $sort";
} }
if ($query['searchletter']) // only show contacts if the order-criteria starts with the given letter if ($query['searchletter']) // only show contacts if the order-criteria starts with the given letter
{ {

View File

@ -931,7 +931,12 @@ class so_sql
} }
if ($only_keys === true) if ($only_keys === true)
{ {
$colums = implode(',',array_keys($this->db_key_cols)); $colums = array_keys($this->db_key_cols);
foreach($colums as &$column)
{
$column = $this->table_name . '.' . $column;
}
$colums = implode(',',$colums);
if (!empty($colums)) $colums = ' DISTINCT '.$colums; if (!empty($colums)) $colums = ' DISTINCT '.$colums;
} }
elseif (is_array($only_keys)) elseif (is_array($only_keys))