forked from extern/egroupware
Move field types to egw_record, use them in human friendly conversions when exporting and importing
This commit is contained in:
parent
cd5bcab6b6
commit
1777dbcf2a
@ -22,6 +22,15 @@ class timesheet_egw_record implements importexport_iface_egw_record
|
|||||||
private $timesheetentry = array();
|
private $timesheetentry = array();
|
||||||
private $botimesheet;
|
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'),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,15 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
class timesheet_export_csv implements importexport_iface_export_plugin {
|
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
|
* Exports records as defined in $_definition
|
||||||
*
|
*
|
||||||
@ -62,7 +53,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin {
|
|||||||
foreach ($selection as $identifier) {
|
foreach ($selection as $identifier) {
|
||||||
$record = new timesheet_egw_record($identifier);
|
$record = new timesheet_egw_record($identifier);
|
||||||
if($options['convert']) {
|
if($options['convert']) {
|
||||||
importexport_export_csv::convert($record, self::$types, 'timesheet', $lookups);
|
importexport_export_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $lookups);
|
||||||
} else {
|
} else {
|
||||||
// Implode arrays, so they don't say 'Array'
|
// Implode arrays, so they don't say 'Array'
|
||||||
foreach($record->get_record_array() as $key => $value) {
|
foreach($record->get_record_array() as $key => $value) {
|
||||||
|
@ -163,6 +163,8 @@ class timesheet_import_csv implements importexport_iface_import_plugin {
|
|||||||
// don't import empty records
|
// don't import empty records
|
||||||
if( count( array_unique( $record ) ) < 2 ) continue;
|
if( count( array_unique( $record ) ) < 2 ) continue;
|
||||||
|
|
||||||
|
importexport_import_csv::convert($record, timesheet_egw_record::$types, 'timesheet', $lookups);
|
||||||
|
|
||||||
// Date / time
|
// Date / time
|
||||||
$record['ts_start'] = strtotime($record['ts_start']);
|
$record['ts_start'] = strtotime($record['ts_start']);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user