diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-07-29 06:38:42 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2011-07-29 06:38:42 +0000 |
| commit | 7728fc147efaabe076fce269bf17ab0d2106271c (patch) | |
| tree | 06ea8cff3a89e3b079acee0b2c8f63fef9c75ab5 /roundcubemail | |
| parent | 64595d5ab87e09fb76e59fe40750c500d6531074 (diff) | |
- Fixed search fields handling in quick-search
git-svn-id: https://svn.roundcube.net/trunk@4986 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail')
| -rw-r--r-- | roundcubemail/program/steps/addressbook/search.inc | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/roundcubemail/program/steps/addressbook/search.inc b/roundcubemail/program/steps/addressbook/search.inc index bb2f4d2ad..352556de0 100644 --- a/roundcubemail/program/steps/addressbook/search.inc +++ b/roundcubemail/program/steps/addressbook/search.inc @@ -56,7 +56,10 @@ function rcmail_contact_search() $fields = explode(',', get_input_value('_headers', RCUBE_INPUT_GET)); if (empty($fields)) { - $fields = $SEARCH_MODS_DEFAULT; + $fields = array_keys($SEARCH_MODS_DEFAULT); + } + else { + $fields = array_filter($fields); } // update search_mods setting @@ -66,7 +69,7 @@ function rcmail_contact_search() $RCMAIL->user->save_prefs(array('addressbook_search_mods' => $search_mods)); } - if ($fields['*'] || count($fields) == count($SEARCH_MODS_DEFAULT)) { + if (in_array('*', $fields)) { $fields = '*'; } } @@ -79,7 +82,7 @@ function rcmail_contact_search() foreach ($sources as $s) { $source = $RCMAIL->get_address_book($s['id']); - // check if all search fields are supported.... + // check if search fields are supported.... if (is_array($fields)) { $cols = $source->coltypes[0] ? array_flip($source->coltypes) : $source->coltypes; $supported = 0; @@ -90,8 +93,9 @@ function rcmail_contact_search() } } - // ...if not, we can skip this source - if ($supported < count($fields)) { + // in advanced search we require all fields (AND operator) + // in quick search we require at least one field (OR operator) + if (($adv && $supported < count($fields)) || (!$adv && !$supported)) { continue; } } |
