Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Fix some code and add a changelog.
James Cole5a638ba02e7d
diff --git a/app/Api/V1/Controllers/Chart/AccountController.php b/app/Api/V1/Controllers/Chart/AccountController.phpindex 4d6714e651..09c3aaff2e 100644--- a/app/Api/V1/Controllers/Chart/AccountController.php+++ b/app/Api/V1/Controllers/Chart/AccountController.php@@ -24,6 +24,7 @@ declare(strict_types=1);namespace FireflyIII\Api\V1\Controllers\Chart;+use Carbon\Carbon;use FireflyIII\Api\V1\Controllers\Controller;use FireflyIII\Api\V1\Requests\Chart\ChartRequest;use FireflyIII\Enums\UserRoleEnum;@@ -51,7 +52,7 @@ class AccountController extends Controllerprotected array $acceptedRoles = [UserRoleEnum::READ_ONLY];- private array $chartData = [];+ private array $chartData = [];private AccountRepositoryInterface $repository;/**@@ -99,28 +100,28 @@ class AccountController extends Controllerprivate function renderAccountData(array $params, Account $account): void{Log::debug(sprintf('Now in %s(array, #%d)', __METHOD__, $account->id));- $currency = $this->repository->getAccountCurrency($account);- $currentStart = clone $params['start'];- $range = Steam::finalAccountBalanceInRange($account, $params['start'], clone $params['end'], $this->convertToPrimary);- $period = $params['period'] ?? '1D';+ $currency = $this->repository->getAccountCurrency($account);+ $currentStart = clone $params['start'];+ $range = Steam::finalAccountBalanceInRange($account, $params['start'], clone $params['end'], $this->convertToPrimary);+ $period = $params['period'] ?? '1D';- $previous = array_values($range)[0]['balance'];- $pcPrevious = null;+ $previous = array_values($range)[0]['balance'];+ $pcPrevious = null;if (!$currency instanceof TransactionCurrency) {$currency = $this->primaryCurrency;}- $currentSet = [+ $currentSet = ['label' => $account->name,// the currency that belongs to the account.- 'currency_id' => (string) $currency->id,+ 'currency_id' => (string)$currency->id,'currency_name' => $currency->name,'currency_code' => $currency->code,'currency_symbol' => $currency->symbol,'currency_decimal_places' => $currency->decimal_places,// the primary currency- 'primary_currency_id' => (string) $this->primaryCurrency->id,+ 'primary_currency_id' => (string)$this->primaryCurrency->id,// the default currency of the user (could be the same!)'date' => $params['start']->toAtomString(),@@ -134,7 +135,7 @@ class AccountController extends Controller];if ($this->convertToPrimary) {$currentSet['pc_entries'] = [];- $currentSet['primary_currency_id'] = (string) $this->primaryCurrency->id;+ $currentSet['primary_currency_id'] = (string)$this->primaryCurrency->id;$currentSet['primary_currency_code'] = $this->primaryCurrency->code;$currentSet['primary_currency_symbol'] = $this->primaryCurrency->symbol;$currentSet['primary_currency_decimal_places'] = $this->primaryCurrency->decimal_places;@@ -142,25 +143,24 @@ class AccountController extends Controller}// create array of values to collect.- $rangeDates = array_keys($range);+ $rangeDates = array_map(static fn(string $d): Carbon => Carbon::createFromFormat('Y-m-d', $d)->startOfDay(), array_keys($range));+ $rangeVals = array_values($range);$rangeIdx = 0;$rangeCount = count($rangeDates);while ($currentStart <= $params['end']) {- $format = $currentStart->format('Y-m-d');- $label = $currentStart->toAtomString();+ $label = $currentStart->toAtomString();// Advance through all range entries up to current chart date- while ($rangeIdx < $rangeCount && $rangeDates[$rangeIdx] <= $format) {- $previous = $range[$rangeDates[$rangeIdx]]['balance'];+ while ($rangeIdx < $rangeCount && $rangeDates[$rangeIdx] <= $currentStart) {+ $previous = $rangeVals[$rangeIdx]['balance'];if ($this->convertToPrimary) {- $pcPrevious = $range[$rangeDates[$rangeIdx]]['pc_balance'];+ $pcPrevious = $rangeVals[$rangeIdx]['pc_balance'];}++$rangeIdx;}$currentSet['entries'][$label] = $previous;- $pcBalance = null;if ($this->convertToPrimary) {$currentSet['pc_entries'][$label] = $pcPrevious;}diff --git a/app/Support/Steam.php b/app/Support/Steam.phpindex 5326d6ccf1..eaca150b46 100644--- a/app/Support/Steam.php+++ b/app/Support/Steam.php@@ -436,7 +436,7 @@ class Steamif ($cache->has()) {Log::debug('Return cached finalAccountBalanceInRange');- // return $cache->get();+ return $cache->get();}$balances = [];diff --git a/changelog.md b/changelog.mdindex 8b57e2a43d..64e80c09c8 100644--- a/changelog.md+++ b/changelog.md@@ -23,6 +23,7 @@ And yes, despite my goal not to change things, some very clever users (that's yo### Fixed- [Discussion 11685](https://github.com/orgs/firefly-iii/discussions/11685) (Yearly budget best practices) started by @molnarti- [Issue 11778](https://github.com/firefly-iii/firefly-iii/issues/11778) (API update rule trigger only accepts "store-journal") reported by @jhns-de+- #11785- Test notification was broken for system owners.## v6.4.23 - 2026-02-20