Human value lookups for priority, type & status

This commit is contained in:
Nathan Gray 2012-04-17 16:37:38 +00:00
parent c200bfa403
commit c59c0fe22f
2 changed files with 15 additions and 1 deletions

View File

@ -25,6 +25,7 @@ class infolog_egw_record implements importexport_iface_egw_record
// Used in conversions // Used in conversions
static $types = array( static $types = array(
'select-account' => array('info_owner','info_responsible','modifier'), 'select-account' => array('info_owner','info_responsible','modifier'),
'select' => array('info_priority', 'info_type', 'info_status'),
'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','created','last_event','next_event'), 'date-time' => array('info_startdate', 'info_enddate','info_datecompleted', 'info_datemodified','created','last_event','next_event'),
'select-cat' => array('info_cat', 'cat_id'), 'select-cat' => array('info_cat', 'cat_id'),
'links' => array('info_link_id'), 'links' => array('info_link_id'),

View File

@ -30,6 +30,12 @@ class infolog_export_csv implements importexport_iface_export_plugin {
$query = array(); $query = array();
$cf_links = array(); $cf_links = array();
if(!$this->selects)
{
$this->selects['info_type'] = $bo->enums['type'];
$this->selects['info_priority'] = $bo->enums['priority'];
}
$export_object = new importexport_export_csv($_stream, (array)$options); $export_object = new importexport_export_csv($_stream, (array)$options);
$export_object->set_mapping($options['mapping']); $export_object->set_mapping($options['mapping']);
@ -123,8 +129,15 @@ class infolog_export_csv implements importexport_iface_export_plugin {
} }
// Some conversion // Some conversion
if($options['convert']) { if($options['convert']) {
importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog'); $this->selects['info_status'] = $bo->status[$record->info_type];
importexport_export_csv::convert($record, infolog_egw_record::$types, 'infolog', $this->selects);
$this->convert($record); $this->convert($record);
// Force 0 times to ''
foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field)
{
if($record->$field == 0) $record->$field = '';
}
} 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) {