From 168e5409239583343ae40695585aa8dbc276f740 Mon Sep 17 00:00:00 2001 From: thomascube <thomas@roundcube.net> Date: Wed, 14 Mar 2012 04:27:18 -0400 Subject: [PATCH] Request all needed fields from address book backends (#1488394) --- program/steps/addressbook/list.inc | 4 ++-- program/steps/mail/autocomplete.inc | 7 ++++--- program/steps/addressbook/delete.inc | 2 +- program/steps/mail/list_contacts.inc | 2 +- program/steps/addressbook/search.inc | 2 +- 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc index f19dcf4..1e2142c 100644 --- a/program/steps/addressbook/delete.inc +++ b/program/steps/addressbook/delete.inc @@ -86,7 +86,7 @@ $source->set_search_set($set); // get records - $result = $source->list_records(array('name', 'email')); + $result = $source->list_records(array('name', 'firstname', 'surname', 'email')); if (!$result->count) { unset($search[$s]); diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc index 91852a4..5876f3c 100644 --- a/program/steps/addressbook/list.inc +++ b/program/steps/addressbook/list.inc @@ -46,7 +46,7 @@ $source->set_search_set($set); // get records - $result = $source->list_records(array('name', 'email')); + $result = $source->list_records(array('name', 'firstname', 'surname', 'email')); while ($row = $result->next()) { $row['sourceid'] = $s; @@ -76,7 +76,7 @@ $CONTACTS = rcmail_contact_source(null, true); // get contacts for this user - $result = $CONTACTS->list_records(array('name')); + $result = $CONTACTS->list_records(array('name', 'firstname', 'surname', 'email')); if (!$result->count && $result->searchonly) { $OUTPUT->show_message('contactsearchonly', 'notice'); diff --git a/program/steps/addressbook/search.inc b/program/steps/addressbook/search.inc index 2c65481..6422bc7 100644 --- a/program/steps/addressbook/search.inc +++ b/program/steps/addressbook/search.inc @@ -182,7 +182,7 @@ } // get records - $result = $source->list_records(array('name', 'email')); + $result = $source->list_records(array('name', 'firstname', 'surname', 'email')); while ($row = $result->next()) { $row['sourceid'] = $s['id']; diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc index a7823a5..95d6118 100644 --- a/program/steps/mail/autocomplete.inc +++ b/program/steps/mail/autocomplete.inc @@ -29,10 +29,10 @@ $members = array(); $abook->set_group($gid); $abook->set_pagesize(1000); // TODO: limit number of group members by config - $result = $abook->list_records(array('email','name')); + $result = $abook->list_records(array('name', 'firstname', 'surname', 'email')); while ($result && ($sql_arr = $result->iterate())) { foreach ((array)$sql_arr['email'] as $email) { - $members[] = format_email_recipient($email, $sql_arr['name']); + $members[] = format_email_recipient($email, rcube_addressbook::compose_list_name($sql_arr)); break; // only expand one email per contact } } @@ -67,7 +67,7 @@ $abook = $RCMAIL->get_address_book($id); $abook->set_pagesize($MAXNUM); - if ($result = $abook->search(array('email','name'), $search, $mode, true, true, 'email')) { + if ($result = $abook->search(array('name', 'firstname', 'surname', 'email'), $search, $mode, true, true, 'email')) { while ($sql_arr = $result->iterate()) { // Contact can have more than one e-mail address $email_arr = (array)$abook->get_col_values('email', $sql_arr, true); @@ -78,6 +78,7 @@ continue; } + $sql_arr['name'] = rcube_addressbook::compose_list_name($sql_arr); $contact = format_email_recipient($email, $sql_arr['name']); // skip entries that don't match diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc index 0791ae3..eb425d2 100644 --- a/program/steps/mail/list_contacts.inc +++ b/program/steps/mail/list_contacts.inc @@ -60,7 +60,7 @@ // get contacts for this user $CONTACTS->set_group(0); - $result = $CONTACTS->list_records(array('name', 'email')); + $result = $CONTACTS->list_records(array('name', 'firstname', 'surname', 'email')); if (!$result->count && $result->searchonly) { $OUTPUT->show_message('contactsearchonly', 'notice'); -- Gitblit v1.9.1