From 5b0ecf04916dbe2bec9140e2cb5bc3b7700b5965 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Tue, 15 May 2012 14:35:09 +0000 Subject: [PATCH] Fix SQL error when exporting sorted by contact_id --- addressbook/inc/class.addressbook_ui.inc.php | 2 +- etemplate/inc/class.so_sql.inc.php | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 86d496ea5f..adf4e9297e 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -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"; break; 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 { diff --git a/etemplate/inc/class.so_sql.inc.php b/etemplate/inc/class.so_sql.inc.php index 01a372885a..374abd4d0e 100644 --- a/etemplate/inc/class.so_sql.inc.php +++ b/etemplate/inc/class.so_sql.inc.php @@ -931,7 +931,12 @@ class so_sql } 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; } elseif (is_array($only_keys))