From 6ad10f1772757582227df9b27e42c6e548e46292 Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 7 Mar 2016 19:52:59 +0100 Subject: [PATCH] Fix bug that occurs when the transaction journal does not have the field "transaction_currency_code" --- app/Support/Amount.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Support/Amount.php b/app/Support/Amount.php index ad4b63b61e..2fa746dbb1 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -75,8 +75,9 @@ class Amount if ($journal->isWithdrawal()) { $float = floatval($journal->source_amount); } - $formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY); - $result = $formatter->formatCurrency($float, $journal->transaction_currency_code); + $formatter = new NumberFormatter($locale, NumberFormatter::CURRENCY); + $currencyCode = $journal->transaction_currency_code ?? $journal->transactionCurrency->code; + $result = $formatter->formatCurrency($float, $currencyCode); if ($coloured === true && $float == 0) { return '' . $result . ''; // always grey.