From 8057d8b368e9dfe151689b23156181e2b88e5508 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Mon, 7 Apr 2008 09:47:01 +0000 Subject: [PATCH] forgot the debug, and fixed a bug in advanced search regarding customfields, if you sort by a customfield --- addressbook/inc/class.socontacts_sql.inc.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/addressbook/inc/class.socontacts_sql.inc.php b/addressbook/inc/class.socontacts_sql.inc.php index e701460af2..c10d01f7f5 100644 --- a/addressbook/inc/class.socontacts_sql.inc.php +++ b/addressbook/inc/class.socontacts_sql.inc.php @@ -235,7 +235,6 @@ class socontacts_sql extends so_sql */ 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) { -$this->debug=5; 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"; $owner = isset($filter['owner']) ? $filter['owner'] : (isset($criteria['owner']) ? $criteria['owner'] : null); @@ -293,9 +292,11 @@ $this->debug=5; { if ($op=='AND') { $criteria[] =$this->extra_table.'.contact_id in (select '.$this->extra_table.'.contact_id from '.$this->extra_table.' where '. - "(contact_name='".substr($col,1)."' AND contact_value".($wildcard?' LIKE ':'=')."'".$wildcard.$part.$wildcard."'))"; + "(".$this->extra_table.".contact_name='".substr($col,1)."' AND ".$this->extra_table.".contact_value".($wildcard?' LIKE ':'=')."'".$wildcard.$part.$wildcard."'))"; } else { - $criteria[] = $this->db->expression($this->extra_table,'(',array('contact_name'=>substr($col,1),'contact_value'.($wildcard?' LIKE ':'=')."'".$wildcard.$part.$wildcard."'"),')'); + $criteria[] = $this->db->expression($this->extra_table,'(',array( + $this->extra_table.'.contact_name='."'".substr($col,1)."'", + $this->extra_table.'.contact_value'.($wildcard?' LIKE ':'=')."'".$wildcard.$part.$wildcard."'"),')'); } } $search_customfields = true;