Compare commits

...

7 Commits

Author SHA1 Message Date
github-actions[bot]
c5706e95b7 Merge pull request #12048 from firefly-iii/release-1774809887
🤖 Automatically merge the PR into the develop branch.
2026-03-29 20:44:53 +02:00
JC5
fdabb2c994 🤖 Auto commit for release 'develop' on 2026-03-29 2026-03-29 20:44:47 +02:00
James Cole
615fa733e6 Add extra debug. 2026-03-29 20:39:23 +02:00
github-actions[bot]
d3fc8673d3 Merge pull request #12047 from firefly-iii/release-1774809181
🤖 Automatically merge the PR into the develop branch.
2026-03-29 20:33:10 +02:00
JC5
db156ffcf2 🤖 Auto commit for release 'develop' on 2026-03-29 2026-03-29 20:33:01 +02:00
James Cole
59510a9acc Catch big group correction that does not need a balance correction. 2026-03-29 20:27:08 +02:00
James Cole
7f9640087e Fix https://github.com/firefly-iii/firefly-iii/issues/12043 2026-03-29 16:53:55 +02:00
6 changed files with 32 additions and 18 deletions

View File

@@ -61,6 +61,7 @@ class CorrectsGroupAccounts extends Command
$flags->applyRules = false;
$flags->fireWebhooks = false;
$flags->recalculateCredit = true;
$flags->unifyOnly = true;
$objects = new TransactionGroupEventObjects();
foreach ($groups as $groupId) {
$group = TransactionGroup::find($groupId);

View File

@@ -30,4 +30,5 @@ class TransactionGroupEventFlags
public bool $fireWebhooks = true;
public bool $batchSubmission = false;
public bool $recalculateCredit = true;
public bool $unifyOnly = false;
}

View File

@@ -40,8 +40,8 @@ class ProcessesUpdatedTransactionGroup
public function handle(UpdatedSingleTransactionGroup $event): void
{
Log::debug(sprintf('Now handling event %s', get_class($event)));
$this->unifyAccounts($event);
$effect = $this->unifyAccounts($event);
Log::debug(sprintf('Effect of unifyAccounts = %d', $effect));
Log::debug(sprintf('Transaction journal count is %d', $event->objects->transactionJournals->count()));
if (!$event->flags->applyRules) {
Log::debug(sprintf('Will NOT process rules for %d journal(s)', $event->objects->transactionJournals->count()));
@@ -63,7 +63,13 @@ class ProcessesUpdatedTransactionGroup
$this->createWebhookMessages($event->objects->transactionGroups, WebhookTrigger::UPDATE_TRANSACTION);
}
$this->removePeriodStatistics($event->objects);
$this->recalculateRunningBalance($event->objects);
if (0 === $effect && true === $event->flags->unifyOnly) {
Log::debug('Effect = 0, will not recalculate running balance.');
}
if (0 !== $effect || false === $event->flags->unifyOnly) {
Log::debug(sprintf('Effect is != 0 (%d) OR unifyOnly = false, will recalc running balance', $effect));
$this->recalculateRunningBalance($event->objects);
}
Log::debug('Done with handle() for UpdatedSingleTransactionGroup');
}
@@ -71,23 +77,26 @@ class ProcessesUpdatedTransactionGroup
/**
* This method will make sure all source / destination accounts are the same.
*/
protected function unifyAccounts(UpdatedSingleTransactionGroup $updatedGroupEvent): void
protected function unifyAccounts(UpdatedSingleTransactionGroup $updatedGroupEvent): int
{
Log::debug('Now in unifyAccounts()');
$effect = 0;
/** @var TransactionGroup $group */
foreach ($updatedGroupEvent->objects->transactionGroups as $group) {
$this->unifyAccountsForGroup($group);
$effect += $this->unifyAccountsForGroup($group);
}
Log::debug('Done with unifyAccounts()');
Log::debug(sprintf('Done with unifyAccounts(%d)', $effect));
return $effect;
}
private function unifyAccountsForGroup(TransactionGroup $group): void
private function unifyAccountsForGroup(TransactionGroup $group): int
{
if (1 === $group->transactionJournals->count()) {
Log::debug('Nothing to do in unifyAccounts()');
return;
return 0;
}
// first journal:
@@ -104,7 +113,7 @@ class ProcessesUpdatedTransactionGroup
if (null === $first) {
Log::warning(sprintf('Group #%d has no transaction journals.', $group->id));
return;
return 0;
}
$all = $group->transactionJournals()->get()->pluck('id')->toArray();
@@ -136,8 +145,10 @@ class ProcessesUpdatedTransactionGroup
if (0 === $effect) {
Log::debug(sprintf('Had nothing to do in unifyAccounts(#%d)', $group->id));
return;
return 0;
}
Log::debug(sprintf('Updated %d transaction(s) in unifyAccounts(#%d)', $effect, $group->id));
return $effect;
}
}

12
composer.lock generated
View File

@@ -11220,16 +11220,16 @@
},
{
"name": "php-debugbar/php-debugbar",
"version": "v3.5.1",
"version": "v3.6.0",
"source": {
"type": "git",
"url": "https://github.com/php-debugbar/php-debugbar.git",
"reference": "486b32fd98efe9a3c10f0b24c0caabc187f78f04"
"reference": "31f7d2e7943a82e72a670335d408d967b05efa5a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/486b32fd98efe9a3c10f0b24c0caabc187f78f04",
"reference": "486b32fd98efe9a3c10f0b24c0caabc187f78f04",
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/31f7d2e7943a82e72a670335d408d967b05efa5a",
"reference": "31f7d2e7943a82e72a670335d408d967b05efa5a",
"shasum": ""
},
"require": {
@@ -11306,7 +11306,7 @@
],
"support": {
"issues": "https://github.com/php-debugbar/php-debugbar/issues",
"source": "https://github.com/php-debugbar/php-debugbar/tree/v3.5.1"
"source": "https://github.com/php-debugbar/php-debugbar/tree/v3.6.0"
},
"funding": [
{
@@ -11318,7 +11318,7 @@
"type": "github"
}
],
"time": "2026-03-05T20:37:33+00:00"
"time": "2026-03-29T17:26:18+00:00"
},
{
"name": "php-debugbar/symfony-bridge",

View File

@@ -79,7 +79,7 @@ return [
// see cer.php for exchange rates feature flag.
],
'version' => 'develop/2026-03-29',
'build_time' => 1774795378,
'build_time' => 1774809697,
'api_version' => '2.1.0', // field is no longer used.
'db_version' => 28, // field is no longer used.

View File

@@ -282,7 +282,8 @@
{% if transaction.source_account_id == account.id %}
<span title="Deposit, source">{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}</span>
{% else %}
<span title="Deposit, dest">{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}</span>
{# changed from normal currency_symbol to foreign_currency_symbol for #12043 #}
<span title="Deposit, dest">{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }}</span>
{% endif %}
{% elseif transaction.transaction_type_type == 'Withdrawal' %}