Fixed problems with export audit log to csv when no data to show

This commit is contained in:
m-lopez-f 2015-01-30 11:41:52 +01:00
parent fea686dfc5
commit 626a3b5527

View File

@ -2230,11 +2230,16 @@ function print_audit_csv ($data) {
header("Pragma: no-cache"); header("Pragma: no-cache");
header("Expires: 0"); header("Expires: 0");
if ($data){
echo __('User') . ';' . __('Action') . ';' . __('Date') . ';' . __('Source ID') . ';'. __('Comments') ."\n"; echo __('User') . ';' . __('Action') . ';' . __('Date') . ';' . __('Source ID') . ';'. __('Comments') ."\n";
foreach ($data as $line) { foreach ($data as $line) {
echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n"; echo io_safe_output($line['id_usuario']) . ';' . io_safe_output($line['accion']) . ';' . $line['fecha'] . ';' . $line['ip_origen'] . ';'. io_safe_output($line['descripcion']). "\n";
} }
} }
else{
echo __('No data found to export');
}
}
/** /**
* Validate the code given to surpass the 2 step authentication * Validate the code given to surpass the 2 step authentication