mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
some more tolerant searches to find numbers in EGroupware GmbH database
This commit is contained in:
parent
f8ec1618d9
commit
cfc7c1cbdf
@ -2758,9 +2758,9 @@ class Contacts extends Contacts\Storage
|
|||||||
/**
|
/**
|
||||||
* Regular expression to search for an exact phone number match instead of regular search
|
* Regular expression to search for an exact phone number match instead of regular search
|
||||||
*
|
*
|
||||||
* Requires a leading + or 0 and only numbers (ignores /-() and space) plus minimum length of 9 chars
|
* Requires a leading + or digit and only numbers (ignores /-() and space) plus minimum length of 9 chars
|
||||||
*/
|
*/
|
||||||
const PHONE_PREG = '/^(\+|0)[0-9 ()\/-]{8,}$/';
|
const PHONE_PREG = '/^(\+|\d])[0-9 ()\/-]{8,}$/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* searches db for rows matching searchcriteria
|
* searches db for rows matching searchcriteria
|
||||||
@ -2831,7 +2831,12 @@ class Contacts extends Contacts\Storage
|
|||||||
$rest_without_space = str_replace(' ', '', $rest);
|
$rest_without_space = str_replace(' ', '', $rest);
|
||||||
foreach([
|
foreach([
|
||||||
$area.' +'.$rest_without_space,
|
$area.' +'.$rest_without_space,
|
||||||
$area.' +'.substr($rest_without_space, 0, -3), // strip last 3 digits, in case they are written as extension
|
// strip last 4 digits off, in case they are written as extension or formatted like 123 45 67
|
||||||
|
$area.' +'.substr($rest_without_space, 0, -4),
|
||||||
|
// use first 2 digit from rest, in case they are written as extension or formatted like 12 3...
|
||||||
|
$area.' +'.substr($rest_without_space, 0, 2),
|
||||||
|
// try exact match
|
||||||
|
'"'.$criteria.'"',
|
||||||
] as $pattern)
|
] as $pattern)
|
||||||
{
|
{
|
||||||
$rows = parent::search($pattern, $only_keys, $order_by, $extra_cols, $wildcard, $empty, $op, $start, $filter, $join, $ignore_acl) ?: [];
|
$rows = parent::search($pattern, $only_keys, $order_by, $extra_cols, $wildcard, $empty, $op, $start, $filter, $join, $ignore_acl) ?: [];
|
||||||
|
Loading…
Reference in New Issue
Block a user