* 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
This commit is contained in:
Ralf Becker 2011-03-23 09:37:19 +00:00
parent 26a55d8c01
commit 01d1b16b6e
3 changed files with 5 additions and 18 deletions

View File

@ -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)
{

View File

@ -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 "<p>socontacts::search(".print_r($criteria,true).",'$only_keys','$order_by','$extra_cols','$wildcard','$empty','$op','$start',".print_r($filter,true).",'$join')</p>\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 '<p>'.__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')</p>\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-')

View File

@ -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 "<p>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')</p>\n";
if ((int) $this->debug >= 4) echo '<p>'.__METHOD__.'('.array2string($criteria,true).','.array2string($only_keys).",'$order_by','$extra_cols','$wildcard','$empty','$op',$start,".array2string($filter,true).",'$join')</p>\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))