Set default export definition

This commit is contained in:
Nathan Gray 2011-03-21 16:19:52 +00:00
parent 1b1a142d50
commit f031b3dde2

View File

@ -200,18 +200,24 @@ class timesheet_hooks
'application' => 'timesheet' 'application' => 'timesheet'
)); ));
$options = array(); $options = array();
foreach ((array)$definitions->get_definitions() as $identifier) { foreach ((array)$definitions->get_definitions() as $identifier)
try { {
try
{
$definition = new importexport_definition($identifier); $definition = new importexport_definition($identifier);
} catch (Exception $e) { }
catch (Exception $e)
{
// permission error // permission error
continue; continue;
} }
if ($title = $definition->get_title()) { if ($title = $definition->get_title())
{
$options[$title] = $title; $options[$title] = $title;
} }
unset($definition); unset($definition);
} }
$default_def = 'export-timesheet';
$settings['nextmatch-export-definition'] = array( $settings['nextmatch-export-definition'] = array(
'type' => 'select', 'type' => 'select',
'values' => $options, 'values' => $options,
@ -221,6 +227,7 @@ class timesheet_hooks
'run_lang' => false, 'run_lang' => false,
'xmlrpc' => True, 'xmlrpc' => True,
'admin' => False, 'admin' => False,
'default'=> isset($options[$default_def]) ? $default_def : false,
); );
} }