This commit is contained in:
James Cole
2025-10-01 20:28:24 +02:00
parent 5637573fd0
commit 87d3d14504
4 changed files with 16 additions and 16 deletions

View File

@@ -242,7 +242,7 @@ class PiggyBankFactory
}
}
}
Log::debug('Looping all accounts.');
/** @var array $info */
foreach ($accounts as $info) {
$account = $this->accountRepository->find((int)($info['account_id'] ?? 0));
@@ -251,6 +251,7 @@ class PiggyBankFactory
continue;
}
Log::debug(sprintf('Working on account #%d', $account->id));
if (array_key_exists('current_amount', $info) && null !== $info['current_amount']) {
// an amount is set, first check out if there is a difference with the previous amount.
$previous = $toBeLinked[$account->id]['current_amount'] ?? '0';
@@ -258,22 +259,24 @@ class PiggyBankFactory
// create event for difference.
if (0 !== bccomp($diff, '0')) {
// 2025-10-01 for issue #10990 disable this event.
Log::debug(sprintf('[a] Will save event for difference %s (previous value was %s)', $diff, $previous));
event(new ChangedAmount($piggyBank, $diff, null, null));
// event(new ChangedAmount($piggyBank, $diff, null, null));
}
$toBeLinked[$account->id] = ['current_amount' => $info['current_amount']];
Log::debug(sprintf('[a] Will link account #%d with amount %s', $account->id, $info['current_amount']));
}
if (array_key_exists('current_amount', $info) && null === $info['current_amount']) {
// an amount is set, first check out if there is a difference with the previous amount.
// no amount is set, first check out if there is a difference with the previous amount.
$previous = $toBeLinked[$account->id]['current_amount'] ?? '0';
$diff = bcsub('0', $previous);
// create event for difference.
if (0 !== bccomp($diff, '0')) {
// 2025-10-01 for issue #10990 disable this event.
Log::debug(sprintf('[b] Will save event for difference %s (previous value was %s)', $diff, $previous));
event(new ChangedAmount($piggyBank, $diff, null, null));
// event(new ChangedAmount($piggyBank, $diff, null, null));
}
// no amount set, use previous amount or go to ZERO.
@@ -282,7 +285,8 @@ class PiggyBankFactory
// create event:
Log::debug('linkToAccountIds: Trigger change for positive amount [b].');
event(new ChangedAmount($piggyBank, $toBeLinked[$account->id]['current_amount'] ?? '0', null, null));
// 2025-10-01 for issue #10990 disable this event.
// event(new ChangedAmount($piggyBank, $toBeLinked[$account->id]['current_amount'] ?? '0', null, null));
}
if (!array_key_exists('current_amount', $info)) {
$toBeLinked[$account->id] ??= [];