fixed a problem regarding search in extra fields for addressbook when using the advanced search dialog

This commit is contained in:
Klaus Leithoff 2008-03-05 11:41:40 +00:00
parent db165536e1
commit 2bb4fd1df1

View File

@ -286,7 +286,12 @@ class socontacts_sql extends so_sql
if ($col{0} == '#') // search for a value in a certain custom field if ($col{0} == '#') // search for a value in a certain custom field
{ {
unset($criteria[$col]); unset($criteria[$col]);
$criteria[] = $this->db->expression($this->extra_table,'(',array('contact_name'=>substr($col,1),'contact_value'=>$val),')'); 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.$val.$wildcard."'))";
} else {
$criteria[] = $this->db->expression($this->extra_table,'(',array('contact_name'=>substr($col,1),'contact_value'.($wildcard?' LIKE ':'=')."'".$wildcard.$val.$wildcard."'"),')');
}
$search_customfields = true; $search_customfields = true;
} }
elseif($col == 'cat_id') // search in comma-sep. cat-column elseif($col == 'cat_id') // search in comma-sep. cat-column