Fix searching in date fields - raleted to Roundcube issue #1488888
This commit is contained in:
parent
71b64ebca2
commit
cbb7db9361
1 changed files with 9 additions and 24 deletions
|
@ -82,6 +82,11 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
'pgppublickey' => 'KEY',
|
'pgppublickey' => 'KEY',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of date type fields
|
||||||
|
*/
|
||||||
|
public $date_cols = array('birthday', 'anniversary');
|
||||||
|
|
||||||
private $gid;
|
private $gid;
|
||||||
private $storagefolder;
|
private $storagefolder;
|
||||||
private $contacts;
|
private $contacts;
|
||||||
|
@ -386,32 +391,12 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
|
|
||||||
$found = array();
|
$found = array();
|
||||||
foreach (preg_grep($regexp, array_keys($contact)) as $col) {
|
foreach (preg_grep($regexp, array_keys($contact)) as $col) {
|
||||||
if ($advanced) {
|
$pos = strpos($col, ':');
|
||||||
$pos = strpos($col, ':');
|
$colname = $pos ? substr($col, 0, $pos) : $col;
|
||||||
$colname = $pos ? substr($col, 0, $pos) : $col;
|
$search = $advanced ? $value[array_search($colname, $fields)] : $value;
|
||||||
$search = $value[array_search($colname, $fields)];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$search = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ((array)$contact[$col] as $val) {
|
foreach ((array)$contact[$col] as $val) {
|
||||||
foreach ((array)$val as $str) {
|
if ($this->compare_search_value($colname, $val, $search, $mode)) {
|
||||||
$str = mb_strtolower($str);
|
|
||||||
switch ($mode) {
|
|
||||||
case 1:
|
|
||||||
$got = ($str == $search);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
$got = ($search == substr($str, 0, strlen($search)));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
$got = (strpos($str, $search) !== false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($got) {
|
|
||||||
if (!$advanced) {
|
if (!$advanced) {
|
||||||
$this->filter['ids'][] = $id;
|
$this->filter['ids'][] = $id;
|
||||||
break 2;
|
break 2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue