summaryrefslogtreecommitdiff
path: root/program
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2011-03-31 06:07:15 +0000
committeralecpl <alec@alec.pl>2011-03-31 06:07:15 +0000
commit111a6fc31457e0efa8276e58aeb7632a64a32cbf (patch)
tree1607e7010c52584e5f81b501f8e1db436a51f1fd /program
parent2d10908f046e8a8c7b3999a90b82ccbb065b480e (diff)
- Add info about indexcontacts.sh script in upgrade procedure
Diffstat (limited to 'program')
-rw-r--r--program/steps/mail/autocomplete.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index 36542caec..85f3cf352 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -47,8 +47,15 @@ else if ($book_types && $search = get_input_value('_search', RCUBE_INPUT_GPC, tr
if ($result = $abook->search(array('email','name'), $search, false, true, true, 'email')) {
while ($sql_arr = $result->iterate()) {
- foreach ((array)$abook->get_col_values('email', $sql_arr, true) as $email) {
+ // Contact can have more than one e-mail address
+ $email_arr = (array)$abook->get_col_values('email', $sql_arr, true);
+ $email_cnt = count($email_arr);
+ foreach ($email_arr as $email) {
$contact = format_email_recipient($email, $sql_arr['name']);
+ // skip entries that don't match
+ if ($email_cnt > 1 && strpos($contact, $search) === false) {
+ continue;
+ }
// when we've got more than one book, we need to skip duplicates
if ($books_num == 1 || !in_array($contact, $contacts)) {
$contacts[] = $contact;