Skip to content

Firefly III: a personal finances manager

Fix bug that occurs when the transaction journal does not have the field "transaction_currency_code"

James Cole6ad10f177275
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 '<span style="color:#999">' . $result . '</span>'; // always grey.