Support rcube_addressbook::SEARCH_* constants in search mode
This commit is contained in:
parent
03cfe38a98
commit
0b59c065ad
1 changed files with 12 additions and 5 deletions
|
@ -417,6 +417,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
* 0 - partial (*abc*),
|
* 0 - partial (*abc*),
|
||||||
* 1 - strict (=),
|
* 1 - strict (=),
|
||||||
* 2 - prefix (abc*)
|
* 2 - prefix (abc*)
|
||||||
|
* 4 - include groups (if supported)
|
||||||
* @param boolean $select True if results are requested, False if count only
|
* @param boolean $select True if results are requested, False if count only
|
||||||
* @param boolean $nocount True to skip the count query (select only)
|
* @param boolean $nocount True to skip the count query (select only)
|
||||||
* @param array $required List of fields that cannot be empty
|
* @param array $required List of fields that cannot be empty
|
||||||
|
@ -439,7 +440,7 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
else if ($fields == '*') {
|
else if ($fields == '*') {
|
||||||
$fields = $this->search_fields;
|
$fields = $this->search_fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($fields))
|
if (!is_array($fields))
|
||||||
|
@ -468,6 +469,8 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
$squery[] = array('tags', '=', 'x-has-birthday');
|
$squery[] = array('tags', '=', 'x-has-birthday');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$squery[] = array('type', '=', 'contact');
|
||||||
|
|
||||||
// get all/matching records
|
// get all/matching records
|
||||||
$this->_fetch_contacts($squery);
|
$this->_fetch_contacts($squery);
|
||||||
|
|
||||||
|
@ -1177,10 +1180,14 @@ class rcube_kolab_contacts extends rcube_addressbook
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($cols) == count($fields)) {
|
if (count($cols) == count($fields)) {
|
||||||
switch ($mode) {
|
if ($mode & rcube_addressbook::SEARCH_STRICT) {
|
||||||
case 1: $prefix = '^'; $suffix = '$'; break; // strict
|
$prefix = '^'; $suffix = '$';
|
||||||
case 2: $prefix = '^'; $suffix = ''; break; // prefix
|
}
|
||||||
default: $prefix = ''; $suffix = ''; break; // substring
|
else if ($mode & rcube_addressbook::SEARCH_PREFIX) {
|
||||||
|
$prefix = '^'; $suffix = '';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$prefix = ''; $suffix = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$search_string = is_array($value) ? join(' ', $value) : $value;
|
$search_string = is_array($value) ? join(' ', $value) : $value;
|
||||||
|
|
Loading…
Add table
Reference in a new issue