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
static $types = array(
'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'),
'select-cat' => array('info_cat', 'cat_id'),
'links' => array('info_link_id'),

View File

@ -30,6 +30,12 @@ class infolog_export_csv implements importexport_iface_export_plugin {
$query = 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->set_mapping($options['mapping']);
@ -123,8 +129,15 @@ class infolog_export_csv implements importexport_iface_export_plugin {
}
// Some conversion
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);
// Force 0 times to ''
foreach(array('info_planned_time', 'info_used_time', 'info_replanned_time') as $field)
{
if($record->$field == 0) $record->$field = '';
}
} else {
// Implode arrays, so they don't say 'Array'
foreach($record->get_record_array() as $key => $value) {