Fix ExportReportResults (#3506)

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
This commit is contained in:
Kristian Feldsam 2020-03-24 09:51:11 +01:00 committed by GitHub
parent bfd13719c9
commit 5f5a1a6740
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -65,7 +65,17 @@ class ExportReportResults extends Job
foreach ($totals as $currencyId => $each) {
foreach ($each as $dimension => $val) {
$tmp = [];
$tmp[] = Utils::getFromCache($currencyId, 'currencies')->name . (($dimension) ? ' - ' . $dimension : '');
$currency = Utils::getFromCache($currencyId, 'currencies');
if (!$currency) {
$name = $currencyId;
$account = $this->user->account->first();
$currencyId = $account->currency_id;
} else {
$name = $currency->name;
}
$tmp[] = $dimension ? $name . ' - ' . $dimension : $name;
foreach ($val as $field => $value) {
if ($field == 'duration') {
$tmp[] = Utils::formatTime($value);