Fix merging of custom fields with provided fields

This commit is contained in:
Nathan Gray 2010-11-19 15:55:08 +00:00
parent c3bdb4c416
commit d8f79014f8

View File

@ -177,6 +177,7 @@ class importexport_export_csv implements importexport_iface_export_record
public static function convert_parse_custom_fields($appname, &$selects = array(), &$links = array(), &$methods = array()) {
if(!$appname) return;
$fields = array();
$custom = config::get_customfields($appname);
foreach($custom as $name => $c_field) {
$name = '#' . $name;
@ -234,7 +235,7 @@ class importexport_export_csv implements importexport_iface_export_record
// Not quite a recursive merge, since only one level
foreach($fields as $type => &$list) {
if($c_fields[$type]) {
$list += $c_fields[$type];
$list = array_merge($c_fields[$type], $list);;
unset($c_fields[$type]);
}
}
@ -269,6 +270,11 @@ class importexport_export_csv implements importexport_iface_export_record
}
}
}
foreach((array)$fields['select-bool'] as $name) {
if($record->$name != null) {
$record->$name = $record->$name ? lang('Yes') : lang('No');
}
}
foreach((array)$fields['date-time'] as $name) {
//if ($record->$name) $record->$name = date('Y-m-d H:i:s',$record->$name); // Standard date format
if ($record->$name && is_numeric($record->$name)) $record->$name = date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ', '.