From 15d8e0d422f1d5dc0ef93fe0be4ab5b522e8e8ca Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Thu, 18 Jul 2019 15:27:06 +0200 Subject: [PATCH] allow to search for multiple items and strip "contact_" prefix --- api/src/Contacts/Ldap.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/api/src/Contacts/Ldap.php b/api/src/Contacts/Ldap.php index 30aef6d79a..484ce0464c 100644 --- a/api/src/Contacts/Ldap.php +++ b/api/src/Contacts/Ldap.php @@ -821,10 +821,17 @@ class Ldap } foreach($this->schema2egw as $mapping) { + if (substr($egwSearchKey, 0, 8) === 'contact_') + { + $egwSearchKey = substr($egwSearchKey, 8); + } if(($ldapSearchKey = $mapping[$egwSearchKey])) { - $searchString = Api\Translation::convert($searchValue,$this->charset,'utf-8'); - $searchFilter .= '('.$ldapSearchKey.'='.$wildcard.Api\Ldap::quote($searchString).$wildcard.')'; + foreach((array)$searchValue as $val) + { + $searchString = Api\Translation::convert($val, $this->charset,'utf-8'); + $searchFilter .= '('.$ldapSearchKey.'='.$wildcard.Api\Ldap::quote($searchString).$wildcard.')'; + } break; } }