Stop using a preference for selection default. If the definition has a filter set, use filter, otherwise default to search results

This commit is contained in:
Nathan Gray 2013-01-24 17:24:04 +00:00
parent 2b952c0157
commit 8a3f81c77c

View File

@ -212,11 +212,6 @@ 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,13 +230,10 @@ class importexport_export_ui {
$preserv['old_definition'] = $content['definition']; $preserv['old_definition'] = $content['definition'];
// If not set by plugin, pre-set selection to preference, or 'search' // If not set by plugin, pre-set selection to filter if definition has one, or 'search'
if (($prefs = $GLOBALS['egw_info']['user']['preferences']['importexport'][$definition->definition_id]) && if (!$content['selection'] && $definition->filter)
($prefs = unserialize($prefs)) && !$content['selection']['plugin_override'])
{ {
$selection = $content['selection']; $content['selection'] = 'filter';
$content = array_merge_recursive($content,$prefs);
$content['selection'] = $prefs['selection'] ? $prefs['selection'] : $selection;
} }
if(!$content['selection']) if(!$content['selection'])
{ {
@ -366,12 +358,6 @@ class importexport_export_ui {
} }
} }
// Keep settings
$keep = array_diff_key($_content, array_flip(array('appname', 'definition', 'plugin', 'preview', 'export', $tabs)));
$GLOBALS['egw']->preferences->add('importexport',$definition->definition_id,serialize($keep));
// save prefs, but do NOT invalid the cache (unnecessary)
$GLOBALS['egw']->preferences->save_repository(false,'user',false);
// Store charset to use in header // Store charset to use in header
egw_cache::setSession('importexport', $tmpfname, $charset, 100); egw_cache::setSession('importexport', $tmpfname, $charset, 100);