Fix selection choice default

This commit is contained in:
Nathan Gray 2013-01-23 17:44:03 +00:00
parent 36e0b275c3
commit 31d717643c
2 changed files with 17 additions and 3 deletions

View File

@ -212,6 +212,11 @@ class importexport_export_ui {
} }
else else
{ {
if($definition->filter)
{
$content['selection'] = 'filter';
}
// Process relative dates into the current absolute date // Process relative dates into the current absolute date
foreach($content['filter']['fields'] as $field => $settings) foreach($content['filter']['fields'] as $field => $settings)
{ {
@ -235,15 +240,20 @@ class importexport_export_ui {
\$j('div.filters').hide(); \$j('div.filters').hide();
"); ");
} }
$preserv['old_definition'] = $content['definition']; $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]) && 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']; $selection = $content['selection'];
$content = array_merge_recursive($content,$prefs); $content = array_merge_recursive($content,$prefs);
$content['selection'] = $prefs['selection'] ? $prefs['selection'] : $selection; $content['selection'] = $prefs['selection'] ? $prefs['selection'] : $selection;
} }
if(!$content['selection'])
{
$content['selection'] = 'search';
}
unset ($plugin_object); unset ($plugin_object);
$apps = importexport_helper_functions::get_apps('export'); $apps = importexport_helper_functions::get_apps('export');
//error_log(__METHOD__.__LINE__.array2string($apps)); //error_log(__METHOD__.__LINE__.array2string($apps));

View File

@ -580,7 +580,11 @@ class importexport_helper_functions {
} }
// Get field -> label map and initialize fields using wizard field order // 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) foreach($record_classname::$types as $type => $type_fields)
{ {