From baecd8becccd7786632c1cda895123293ceb1408 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli Date: Thu, 26 Jul 2012 17:18:38 +0200 Subject: Move the hard-coded list of fields used to list contacts to a central location --- program/steps/addressbook/delete.inc | 3 ++- program/steps/addressbook/list.inc | 6 ++++-- program/steps/addressbook/search.inc | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) (limited to 'program/steps/addressbook') diff --git a/program/steps/addressbook/delete.inc b/program/steps/addressbook/delete.inc index a2f12495c..81b8a0970 100644 --- a/program/steps/addressbook/delete.inc +++ b/program/steps/addressbook/delete.inc @@ -70,6 +70,7 @@ $page = isset($_SESSION['page']) ? $_SESSION['page'] : 1; // update saved search after data changed if (($search_request = $_REQUEST['_search']) && isset($_SESSION['search'][$search_request])) { $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name'); + $afields = $RCMAIL->config->get('contactlist_fields'); $search = (array)$_SESSION['search'][$search_request]; $records = array(); @@ -83,7 +84,7 @@ if (($search_request = $_REQUEST['_search']) && isset($_SESSION['search'][$searc $source->set_search_set($set); // get records - $result = $source->list_records(array('name', 'firstname', 'surname', 'email')); + $result = $source->list_records($afields); if (!$result->count) { unset($search[$s]); diff --git a/program/steps/addressbook/list.inc b/program/steps/addressbook/list.inc index a24fb9520..06a1e10a3 100644 --- a/program/steps/addressbook/list.inc +++ b/program/steps/addressbook/list.inc @@ -19,6 +19,8 @@ +-----------------------------------------------------------------------+ */ +$afields = $RCMAIL->config->get('contactlist_fields'); + // Use search result if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search']])) { @@ -43,7 +45,7 @@ if (!empty($_REQUEST['_search']) && isset($_SESSION['search'][$_REQUEST['_search $source->set_search_set($set); // get records - $result = $source->list_records(array('name', 'firstname', 'surname', 'email')); + $result = $source->list_records($afields); while ($row = $result->next()) { $row['sourceid'] = $s; @@ -73,7 +75,7 @@ else { $CONTACTS = rcmail_contact_source(null, true); // get contacts for this user - $result = $CONTACTS->list_records(array('name', 'firstname', 'surname', 'email')); + $result = $CONTACTS->list_records($afields); 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 f83eb9fd6..d31e54b1a 100644 --- a/program/steps/addressbook/search.inc +++ b/program/steps/addressbook/search.inc @@ -145,6 +145,7 @@ function rcmail_contact_search() $search_set = array(); $records = array(); $sort_col = $RCMAIL->config->get('addressbook_sort_col', 'name'); + $afields = $RCMAIL->config->get('contactlist_fields'); foreach ($sources as $s) { $source = $RCMAIL->get_address_book($s['id']); @@ -179,7 +180,7 @@ function rcmail_contact_search() } // get records - $result = $source->list_records(array('name', 'firstname', 'surname', 'email')); + $result = $source->list_records($afields); while ($row = $result->next()) { $row['sourceid'] = $s['id']; -- cgit v1.2.3