diff --git a/addressbook/inc/class.contacts_shared.inc.php b/addressbook/inc/class.contacts_shared.inc.php index eada4f0aab..e34b0d5acd 100644 --- a/addressbook/inc/class.contacts_shared.inc.php +++ b/addressbook/inc/class.contacts_shared.inc.php @@ -188,18 +188,55 @@ reset($filterfields); while (list($col,$filt) = each($filterfields)) { - if($DEBUG) { echo '  Testing "'.$col.'" for "'.$filt.'"'; } - if ($ldap_fields[$i][$col][0] == $filt) + if ($col == 'phpgwcontactcatid') { - if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."  "; } - $yes &= True; - $match++; + $colarray = explode(',',$ldap_fields[$i][$col][0]); + if ($colarray[1]) + { + while(list($key,$val) = each ($colarray)) + { + if($DEBUG) { echo '  Testing "'.$col.'" for "'.$val.'"'; } + if ($val == $filt) + { + if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."  "; } + $yes &= True; + $match++; + break; + } + } + } + else + { + if($DEBUG) { echo '  Testing "'.$col.'" for "'.$filt.'"'; } + if ($ldap_fields[$i][$col][0] == $filt) + { + if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."  "; } + $yes &= True; + $match++; + } + else + { + if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."  "; } + $yes &= False; + $match--; + } + } } else { - if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."  "; } - $yes &= False; - $match--; + if($DEBUG) { echo '  Testing "'.$col.'" for "'.$filt.'"'; } + if ($ldap_fields[$i][$col][0] == $filt) + { + if($DEBUG) { echo ', and number '.$ldap_fields[$i]["uidnumber"][0].' matched.'."  "; } + $yes &= True; + $match++; + } + else + { + if($DEBUG) { echo ', but number '.$ldap_fields[$i]["uidnumber"][0].' did not match.'."  "; } + $yes &= False; + $match--; + } } }