From f031b3dde226ed0990e70100a66bce6e43c3ac09 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 21 Mar 2011 16:19:52 +0000 Subject: [PATCH] Set default export definition --- timesheet/inc/class.timesheet_hooks.inc.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/timesheet/inc/class.timesheet_hooks.inc.php b/timesheet/inc/class.timesheet_hooks.inc.php index 76c347cada..affe2916cb 100644 --- a/timesheet/inc/class.timesheet_hooks.inc.php +++ b/timesheet/inc/class.timesheet_hooks.inc.php @@ -200,18 +200,24 @@ class timesheet_hooks 'application' => 'timesheet' )); $options = array(); - foreach ((array)$definitions->get_definitions() as $identifier) { - try { + foreach ((array)$definitions->get_definitions() as $identifier) + { + try + { $definition = new importexport_definition($identifier); - } catch (Exception $e) { + } + catch (Exception $e) + { // permission error continue; } - if ($title = $definition->get_title()) { + if ($title = $definition->get_title()) + { $options[$title] = $title; } unset($definition); } + $default_def = 'export-timesheet'; $settings['nextmatch-export-definition'] = array( 'type' => 'select', 'values' => $options, @@ -221,6 +227,7 @@ class timesheet_hooks 'run_lang' => false, 'xmlrpc' => True, 'admin' => False, + 'default'=> isset($options[$default_def]) ? $default_def : false, ); }