From 0501b637a3177cce441166b5fcfe27c9bd9fbe0f Mon Sep 17 00:00:00 2001 From: thomascube Date: Tue, 18 Jan 2011 18:00:57 +0000 Subject: Merge branch devel-addressbook (r4193:4382) back into trunk --- program/steps/mail/autocomplete.inc | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'program/steps/mail/autocomplete.inc') diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc index b42ebf87b..36542caec 100644 --- a/program/steps/mail/autocomplete.inc +++ b/program/steps/mail/autocomplete.inc @@ -29,8 +29,10 @@ if ($RCMAIL->action == 'group-expand') { $abook->set_group($gid); $abook->set_pagesize(1000); // TODO: limit number of group members by config $result = $abook->list_records(array('email','name')); - while ($result && ($sql_arr = $result->iterate())) - $members[] = format_email_recipient($sql_arr['email'], $sql_arr['name']); + while ($result && ($sql_arr = $result->iterate())) { + foreach ((array)$sql_arr['email'] as $email) + $members[] = format_email_recipient($email, $sql_arr['name']); + } $OUTPUT->command('replace_group_recipients', $gid, join(', ', $members)); } @@ -45,12 +47,14 @@ 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()) { - $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; + foreach ((array)$abook->get_col_values('email', $sql_arr, true) as $email) { + $contact = format_email_recipient($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; + } } } } -- cgit v1.2.3