Request all needed fields from address book backends (#1488394)

pull/1/head
thomascube 13 years ago
parent ec318158ce
commit 168e540923

@ -86,7 +86,7 @@ if (($search_request = $_REQUEST['_search']) && isset($_SESSION['search'][$searc
$source->set_search_set($set); $source->set_search_set($set);
// get records // get records
$result = $source->list_records(array('name', 'email')); $result = $source->list_records(array('name', 'firstname', 'surname', 'email'));
if (!$result->count) { if (!$result->count) {
unset($search[$s]); unset($search[$s]);

@ -46,7 +46,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search
$source->set_search_set($set); $source->set_search_set($set);
// get records // get records
$result = $source->list_records(array('name', 'email')); $result = $source->list_records(array('name', 'firstname', 'surname', 'email'));
while ($row = $result->next()) { while ($row = $result->next()) {
$row['sourceid'] = $s; $row['sourceid'] = $s;
@ -76,7 +76,7 @@ else {
$CONTACTS = rcmail_contact_source(null, true); $CONTACTS = rcmail_contact_source(null, true);
// get contacts for this user // 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) { if (!$result->count && $result->searchonly) {
$OUTPUT->show_message('contactsearchonly', 'notice'); $OUTPUT->show_message('contactsearchonly', 'notice');

@ -182,7 +182,7 @@ function rcmail_contact_search()
} }
// get records // get records
$result = $source->list_records(array('name', 'email')); $result = $source->list_records(array('name', 'firstname', 'surname', 'email'));
while ($row = $result->next()) { while ($row = $result->next()) {
$row['sourceid'] = $s['id']; $row['sourceid'] = $s['id'];

@ -29,10 +29,10 @@ if ($RCMAIL->action == 'group-expand') {
$members = array(); $members = array();
$abook->set_group($gid); $abook->set_group($gid);
$abook->set_pagesize(1000); // TODO: limit number of group members by config $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())) { while ($result && ($sql_arr = $result->iterate())) {
foreach ((array)$sql_arr['email'] as $email) { 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 break; // only expand one email per contact
} }
} }
@ -67,7 +67,7 @@ if (!empty($book_types) && strlen($search)) {
$abook = $RCMAIL->get_address_book($id); $abook = $RCMAIL->get_address_book($id);
$abook->set_pagesize($MAXNUM); $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()) { while ($sql_arr = $result->iterate()) {
// Contact can have more than one e-mail address // Contact can have more than one e-mail address
$email_arr = (array)$abook->get_col_values('email', $sql_arr, true); $email_arr = (array)$abook->get_col_values('email', $sql_arr, true);
@ -78,6 +78,7 @@ if (!empty($book_types) && strlen($search)) {
continue; continue;
} }
$sql_arr['name'] = rcube_addressbook::compose_list_name($sql_arr);
$contact = format_email_recipient($email, $sql_arr['name']); $contact = format_email_recipient($email, $sql_arr['name']);
// skip entries that don't match // skip entries that don't match

@ -60,7 +60,7 @@ if ($CONTACTS && $CONTACTS->ready) {
// get contacts for this user // get contacts for this user
$CONTACTS->set_group(0); $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) { if (!$result->count && $result->searchonly) {
$OUTPUT->show_message('contactsearchonly', 'notice'); $OUTPUT->show_message('contactsearchonly', 'notice');

Loading…
Cancel
Save