From 31d717643c49fb8fecccb67d30d12ff6bc385afe Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Wed, 23 Jan 2013 17:44:03 +0000 Subject: [PATCH] Fix selection choice default --- .../inc/class.importexport_export_ui.inc.php | 14 ++++++++++++-- .../class.importexport_helper_functions.inc.php | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/importexport/inc/class.importexport_export_ui.inc.php b/importexport/inc/class.importexport_export_ui.inc.php index 07cb6fde8d..07bc1045f6 100644 --- a/importexport/inc/class.importexport_export_ui.inc.php +++ b/importexport/inc/class.importexport_export_ui.inc.php @@ -212,6 +212,11 @@ class importexport_export_ui { } else { + if($definition->filter) + { + $content['selection'] = 'filter'; + } + // Process relative dates into the current absolute date foreach($content['filter']['fields'] as $field => $settings) { @@ -235,15 +240,20 @@ class importexport_export_ui { \$j('div.filters').hide(); "); } - $preserv['old_definition'] = $content['definition']; + + // If not set by plugin, pre-set selection to preference, or 'search' if (($prefs = $GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]) && - ($prefs = unserialize($prefs)) && is_array($content['selection']) && !$content['selection']['plugin_override']) + ($prefs = unserialize($prefs)) && !$content['selection']['plugin_override']) { $selection = $content['selection']; $content = array_merge_recursive($content,$prefs); $content['selection'] = $prefs['selection'] ? $prefs['selection'] : $selection; } + if(!$content['selection']) + { + $content['selection'] = 'search'; + } unset ($plugin_object); $apps = importexport_helper_functions::get_apps('export'); //error_log(__METHOD__.__LINE__.array2string($apps)); diff --git a/importexport/inc/class.importexport_helper_functions.inc.php b/importexport/inc/class.importexport_helper_functions.inc.php index 0244e70ce8..615c23996e 100755 --- a/importexport/inc/class.importexport_helper_functions.inc.php +++ b/importexport/inc/class.importexport_helper_functions.inc.php @@ -580,7 +580,11 @@ class importexport_helper_functions { } // Get field -> label map and initialize fields using wizard field order - $fields = $export_fields = $wizard_plugin->get_export_fields(); + $fields = $export_fields = array(); + if(method_exists($wizard_plugin, 'get_export_fields')) + { + $fields = $export_fields = $wizard_plugin->get_export_fields(); + } foreach($record_classname::$types as $type => $type_fields) {