Import/export fixes

- Fix for missing floats by Jürgen Dlugi
- Fix broken timesheet export was always 0 results
This commit is contained in:
nathangray 2021-04-06 14:07:25 -06:00
parent e88c4edea2
commit aff06ec4cc
4 changed files with 17 additions and 11 deletions

View File

@ -244,6 +244,9 @@ class importexport_export_csv implements importexport_iface_export_record
foreach($custom as $name => $c_field) { foreach($custom as $name => $c_field) {
$name = '#' . $name; $name = '#' . $name;
switch($c_field['type']) { switch($c_field['type']) {
case 'float' :
$fields['float'][] = $name;
break;
case 'date': case 'date':
case 'date-time': case 'date-time':
if ($c_field['values']['format']) if ($c_field['values']['format'])
@ -296,13 +299,14 @@ class importexport_export_csv implements importexport_iface_export_record
} }
/** /**
* Convert system info into a format with a little more transferrable meaning * Convert system info into a format with a little more transferable meaning
* *
* Uses the static variable $types to convert various datatypes. * Uses the static variable $types to convert various datatypes.
* *
* @param record Record to be converted * @param importexport_iface_egw_record $record Record to be converted
* @parem fields List of field types => field names to be converted * @param string[] $fields List of field types => field names to be converted
* @param appname Current appname if you want to do custom fields too * @param string $appname Current appname if you want to do custom fields too
* @param array[] $selects Select box options
*/ */
public static function convert(importexport_iface_egw_record &$record, Array $fields = array(), $appname = null, $selects = array()) public static function convert(importexport_iface_egw_record &$record, Array $fields = array(), $appname = null, $selects = array())
{ {

View File

@ -24,12 +24,13 @@ class infolog_egw_record implements importexport_iface_egw_record
// Used in conversions // Used in conversions
static $types = array( static $types = array(
'flaot' => array('info_price'),
'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'), 'select' => array('info_type', 'info_status', 'info_priority', 'pl_id'),
'select-cat' => array('info_cat'), 'select-cat' => array('info_cat'),
'select-account' => array('info_owner','info_responsible','info_modifier'), 'select-account' => array('info_owner','info_responsible','info_modifier'),
'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'), 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','info_created'),
'links' => array('info_link_id'), 'links' => array('info_link_id'),
); );
/** /**
* constructor * constructor

View File

@ -26,6 +26,7 @@ class timesheet_egw_record implements importexport_iface_egw_record
// Used in conversions // Used in conversions
static $types = array( static $types = array(
'float' => array('ts_quantity','ts_unitprice'),
'select-account' => array('ts_owner','ts_modifier'), 'select-account' => array('ts_owner','ts_modifier'),
'date-time' => array('ts_start', 'ts_created', 'ts_modified'), 'date-time' => array('ts_start', 'ts_created', 'ts_modified'),
'select-cat' => array('cat_id'), 'select-cat' => array('cat_id'),

View File

@ -42,7 +42,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin
$query = Api\Cache::getSession(TIMESHEET_APP, 'index'); $query = Api\Cache::getSession(TIMESHEET_APP, 'index');
$query['num_rows'] = -1; // all records $query['num_rows'] = -1; // all records
$query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session $query['csv_export'] = true; // so get_rows method _can_ produce different content or not store state in the session
$this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's $this->ui->get_rrows($query,$selection,$readonlys,true); // true = only return the id's
} }
elseif($options['selection'] == 'all') elseif($options['selection'] == 'all')
{ {
@ -50,7 +50,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin
'num_rows' => -1, 'num_rows' => -1,
'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session 'csv_export' => true, // so get_rows method _can_ produce different content or not store state in the session
); );
$this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's $this->ui->get_rrows($query,$selection,$readonlys,true); // true = only return the id's
} }
else if($options['selection'] == 'filter') else if($options['selection'] == 'filter')
{ {
@ -78,7 +78,7 @@ class timesheet_export_csv implements importexport_iface_export_plugin
if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to']; if($value['to']) $query['col_filter'][] = "$field <= " . (int)$value['to'];
unset($query['col_filter'][$field]); unset($query['col_filter'][$field]);
} }
$this->ui->get_rows($query,$selection,$readonlys,true); // true = only return the id's $this->ui->get_rrows($query,$selection,$readonlys,true); // true = only return the id's
} }