From fc50aa6312a389498ae393db9a3b62dbf137dbd1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 21 Mar 2021 10:39:26 +0100 Subject: [PATCH] phonesearch: LDAP or AD backend only search for local part hopefully stored without any formatting --- api/src/Contacts.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/api/src/Contacts.php b/api/src/Contacts.php index 20cc768216..63a7b088ac 100755 --- a/api/src/Contacts.php +++ b/api/src/Contacts.php @@ -2833,10 +2833,17 @@ class Contacts extends Contacts\Storage $rest_without_space = str_replace(' ', '', $rest); /** @var Contacts\Sql */ $backend = $this->get_backend(null, $filter['owner']); + // SQL Backend supporting regexp_replace (MySQL 8.0+ or MariaDB 10.0+ or PostgreSQL) if (is_a($backend, Contacts\Sql::class) && $this->db->regexp_replace('test', '', '') !== 'test') { $patterns = [$area.$rest_without_space]; } + // LDAP or AD backend (were EGroupware does NOT support boolean search) only search for local part hopefully stored without any formatting + elseif (is_a($backend, Contacts\Ldap::class)) + { + $patterns = [$rest_without_space]; + } + // older SQL databases else { $patterns = [