Skip to content

Firefly III: a personal finances manager

Fix a bug where the balance routine forgot to account for accounts without a currency preference.

James Coleb48de98865cf
diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php
index c0af003e81..3771f913a8 100644
--- a/app/Http/Controllers/Chart/AccountController.php
+++ b/app/Http/Controllers/Chart/AccountController.php
@@ -127,6 +127,7 @@ class AccountController extends Controller
$chartData[$account->name] = $diff;
}
}
+
arsort($chartData);
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
$cache->store($data);
diff --git a/app/Support/Steam.php b/app/Support/Steam.php
index 398400e05b..7294b07bde 100644
--- a/app/Support/Steam.php
+++ b/app/Support/Steam.php
@@ -13,6 +13,7 @@ declare(strict_types=1);
namespace FireflyIII\Support;
+use Amount;
use Carbon\Carbon;
use Crypt;
use DB;
@@ -47,6 +48,11 @@ class Steam
return $cache->get(); // @codeCoverageIgnore
}
$currencyId = intval($account->getMeta('currency_id'));
+ // if null, use system default currency:
+ if ($currencyId === 0) {
+ $currency = Amount::getDefaultCurrency();
+ $currencyId = $currency->id;
+ }
// first part: get all balances in own currency:
$nativeBalance = strval(
$account->transactions()