From 0eeb67f90ac33ab9c7143f79c9b035d38ea7cb2b Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Fri, 20 May 2011 17:18:49 +0000 Subject: [PATCH] Respect addressbook's extra export limit --- .../inc/class.addressbook_export_contacts_csv.inc.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/addressbook/inc/class.addressbook_export_contacts_csv.inc.php b/addressbook/inc/class.addressbook_export_contacts_csv.inc.php index 416d04bc33..442a75b35a 100644 --- a/addressbook/inc/class.addressbook_export_contacts_csv.inc.php +++ b/addressbook/inc/class.addressbook_export_contacts_csv.inc.php @@ -31,11 +31,18 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi * @param egw_record $_definition */ public function export( $_stream, importexport_definition $_definition) { + $options = $_definition->plugin_options; + $export_object = new importexport_export_csv($_stream, (array)$options); $uicontacts = new addressbook_ui(); $selection = array(); + // Addressbook defines its own export limits + if($GLOBALS['egw_info']['server']['contact_export_limit'] == 'no' && !$GLOBALS['egw_info']['user']['apps']['admin']) { + return; + } + // Need to switch the app to get the same results $old_app = $GLOBALS['egw_info']['flags']['currentapp']; $GLOBALS['egw_info']['flags']['currentapp'] = 'addressbook'; @@ -57,6 +64,9 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi } $GLOBALS['egw_info']['flags']['currentapp'] = $old_app; + if($GLOBALS['egw_info']['server']['contact_export_limit'] && !$GLOBALS['egw_info']['user']['apps']['admin']) { + $selection = array_slice($selection, 0, $GLOBALS['egw_info']['server']['contact_export_limit']); + } if($options['explode_multiselects']) { $customfields = config::get_customfields('addressbook'); $additional_fields = array(); @@ -168,7 +178,6 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi } } - $export_object = new importexport_export_csv($_stream, (array)$options); $export_object->set_mapping($options['mapping']); // $options['selection'] is array of identifiers as this plugin doesn't