From 01d1b16b6e8b64d9fa86c6a12d985a223cc5feed Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 23 Mar 2011 09:37:19 +0000 Subject: [PATCH] * GroupDAV/CardDAV: fixed empty addressbooks issue (url in PROPFIND contained empty id --> "/.vcf" instead "/123.vcf") caused by not longer necessary special handling of contact_id in addressbook_sql, which is handled now in so_sql(_cf) fix for PostgreSQL to NOT get SQL error ORDER BY must be in column list for GroupDAV/CardDAV propfinds --- .../inc/class.addressbook_groupdav.inc.php | 2 +- addressbook/inc/class.addressbook_so.inc.php | 4 ++-- addressbook/inc/class.addressbook_sql.inc.php | 17 ++--------------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/addressbook/inc/class.addressbook_groupdav.inc.php b/addressbook/inc/class.addressbook_groupdav.inc.php index c19b58277d..2025c992cb 100644 --- a/addressbook/inc/class.addressbook_groupdav.inc.php +++ b/addressbook/inc/class.addressbook_groupdav.inc.php @@ -169,7 +169,7 @@ class addressbook_groupdav extends groupdav_handler unset($filter['address_data']); $files = array(); // we query etag and modified, as LDAP does not have the strong sql etag - if (($contacts =& $this->bo->search(array(),array('id','uid','etag','modified'),'contact_id','','',False,'AND',$start,$filter))) + if (($contacts =& $this->bo->search(array(),array('id','uid','etag','modified'),'egw_addressbook.contact_id','','',False,'AND',$start,$filter))) { foreach($contacts as &$contact) { diff --git a/addressbook/inc/class.addressbook_so.inc.php b/addressbook/inc/class.addressbook_so.inc.php index 9b35d09d59..7f00d3a19c 100755 --- a/addressbook/inc/class.addressbook_so.inc.php +++ b/addressbook/inc/class.addressbook_so.inc.php @@ -557,8 +557,8 @@ class addressbook_so */ function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='') { - //echo "

socontacts::search(".print_r($criteria,true).",'$only_keys','$order_by','$extra_cols','$wildcard','$empty','$op','$start',".print_r($filter,true).",'$join')

\n"; - //error_log("socontacts::search(".print_r($criteria,true).",'$only_keys','$order_by','$extra_cols','$wildcard','$empty','$op','$start',".print_r($filter,true).",'$join')"); + //echo '

'.__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')

\n"; + //error_log(__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')"); // Handle 'None' country option if(is_array($filter) && $filter['adr_one_countrycode'] == '-custom-') diff --git a/addressbook/inc/class.addressbook_sql.inc.php b/addressbook/inc/class.addressbook_sql.inc.php index c7053c3762..22c0c79366 100644 --- a/addressbook/inc/class.addressbook_sql.inc.php +++ b/addressbook/inc/class.addressbook_sql.inc.php @@ -248,7 +248,8 @@ class addressbook_sql extends so_sql_cf */ function &search($criteria,$only_keys=True,$order_by='',$extra_cols='',$wildcard='',$empty=False,$op='AND',$start=false,$filter=null,$join='',$need_full_no_count=false) { - if ((int) $this->debug >= 4) echo "

socontacts_sql::search(".print_r($criteria,true).",".print_r($only_keys,true).",'$order_by','$extra_cols','$wildcard','$empty','$op','$start',".print_r($filter,true).",'$join')

\n"; + if ((int) $this->debug >= 4) echo '

'.__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')

\n"; + //error_log(__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')"); $owner = isset($filter['owner']) ? $filter['owner'] : (isset($criteria['owner']) ? $criteria['owner'] : null); @@ -345,20 +346,6 @@ class addressbook_sql extends so_sql_cf case 'string': $only_keys = explode(',',$only_keys); // fall through - case 'array': - foreach($only_keys as $key => $val) - { - switch($val) - { - case 'id': case 'contact_id': - $only_keys[$key] = $this->table_name.'.contact_id'; - break; - case 'owner': case 'contact_owner': - $only_keys[$key] = $this->table_name.'.contact_owner'; - break; - } - } - break; } // postgres requires that expressions in order by appear in the columns of a distinct select if ($this->db->Type != 'mysql' && preg_match("/([a-zA-Z_.]+)<>''/",$order_by,$matches))