summaryrefslogtreecommitdiff
path: root/program/steps/mail
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-07-26 17:18:38 +0200
committerThomas Bruederli <thomas@roundcube.net>2012-07-26 17:18:38 +0200
commitbaecd8becccd7786632c1cda895123293ceb1408 (patch)
treee33c882fe684e73fab73d77b1b16fe54ce9754ec /program/steps/mail
parent5bc1233de808442f8d412bf4394fda05b22f41d2 (diff)
Move the hard-coded list of fields used to list contacts to a central location
Diffstat (limited to 'program/steps/mail')
-rw-r--r--program/steps/mail/autocomplete.inc4
-rw-r--r--program/steps/mail/list_contacts.inc3
2 files changed, 4 insertions, 3 deletions
diff --git a/program/steps/mail/autocomplete.inc b/program/steps/mail/autocomplete.inc
index ba34fa5aa..55579814c 100644
--- a/program/steps/mail/autocomplete.inc
+++ b/program/steps/mail/autocomplete.inc
@@ -26,7 +26,7 @@ if ($RCMAIL->action == 'group-expand') {
$members = array();
$abook->set_group($gid);
$abook->set_pagesize(1000); // TODO: limit number of group members by config
- $result = $abook->list_records(array('name', 'firstname', 'surname', 'email'));
+ $result = $abook->list_records($RCMAIL->config->get('contactlist_fields'));
while ($result && ($sql_arr = $result->iterate())) {
foreach ((array)$sql_arr['email'] as $email) {
$members[] = format_email_recipient($email, rcube_addressbook::compose_list_name($sql_arr));
@@ -64,7 +64,7 @@ if (!empty($book_types) && strlen($search)) {
$abook = $RCMAIL->get_address_book($id);
$abook->set_pagesize($MAXNUM);
- if ($result = $abook->search(array('name', 'firstname', 'surname', 'email'), $search, $mode, true, true, 'email')) {
+ if ($result = $abook->search($RCMAIL->config->get('contactlist_fields'), $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);
diff --git a/program/steps/mail/list_contacts.inc b/program/steps/mail/list_contacts.inc
index 1a6480339..7c99a1309 100644
--- a/program/steps/mail/list_contacts.inc
+++ b/program/steps/mail/list_contacts.inc
@@ -57,7 +57,8 @@ if ($CONTACTS && $CONTACTS->ready) {
// get contacts for this user
$CONTACTS->set_group(0);
- $result = $CONTACTS->list_records(array('name', 'firstname', 'surname', 'email'));
+ $afields = $RCMAIL->config->get('contactlist_fields');
+ $result = $CONTACTS->list_records($afields);
if (!$result->count && $result->searchonly) {
$OUTPUT->show_message('contactsearchonly', 'notice');