diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-06-04 11:51:50 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-06-04 11:51:50 +0000 |
| commit | b3c1c3eda52976ee5194bac50549a24fed75f206 (patch) | |
| tree | a5f2c10ed6ff5056cf3a30c8999f524117234b17 /roundcubemail/program/steps | |
| parent | 5f163c90c77490b87401f11720b1fe9338947f3b (diff) | |
- Remove duplicates in autocomplete result (#1486772)
git-svn-id: https://svn.roundcube.net/trunk@3715 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
| -rw-r--r-- | roundcubemail/program/steps/mail/autocomplete.inc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/roundcubemail/program/steps/mail/autocomplete.inc b/roundcubemail/program/steps/mail/autocomplete.inc index 2fb5eb6db..4fbea1fba 100644 --- a/roundcubemail/program/steps/mail/autocomplete.inc +++ b/roundcubemail/program/steps/mail/autocomplete.inc @@ -37,6 +37,7 @@ if ($RCMAIL->action == 'group-expand') { } else if ($book_types && $search = get_input_value('_search', RCUBE_INPUT_GPC, true)) { $contacts = array(); + $books_num = count($book_types); foreach ($book_types as $id) { $abook = $RCMAIL->get_address_book($id); @@ -44,9 +45,13 @@ 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()) { - $contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); + $contact = format_email_recipient($sql_arr['email'], $sql_arr['name']); + // when we've got more than one book, we need to skip duplicates + if ($books_num == 1 || !in_array($contact, $contacts)) { + $contacts[] = $contact; if (count($contacts) >= $MAXNUM) break 2; + } } } |
