From 34160da67a8ba76d41b6185b435f7ac3f72ef0b1 Mon Sep 17 00:00:00 2001 From: JC5 Date: Sun, 8 Feb 2026 07:15:58 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20release=20?= =?UTF-8?q?'develop'=20on=202026-02-08?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Model/Account/UpdatedExistingAccount.php | 3 +- .../Account/UpdatesAccountInformation.php | 105 +++++++++++------- .../Internal/Update/AccountUpdateService.php | 8 +- app/Support/Calendar/Calculator.php | 1 + app/Support/Export/ExportDataGenerator.php | 2 + .../Http/Controllers/PeriodOverview.php | 3 + .../Enrichments/AvailableBudgetEnrichment.php | 2 + .../Enrichments/BudgetLimitEnrichment.php | 1 + .../Enrichments/PiggyBankEnrichment.php | 2 + .../Enrichments/PiggyBankEventEnrichment.php | 2 + .../Enrichments/SubscriptionEnrichment.php | 1 + .../TransactionGroupEnrichment.php | 2 + .../JsonApi/Enrichments/WebhookEnrichment.php | 2 + changelog.md | 6 +- composer.lock | 28 ++--- config/firefly.php | 4 +- package-lock.json | 6 +- 17 files changed, 111 insertions(+), 67 deletions(-) diff --git a/app/Events/Model/Account/UpdatedExistingAccount.php b/app/Events/Model/Account/UpdatedExistingAccount.php index 07b04707a9..ee615c9ed8 100644 --- a/app/Events/Model/Account/UpdatedExistingAccount.php +++ b/app/Events/Model/Account/UpdatedExistingAccount.php @@ -36,6 +36,7 @@ class UpdatedExistingAccount extends Event * Create a new event instance. */ public function __construct( - public Account $account,public array $oldData + public Account $account, + public array $oldData ) {} } diff --git a/app/Listeners/Model/Account/UpdatesAccountInformation.php b/app/Listeners/Model/Account/UpdatesAccountInformation.php index 114282e1c0..0360e63644 100644 --- a/app/Listeners/Model/Account/UpdatesAccountInformation.php +++ b/app/Listeners/Model/Account/UpdatesAccountInformation.php @@ -40,48 +40,13 @@ use Illuminate\Support\Facades\Log; class UpdatesAccountInformation implements ShouldQueue { - public function handle(CreatedNewAccount | UpdatedExistingAccount $event): void + public function handle(CreatedNewAccount|UpdatedExistingAccount $event): void { $this->recalculateCredit($event->account); $this->updateVirtualBalance($event->account); if ($event instanceof UpdatedExistingAccount) { $this->renameRules($event->account, $event->oldData); } - - } - - private function correctRuleTriggers(Account $account, array $oldData, Rule $rule): void - { - $nameFields = ['source_account_is', 'source_account_contains', 'source_account_ends', 'source_account_starts', 'destination_account_is', 'destination_account_contains', 'destination_account_ends', 'destination_account_starts', 'account_is', 'account_contains', 'account_ends', 'account_starts',]; - $numberFields = ['source_account_nr_is', 'source_account_nr_contains', 'source_account_nr_ends', 'source_account_nr_starts', 'destination_account_nr_is', 'destination_account_nr_contains', 'destination_account_nr_starts', 'account_nr_is', 'account_nr_contains', 'account_nr_ends', 'account_nr_starts',]; - - Log::debug(sprintf('Check if rule #%d triggers reference account #%d "%s"', $rule->id, $account->id, $account->name)); - $fixed = 0; - /** @var RuleTrigger $trigger */ - foreach ($rule->ruleTriggers as $trigger) { - // fix name: - if ($oldData['name'] === $trigger->trigger_value && in_array($trigger->trigger_type, $nameFields, true)) { - Log::debug(sprintf('Rule trigger #%d "%s" has old account name, replace with new.', $trigger->id, $trigger->trigger_type)); - $trigger->trigger_value = $account->name; - $trigger->save(); - $fixed++; - } - // fix IBAN: - if ($oldData['iban'] === $trigger->trigger_value && in_array($trigger->trigger_type, $numberFields, true)) { - Log::debug(sprintf('Rule trigger #%d "%s" has old account IBAN, replace with new.', $trigger->id, $trigger->trigger_type)); - $trigger->trigger_value = $account->iban; - $trigger->save(); - $fixed++; - } - // fix account number: // account_number - if ($oldData['account_number'] === $trigger->trigger_value && in_array($trigger->trigger_type, $numberFields, true)) { - Log::debug(sprintf('Rule trigger #%d "%s" has old account account_number, replace with new.', $trigger->id, $trigger->trigger_type)); - $trigger->trigger_value = $account->iban; - $trigger->save(); - $fixed++; - } - } - Log::debug(sprintf('Corrected %d trigger(s) for rule #%d', $fixed, $rule->id)); } private function correctRuleActions(Account $account, array $oldData, Rule $rule): void @@ -89,21 +54,81 @@ class UpdatesAccountInformation implements ShouldQueue $fields = ['set_source_account', 'set_destination_account']; Log::debug(sprintf('Check if rule #%d actions reference account #%d "%s"', $rule->id, $account->id, $account->name)); - $fixed = 0; + $fixed = 0; + /** @var RuleAction $action */ foreach ($rule->ruleActions as $action) { - // fix name: if ($oldData['name'] === $action->action_value && in_array($action->action_type, $fields, true)) { Log::debug(sprintf('Rule action #%d "%s" has old account name, replace with new.', $action->id, $action->action_type)); $action->action_value = $account->name; $action->save(); - $fixed++; + ++$fixed; } } Log::debug(sprintf('Corrected %d action(s) for rule #%d', $fixed, $rule->id)); } + private function correctRuleTriggers(Account $account, array $oldData, Rule $rule): void + { + $nameFields = [ + 'source_account_is', + 'source_account_contains', + 'source_account_ends', + 'source_account_starts', + 'destination_account_is', + 'destination_account_contains', + 'destination_account_ends', + 'destination_account_starts', + 'account_is', + 'account_contains', + 'account_ends', + 'account_starts', + ]; + $numberFields = [ + 'source_account_nr_is', + 'source_account_nr_contains', + 'source_account_nr_ends', + 'source_account_nr_starts', + 'destination_account_nr_is', + 'destination_account_nr_contains', + 'destination_account_nr_starts', + 'account_nr_is', + 'account_nr_contains', + 'account_nr_ends', + 'account_nr_starts', + ]; + + Log::debug(sprintf('Check if rule #%d triggers reference account #%d "%s"', $rule->id, $account->id, $account->name)); + $fixed = 0; + + /** @var RuleTrigger $trigger */ + foreach ($rule->ruleTriggers as $trigger) { + // fix name: + if ($oldData['name'] === $trigger->trigger_value && in_array($trigger->trigger_type, $nameFields, true)) { + Log::debug(sprintf('Rule trigger #%d "%s" has old account name, replace with new.', $trigger->id, $trigger->trigger_type)); + $trigger->trigger_value = $account->name; + $trigger->save(); + ++$fixed; + } + // fix IBAN: + if ($oldData['iban'] === $trigger->trigger_value && in_array($trigger->trigger_type, $numberFields, true)) { + Log::debug(sprintf('Rule trigger #%d "%s" has old account IBAN, replace with new.', $trigger->id, $trigger->trigger_type)); + $trigger->trigger_value = $account->iban; + $trigger->save(); + ++$fixed; + } + // fix account number: // account_number + if ($oldData['account_number'] === $trigger->trigger_value && in_array($trigger->trigger_type, $numberFields, true)) { + Log::debug(sprintf('Rule trigger #%d "%s" has old account account_number, replace with new.', $trigger->id, $trigger->trigger_type)); + $trigger->trigger_value = $account->iban; + $trigger->save(); + ++$fixed; + } + } + Log::debug(sprintf('Corrected %d trigger(s) for rule #%d', $fixed, $rule->id)); + } + private function recalculateCredit(Account $account): void { Log::debug('Will call CreditRecalculateService because a new account was created or updated.'); @@ -119,7 +144,7 @@ class UpdatesAccountInformation implements ShouldQueue Log::debug('Updated account, will now correct rules.'); $repository = app(RuleRepositoryInterface::class); $repository->setUser($account->user); - $rules = $repository->getAll(); + $rules = $repository->getAll(); /** @var Rule $rule */ foreach ($rules as $rule) { diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index 3965f1e69b..2062e41c51 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -78,11 +78,11 @@ class AccountUpdateService { Log::debug(sprintf('Now in %s', __METHOD__)); $this->accountRepository->setUser($account->user); - $this->user = $account->user; - $oldData = $account->toArray(); + $this->user = $account->user; + $oldData = $account->toArray(); $oldData['account_number'] = $this->accountRepository->getMetaValue($account, 'account_number'); - $account = $this->updateAccount($account, $data); - $account = $this->updateAccountOrder($account, $data); + $account = $this->updateAccount($account, $data); + $account = $this->updateAccountOrder($account, $data); // find currency, or use default currency instead. if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) { diff --git a/app/Support/Calendar/Calculator.php b/app/Support/Calendar/Calculator.php index 314eb8d860..22f44896f0 100644 --- a/app/Support/Calendar/Calculator.php +++ b/app/Support/Calendar/Calculator.php @@ -42,6 +42,7 @@ class Calculator // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private static array $intervals = []; public function isAvailablePeriodicity(Periodicity $periodicity): bool diff --git a/app/Support/Export/ExportDataGenerator.php b/app/Support/Export/ExportDataGenerator.php index 2451538dc4..2491d10a9a 100644 --- a/app/Support/Export/ExportDataGenerator.php +++ b/app/Support/Export/ExportDataGenerator.php @@ -102,6 +102,8 @@ class ExportDataGenerator // @phpstan-ignore-line + // @phpstan-ignore-line + public function __construct() { $this->accounts = new Collection(); diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php index 8a93f36728..79a31d8c39 100644 --- a/app/Support/Http/Controllers/PeriodOverview.php +++ b/app/Support/Http/Controllers/PeriodOverview.php @@ -87,6 +87,7 @@ trait PeriodOverview // temp data holder // temp data holder // temp data holder + // temp data holder private array $transactions; // temp data holder // temp data holder @@ -101,6 +102,8 @@ trait PeriodOverview // temp data holder + // temp data holder + /** * This method returns "period entries", so nov-2015, dec-2015, etc. (this depends on the users session range) * and for each period, the amount of money spent and earned. This is a complex operation which is cached for diff --git a/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php b/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php index fc47cf80cc..d3c59a9b04 100644 --- a/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php +++ b/app/Support/JsonApi/Enrichments/AvailableBudgetEnrichment.php @@ -47,6 +47,7 @@ class AvailableBudgetEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private readonly bool $convertToPrimary; // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line @@ -54,6 +55,7 @@ class AvailableBudgetEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $currencies = []; private array $currencyIds = []; private array $ids = []; diff --git a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php index 809c39cd66..bb95269aa2 100644 --- a/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php +++ b/app/Support/JsonApi/Enrichments/BudgetLimitEnrichment.php @@ -47,6 +47,7 @@ class BudgetLimitEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $currencies = []; private array $currencyIds = []; private Carbon $end; diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php index 63cc45ae09..c411f02a80 100644 --- a/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php +++ b/app/Support/JsonApi/Enrichments/PiggyBankEnrichment.php @@ -49,6 +49,7 @@ class PiggyBankEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $accounts = []; // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line @@ -56,6 +57,7 @@ class PiggyBankEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $amounts = []; private Collection $collection; private array $currencies = []; diff --git a/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php b/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php index 653c12248b..f74b4b5fff 100644 --- a/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php +++ b/app/Support/JsonApi/Enrichments/PiggyBankEventEnrichment.php @@ -44,6 +44,7 @@ class PiggyBankEventEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $accountIds = []; // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line @@ -51,6 +52,7 @@ class PiggyBankEventEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private Collection $collection; private array $currencies = []; private array $groupIds = []; diff --git a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php index 1d8fcbe8f7..b57494bbad 100644 --- a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php +++ b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php @@ -53,6 +53,7 @@ class SubscriptionEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private readonly bool $convertToPrimary; private ?Carbon $end = null; private array $mappedObjects = []; diff --git a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php index 87a375119b..b497f8fec4 100644 --- a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php +++ b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php @@ -67,6 +67,8 @@ class TransactionGroupEnrichment implements EnrichmentInterface // @phpstan-ignore-line + // @phpstan-ignore-line + public function __construct() { $this->dateFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date']; diff --git a/app/Support/JsonApi/Enrichments/WebhookEnrichment.php b/app/Support/JsonApi/Enrichments/WebhookEnrichment.php index 6f6b7fa16d..9d01d1478e 100644 --- a/app/Support/JsonApi/Enrichments/WebhookEnrichment.php +++ b/app/Support/JsonApi/Enrichments/WebhookEnrichment.php @@ -49,6 +49,7 @@ class WebhookEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $ids = []; // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line @@ -56,6 +57,7 @@ class WebhookEnrichment implements EnrichmentInterface // @phpstan-ignore-line // @phpstan-ignore-line // @phpstan-ignore-line + // @phpstan-ignore-line private array $responses = []; private array $triggers = []; private array $webhookDeliveries = []; diff --git a/changelog.md b/changelog.md index b870e9111b..b0aeffa53b 100644 --- a/changelog.md +++ b/changelog.md @@ -6,9 +6,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## v6.4.18 ### Fixed -- #11671 -- #11667 -- #11668 +- [Discussion 11671](https://github.com/orgs/firefly-iii/discussions/11671) (Subscriptions Next Expected Match) started by @idgaron +- [Issue 11667](https://github.com/firefly-iii/firefly-iii/issues/11667) (Account names and numbers are not corrected in rules when the account is updated) reported by @Kage1 +- [Issue 11668](https://github.com/firefly-iii/firefly-iii/issues/11668) (Auto-budget cron crashes on develop: Call to a member function budgets() on null (BudgetLimitRepository.php:311)) reported by @sykmer ## v6.4.17 - 2026-02-06 diff --git a/composer.lock b/composer.lock index 70164b7b15..6aa378c6cf 100644 --- a/composer.lock +++ b/composer.lock @@ -130,16 +130,16 @@ }, { "name": "brick/math", - "version": "0.14.6", + "version": "0.14.7", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "32498d5e1897e7642c0b961ace2df6d7dc9a3bc3" + "reference": "07ff363b16ef8aca9692bba3be9e73fe63f34e50" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/32498d5e1897e7642c0b961ace2df6d7dc9a3bc3", - "reference": "32498d5e1897e7642c0b961ace2df6d7dc9a3bc3", + "url": "https://api.github.com/repos/brick/math/zipball/07ff363b16ef8aca9692bba3be9e73fe63f34e50", + "reference": "07ff363b16ef8aca9692bba3be9e73fe63f34e50", "shasum": "" }, "require": { @@ -178,7 +178,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.14.6" + "source": "https://github.com/brick/math/tree/0.14.7" }, "funding": [ { @@ -186,7 +186,7 @@ "type": "github" } ], - "time": "2026-02-05T07:59:58+00:00" + "time": "2026-02-07T10:57:35+00:00" }, { "name": "carbonphp/carbon-doctrine-types", @@ -3829,16 +3829,16 @@ }, { "name": "nette/schema", - "version": "v1.3.3", + "version": "v1.3.4", "source": { "type": "git", "url": "https://github.com/nette/schema.git", - "reference": "2befc2f42d7c715fd9d95efc31b1081e5d765004" + "reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/schema/zipball/2befc2f42d7c715fd9d95efc31b1081e5d765004", - "reference": "2befc2f42d7c715fd9d95efc31b1081e5d765004", + "url": "https://api.github.com/repos/nette/schema/zipball/086497a2f34b82fede9b5a41cc8e131d087cd8f7", + "reference": "086497a2f34b82fede9b5a41cc8e131d087cd8f7", "shasum": "" }, "require": { @@ -3846,8 +3846,8 @@ "php": "8.1 - 8.5" }, "require-dev": { - "nette/tester": "^2.5.2", - "phpstan/phpstan-nette": "^2.0@stable", + "nette/tester": "^2.6", + "phpstan/phpstan": "^2.0@stable", "tracy/tracy": "^2.8" }, "type": "library", @@ -3888,9 +3888,9 @@ ], "support": { "issues": "https://github.com/nette/schema/issues", - "source": "https://github.com/nette/schema/tree/v1.3.3" + "source": "https://github.com/nette/schema/tree/v1.3.4" }, - "time": "2025-10-30T22:57:59+00:00" + "time": "2026-02-08T02:54:00+00:00" }, { "name": "nette/utils", diff --git a/config/firefly.php b/config/firefly.php index 6139900f67..5393bf993f 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => '6.4.17', - 'build_time' => 1770447202, + 'version' => 'develop/2026-02-08', + 'build_time' => 1770531224, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. diff --git a/package-lock.json b/package-lock.json index c2c45b6eb8..f5e617b8ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3246,9 +3246,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "25.2.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.1.tgz", - "integrity": "sha512-CPrnr8voK8vC6eEtyRzvMpgp3VyVRhgclonE7qYi6P9sXwYb59ucfrnmFBTaP0yUi8Gk4yZg/LlTJULGxvTNsg==", + "version": "25.2.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.2.2.tgz", + "integrity": "sha512-BkmoP5/FhRYek5izySdkOneRyXYN35I860MFAGupTdebyE66uZaR+bXLHq8k4DirE5DwQi3NuhvRU1jqTVwUrQ==", "dev": true, "license": "MIT", "dependencies": {