From bc4018481f69546b80c460a21fba30870859fbec Mon Sep 17 00:00:00 2001 From: JC5 Date: Mon, 22 Dec 2025 04:36:14 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20release=20?= =?UTF-8?q?'develop'=20on=202025-12-22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Correction/CorrectsCurrencies.php | 3 +- .../CorrectsOpeningBalanceCurrencies.php | 3 +- .../Upgrade/UpgradesAccountCurrencies.php | 3 +- .../Commands/Upgrade/UpgradesBudgetLimits.php | 3 +- .../Upgrade/UpgradesMultiPiggyBanks.php | 3 +- app/Factory/BillFactory.php | 3 +- app/Factory/PiggyBankFactory.php | 3 +- app/Factory/TransactionJournalFactory.php | 3 +- .../Report/Audit/MonthReportGenerator.php | 3 +- app/Handlers/Observer/AccountObserver.php | 2 +- app/Handlers/Observer/AutoBudgetObserver.php | 2 +- .../Observer/AvailableBudgetObserver.php | 2 +- app/Handlers/Observer/BillObserver.php | 2 +- app/Handlers/Observer/BudgetLimitObserver.php | 2 +- .../Observer/PiggyBankEventObserver.php | 2 +- app/Handlers/Observer/PiggyBankObserver.php | 3 +- app/Handlers/Observer/TransactionObserver.php | 2 +- .../Budget/BudgetLimitController.php | 17 +- app/Http/Controllers/JavascriptController.php | 3 +- app/Http/Controllers/Json/BoxController.php | 14 +- .../Controllers/Json/BudgetController.php | 5 +- .../PiggyBank/AmountController.php | 9 +- app/Models/TransactionCurrency.php | 3 +- .../Account/AccountRepository.php | 2 +- app/Repositories/Account/AccountTasker.php | 7 +- app/Repositories/Bill/BillRepository.php | 4 +- app/Repositories/Budget/BudgetRepository.php | 7 +- .../Currency/CurrencyRepository.php | 38 ++-- .../PiggyBank/ModifiesPiggyBanks.php | 4 +- .../PiggyBank/PiggyBankRepository.php | 5 +- .../Internal/Support/AccountServiceTrait.php | 13 +- .../Support/RecurringTransactionTrait.php | 3 +- .../Internal/Update/BillUpdateService.php | 3 +- .../Internal/Update/JournalUpdateService.php | 114 +++++------ app/Support/Amount.php | 3 +- app/Support/Form/CurrencyForm.php | 9 +- .../Http/Controllers/ChartGeneration.php | 2 +- .../Report/Budget/BudgetReportGenerator.php | 3 +- app/Support/Twig/General.php | 6 +- app/Support/Twig/TransactionGroupTwig.php | 9 +- app/TransactionRules/Actions/SetAmount.php | 36 ++-- app/Validation/TransactionValidation.php | 3 +- composer.lock | 23 +-- config/firefly.php | 4 +- package-lock.json | 182 +++++++++--------- 45 files changed, 303 insertions(+), 272 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsCurrencies.php b/app/Console/Commands/Correction/CorrectsCurrencies.php index c9df75fdc7..75a5583729 100644 --- a/app/Console/Commands/Correction/CorrectsCurrencies.php +++ b/app/Console/Commands/Correction/CorrectsCurrencies.php @@ -36,6 +36,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Symfony\Component\Console\Command\Command as CommandAlias; +use FireflyIII\Support\Facades\Amount; class CorrectsCurrencies extends Command { @@ -63,7 +64,7 @@ class CorrectsCurrencies extends Command $repos = app(CurrencyRepositoryInterface::class); // first check if the user has any default currency (not necessarily the case, so can be forced). - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($userGroup); Log::debug(sprintf('Now correcting currencies for user group #%d', $userGroup->id)); $found = [$primaryCurrency->id]; diff --git a/app/Console/Commands/Correction/CorrectsOpeningBalanceCurrencies.php b/app/Console/Commands/Correction/CorrectsOpeningBalanceCurrencies.php index a52e8b04a4..a59d10c805 100644 --- a/app/Console/Commands/Correction/CorrectsOpeningBalanceCurrencies.php +++ b/app/Console/Commands/Correction/CorrectsOpeningBalanceCurrencies.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; class CorrectsOpeningBalanceCurrencies extends Command { @@ -133,6 +134,6 @@ class CorrectsOpeningBalanceCurrencies extends Command $repos = app(AccountRepositoryInterface::class); $repos->setUser($account->user); - return $repos->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->userGroup); + return $repos->getAccountCurrency($account) ?? Amount::getPrimaryCurrencyByUserGroup($account->userGroup); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php index 46b7736562..2d4570db21 100644 --- a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php +++ b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php @@ -36,6 +36,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\User; use Illuminate\Console\Command; use FireflyIII\Support\Facades\FireflyConfig; +use FireflyIII\Support\Facades\Amount; class UpgradesAccountCurrencies extends Command { @@ -105,7 +106,7 @@ class UpgradesAccountCurrencies extends Command $accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value]); // get user's currency preference: - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($user->userGroup); /** @var Account $account */ foreach ($accounts as $account) { diff --git a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php index 4bb1017bbe..4a568024b5 100644 --- a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php +++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php @@ -31,6 +31,7 @@ use FireflyIII\Models\BudgetLimit; use FireflyIII\User; use Illuminate\Console\Command; use FireflyIII\Support\Facades\FireflyConfig; +use FireflyIII\Support\Facades\Amount; class UpgradesBudgetLimits extends Command { @@ -67,7 +68,7 @@ class UpgradesBudgetLimits extends Command /** @var null|User $user */ $user = $budget->user; if (null !== $user) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($user->userGroup); $budgetLimit->transaction_currency_id = $currency->id; $budgetLimit->save(); $this->friendlyInfo( diff --git a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php index 1d746b4b9e..e412c4a275 100644 --- a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php +++ b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php @@ -32,6 +32,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; use FireflyIII\Support\Facades\FireflyConfig; +use FireflyIII\Support\Facades\Amount; class UpgradesMultiPiggyBanks extends Command { @@ -95,7 +96,7 @@ class UpgradesMultiPiggyBanks extends Command $this->repository->setUser($piggyBank->account->user); $this->accountRepository->setUser($piggyBank->account->user); $repetition = $this->repository->getRepetition($piggyBank, true); - $currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup); + $currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? Amount::getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup); // update piggy bank to have a currency. $piggyBank->transaction_currency_id = $currency->id; diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php index 48f3a4e6f8..4052309696 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -32,6 +32,7 @@ use FireflyIII\Services\Internal\Support\BillServiceTrait; use FireflyIII\User; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; /** * Class BillFactory @@ -51,7 +52,7 @@ class BillFactory Log::debug(sprintf('Now in %s', __METHOD__), $data); $factory = app(TransactionCurrencyFactory::class); $currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) - ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + ?? Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); try { $skip = array_key_exists('skip', $data) ? $data['skip'] : 0; diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php index 9eb807725a..54bb104e41 100644 --- a/app/Factory/PiggyBankFactory.php +++ b/app/Factory/PiggyBankFactory.php @@ -36,6 +36,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\User; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; use function Safe\json_encode; @@ -126,7 +127,7 @@ class PiggyBankFactory private function getCurrency(array $data): TransactionCurrency { // currency: - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primaryCurrency = Amount::getPrimaryCurrency(); $currency = null; if (array_key_exists('transaction_currency_code', $data)) { $currency = $this->currencyRepository->findByCode((string)($data['transaction_currency_code'] ?? '')); diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 7d890b95ce..437042c0e0 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -55,6 +55,7 @@ use FireflyIII\Validation\AccountValidator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use JsonException; +use FireflyIII\Support\Facades\Amount; use function Safe\json_encode; @@ -502,7 +503,7 @@ class TransactionJournalFactory $preference = $this->accountRepository->getAccountCurrency($account); if (null === $preference && !$currency instanceof TransactionCurrency) { // return user's default: - return \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + return Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } $result = $preference ?? $currency; Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name)); diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index 9bc9ec1546..66db8cfed9 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -35,6 +35,7 @@ use FireflyIII\Support\Facades\Steam; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Throwable; +use FireflyIII\Support\Facades\Amount; /** * Class MonthReportGenerator. @@ -144,7 +145,7 @@ class MonthReportGenerator implements ReportGeneratorInterface $dayBeforeBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id]; $startBalance = $dayBeforeBalance['balance']; - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $currency = $accountRepository->getAccountCurrency($account) ?? $primaryCurrency; foreach ($journals as $index => $journal) { diff --git a/app/Handlers/Observer/AccountObserver.php b/app/Handlers/Observer/AccountObserver.php index 0cc686a618..58fd1d50fd 100644 --- a/app/Handlers/Observer/AccountObserver.php +++ b/app/Handlers/Observer/AccountObserver.php @@ -52,7 +52,7 @@ class AccountObserver if (!Amount::convertToPrimary($account->user)) { return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); $repository = app(AccountRepositoryInterface::class); $currency = $repository->getAccountCurrency($account); if (null !== $currency && $currency->id !== $userCurrency->id && '' !== (string) $account->virtual_balance && 0 !== bccomp($account->virtual_balance, '0')) { diff --git a/app/Handlers/Observer/AutoBudgetObserver.php b/app/Handlers/Observer/AutoBudgetObserver.php index 003767c1d9..fd838dcd68 100644 --- a/app/Handlers/Observer/AutoBudgetObserver.php +++ b/app/Handlers/Observer/AutoBudgetObserver.php @@ -42,7 +42,7 @@ class AutoBudgetObserver if (!Amount::convertToPrimary($autoBudget->budget->user)) { return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup); $autoBudget->native_amount = null; if ($autoBudget->transactionCurrency->id !== $userCurrency->id) { $converter = new ExchangeRateConverter(); diff --git a/app/Handlers/Observer/AvailableBudgetObserver.php b/app/Handlers/Observer/AvailableBudgetObserver.php index e310962c16..f9eb735b2f 100644 --- a/app/Handlers/Observer/AvailableBudgetObserver.php +++ b/app/Handlers/Observer/AvailableBudgetObserver.php @@ -44,7 +44,7 @@ class AvailableBudgetObserver return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup); $availableBudget->native_amount = null; if ($availableBudget->transactionCurrency->id !== $userCurrency->id) { $converter = new ExchangeRateConverter(); diff --git a/app/Handlers/Observer/BillObserver.php b/app/Handlers/Observer/BillObserver.php index 265957a367..ea9c8bf4e0 100644 --- a/app/Handlers/Observer/BillObserver.php +++ b/app/Handlers/Observer/BillObserver.php @@ -46,7 +46,7 @@ class BillObserver if (!Amount::convertToPrimary($bill->user)) { return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); $bill->native_amount_min = null; $bill->native_amount_max = null; if ($bill->transactionCurrency->id !== $userCurrency->id) { diff --git a/app/Handlers/Observer/BudgetLimitObserver.php b/app/Handlers/Observer/BudgetLimitObserver.php index 83783e5640..2b07e585b1 100644 --- a/app/Handlers/Observer/BudgetLimitObserver.php +++ b/app/Handlers/Observer/BudgetLimitObserver.php @@ -72,7 +72,7 @@ class BudgetLimitObserver return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup); $budgetLimit->native_amount = null; if ($budgetLimit->transactionCurrency->id !== $userCurrency->id) { $converter = new ExchangeRateConverter(); diff --git a/app/Handlers/Observer/PiggyBankEventObserver.php b/app/Handlers/Observer/PiggyBankEventObserver.php index 1c60c90414..0aab702717 100644 --- a/app/Handlers/Observer/PiggyBankEventObserver.php +++ b/app/Handlers/Observer/PiggyBankEventObserver.php @@ -48,7 +48,7 @@ class PiggyBankEventObserver if (!Amount::convertToPrimary($user)) { return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup); $event->native_amount = null; if ($event->piggyBank->transactionCurrency->id !== $userCurrency->id) { $converter = new ExchangeRateConverter(); diff --git a/app/Handlers/Observer/PiggyBankObserver.php b/app/Handlers/Observer/PiggyBankObserver.php index a48686c132..214ceed224 100644 --- a/app/Handlers/Observer/PiggyBankObserver.php +++ b/app/Handlers/Observer/PiggyBankObserver.php @@ -29,6 +29,7 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; /** * Class PiggyBankObserver @@ -49,7 +50,7 @@ class PiggyBankObserver return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($group); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($group); $piggyBank->native_target_amount = null; if ($piggyBank->transactionCurrency->id !== $userCurrency->id) { $converter = new ExchangeRateConverter(); diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index 703d5b2b81..1ab0953d6c 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -52,7 +52,7 @@ class TransactionObserver if (!Amount::convertToPrimary($transaction->transactionJournal->user)) { return; } - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup); $transaction->native_amount = null; $transaction->native_foreign_amount = null; // first normal amount diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php index 0c6c0b6491..6dfa5a84cb 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -45,6 +45,7 @@ use Illuminate\Routing\Redirector; use Illuminate\Support\Collection; use Illuminate\View\View; use FireflyIII\Support\Facades\Steam; +use FireflyIII\Support\Facades\Amount; /** * Class BudgetLimitController @@ -205,14 +206,14 @@ class BudgetLimitController extends Controller // add some extra metadata: $spentArr = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection()->push($budget), $currency); $array['spent'] = $spentArr[$currency->id]['sum'] ?? '0'; - $array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); - $array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']); + $array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); + $array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']); $array['days_left'] = (string) $this->activeDaysLeft($start, $end); // left per day: $array['left_per_day'] = 0 === bccomp('0', $array['days_left']) ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']); // left per day formatted. - $array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); + $array['left_per_day_formatted'] = Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); // notes: $array['notes'] = $this->blRepository->getNoteText($limit); @@ -239,8 +240,8 @@ class BudgetLimitController extends Controller $this->blRepository->destroyBudgetLimit($budgetLimit); $array = [ 'budget_id' => $budgetId, - 'left_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'), - 'left_per_day_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'), + 'left_formatted' => Amount::formatAnything($currency, '0'), + 'left_per_day_formatted' => Amount::formatAnything($currency, '0'), 'transaction_currency_id' => $currency->id, ]; @@ -269,14 +270,14 @@ class BudgetLimitController extends Controller ); $daysLeft = $this->activeDaysLeft($limit->start_date, $limit->end_date); $array['spent'] = $spentArr[$budgetLimit->transactionCurrency->id]['sum'] ?? '0'; - $array['left_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); - $array['amount_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $limit['amount']); + $array['left_formatted'] = Amount::formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); + $array['amount_formatted'] = Amount::formatAnything($limit->transactionCurrency, $limit['amount']); $array['days_left'] = (string) $daysLeft; $array['left_per_day'] = 0 === $daysLeft ? bcadd((string) $array['spent'], (string) $array['amount']) : bcdiv(bcadd((string) $array['spent'], (string) $array['amount']), $array['days_left']); // left per day formatted. $array['amount'] = Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places); - $array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); + $array['left_per_day_formatted'] = Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); if ('true' === $request->get('redirect')) { return redirect(route('budgets.index')); } diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index 271b27c902..7eabd033f3 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -37,6 +37,7 @@ use Illuminate\Http\Request; use Illuminate\Http\Response; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use FireflyIII\Support\Facades\Amount; /** * Class JavascriptController. @@ -106,7 +107,7 @@ class JavascriptController extends Controller $currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency; } $locale = Steam::getLocale(); - $accounting = \FireflyIII\Support\Facades\Amount::getJsConfig(); + $accounting = Amount::getJsConfig(); $accounting['frac_digits'] = $currency->decimal_places; $pref = Preferences::get('language', config('firefly.default_language', 'en_US')); $lang = $pref->data; diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php index 4db6418a8a..36d0832bc9 100644 --- a/app/Http/Controllers/Json/BoxController.php +++ b/app/Http/Controllers/Json/BoxController.php @@ -121,15 +121,15 @@ class BoxController extends Controller $keys = array_keys($sums); foreach ($keys as $currencyId) { $currency = $repository->find($currencyId); - $sums[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $sums[$currencyId], false); - $incomes[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $incomes[$currencyId] ?? '0', false); - $expenses[$currencyId] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $expenses[$currencyId] ?? '0', false); + $sums[$currencyId] = Amount::formatAnything($currency, $sums[$currencyId], false); + $incomes[$currencyId] = Amount::formatAnything($currency, $incomes[$currencyId] ?? '0', false); + $expenses[$currencyId] = Amount::formatAnything($currency, $expenses[$currencyId] ?? '0', false); } if (0 === count($sums)) { $currency = $this->primaryCurrency; - $sums[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false); - $incomes[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false); - $expenses[$this->primaryCurrency->id] = \FireflyIII\Support\Facades\Amount::formatAnything($this->primaryCurrency, '0', false); + $sums[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false); + $incomes[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false); + $expenses[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false); } $response = [ @@ -187,7 +187,7 @@ class BoxController extends Controller if ('primary' === $key) { continue; } - $return[$data['currency_id']] = \FireflyIII\Support\Facades\Amount::formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false); + $return[$data['currency_id']] = Amount::formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false); } $return = [ 'net_worths' => array_values($return), diff --git a/app/Http/Controllers/Json/BudgetController.php b/app/Http/Controllers/Json/BudgetController.php index 6eaffdacc1..dce9b244ca 100644 --- a/app/Http/Controllers/Json/BudgetController.php +++ b/app/Http/Controllers/Json/BudgetController.php @@ -33,6 +33,7 @@ use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Support\Http\Controllers\DateCalculation; use Illuminate\Http\JsonResponse; +use FireflyIII\Support\Facades\Amount; /** * Class BudgetController @@ -84,9 +85,9 @@ class BudgetController extends Controller return response()->json( [ 'budgeted' => $budgeted, - 'budgeted_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $budgeted, true), + 'budgeted_formatted' => Amount::formatAnything($currency, $budgeted, true), 'available' => $available, - 'available_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $available, true), + 'available_formatted' => Amount::formatAnything($currency, $available, true), 'percentage' => $percentage, 'currency_id' => $currency->id, 'currency_code' => $currency->code, diff --git a/app/Http/Controllers/PiggyBank/AmountController.php b/app/Http/Controllers/PiggyBank/AmountController.php index 2f40a833bd..5d66fffe36 100644 --- a/app/Http/Controllers/PiggyBank/AmountController.php +++ b/app/Http/Controllers/PiggyBank/AmountController.php @@ -35,6 +35,7 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\View\View; +use FireflyIII\Support\Facades\Amount; /** * Class AmountController @@ -167,7 +168,7 @@ class AmountController extends Controller $piggyBank->refresh(); } if (0 !== bccomp($total, '0')) { - session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name])); + session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name])); Preferences::mark(); return redirect(route('piggy-banks.index')); @@ -177,7 +178,7 @@ class AmountController extends Controller 'error', (string) trans( 'firefly.cannot_add_amount_piggy', - ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] + ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] ) ); @@ -214,7 +215,7 @@ class AmountController extends Controller 'success', (string) trans( 'firefly.removed_amount_from_piggy', - ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name] + ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name] ) ); Preferences::mark(); @@ -226,7 +227,7 @@ class AmountController extends Controller 'error', (string) trans( 'firefly.cannot_remove_from_piggy', - ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] + ['amount' => Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] ) ); diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index f1d610e56c..7c8f6814c1 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -31,6 +31,7 @@ use Illuminate\Database\Eloquent\Relations\BelongsToMany; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\SoftDeletes; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\Amount; class TransactionCurrency extends Model { @@ -65,7 +66,7 @@ class TransactionCurrency extends Model public function refreshForUser(User $user): void { $current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first(); - $native = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); + $native = Amount::getPrimaryCurrencyByUserGroup($user->userGroup); $this->userGroupNative = $native->id === $this->id; $this->userGroupEnabled = null !== $current; } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 63e0db9724..f41f2bf590 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -353,7 +353,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac if (AccountTypeEnum::ASSET->value !== $account->accountType->type) { throw new FireflyException(sprintf('%s is not an asset account.', $account->name)); } - $currency = $this->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $currency = $this->getAccountCurrency($account) ?? Amount::getPrimaryCurrency(); $name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]); /** @var AccountType $type */ diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index f984053215..5c190ae18a 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -34,6 +34,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; /** * Class AccountTasker. @@ -59,7 +60,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $return = [ 'accounts' => [], @@ -146,7 +147,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface private function groupExpenseByDestination(array $array): array { - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ $currencyRepos = app(CurrencyRepositoryInterface::class); @@ -231,7 +232,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface private function groupIncomeBySource(array $array): array { - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ $currencyRepos = app(CurrencyRepositoryInterface::class); diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index a5a4988ec1..dea1415d81 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -536,7 +536,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $bills = $this->getActiveBills(); $return = []; $convertToPrimary = Amount::convertToPrimary($this->user); - $primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primary = Amount::getPrimaryCurrency(); /** @var Bill $bill */ foreach ($bills as $bill) { @@ -602,7 +602,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $bills = $this->getActiveBills(); $return = []; $convertToPrimary = Amount::convertToPrimary($this->user); - $primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primary = Amount::getPrimaryCurrency(); /** @var Bill $bill */ foreach ($bills as $bill) { diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 006a725a51..3f6018c3ff 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -51,6 +51,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; +use FireflyIII\Support\Facades\Amount; /** * Class BudgetRepository. @@ -94,7 +95,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $limitRepository = app(BudgetLimitRepository::class); $limitRepository->setUser($this->user); $budgets = $this->getActiveBudgets(); - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primaryCurrency = Amount::getPrimaryCurrency(); $converter = new ExchangeRateConverter(); /** @var Budget $budget */ @@ -393,7 +394,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $autoBudget = $this->getAutoBudget($budget); // grab default currency: - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); if (!$autoBudget instanceof AutoBudget) { // at this point it's a blind assumption auto_budget_type is 1 or 2. @@ -778,7 +779,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $currency = $repos->findByCode((string) $data['currency_code']); } if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } $autoBudget = new AutoBudget(); diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index dc7876aed5..7dddd5d0e8 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -45,6 +45,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Override; use Safe\Exceptions\JsonException; + use function Safe\json_encode; /** @@ -70,7 +71,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf public function currencyInUseAt(TransactionCurrency $currency): ?string { Log::debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); - $countJournals = $this->countJournals($currency); + $countJournals = $this->countJournals($currency); if ($countJournals > 0) { Log::info(sprintf('Count journals is %d, return true.', $countJournals)); @@ -85,7 +86,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is being used in accounts: - $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string)$currency->id))->count(); + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string)$currency->id))->count(); if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -93,7 +94,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // second search using integer check. - $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int)$currency->id))->count(); + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int)$currency->id))->count(); if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -101,7 +102,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is being used in bills: - $bills = Bill::where('transaction_currency_id', $currency->id)->count(); + $bills = Bill::where('transaction_currency_id', $currency->id)->count(); if ($bills > 0) { Log::info(sprintf('Used in %d bills as currency, return true. ', $bills)); @@ -119,9 +120,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is being used in accounts (as integer) - $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') - ->whereNull('accounts.deleted_at') - ->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count(); + $meta = AccountMeta::leftJoin('accounts', 'accounts.id', '=', 'account_meta.account_id') + ->whereNull('accounts.deleted_at') + ->where('account_meta.name', 'currency_id')->where('account_meta.data', json_encode($currency->id))->count() + ; if ($meta > 0) { Log::info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -137,7 +139,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is being used in budget limits - $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count(); + $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count(); if ($budgetLimit > 0) { Log::info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); @@ -145,7 +147,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is the default currency for the user or the system - $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count(); + $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count(); if ($count > 0) { Log::info('Is the default currency of the user, return true.'); @@ -153,7 +155,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf } // is the default currency for the user or the system - $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count(); + $count = $this->userGroup->currencies()->where('transaction_currencies.id', $currency->id)->wherePivot('group_default', 1)->count(); if ($count > 0) { Log::info('Is the default currency of the user group, return true.'); @@ -182,8 +184,8 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf $local = $this->get(); return $all->map(static function (TransactionCurrency $current) use ($local): TransactionCurrency { - $hasId = $local->contains(static fn(TransactionCurrency $entry): bool => $entry->id === $current->id); - $isPrimary = $local->contains(static fn(TransactionCurrency $entry): bool => 1 === (int)$entry->pivot->group_default && $entry->id === $current->id); + $hasId = $local->contains(static fn (TransactionCurrency $entry): bool => $entry->id === $current->id); + $isPrimary = $local->contains(static fn (TransactionCurrency $entry): bool => 1 === (int)$entry->pivot->group_default && $entry->id === $current->id); $current->userGroupEnabled = $hasId; $current->userGroupNative = $isPrimary; @@ -240,7 +242,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf Log::debug('Grabbing default currency for this user...'); /** @var null|TransactionCurrency $result */ - $result = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $result = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } Log::debug(sprintf('Final result: %s', $result->code)); @@ -274,6 +276,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf Log::debug(sprintf('Also enabled currency %s', $result->code)); $this->enable($result); } + return $result; } Log::debug('Found no currency, returning NULL.'); @@ -338,9 +341,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf /** @var null|CurrencyExchangeRate $rate */ $rate = $this->user->currencyExchangeRates() - ->where('from_currency_id', $fromCurrency->id) - ->where('to_currency_id', $toCurrency->id) - ->where('date', $date->format('Y-m-d'))->first(); + ->where('from_currency_id', $fromCurrency->id) + ->where('to_currency_id', $toCurrency->id) + ->where('date', $date->format('Y-m-d'))->first() + ; if (null !== $rate) { Log::debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d'))); @@ -440,7 +444,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf public function makePrimary(TransactionCurrency $currency): void { - $current = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->userGroup); + $current = Amount::getPrimaryCurrencyByUserGroup($this->userGroup); Log::debug(sprintf('Enabled + made default currency %s for user #%d', $currency->code, $this->userGroup->id)); $this->userGroup->currencies()->detach($currency->id); foreach ($this->userGroup->currencies()->get() as $item) { diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index 1800085966..bdf65d177e 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -72,7 +72,7 @@ trait ModifiesPiggyBanks $pivot->native_current_amount = null; // also update native_current_amount. - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); if ($userCurrency->id !== $piggyBank->transaction_currency_id) { $converter = new ExchangeRateConverter(); $converter->setIgnoreSettings(true); @@ -95,7 +95,7 @@ trait ModifiesPiggyBanks $pivot->native_current_amount = null; // also update native_current_amount. - $userCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $userCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); if ($userCurrency->id !== $piggyBank->transaction_currency_id) { $converter = new ExchangeRateConverter(); $converter->setIgnoreSettings(true); diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index f6d314e2f5..8342b4f073 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -44,6 +44,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use Override; +use FireflyIII\Support\Facades\Amount; /** * Class PiggyBankRepository. @@ -171,7 +172,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte $accountRepos = app(AccountRepositoryInterface::class); $accountRepos->setUser($this->user); - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code)); @@ -302,7 +303,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte /** @var PiggyBank $piggy */ foreach ($set as $piggy) { $currentAmount = $this->getCurrentAmount($piggy); - $piggy->name = sprintf('%s (%s)', $piggy->name, \FireflyIII\Support\Facades\Amount::formatAnything($piggy->transactionCurrency, $currentAmount, false)); + $piggy->name = sprintf('%s (%s)', $piggy->name, Amount::formatAnything($piggy->transactionCurrency, $currentAmount, false)); } return $set; diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index 5fbc87f1f4..ec75b0de50 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -44,6 +44,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService; use Illuminate\Support\Facades\Validator; use FireflyIII\Support\Facades\Steam; +use FireflyIII\Support\Facades\Amount; /** * Trait AccountServiceTrait @@ -231,7 +232,7 @@ trait AccountServiceTrait // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // submit to factory: @@ -348,7 +349,7 @@ trait AccountServiceTrait if (null === $currency) { // use default currency: - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } $currency->enabled = true; $currency->save(); @@ -388,7 +389,7 @@ trait AccountServiceTrait // if exists, update: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // simply grab the first journal and change it: @@ -454,7 +455,7 @@ trait AccountServiceTrait // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // submit to factory: $submission = [ @@ -571,7 +572,7 @@ trait AccountServiceTrait // if exists, update: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // simply grab the first journal and change it: @@ -652,7 +653,7 @@ trait AccountServiceTrait // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // submit to factory: diff --git a/app/Services/Internal/Support/RecurringTransactionTrait.php b/app/Services/Internal/Support/RecurringTransactionTrait.php index da4e9ef091..bba3f5019b 100644 --- a/app/Services/Internal/Support/RecurringTransactionTrait.php +++ b/app/Services/Internal/Support/RecurringTransactionTrait.php @@ -42,6 +42,7 @@ use FireflyIII\Models\RecurrenceTransactionMeta; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Validation\AccountValidator; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; use function Safe\json_encode; @@ -107,7 +108,7 @@ trait RecurringTransactionTrait $currency = $factory->find($array['currency_id'] ?? null, $array['currency_code'] ?? null); $foreignCurrency = $factory->find($array['foreign_currency_id'] ?? null, $array['foreign_currency_code'] ?? null); if (null === $currency) { - $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($recurrence->user->userGroup); + $currency = Amount::getPrimaryCurrencyByUserGroup($recurrence->user->userGroup); } Log::debug( diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index 71d9771666..a13a0707be 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\ObjectGroup\CreatesObjectGroups; use FireflyIII\Services\Internal\Support\BillServiceTrait; use FireflyIII\User; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\Amount; /** * Class BillUpdateService @@ -53,7 +54,7 @@ class BillUpdateService if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) { $factory = app(TransactionCurrencyFactory::class); $currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) - ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); + ?? Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); // enable the currency if it isn't. $currency->enabled = true; diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 84552f79d2..3029cf1a37 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -69,7 +69,7 @@ class JournalUpdateService private ?Transaction $destinationTransaction = null; private array $metaDate = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', - 'invoice_date',]; + 'invoice_date', ]; private array $metaString = [ 'sepa_cc', @@ -113,7 +113,7 @@ class JournalUpdateService public function setTransactionGroup(TransactionGroup $transactionGroup): void { - $this->transactionGroup = $transactionGroup; + $this->transactionGroup = $transactionGroup; $this->billRepository->setUser($transactionGroup->user); $this->categoryRepository->setUser($transactionGroup->user); $this->budgetRepository->setUser($transactionGroup->user); @@ -184,8 +184,8 @@ class JournalUpdateService private function hasValidSourceAccount(): bool { - $sourceId = $this->data['source_id'] ?? null; - $sourceName = $this->data['source_name'] ?? null; + $sourceId = $this->data['source_id'] ?? null; + $sourceName = $this->data['source_name'] ?? null; Log::debug(sprintf('Now in hasValidSourceAccount("%s","%s").', $sourceId, $sourceName)); if (!$this->hasFields(['source_id', 'source_name'])) { @@ -200,11 +200,11 @@ class JournalUpdateService // make a new validator. /** @var AccountValidator $validator */ - $validator = app(AccountValidator::class); + $validator = app(AccountValidator::class); $validator->setTransactionType($expectedType); $validator->setUser($this->transactionJournal->user); - $result = $validator->validateSource(['id' => $sourceId, 'name' => $sourceName]); + $result = $validator->validateSource(['id' => $sourceId, 'name' => $sourceName]); Log::debug( sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true)) ); @@ -217,7 +217,7 @@ class JournalUpdateService private function hasFields(array $fields): bool { - return array_any($fields, fn($field): bool => array_key_exists($field, $this->data)); + return array_any($fields, fn ($field): bool => array_key_exists($field, $this->data)); } private function getOriginalSourceAccount(): Account @@ -262,8 +262,8 @@ class JournalUpdateService private function hasValidDestinationAccount(): bool { Log::debug('Now in hasValidDestinationAccount().'); - $destId = $this->data['destination_id'] ?? null; - $destName = $this->data['destination_name'] ?? null; + $destId = $this->data['destination_id'] ?? null; + $destName = $this->data['destination_name'] ?? null; if (!$this->hasFields(['destination_id', 'destination_name'])) { Log::debug('No destination info submitted, grab the original data.'); @@ -273,12 +273,12 @@ class JournalUpdateService } // make new account validator. - $expectedType = $this->getExpectedType(); + $expectedType = $this->getExpectedType(); Log::debug(sprintf('(b) Expected type (new or unchanged) is %s', $expectedType)); // make a new validator. /** @var AccountValidator $validator */ - $validator = app(AccountValidator::class); + $validator = app(AccountValidator::class); $validator->setTransactionType($expectedType); $validator->setUser($this->transactionJournal->user); $validator->source = $this->getValidSourceAccount(); @@ -333,7 +333,7 @@ class JournalUpdateService return $this->getOriginalSourceAccount(); } - $sourceInfo = [ + $sourceInfo = [ 'id' => (int)($this->data['source_id'] ?? null), 'name' => $this->data['source_name'] ?? null, 'iban' => $this->data['source_iban'] ?? null, @@ -361,8 +361,8 @@ class JournalUpdateService */ private function updateAccounts(): void { - $source = $this->getValidSourceAccount(); - $destination = $this->getValidDestinationAccount(); + $source = $this->getValidSourceAccount(); + $destination = $this->getValidDestinationAccount(); // cowardly refuse to update if both accounts are the same. if ($source->id === $destination->id) { @@ -375,7 +375,7 @@ class JournalUpdateService $origSourceTransaction->account()->associate($source); $origSourceTransaction->save(); - $destTransaction = $this->getDestinationTransaction(); + $destTransaction = $this->getDestinationTransaction(); $destTransaction->account()->associate($destination); $destTransaction->save(); @@ -397,7 +397,7 @@ class JournalUpdateService return $this->getOriginalDestinationAccount(); } - $destInfo = [ + $destInfo = [ 'id' => (int)($this->data['destination_id'] ?? null), 'name' => $this->data['destination_name'] ?? null, 'iban' => $this->data['destination_iban'] ?? null, @@ -426,7 +426,7 @@ class JournalUpdateService { Log::debug('Now in updateType()'); if ($this->hasFields(['type'])) { - $type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type']; + $type = 'opening-balance' === $this->data['type'] ? 'opening balance' : $this->data['type']; Log::debug( sprintf( 'Trying to change journal #%d from a %s to a %s.', @@ -459,9 +459,9 @@ class JournalUpdateService { $type = $this->transactionJournal->transactionType->type; if (( - array_key_exists('bill_id', $this->data) + array_key_exists('bill_id', $this->data) || array_key_exists('bill_name', $this->data) - ) + ) && TransactionTypeEnum::WITHDRAWAL->value === $type ) { $billId = (int)($this->data['bill_id'] ?? 0); @@ -478,7 +478,7 @@ class JournalUpdateService private function updateField(string $fieldName): void { if (array_key_exists($fieldName, $this->data) && '' !== (string)$this->data[$fieldName]) { - $value = $this->data[$fieldName]; + $value = $this->data[$fieldName]; if ('date' === $fieldName) { if (!$value instanceof Carbon) { @@ -575,7 +575,7 @@ class JournalUpdateService if ($this->hasFields([$field])) { $value = '' === $this->data[$field] ? null : $this->data[$field]; Log::debug(sprintf('Field "%s" is present ("%s"), try to update it.', $field, $value)); - $set = [ + $set = [ 'journal' => $this->transactionJournal, 'name' => $field, 'data' => $value, @@ -594,7 +594,7 @@ class JournalUpdateService if ($this->hasFields([$field])) { try { $value = '' === (string)$this->data[$field] ? null : new Carbon($this->data[$field]); - } catch (InvalidDateException | InvalidFormatException $e) { // @phpstan-ignore-line + } catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line Log::debug(sprintf('%s is not a valid date value: %s', $this->data[$field], $e->getMessage())); return; @@ -623,19 +623,19 @@ class JournalUpdateService if (!$this->hasFields(['currency_id', 'currency_code'])) { return; } - $currencyId = $this->data['currency_id'] ?? null; - $currencyCode = $this->data['currency_code'] ?? null; - $currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode); + $currencyId = $this->data['currency_id'] ?? null; + $currencyCode = $this->data['currency_code'] ?? null; + $currency = $this->currencyRepository->findCurrency($currencyId, $currencyCode); // update currency everywhere. $this->transactionJournal->transaction_currency_id = $currency->id; $this->transactionJournal->save(); - $source = $this->getSourceTransaction(); - $source->transaction_currency_id = $currency->id; + $source = $this->getSourceTransaction(); + $source->transaction_currency_id = $currency->id; $source->save(); - $dest = $this->getDestinationTransaction(); - $dest->transaction_currency_id = $currency->id; + $dest = $this->getDestinationTransaction(); + $dest->transaction_currency_id = $currency->id; $dest->save(); // refresh transactions. @@ -651,7 +651,7 @@ class JournalUpdateService return; } - $value = $this->data['amount'] ?? ''; + $value = $this->data['amount'] ?? ''; Log::debug(sprintf('Amount is now "%s"', $value)); try { @@ -665,17 +665,17 @@ class JournalUpdateService $origSourceTransaction->amount = Steam::negative($amount); $origSourceTransaction->balance_dirty = true; $origSourceTransaction->save(); - $destTransaction = $this->getDestinationTransaction(); - $originalAmount = $destTransaction->amount; - $destTransaction->amount = Steam::positive($amount); - $destTransaction->balance_dirty = true; + $destTransaction = $this->getDestinationTransaction(); + $originalAmount = $destTransaction->amount; + $destTransaction->amount = Steam::positive($amount); + $destTransaction->balance_dirty = true; $destTransaction->save(); // refresh transactions. $this->sourceTransaction->refresh(); $this->destinationTransaction->refresh(); Log::debug(sprintf('Updated amount to "%s"', $amount)); - $group = $this->transactionGroup; + $group = $this->transactionGroup; if (null === $group) { $group = $this->transactionJournal?->transactionGroup; } @@ -686,20 +686,20 @@ class JournalUpdateService // should not return in NULL but seems to do. if (0 !== bccomp($originalAmount, $value)) { event(new TriggeredAuditLog( - $group->user, - $group, - 'update_amount', - [ - 'currency_symbol' => $destTransaction->transactionCurrency->symbol, - 'decimal_places' => $destTransaction->transactionCurrency->decimal_places, - 'amount' => $originalAmount, - ], - [ - 'currency_symbol' => $destTransaction->transactionCurrency->symbol, - 'decimal_places' => $destTransaction->transactionCurrency->decimal_places, - 'amount' => $value, - ] - )); + $group->user, + $group, + 'update_amount', + [ + 'currency_symbol' => $destTransaction->transactionCurrency->symbol, + 'decimal_places' => $destTransaction->transactionCurrency->decimal_places, + 'amount' => $originalAmount, + ], + [ + 'currency_symbol' => $destTransaction->transactionCurrency->symbol, + 'decimal_places' => $destTransaction->transactionCurrency->decimal_places, + 'amount' => $value, + ] + )); } } @@ -738,9 +738,9 @@ class JournalUpdateService // if the transaction is a TRANSFER, and the foreign amount and currency are set (like they seem to be) // the correct fields to update in the destination transaction are NOT the foreign amount and currency // but rather the normal amount and currency. This is new behavior. - $isTransfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type; + $isTransfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type; // also check if it is not between an asset account and a liability, because then the same rule applies. - $isBetween = $this->isBetweenAssetAndLiability(); + $isBetween = $this->isBetweenAssetAndLiability(); if ($isTransfer || $isBetween) { Log::debug('Switch amounts, store in amount and not foreign_amount'); @@ -776,8 +776,8 @@ class JournalUpdateService $source->foreign_amount = null; $source->save(); - $dest->foreign_currency_id = null; - $dest->foreign_amount = null; + $dest->foreign_currency_id = null; + $dest->foreign_amount = null; $dest->save(); Log::debug(sprintf('Foreign amount is "%s" so remove foreign amount info.', $amount)); } @@ -791,7 +791,7 @@ class JournalUpdateService private function isBetweenAssetAndLiability(): bool { /** @var null|Transaction $sourceTransaction */ - $sourceTransaction = $this->transactionJournal->transactions()->where('amount', '<', 0)->first(); + $sourceTransaction = $this->transactionJournal->transactions()->where('amount', '<', 0)->first(); /** @var null|Transaction $destinationTransaction */ $destinationTransaction = $this->transactionJournal->transactions()->where('amount', '>', 0)->first(); @@ -806,15 +806,15 @@ class JournalUpdateService return false; } - $source = $sourceTransaction->account; - $destination = $destinationTransaction->account; + $source = $sourceTransaction->account; + $destination = $destinationTransaction->account; if (null === $source || null === $destination) { Log::warning('Either is false, stop.'); return false; } - $sourceTypes = [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]; + $sourceTypes = [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]; // source is liability, destination is asset if (in_array($source->accountType->type, $sourceTypes, true) && AccountTypeEnum::ASSET->value === $destination->accountType->type) { diff --git a/app/Support/Amount.php b/app/Support/Amount.php index ab12026b13..ce5e0942fe 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -334,8 +334,9 @@ class Amount public function getTransactionCurrencyById(int $currencyId): TransactionCurrency { - if(0 === $currencyId) { + if (0 === $currencyId) { Log::debug('Could never find a currency with ID zero. Throw error.'); + throw new FireflyException('Could never find a currency with ID zero. Throw error.'); } $instance = PreferencesSingleton::getInstance(); diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index d487bc7b15..9e7188b8d9 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; use Throwable; use FireflyIII\Support\Facades\Steam; +use FireflyIII\Support\Facades\Amount; /** * Class CurrencyForm @@ -123,10 +124,10 @@ class CurrencyForm $classes = $this->getHolderClasses($name); $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; - $primaryCurrency = $options['currency'] ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primaryCurrency = $options['currency'] ?? Amount::getPrimaryCurrency(); /** @var Collection $currencies */ - $currencies = \FireflyIII\Support\Facades\Amount::getAllCurrencies(); + $currencies = Amount::getAllCurrencies(); unset($options['currency'], $options['placeholder']); // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) @@ -176,10 +177,10 @@ class CurrencyForm $classes = $this->getHolderClasses($name); $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; - $primaryCurrency = $options['currency'] ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primaryCurrency = $options['currency'] ?? Amount::getPrimaryCurrency(); /** @var Collection $currencies */ - $currencies = \FireflyIII\Support\Facades\Amount::getCurrencies(); + $currencies = Amount::getCurrencies(); unset($options['currency'], $options['placeholder']); // perhaps the currency has been sent to us in the field $amount_currency_id_$name (amount_currency_id_amount) $preFilled = session('preFilled'); diff --git a/app/Support/Http/Controllers/ChartGeneration.php b/app/Support/Http/Controllers/ChartGeneration.php index fd98a732fc..3480b03078 100644 --- a/app/Support/Http/Controllers/ChartGeneration.php +++ b/app/Support/Http/Controllers/ChartGeneration.php @@ -67,7 +67,7 @@ trait ChartGeneration /** @var AccountRepositoryInterface $accountRepos */ $accountRepos = app(AccountRepositoryInterface::class); - $primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primary = Amount::getPrimaryCurrency(); $chartData = []; Log::debug(sprintf('Start of accountBalanceChart(list, %s, %s)', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); diff --git a/app/Support/Report/Budget/BudgetReportGenerator.php b/app/Support/Report/Budget/BudgetReportGenerator.php index c839853eb7..0950a7c300 100644 --- a/app/Support/Report/Budget/BudgetReportGenerator.php +++ b/app/Support/Report/Budget/BudgetReportGenerator.php @@ -34,6 +34,7 @@ use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use FireflyIII\User; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\Amount; /** * Class BudgetReportGenerator @@ -136,7 +137,7 @@ class BudgetReportGenerator $this->blRepository->setUser($user); $this->opsRepository->setUser($user); $this->nbRepository->setUser($user); - $this->currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); + $this->currency = Amount::getPrimaryCurrencyByUserGroup($user->userGroup); } /** diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index d4d5c9c553..1f53977b15 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -180,7 +180,7 @@ class General extends AbstractExtension if ('balance' === $key) { // balance in account currency. if (!$usePrimary) { - $strings[] = \FireflyIII\Support\Facades\Amount::formatAnything($currency, $balance, false); + $strings[] = Amount::formatAnything($currency, $balance, false); } continue; @@ -188,14 +188,14 @@ class General extends AbstractExtension if ('pc_balance' === $key) { // balance in primary currency. if ($usePrimary) { - $strings[] = \FireflyIII\Support\Facades\Amount::formatAnything($primary, $balance, false); + $strings[] = Amount::formatAnything($primary, $balance, false); } continue; } // for multi currency accounts. if ($usePrimary && $key !== $primary->code) { - $strings[] = \FireflyIII\Support\Facades\Amount::formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false); + $strings[] = Amount::formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false); } } diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index 891525bf71..b3b8469a26 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -35,6 +35,7 @@ use Illuminate\Support\Facades\DB; use Override; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; +use FireflyIII\Support\Facades\Amount; use function Safe\json_decode; @@ -172,7 +173,7 @@ class TransactionGroupTwig extends AbstractExtension if (TransactionTypeEnum::TRANSFER->value === $type) { $colored = false; } - $result = \FireflyIII\Support\Facades\Amount::formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored); + $result = Amount::formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } @@ -199,7 +200,7 @@ class TransactionGroupTwig extends AbstractExtension if (TransactionTypeEnum::TRANSFER->value === $type) { $colored = false; } - $result = \FireflyIII\Support\Facades\Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); + $result = Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } @@ -230,7 +231,7 @@ class TransactionGroupTwig extends AbstractExtension $colored = false; } - $result = \FireflyIII\Support\Facades\Amount::formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored); + $result = Amount::formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } @@ -257,7 +258,7 @@ class TransactionGroupTwig extends AbstractExtension if (TransactionTypeEnum::TRANSFER->value === $type) { $colored = false; } - $result = \FireflyIII\Support\Facades\Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); + $result = Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } diff --git a/app/TransactionRules/Actions/SetAmount.php b/app/TransactionRules/Actions/SetAmount.php index c20ef68a29..856e342336 100644 --- a/app/TransactionRules/Actions/SetAmount.php +++ b/app/TransactionRules/Actions/SetAmount.php @@ -55,7 +55,7 @@ class SetAmount implements ActionInterface return false; } - $value = $this->action->getValue($journal); + $value = $this->action->getValue($journal); if (!is_numeric($value) || 0 === bccomp($value, '0')) { Log::debug(sprintf('RuleAction SetAmount, amount "%s" is not a number or is zero, will not continue.', $value)); @@ -65,10 +65,10 @@ class SetAmount implements ActionInterface } /** @var TransactionJournal $object */ - $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); + $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); - $positive = Steam::positive($value); - $negative = Steam::negative($value); + $positive = Steam::positive($value); + $negative = Steam::negative($value); $this->updatePositive($object, $positive); $this->updateNegative($object, $negative); @@ -77,20 +77,20 @@ class SetAmount implements ActionInterface // event for audit log entry if (0 !== bccomp($journal['amount'], $value)) { event(new TriggeredAuditLog( - $this->action->rule, - $object, - 'update_amount', - [ - 'currency_symbol' => $object->transactionCurrency->symbol, - 'decimal_places' => $object->transactionCurrency->decimal_places, - 'amount' => $journal['amount'], - ], - [ - 'currency_symbol' => $object->transactionCurrency->symbol, - 'decimal_places' => $object->transactionCurrency->decimal_places, - 'amount' => $value, - ] - )); + $this->action->rule, + $object, + 'update_amount', + [ + 'currency_symbol' => $object->transactionCurrency->symbol, + 'decimal_places' => $object->transactionCurrency->decimal_places, + 'amount' => $journal['amount'], + ], + [ + 'currency_symbol' => $object->transactionCurrency->symbol, + 'decimal_places' => $object->transactionCurrency->decimal_places, + 'amount' => $value, + ] + )); } return true; diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php index e95a826ffb..04f76ecf87 100644 --- a/app/Validation/TransactionValidation.php +++ b/app/Validation/TransactionValidation.php @@ -37,6 +37,7 @@ use FireflyIII\Repositories\Account\AccountRepository; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Amount; /** * Trait TransactionValidation @@ -224,7 +225,7 @@ trait TransactionValidation /** @var AccountRepository $accountRepository */ $accountRepository = app(AccountRepositoryInterface::class); - $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); + $primaryCurrency = Amount::getPrimaryCurrency(); $sourceCurrency = $accountRepository->getAccountCurrency($source) ?? $primaryCurrency; $destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $primaryCurrency; // if both accounts have the same currency, continue. diff --git a/composer.lock b/composer.lock index 38072b6877..8501567efa 100644 --- a/composer.lock +++ b/composer.lock @@ -11181,31 +11181,32 @@ }, { "name": "php-debugbar/php-debugbar", - "version": "v2.2.4", + "version": "v2.2.5", "source": { "type": "git", "url": "https://github.com/php-debugbar/php-debugbar.git", - "reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35" + "reference": "c5dce08e98dd101c771e55949fd89124b216271d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/3146d04671f51f69ffec2a4207ac3bdcf13a9f35", - "reference": "3146d04671f51f69ffec2a4207ac3bdcf13a9f35", + "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/c5dce08e98dd101c771e55949fd89124b216271d", + "reference": "c5dce08e98dd101c771e55949fd89124b216271d", "shasum": "" }, "require": { - "php": "^8", + "php": "^8.1", "psr/log": "^1|^2|^3", - "symfony/var-dumper": "^4|^5|^6|^7" + "symfony/var-dumper": "^5.4|^6.4|^7.3|^8.0" }, "replace": { "maximebf/debugbar": "self.version" }, "require-dev": { "dbrekelmans/bdi": "^1", - "phpunit/phpunit": "^8|^9", + "phpunit/phpunit": "^10", + "symfony/browser-kit": "^6.0|7.0", "symfony/panther": "^1|^2.1", - "twig/twig": "^1.38|^2.7|^3.0" + "twig/twig": "^3.11.2" }, "suggest": { "kriswallsmith/assetic": "The best way to manage assets", @@ -11215,7 +11216,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.1-dev" + "dev-master": "2.2-dev" } }, "autoload": { @@ -11248,9 +11249,9 @@ ], "support": { "issues": "https://github.com/php-debugbar/php-debugbar/issues", - "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.4" + "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.5" }, - "time": "2025-07-22T14:01:30+00:00" + "time": "2025-12-21T08:50:08+00:00" }, { "name": "phpstan/extension-installer", diff --git a/config/firefly.php b/config/firefly.php index 088fbbfa1a..55e3e15307 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-20', - 'build_time' => 1766210708, + 'version' => 'develop/2025-12-22', + 'build_time' => 1766374469, '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 79cf4ad7e5..9b556be2e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2592,9 +2592,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.5.tgz", - "integrity": "sha512-iDGS/h7D8t7tvZ1t6+WPK04KD0MwzLZrG0se1hzBjSi5fyxlsiggoJHwh18PCFNn7tG43OWb6pdZ6Y+rMlmyNQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.54.0.tgz", + "integrity": "sha512-OywsdRHrFvCdvsewAInDKCNyR3laPA2mc9bRYJ6LBp5IyvF3fvXbbNR0bSzHlZVFtn6E0xw2oZlyjg4rKCVcng==", "cpu": [ "arm" ], @@ -2606,9 +2606,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.5.tgz", - "integrity": "sha512-wrSAViWvZHBMMlWk6EJhvg8/rjxzyEhEdgfMMjREHEq11EtJ6IP6yfcCH57YAEca2Oe3FNCE9DSTgU70EIGmVw==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.54.0.tgz", + "integrity": "sha512-Skx39Uv+u7H224Af+bDgNinitlmHyQX1K/atIA32JP3JQw6hVODX5tkbi2zof/E69M1qH2UoN3Xdxgs90mmNYw==", "cpu": [ "arm64" ], @@ -2620,9 +2620,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.5.tgz", - "integrity": "sha512-S87zZPBmRO6u1YXQLwpveZm4JfPpAa6oHBX7/ghSiGH3rz/KDgAu1rKdGutV+WUI6tKDMbaBJomhnT30Y2t4VQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.54.0.tgz", + "integrity": "sha512-k43D4qta/+6Fq+nCDhhv9yP2HdeKeP56QrUUTW7E6PhZP1US6NDqpJj4MY0jBHlJivVJD5P8NxrjuobZBJTCRw==", "cpu": [ "arm64" ], @@ -2634,9 +2634,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.5.tgz", - "integrity": "sha512-YTbnsAaHo6VrAczISxgpTva8EkfQus0VPEVJCEaboHtZRIb6h6j0BNxRBOwnDciFTZLDPW5r+ZBmhL/+YpTZgA==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.54.0.tgz", + "integrity": "sha512-cOo7biqwkpawslEfox5Vs8/qj83M/aZCSSNIWpVzfU2CYHa2G3P1UN5WF01RdTHSgCkri7XOlTdtk17BezlV3A==", "cpu": [ "x64" ], @@ -2648,9 +2648,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.5.tgz", - "integrity": "sha512-1T8eY2J8rKJWzaznV7zedfdhD1BqVs1iqILhmHDq/bqCUZsrMt+j8VCTHhP0vdfbHK3e1IQ7VYx3jlKqwlf+vw==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.54.0.tgz", + "integrity": "sha512-miSvuFkmvFbgJ1BevMa4CPCFt5MPGw094knM64W9I0giUIMMmRYcGW/JWZDriaw/k1kOBtsWh1z6nIFV1vPNtA==", "cpu": [ "arm64" ], @@ -2662,9 +2662,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.5.tgz", - "integrity": "sha512-sHTiuXyBJApxRn+VFMaw1U+Qsz4kcNlxQ742snICYPrY+DDL8/ZbaC4DVIB7vgZmp3jiDaKA0WpBdP0aqPJoBQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.54.0.tgz", + "integrity": "sha512-KGXIs55+b/ZfZsq9aR026tmr/+7tq6VG6MsnrvF4H8VhwflTIuYh+LFUlIsRdQSgrgmtM3fVATzEAj4hBQlaqQ==", "cpu": [ "x64" ], @@ -2676,9 +2676,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.5.tgz", - "integrity": "sha512-dV3T9MyAf0w8zPVLVBptVlzaXxka6xg1f16VAQmjg+4KMSTWDvhimI/Y6mp8oHwNrmnmVl9XxJ/w/mO4uIQONA==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.54.0.tgz", + "integrity": "sha512-EHMUcDwhtdRGlXZsGSIuXSYwD5kOT9NVnx9sqzYiwAc91wfYOE1g1djOEDseZJKKqtHAHGwnGPQu3kytmfaXLQ==", "cpu": [ "arm" ], @@ -2690,9 +2690,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.5.tgz", - "integrity": "sha512-wIGYC1x/hyjP+KAu9+ewDI+fi5XSNiUi9Bvg6KGAh2TsNMA3tSEs+Sh6jJ/r4BV/bx/CyWu2ue9kDnIdRyafcQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.54.0.tgz", + "integrity": "sha512-+pBrqEjaakN2ySv5RVrj/qLytYhPKEUwk+e3SFU5jTLHIcAtqh2rLrd/OkbNuHJpsBgxsD8ccJt5ga/SeG0JmA==", "cpu": [ "arm" ], @@ -2704,9 +2704,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.5.tgz", - "integrity": "sha512-Y+qVA0D9d0y2FRNiG9oM3Hut/DgODZbU9I8pLLPwAsU0tUKZ49cyV1tzmB/qRbSzGvY8lpgGkJuMyuhH7Ma+Vg==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.54.0.tgz", + "integrity": "sha512-NSqc7rE9wuUaRBsBp5ckQ5CVz5aIRKCwsoa6WMF7G01sX3/qHUw/z4pv+D+ahL1EIKy6Enpcnz1RY8pf7bjwng==", "cpu": [ "arm64" ], @@ -2718,9 +2718,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.5.tgz", - "integrity": "sha512-juaC4bEgJsyFVfqhtGLz8mbopaWD+WeSOYr5E16y+1of6KQjc0BpwZLuxkClqY1i8sco+MdyoXPNiCkQou09+g==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.54.0.tgz", + "integrity": "sha512-gr5vDbg3Bakga5kbdpqx81m2n9IX8M6gIMlQQIXiLTNeQW6CucvuInJ91EuCJ/JYvc+rcLLsDFcfAD1K7fMofg==", "cpu": [ "arm64" ], @@ -2732,9 +2732,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.5.tgz", - "integrity": "sha512-rIEC0hZ17A42iXtHX+EPJVL/CakHo+tT7W0pbzdAGuWOt2jxDFh7A/lRhsNHBcqL4T36+UiAgwO8pbmn3dE8wA==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.54.0.tgz", + "integrity": "sha512-gsrtB1NA3ZYj2vq0Rzkylo9ylCtW/PhpLEivlgWe0bpgtX5+9j9EZa0wtZiCjgu6zmSeZWyI/e2YRX1URozpIw==", "cpu": [ "loong64" ], @@ -2746,9 +2746,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.5.tgz", - "integrity": "sha512-T7l409NhUE552RcAOcmJHj3xyZ2h7vMWzcwQI0hvn5tqHh3oSoclf9WgTl+0QqffWFG8MEVZZP1/OBglKZx52Q==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.54.0.tgz", + "integrity": "sha512-y3qNOfTBStmFNq+t4s7Tmc9hW2ENtPg8FeUD/VShI7rKxNW7O4fFeaYbMsd3tpFlIg1Q8IapFgy7Q9i2BqeBvA==", "cpu": [ "ppc64" ], @@ -2760,9 +2760,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.5.tgz", - "integrity": "sha512-7OK5/GhxbnrMcxIFoYfhV/TkknarkYC1hqUw1wU2xUN3TVRLNT5FmBv4KkheSG2xZ6IEbRAhTooTV2+R5Tk0lQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.54.0.tgz", + "integrity": "sha512-89sepv7h2lIVPsFma8iwmccN7Yjjtgz0Rj/Ou6fEqg3HDhpCa+Et+YSufy27i6b0Wav69Qv4WBNl3Rs6pwhebQ==", "cpu": [ "riscv64" ], @@ -2774,9 +2774,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.5.tgz", - "integrity": "sha512-GwuDBE/PsXaTa76lO5eLJTyr2k8QkPipAyOrs4V/KJufHCZBJ495VCGJol35grx9xryk4V+2zd3Ri+3v7NPh+w==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.54.0.tgz", + "integrity": "sha512-ZcU77ieh0M2Q8Ur7D5X7KvK+UxbXeDHwiOt/CPSBTI1fBmeDMivW0dPkdqkT4rOgDjrDDBUed9x4EgraIKoR2A==", "cpu": [ "riscv64" ], @@ -2788,9 +2788,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.5.tgz", - "integrity": "sha512-IAE1Ziyr1qNfnmiQLHBURAD+eh/zH1pIeJjeShleII7Vj8kyEm2PF77o+lf3WTHDpNJcu4IXJxNO0Zluro8bOw==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.54.0.tgz", + "integrity": "sha512-2AdWy5RdDF5+4YfG/YesGDDtbyJlC9LHmL6rZw6FurBJ5n4vFGupsOBGfwMRjBYH7qRQowT8D/U4LoSvVwOhSQ==", "cpu": [ "s390x" ], @@ -2802,9 +2802,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.5.tgz", - "integrity": "sha512-Pg6E+oP7GvZ4XwgRJBuSXZjcqpIW3yCBhK4BcsANvb47qMvAbCjR6E+1a/U2WXz1JJxp9/4Dno3/iSJLcm5auw==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.54.0.tgz", + "integrity": "sha512-WGt5J8Ij/rvyqpFexxk3ffKqqbLf9AqrTBbWDk7ApGUzaIs6V+s2s84kAxklFwmMF/vBNGrVdYgbblCOFFezMQ==", "cpu": [ "x64" ], @@ -2816,9 +2816,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.5.tgz", - "integrity": "sha512-txGtluxDKTxaMDzUduGP0wdfng24y1rygUMnmlUJ88fzCCULCLn7oE5kb2+tRB+MWq1QDZT6ObT5RrR8HFRKqg==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.54.0.tgz", + "integrity": "sha512-JzQmb38ATzHjxlPHuTH6tE7ojnMKM2kYNzt44LO/jJi8BpceEC8QuXYA908n8r3CNuG/B3BV8VR3Hi1rYtmPiw==", "cpu": [ "x64" ], @@ -2830,9 +2830,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.5.tgz", - "integrity": "sha512-3DFiLPnTxiOQV993fMc+KO8zXHTcIjgaInrqlG8zDp1TlhYl6WgrOHuJkJQ6M8zHEcntSJsUp1XFZSY8C1DYbg==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.54.0.tgz", + "integrity": "sha512-huT3fd0iC7jigGh7n3q/+lfPcXxBi+om/Rs3yiFxjvSxbSB6aohDFXbWvlspaqjeOh+hx7DDHS+5Es5qRkWkZg==", "cpu": [ "arm64" ], @@ -2844,9 +2844,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.5.tgz", - "integrity": "sha512-nggc/wPpNTgjGg75hu+Q/3i32R00Lq1B6N1DO7MCU340MRKL3WZJMjA9U4K4gzy3dkZPXm9E1Nc81FItBVGRlA==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.54.0.tgz", + "integrity": "sha512-c2V0W1bsKIKfbLMBu/WGBz6Yci8nJ/ZJdheE0EwB73N3MvHYKiKGs3mVilX4Gs70eGeDaMqEob25Tw2Gb9Nqyw==", "cpu": [ "arm64" ], @@ -2858,9 +2858,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.5.tgz", - "integrity": "sha512-U/54pTbdQpPLBdEzCT6NBCFAfSZMvmjr0twhnD9f4EIvlm9wy3jjQ38yQj1AGznrNO65EWQMgm/QUjuIVrYF9w==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.54.0.tgz", + "integrity": "sha512-woEHgqQqDCkAzrDhvDipnSirm5vxUXtSKDYTVpZG3nUdW/VVB5VdCYA2iReSj/u3yCZzXID4kuKG7OynPnB3WQ==", "cpu": [ "ia32" ], @@ -2872,9 +2872,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.5.tgz", - "integrity": "sha512-2NqKgZSuLH9SXBBV2dWNRCZmocgSOx8OJSdpRaEcRlIfX8YrKxUT6z0F1NpvDVhOsl190UFTRh2F2WDWWCYp3A==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.54.0.tgz", + "integrity": "sha512-dzAc53LOuFvHwbCEOS0rPbXp6SIhAf2txMP5p6mGyOXXw5mWY8NGGbPMPrs4P1WItkfApDathBj/NzMLUZ9rtQ==", "cpu": [ "x64" ], @@ -2886,9 +2886,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.5.tgz", - "integrity": "sha512-JRpZUhCfhZ4keB5v0fe02gQJy05GqboPOaxvjugW04RLSYYoB/9t2lx2u/tMs/Na/1NXfY8QYjgRljRpN+MjTQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.54.0.tgz", + "integrity": "sha512-hYT5d3YNdSh3mbCU1gwQyPgQd3T2ne0A3KG8KSBdav5TiBg6eInVmV+TeR5uHufiIgSFg0XsOWGW5/RhNcSvPg==", "cpu": [ "x64" ], @@ -10036,9 +10036,9 @@ } }, "node_modules/rollup": { - "version": "4.53.5", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.5.tgz", - "integrity": "sha512-iTNAbFSlRpcHeeWu73ywU/8KuU/LZmNCSxp6fjQkJBD3ivUb8tpDrXhIxEzA05HlYMEwmtaUnb3RP+YNv162OQ==", + "version": "4.54.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.54.0.tgz", + "integrity": "sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==", "dev": true, "license": "MIT", "dependencies": { @@ -10052,28 +10052,28 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.53.5", - "@rollup/rollup-android-arm64": "4.53.5", - "@rollup/rollup-darwin-arm64": "4.53.5", - "@rollup/rollup-darwin-x64": "4.53.5", - "@rollup/rollup-freebsd-arm64": "4.53.5", - "@rollup/rollup-freebsd-x64": "4.53.5", - "@rollup/rollup-linux-arm-gnueabihf": "4.53.5", - "@rollup/rollup-linux-arm-musleabihf": "4.53.5", - "@rollup/rollup-linux-arm64-gnu": "4.53.5", - "@rollup/rollup-linux-arm64-musl": "4.53.5", - "@rollup/rollup-linux-loong64-gnu": "4.53.5", - "@rollup/rollup-linux-ppc64-gnu": "4.53.5", - "@rollup/rollup-linux-riscv64-gnu": "4.53.5", - "@rollup/rollup-linux-riscv64-musl": "4.53.5", - "@rollup/rollup-linux-s390x-gnu": "4.53.5", - "@rollup/rollup-linux-x64-gnu": "4.53.5", - "@rollup/rollup-linux-x64-musl": "4.53.5", - "@rollup/rollup-openharmony-arm64": "4.53.5", - "@rollup/rollup-win32-arm64-msvc": "4.53.5", - "@rollup/rollup-win32-ia32-msvc": "4.53.5", - "@rollup/rollup-win32-x64-gnu": "4.53.5", - "@rollup/rollup-win32-x64-msvc": "4.53.5", + "@rollup/rollup-android-arm-eabi": "4.54.0", + "@rollup/rollup-android-arm64": "4.54.0", + "@rollup/rollup-darwin-arm64": "4.54.0", + "@rollup/rollup-darwin-x64": "4.54.0", + "@rollup/rollup-freebsd-arm64": "4.54.0", + "@rollup/rollup-freebsd-x64": "4.54.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.54.0", + "@rollup/rollup-linux-arm-musleabihf": "4.54.0", + "@rollup/rollup-linux-arm64-gnu": "4.54.0", + "@rollup/rollup-linux-arm64-musl": "4.54.0", + "@rollup/rollup-linux-loong64-gnu": "4.54.0", + "@rollup/rollup-linux-ppc64-gnu": "4.54.0", + "@rollup/rollup-linux-riscv64-gnu": "4.54.0", + "@rollup/rollup-linux-riscv64-musl": "4.54.0", + "@rollup/rollup-linux-s390x-gnu": "4.54.0", + "@rollup/rollup-linux-x64-gnu": "4.54.0", + "@rollup/rollup-linux-x64-musl": "4.54.0", + "@rollup/rollup-openharmony-arm64": "4.54.0", + "@rollup/rollup-win32-arm64-msvc": "4.54.0", + "@rollup/rollup-win32-ia32-msvc": "4.54.0", + "@rollup/rollup-win32-x64-gnu": "4.54.0", + "@rollup/rollup-win32-x64-msvc": "4.54.0", "fsevents": "~2.3.2" } },