Move field types to egw_record, use them in human friendly conversions when exporting and importing

This commit is contained in:
Nathan Gray 2011-04-04 17:01:17 +00:00
parent cd5bcab6b6
commit 1777dbcf2a
3 changed files with 12 additions and 10 deletions

View File

@ -22,6 +22,15 @@ class timesheet_egw_record implements importexport_iface_egw_record
private $timesheetentry = array();
private $botimesheet;
// Used in conversions
static $types = array(
'select-account' => array('ts_owner','ts_modifier'),
'date-time' => array('ts_start', 'ts_modified'),
'select-cat' => array('cat_id'),
'links' => array('pl_id'),
'select' => array('ts_status'),
);
/**

View File

@ -16,15 +16,6 @@
*/
class timesheet_export_csv implements importexport_iface_export_plugin {
// Used in conversions
static $types = array(
'select-account' => array('ts_owner','ts_modifier'),
'date-time' => array('ts_start', 'ts_modified'),
'select-cat' => array('cat_id'),
'links' => array('pl_id'),
'select' => array('ts_status'),
);
/**
* Exports records as defined in $_definition
*
@ -62,7 +53,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin {
foreach ($selection as $identifier) {
$record = new timesheet_egw_record($identifier);
if($options['convert']) {
importexport_export_csv::convert($record, self::$types, 'timesheet', $lookups);
importexport_export_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $lookups);
} else {
// Implode arrays, so they don't say 'Array'
foreach($record->get_record_array() as $key => $value) {

View File

@ -163,6 +163,8 @@ class timesheet_import_csv implements importexport_iface_import_plugin {
// don't import empty records
if( count( array_unique( $record ) ) < 2 ) continue;
importexport_import_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $lookups);
// Date / time
$record['ts_start'] = strtotime($record['ts_start']);