phonesearch: LDAP or AD backend only search for local part hopefully stored without any formatting

This commit is contained in:
Ralf Becker 2021-03-21 10:39:26 +01:00
parent 678ce97e79
commit fc50aa6312

View File

@ -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 = [