Standardize file names and fixed aging report export

This commit is contained in:
Hillel Coren 2017-04-28 12:23:56 +03:00
parent 44e7f9abbb
commit 3d95f6b8b0
3 changed files with 8 additions and 5 deletions

View File

@ -37,7 +37,7 @@ class ExportController extends BaseController
// set the filename based on the entity types selected
if ($request->include == 'all') {
$fileName = "invoice-ninja-{$date}";
$fileName = "{$date}-invoiceninja";
} else {
$fields = $request->all();
$fields = array_filter(array_map(function ($key) {
@ -47,7 +47,7 @@ class ExportController extends BaseController
return null;
}
}, array_keys($fields), $fields));
$fileName = 'invoice-ninja-' . implode('-', $fields) . "-{$date}";
$fileName = $date. '-invoiceninja-' . implode('-', $fields);
}
if ($format === 'JSON') {

View File

@ -129,11 +129,14 @@ class ReportController extends BaseController
}
$output = fopen('php://output', 'w') or Utils::fatalError();
$reportType = trans("texts.{$reportType}s");
$date = date('Y-m-d');
$columns = array_map(function($key, $val) {
return is_array($val) ? $key : $val;
}, array_keys($columns), $columns);
header('Content-Type:application/csv');
header("Content-Disposition:attachment;filename={$date}_Ninja_{$reportType}.csv");
header("Content-Disposition:attachment;filename={$date}-invoiceninja-{$reportType}-report.csv");
Utils::exportData($output, $data, Utils::trans($columns));

View File

@ -1248,5 +1248,5 @@ class Utils
$contents = fread($handle, 32);
fclose($handle);
return( ord($contents[28]) != 0 );
}
}
}