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

This commit is contained in:
James Cole
2017-06-08 10:35:02 +02:00
parent 5c18794122
commit b48de98865
2 changed files with 7 additions and 0 deletions

View File

@@ -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);

View File

@@ -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()