Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
🤖 Auto commit for release 'develop' on 2025-08-07
JC5468c9c9d560a
diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.phpindex 9e1190e187..096ed01db7 100644--- a/app/Api/V1/Controllers/Summary/BasicController.php+++ b/app/Api/V1/Controllers/Summary/BasicController.php@@ -531,7 +531,7 @@ class BasicController extends Controller}unset($leftToSpend);if (0 === count($return)) {- $days = (int) $start->diffInDays($end, true) + 1;+ $days = (int) $start->diffInDays($end, true) + 1;// a small trick to get every expense in this period, regardless of budget.$spent = $this->opsRepository->sumExpenses($start, $end, null, new Collection());foreach ($spent as $row) {diff --git a/app/Http/Controllers/Report/BudgetController.php b/app/Http/Controllers/Report/BudgetController.phpindex a21fb4c3e3..2b26e16501 100644--- a/app/Http/Controllers/Report/BudgetController.php+++ b/app/Http/Controllers/Report/BudgetController.php@@ -307,9 +307,9 @@ class BudgetController extends Controllerforeach ($budget['transaction_journals'] as $journal) {// #10678// skip transactions between two asset / liability accounts.- if(- in_array($journal['source_account_type'], config('firefly.valid_currency_account_types')) &&- in_array($journal['destination_account_type'], config('firefly.valid_currency_account_types'))+ if (+ in_array($journal['source_account_type'], config('firefly.valid_currency_account_types'), true)+ && in_array($journal['destination_account_type'], config('firefly.valid_currency_account_types'), true)) {continue;}diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.phpindex fbb28afd1d..c1a162d8fc 100644--- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php+++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php@@ -53,24 +53,24 @@ use Override;*/class AccountEnrichment implements EnrichmentInterface{- private array $ids = [];- private array $accountTypeIds = [];- private array $accountTypes = [];+ private array $ids = [];+ private array $accountTypeIds = [];+ private array $accountTypes = [];private Collection $collection;- private array $currencies = [];- private array $locations = [];- private array $meta = [];+ private array $currencies = [];+ private array $locations = [];+ private array $meta = [];private TransactionCurrency $primaryCurrency;- private array $notes = [];+ private array $notes = [];private array $openingBalances = [];private User $user;private UserGroup $userGroup;- private array $lastActivities = [];- private ?Carbon $date = null;+ private array $lastActivities = [];+ private ?Carbon $date = null;private bool $convertToPrimary;- private array $balances = [];- private array $objectGroups = [];- private array $mappedObjects = [];+ private array $balances = [];+ private array $objectGroups = [];+ private array $mappedObjects = [];/*** TODO The account enricher must do conversion from and to the primary currency.@@ -138,9 +138,10 @@ class AccountEnrichment implements EnrichmentInterfaceprivate function collectMetaData(): void{- $set = AccountMeta::whereIn('name', ['is_multi_currency', 'include_net_worth', 'currency_id', 'account_role', 'account_number', 'BIC', 'liability_direction', 'interest', 'interest_period', 'current_debt'])- ->whereIn('account_id', $this->ids)- ->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data'])->toArray();+ $set = AccountMeta::whereIn('name', ['is_multi_currency', 'include_net_worth', 'currency_id', 'account_role', 'account_number', 'BIC', 'liability_direction', 'interest', 'interest_period', 'current_debt'])+ ->whereIn('account_id', $this->ids)+ ->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data'])->toArray()+ ;/** @var array $entry */foreach ($set as $entry) {@@ -166,9 +167,10 @@ class AccountEnrichment implements EnrichmentInterfaceprivate function collectNotes(): void{$notes = Note::query()->whereIn('noteable_id', $this->ids)- ->whereNotNull('notes.text')- ->where('notes.text', '!=', '')- ->where('noteable_type', Account::class)->get(['notes.noteable_id', 'notes.text'])->toArray();+ ->whereNotNull('notes.text')+ ->where('notes.text', '!=', '')+ ->where('noteable_type', Account::class)->get(['notes.noteable_id', 'notes.text'])->toArray()+ ;foreach ($notes as $note) {$this->notes[(int)$note['noteable_id']] = (string)$note['text'];}@@ -178,14 +180,15 @@ class AccountEnrichment implements EnrichmentInterfaceprivate function collectLocations(): void{$locations = Location::query()->whereIn('locatable_id', $this->ids)- ->where('locatable_type', Account::class)->get(['locations.locatable_id', 'locations.latitude', 'locations.longitude', 'locations.zoom_level'])->toArray();+ ->where('locatable_type', Account::class)->get(['locations.locatable_id', 'locations.latitude', 'locations.longitude', 'locations.zoom_level'])->toArray()+ ;foreach ($locations as $location) {$this->locations[(int)$location['locatable_id']]= [- 'latitude' => (float)$location['latitude'],- 'longitude' => (float)$location['longitude'],- 'zoom_level' => (int)$location['zoom_level'],- ];+ 'latitude' => (float)$location['latitude'],+ 'longitude' => (float)$location['longitude'],+ 'zoom_level' => (int)$location['zoom_level'],+ ];}Log::debug(sprintf('Enrich with %d locations(s)', count($this->locations)));}@@ -200,19 +203,20 @@ class AccountEnrichment implements EnrichmentInterface->setUserGroup($this->userGroup)->setAccounts($this->collection)->withAccountInformation()- ->setTypes([TransactionTypeEnum::OPENING_BALANCE->value]);- $journals = $collector->getExtractedJournals();+ ->setTypes([TransactionTypeEnum::OPENING_BALANCE->value])+ ;+ $journals = $collector->getExtractedJournals();foreach ($journals as $journal) {$this->openingBalances[(int)$journal['source_account_id']]= [- 'amount' => Steam::negative($journal['amount']),- 'date' => $journal['date'],- ];+ 'amount' => Steam::negative($journal['amount']),+ 'date' => $journal['date'],+ ];$this->openingBalances[(int)$journal['destination_account_id']]= [- 'amount' => Steam::positive($journal['amount']),- 'date' => $journal['date'],- ];+ 'amount' => Steam::positive($journal['amount']),+ 'date' => $journal['date'],+ ];}}@@ -279,28 +283,28 @@ class AccountEnrichment implements EnrichmentInterface// add balances// get currencies:- $currency = $this->primaryCurrency; // assume primary currency+ $currency = $this->primaryCurrency; // assume primary currencyif (null !== $meta['currency']) {$currency = $meta['currency'];}// get the current balance:- $date = $this->getDate();+ $date = $this->getDate();// $finalBalance = Steam::finalAccountBalance($item, $date, $this->primaryCurrency, $this->convertToPrimary);- $finalBalance = $this->balances[$id];+ $finalBalance = $this->balances[$id];Log::debug(sprintf('Call finalAccountBalance(%s) with date/time "%s"', var_export($this->convertToPrimary, true), $date->toIso8601String()), $finalBalance);// collect current balances:- $currentBalance = Steam::bcround($finalBalance[$currency->code] ?? '0', $currency->decimal_places);- $openingBalance = Steam::bcround($meta['opening_balance_amount'] ?? '0', $currency->decimal_places);- $virtualBalance = Steam::bcround($account->virtual_balance ?? '0', $currency->decimal_places);- $debtAmount = $meta['current_debt'] ?? null;+ $currentBalance = Steam::bcround($finalBalance[$currency->code] ?? '0', $currency->decimal_places);+ $openingBalance = Steam::bcround($meta['opening_balance_amount'] ?? '0', $currency->decimal_places);+ $virtualBalance = Steam::bcround($account->virtual_balance ?? '0', $currency->decimal_places);+ $debtAmount = $meta['current_debt'] ?? null;// set some pc_ default values to NULL:- $pcCurrentBalance = null;- $pcOpeningBalance = null;- $pcVirtualBalance = null;- $pcDebtAmount = null;+ $pcCurrentBalance = null;+ $pcOpeningBalance = null;+ $pcVirtualBalance = null;+ $pcDebtAmount = null;// convert to primary currency if needed:if ($this->convertToPrimary && $currency->id !== $this->primaryCurrency->id) {@@ -323,7 +327,7 @@ class AccountEnrichment implements EnrichmentInterface$openingBalance = null;$pcOpeningBalance = null;}- $meta['balances'] = [+ $meta['balances'] = ['current_balance' => $currentBalance,'pc_current_balance' => $pcCurrentBalance,'opening_balance' => $openingBalance,@@ -334,7 +338,7 @@ class AccountEnrichment implements EnrichmentInterface'pc_debt_amount' => $pcDebtAmount,];// end add balances- $item->meta = $meta;+ $item->meta = $meta;return $item;});@@ -352,12 +356,13 @@ class AccountEnrichment implements EnrichmentInterfaceprivate function collectObjectGroups(): void{- $set = DB::table('object_groupables')- ->whereIn('object_groupable_id', $this->ids)- ->where('object_groupable_type', Account::class)- ->get(['object_groupable_id', 'object_group_id']);+ $set = DB::table('object_groupables')+ ->whereIn('object_groupable_id', $this->ids)+ ->where('object_groupable_type', Account::class)+ ->get(['object_groupable_id', 'object_group_id'])+ ;- $ids = array_unique($set->pluck('object_group_id')->toArray());+ $ids = array_unique($set->pluck('object_group_id')->toArray());foreach ($set as $entry) {$this->mappedObjects[(int)$entry->object_groupable_id] = (int)$entry->object_group_id;diff --git a/app/Support/JsonApi/Enrichments/BudgetEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetEnrichment.phpindex e2dc09e041..5605d7f94a 100644--- a/app/Support/JsonApi/Enrichments/BudgetEnrichment.php+++ b/app/Support/JsonApi/Enrichments/BudgetEnrichment.php@@ -26,16 +26,16 @@ class BudgetEnrichment implements EnrichmentInterfaceprivate TransactionCurrency $primaryCurrency;private User $user;private UserGroup $userGroup;- private array $ids = [];- private array $notes = [];- private array $autoBudgets = [];- private array $currencies = [];- private ?Carbon $start = null;- private ?Carbon $end = null;- private array $spent = [];- private array $pcSpent = [];- private array $objectGroups = [];- private array $mappedObjects = [];+ private array $ids = [];+ private array $notes = [];+ private array $autoBudgets = [];+ private array $currencies = [];+ private ?Carbon $start = null;+ private ?Carbon $end = null;+ private array $spent = [];+ private array $pcSpent = [];+ private array $objectGroups = [];+ private array $mappedObjects = [];public function __construct(){@@ -89,9 +89,10 @@ class BudgetEnrichment implements EnrichmentInterfaceprivate function collectNotes(): void{$notes = Note::query()->whereIn('noteable_id', $this->ids)- ->whereNotNull('notes.text')- ->where('notes.text', '!=', '')- ->where('noteable_type', Budget::class)->get(['notes.noteable_id', 'notes.text'])->toArray();+ ->whereNotNull('notes.text')+ ->where('notes.text', '!=', '')+ ->where('noteable_type', Budget::class)->get(['notes.noteable_id', 'notes.text'])->toArray()+ ;foreach ($notes as $note) {$this->notes[(int)$note['noteable_id']] = (string)$note['text'];}@@ -101,8 +102,8 @@ class BudgetEnrichment implements EnrichmentInterfaceprivate function appendCollectedData(): void{$this->collection = $this->collection->map(function (Budget $item) {- $id = (int)$item->id;- $meta = [+ $id = (int)$item->id;+ $meta = ['object_group_id' => null,'object_group_order' => null,'object_group_title' => null,@@ -154,7 +155,7 @@ class BudgetEnrichment implements EnrichmentInterface$opsRepository->setUserGroup($this->userGroup);// $spent = $this->beautify();// $set = $this->opsRepository->sumExpenses($start, $end, null, new Collection([$budget]))- $expenses = $opsRepository->collectExpenses($this->start, $this->end, null, $this->collection, null);+ $expenses = $opsRepository->collectExpenses($this->start, $this->end, null, $this->collection, null);foreach ($this->collection as $item) {$id = (int)$item->id;$this->spent[$id] = array_values($opsRepository->sumCollectedExpensesByBudget($expenses, $item, false));@@ -175,12 +176,13 @@ class BudgetEnrichment implements EnrichmentInterfaceprivate function collectObjectGroups(): void{- $set = DB::table('object_groupables')- ->whereIn('object_groupable_id', $this->ids)- ->where('object_groupable_type', Budget::class)- ->get(['object_groupable_id', 'object_group_id']);+ $set = DB::table('object_groupables')+ ->whereIn('object_groupable_id', $this->ids)+ ->where('object_groupable_type', Budget::class)+ ->get(['object_groupable_id', 'object_group_id'])+ ;- $ids = array_unique($set->pluck('object_group_id')->toArray());+ $ids = array_unique($set->pluck('object_group_id')->toArray());foreach ($set as $entry) {$this->mappedObjects[(int)$entry->object_groupable_id] = (int)$entry->object_group_id;diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.phpindex 58593f321f..f4697394db 100644--- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php+++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php@@ -74,8 +74,8 @@ class BudgetLimitEnrichment implements EnrichmentInterfaceprivate function collectIds(): void{- $this->start = $this->collection->min('start_date');- $this->end = $this->collection->max('end_date');+ $this->start = $this->collection->min('start_date');+ $this->end = $this->collection->max('end_date');/** @var BudgetLimit $limit */foreach ($this->collection as $limit) {@@ -92,9 +92,10 @@ class BudgetLimitEnrichment implements EnrichmentInterfaceprivate function collectNotes(): void{$notes = Note::query()->whereIn('noteable_id', $this->ids)- ->whereNotNull('notes.text')- ->where('notes.text', '!=', '')- ->where('noteable_type', BudgetLimit::class)->get(['notes.noteable_id', 'notes.text'])->toArray();+ ->whereNotNull('notes.text')+ ->where('notes.text', '!=', '')+ ->where('noteable_type', BudgetLimit::class)->get(['notes.noteable_id', 'notes.text'])->toArray()+ ;foreach ($notes as $note) {$this->notes[(int)$note['noteable_id']] = (string)$note['text'];}@@ -126,9 +127,9 @@ class BudgetLimitEnrichment implements EnrichmentInterface$budgetIds = $this->collection->pluck('budget_id')->unique()->toArray();$this->budgets = Budget::whereIn('id', $budgetIds)->get();- $repository = app(OperationsRepository::class);+ $repository = app(OperationsRepository::class);$repository->setUser($this->user);- $expenses = $repository->collectExpenses($this->start, $this->end, null, $this->budgets, null);+ $expenses = $repository->collectExpenses($this->start, $this->end, null, $this->budgets, null);/** @var BudgetLimit $budgetLimit */foreach ($this->collection as $budgetLimit) {diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.phpindex 273acb1a4f..711ed7bd86 100644--- a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php+++ b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php@@ -25,15 +25,15 @@ class PiggyBankEnrichment implements EnrichmentInterfaceprivate User $user;private UserGroup $userGroup;private Collection $collection;- private array $ids = [];- private array $currencyIds = [];- private array $currencies = [];- private array $accountIds = [];- //private array $accountCurrencies = [];- private array $notes = [];- private array $mappedObjects = [];+ private array $ids = [];+ private array $currencyIds = [];+ private array $currencies = [];+ private array $accountIds = [];+ // private array $accountCurrencies = [];+ private array $notes = [];+ private array $mappedObjects = [];private TransactionCurrency $primaryCurrency;- private array $amounts = [];+ private array $amounts = [];public function __construct(){@@ -116,12 +116,12 @@ class PiggyBankEnrichment implements EnrichmentInterface/** @var AccountMeta $item */foreach ($set as $item) {- $accountId = (int)$item->account_id;- $currencyId = (int)$item->data;+ $accountId = (int)$item->account_id;+ $currencyId = (int)$item->data;if (!array_key_exists($currencyId, $this->currencies)) {$this->currencies[$currencyId] = TransactionCurrency::find($currencyId);}- //$this->accountCurrencies[$accountId] = $this->currencies[$currencyId];+ // $this->accountCurrencies[$accountId] = $this->currencies[$currencyId];}// get account info.diff --git a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php b/app/Support/JsonApi/Enrichments/RecurringEnrichment.phpindex 9a8284758f..beba7dde9b 100644--- a/app/Support/JsonApi/Enrichments/RecurringEnrichment.php+++ b/app/Support/JsonApi/Enrichments/RecurringEnrichment.php@@ -173,7 +173,7 @@ class RecurringEnrichment implements EnrichmentInterface$this->transactions[$id][$transactionId] = ['id' => (string)$transactionId,- //'recurrence_id' => $id,+ // 'recurrence_id' => $id,'transaction_currency_id' => (int)$transaction->transaction_currency_id,'foreign_currency_id' => null === $transaction->foreign_currency_id ? null : (int)$transaction->foreign_currency_id,'source_id' => (int)$transaction->source_id,diff --git a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.phpindex 5046e59e54..2d12ff5dbd 100644--- a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php+++ b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php@@ -28,14 +28,14 @@ class SubscriptionEnrichment implements EnrichmentInterfaceprivate UserGroup $userGroup;private Collection $collection;private bool $convertToPrimary;- private ?Carbon $start = null;- private ?Carbon $end = null;- private array $subscriptionIds = [];- private array $objectGroups = [];- private array $mappedObjects = [];- private array $paidDates = [];- private array $notes = [];- private array $payDates = [];+ private ?Carbon $start = null;+ private ?Carbon $end = null;+ private array $subscriptionIds = [];+ private array $objectGroups = [];+ private array $mappedObjects = [];+ private array $paidDates = [];+ private array $notes = [];+ private array $payDates = [];private TransactionCurrency $primaryCurrency;private BillDateCalculator $calculator;diff --git a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.phpindex ab776d94ce..0e552281a3 100644--- a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php+++ b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php@@ -48,11 +48,11 @@ class TransactionGroupEnrichment implements EnrichmentInterfaceprivate array $attachmentCount = [];private Collection $collection;private readonly array $dateFields;- private array $journalIds = [];- private array $locations = [];- private array $metaData = [];- private array $notes = [];- private array $tags = [];+ private array $journalIds = [];+ private array $locations = [];+ private array $metaData = [];+ private array $notes = [];+ private array $tags = [];private User $user;private readonly TransactionCurrency $primaryCurrency;private UserGroup $userGroup;diff --git a/app/Transformers/BudgetLimitTransformer.php b/app/Transformers/BudgetLimitTransformer.phpindex 9655110254..01786930c4 100644--- a/app/Transformers/BudgetLimitTransformer.php+++ b/app/Transformers/BudgetLimitTransformer.php@@ -73,6 +73,7 @@ class BudgetLimitTransformer extends AbstractTransformerif ($this->convertToPrimary && $currency->id !== $this->primaryCurrency->id) {$pcAmount = Steam::bcround($budgetLimit->native_amount, $this->primaryCurrency->decimal_places);}+return ['id' => (string)$budgetLimit->id,'created_at' => $budgetLimit->created_at->toAtomString(),diff --git a/composer.lock b/composer.lockindex a0f55ed84d..d268d4e3ad 100644--- a/composer.lock+++ b/composer.lock@@ -1879,16 +1879,16 @@},{"name": "laravel/framework",- "version": "v12.21.0",+ "version": "v12.22.0","source": {"type": "git","url": "https://github.com/laravel/framework.git",- "reference": "ac8c4e73bf1b5387b709f7736d41427e6af1c93b"+ "reference": "6ab00c913ef6ec6fad0bd506f7452c0bb9e792c3"},"dist": {"type": "zip",- "url": "https://api.github.com/repos/laravel/framework/zipball/ac8c4e73bf1b5387b709f7736d41427e6af1c93b",- "reference": "ac8c4e73bf1b5387b709f7736d41427e6af1c93b",+ "url": "https://api.github.com/repos/laravel/framework/zipball/6ab00c913ef6ec6fad0bd506f7452c0bb9e792c3",+ "reference": "6ab00c913ef6ec6fad0bd506f7452c0bb9e792c3","shasum": ""},"require": {@@ -2090,7 +2090,7 @@"issues": "https://github.com/laravel/framework/issues","source": "https://github.com/laravel/framework"},- "time": "2025-07-22T15:41:55+00:00"+ "time": "2025-08-07T13:49:53+00:00"},{"name": "laravel/passport",diff --git a/config/firefly.php b/config/firefly.phpindex 1dea5db7ad..bc74a0c710 100644--- a/config/firefly.php+++ b/config/firefly.php@@ -79,7 +79,7 @@ return [// see cer.php for exchange rates feature flag.],'version' => 'develop/2025-08-07',- 'build_time' => 1754540556,+ 'build_time' => 1754589772,'api_version' => '2.1.0', // field is no longer used.'db_version' => 26,diff --git a/package-lock.json b/package-lock.jsonindex b771d2b833..b2e9192369 100644--- a/package-lock.json+++ b/package-lock.json@@ -11524,9 +11524,9 @@}},"node_modules/vite": {- "version": "7.0.6",- "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.6.tgz",- "integrity": "sha512-MHFiOENNBd+Bd9uvc8GEsIzdkn1JxMmEeYX35tI3fv0sJBUTfW5tQsoaOwuY4KhBI09A3dUJ/DXf2yxPVPUceg==",+ "version": "7.1.0",+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.1.0.tgz",+ "integrity": "sha512-3jdAy3NhBJYsa/lCFcnRfbK4kNkO/bhijFCnv5ByUQk/eekYagoV2yQSISUrhpV+5JiY5hmwOh7jNnQ68dFMuQ==","dev": true,"license": "MIT","dependencies": {@@ -11534,7 +11534,7 @@"fdir": "^6.4.6","picomatch": "^4.0.3","postcss": "^8.5.6",- "rollup": "^4.40.0",+ "rollup": "^4.43.0","tinyglobby": "^0.2.14"},"bin": {