Set empty fields to '' instead of retaining their value (null or 0)

This commit is contained in:
Nathan Gray 2012-04-17 16:36:31 +00:00
parent dff86e4842
commit c200bfa403

View File

@ -302,6 +302,10 @@ class importexport_export_csv implements importexport_iface_export_record
$record->$name = lang($selects[$name][$record->$name]);
}
}
else
{
$record->$name = '';
}
}
foreach((array)$fields['links'] as $name) {
if($record->$name) {
@ -314,6 +318,10 @@ class importexport_export_csv implements importexport_iface_export_record
$record->$name = egw_link::title($links[$name], $record->$name);
}
}
else
{
$record->$name = '';
}
}
foreach((array)$fields['select-account'] as $name) {
// Compare against null to deal with empty arrays
@ -328,6 +336,10 @@ class importexport_export_csv implements importexport_iface_export_record
$record->$name = common::grab_owner_name($record->$name);
}
}
else
{
$record->$name = '';
}
}
foreach((array)$fields['select-bool'] as $name) {
if($record->$name != null) {
@ -339,11 +351,13 @@ class importexport_export_csv implements importexport_iface_export_record
if ($record->$name && !is_numeric($record->$name)) $record->$name = strtotime($record->$name); // Custom fields stored as string
if ($record->$name && is_numeric($record->$name)) $record->$name = date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'] . ' '.
($GLOBALS['egw_info']['user']['preferences']['common']['timeformat'] == '24' ? 'H:i:s' : 'h:i:s a'),$record->$name); // User date format
if (!$record->$name) $record->$name = '';
}
foreach((array)$fields['date'] as $name) {
//if ($record->$name) $record->$name = date('Y-m-d',$record->$name); // Standard date format
if ($record->$name && !is_numeric($record->$name)) $record->$name = strtotime($record->$name); // Custom fields stored as string
if ($record->$name && is_numeric($record->$name)) $record->$name = date($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'], $record->$name); // User date format
if (!$record->$name) $record->$name = '';
}
// Some custom methods for conversion
@ -360,6 +374,10 @@ class importexport_export_csv implements importexport_iface_export_record
}
$record->$name = implode(', ',$cats);
}
else
{
$record->$name = '';
}
}
}