From 05f0cb26f8e7a5693037f2589fa7f3ff7ba6bb78 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 17 Dec 2025 06:04:17 +0100 Subject: [PATCH 01/58] Remove sentry. --- .env.example | 10 ---------- app/Exceptions/Handler.php | 6 ------ composer.json | 1 - config/firefly.php | 1 - 4 files changed, 18 deletions(-) diff --git a/.env.example b/.env.example index af3fc69a18..e6737be1e7 100644 --- a/.env.example +++ b/.env.example @@ -275,16 +275,6 @@ DISABLE_CSP_HEADER=false TRACKER_SITE_ID= TRACKER_URL= -# -# You can automatically submit errors to the Firefly III developer using sentry.io -# -# This is entirely optional of course. If you run into errors, I will gladly accept GitHub -# issues or a forwared email message. -# -# If you set this to true, your installation will try to contact sentry.io when it runs into errors. -# -REPORT_ERRORS_ONLINE=false - # # Firefly III supports webhooks. These are security sensitive and must be enabled manually first. # diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 5322b93e08..934040a0b7 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -42,7 +42,6 @@ use Illuminate\Validation\ValidationException as LaravelValidationException; use Laravel\Passport\Exceptions\OAuthServerException as LaravelOAuthException; use League\OAuth2\Server\Exception\OAuthServerException; use Override; -use Sentry\Laravel\Integration; use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; @@ -85,11 +84,6 @@ class Handler extends ExceptionHandler #[Override] public function register(): void { - if (true === config('firefly.report_errors_online')) { - $this->reportable(function (Throwable $e): void { - Integration::captureUnhandledException($e); - }); - } } /** diff --git a/composer.json b/composer.json index 51404b0790..0208b1e63d 100644 --- a/composer.json +++ b/composer.json @@ -103,7 +103,6 @@ "psr/log": "<4", "ramsey/uuid": "^4.7", "rcrowe/twigbridge": "^0.14", - "sentry/sentry-laravel": "^4.18", "spatie/laravel-html": "^3.2", "spatie/laravel-ignition": "^2", "spatie/period": "^2.4", diff --git a/config/firefly.php b/config/firefly.php index 8b4a44dbdd..e4fcb6f898 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -107,7 +107,6 @@ return [ 'demo_password' => env('DEMO_PASSWORD', ''), 'tracker_site_id' => env('TRACKER_SITE_ID', ''), 'tracker_url' => env('TRACKER_URL', ''), - 'report_errors_online' => env('REPORT_ERRORS_ONLINE', false), // authentication settings 'authentication_guard' => envNonEmpty('AUTHENTICATION_GUARD', 'web'), From 486e0d5ed5d26c939a5d97f472740689c091c5cb Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 17 Dec 2025 08:43:39 +0100 Subject: [PATCH 02/58] Update reference to Steam --- .../V1/Controllers/Chart/BudgetController.php | 2 +- .../Commands/Correction/CorrectsAmounts.php | 2 +- .../Commands/Correction/CorrectsIbans.php | 4 +- .../Correction/CorrectsUnevenAmount.php | 12 ++-- app/Exceptions/Handler.php | 2 +- app/Factory/TransactionFactory.php | 8 +-- .../Chart/Basic/ChartJsGenerator.php | 4 +- .../Report/Audit/MonthReportGenerator.php | 6 +- .../Collector/Extensions/AmountCollection.php | 16 ++--- .../Controllers/Account/EditController.php | 4 +- app/Http/Controllers/Bill/EditController.php | 4 +- .../Budget/BudgetLimitController.php | 2 +- .../Controllers/Budget/EditController.php | 2 +- .../Controllers/Budget/IndexController.php | 2 +- app/Http/Controllers/Chart/BillController.php | 2 +- .../Controllers/Chart/BudgetController.php | 12 ++-- .../Controllers/Chart/PiggyBankController.php | 2 +- app/Http/Controllers/JavascriptController.php | 2 +- .../Controllers/Json/ReconcileController.php | 4 +- .../Controllers/Json/RecurrenceController.php | 2 +- .../Controllers/PiggyBank/EditController.php | 2 +- .../Controllers/PreferencesController.php | 2 +- .../Transaction/DeleteController.php | 2 +- .../Transaction/LinkController.php | 2 +- .../Transaction/MassController.php | 4 +- app/Http/Middleware/StartFireflySession.php | 2 +- app/Http/Requests/AccountFormRequest.php | 2 +- app/Mail/NewIPAddressWarningMail.php | 2 +- .../Budget/OperationsRepository.php | 2 +- .../Category/NoCategoryRepository.php | 4 +- .../Category/OperationsRepository.php | 8 +-- app/Repositories/Tag/OperationsRepository.php | 4 +- .../TransactionGroupRepository.php | 8 +-- .../Internal/Support/AccountServiceTrait.php | 24 +++---- .../Support/CreditRecalculateService.php | 72 +++++++++---------- .../Internal/Update/AccountUpdateService.php | 4 +- .../Internal/Update/JournalUpdateService.php | 14 ++-- .../Chart/Budget/FrontpageChartGenerator.php | 2 +- .../Category/WholePeriodChartGenerator.php | 4 +- app/Support/Form/CurrencyForm.php | 4 +- .../Http/Controllers/ChartGeneration.php | 2 +- .../Http/Controllers/UserNavigation.php | 4 +- app/Support/Navigation.php | 4 +- .../RecalculatesAvailableBudgetsTrait.php | 2 +- .../Summarizer/TransactionSummarizer.php | 2 +- app/Support/Search/OperatorQuerySearch.php | 16 ++--- app/Support/Twig/General.php | 2 +- app/TransactionRules/Actions/SetAmount.php | 4 +- 48 files changed, 150 insertions(+), 148 deletions(-) diff --git a/app/Api/V1/Controllers/Chart/BudgetController.php b/app/Api/V1/Controllers/Chart/BudgetController.php index c63d7d32fa..952b736ceb 100644 --- a/app/Api/V1/Controllers/Chart/BudgetController.php +++ b/app/Api/V1/Controllers/Chart/BudgetController.php @@ -286,7 +286,7 @@ class BudgetController extends Controller } if (null !== $limit && $this->convertToPrimary) { // convert and add all amounts. - $limit->amount = app('steam')->positive($amount); + $limit->amount = \FireflyIII\Support\Facades\Steam::positive($amount); Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount)); } diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index 85243b437e..01efb63f45 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -244,7 +244,7 @@ class CorrectsAmounts extends Command return false; } if (-1 === $check) { - $item->trigger_value = app('steam')->positive($item->trigger_value); + $item->trigger_value = \FireflyIII\Support\Facades\Steam::positive($item->trigger_value); $item->save(); return true; diff --git a/app/Console/Commands/Correction/CorrectsIbans.php b/app/Console/Commands/Correction/CorrectsIbans.php index 3b41d44bf5..e07651840c 100644 --- a/app/Console/Commands/Correction/CorrectsIbans.php +++ b/app/Console/Commands/Correction/CorrectsIbans.php @@ -55,7 +55,7 @@ class CorrectsIbans extends Command /** @var Account $account */ foreach ($accounts as $account) { $iban = (string) $account->iban; - $newIban = app('steam')->filterSpaces($iban); + $newIban = \FireflyIII\Support\Facades\Steam::filterSpaces($iban); if ('' !== $iban && $iban !== $newIban) { $account->iban = $newIban; $account->save(); @@ -66,7 +66,7 @@ class CorrectsIbans extends Command $accountNumber = $account->accountMeta->where('name', 'account_number')->first(); if (null !== $accountNumber) { $number = (string) $accountNumber->value; - $newNumber = app('steam')->filterSpaces($number); + $newNumber = \FireflyIII\Support\Facades\Steam::filterSpaces($number); if ('' !== $number && $number !== $newNumber) { $accountNumber->value = $newNumber; $accountNumber->save(); diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 16c8140387..3d82e9c4ff 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -112,9 +112,9 @@ class CorrectsUnevenAmount extends Command if ($source->transaction_currency_id === $destination->transaction_currency_id) { Log::debug('Ready to swap data between transactions.'); $destination->foreign_currency_id = $source->transaction_currency_id; - $destination->foreign_amount = app('steam')->positive($source->amount); + $destination->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); $destination->transaction_currency_id = $source->foreign_currency_id; - $destination->amount = app('steam')->positive($source->foreign_amount); + $destination->amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount); $destination->balance_dirty = true; $source->balance_dirty = true; $destination->save(); @@ -257,8 +257,8 @@ class CorrectsUnevenAmount extends Command // source currency = dest foreign currency // dest amount = source foreign currency // dest currency = source foreign currency - // Log::debug(sprintf('[a] %s', bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount)))); - // Log::debug(sprintf('[b] %s', bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount)))); + // Log::debug(sprintf('[a] %s', bccomp(\FireflyIII\Support\Facades\Steam::positive($source->amount), \FireflyIII\Support\Facades\Steam::positive($destination->foreign_amount)))); + // Log::debug(sprintf('[b] %s', bccomp(\FireflyIII\Support\Facades\Steam::positive($destination->amount), \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount)))); // Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true))); // Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true))); return 0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount)) @@ -428,9 +428,9 @@ class CorrectsUnevenAmount extends Command // // only fix the destination transaction // $destination->foreign_currency_id = $source->transaction_currency_id; - // $destination->foreign_amount = app('steam')->positive($source->amount); + // $destination->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); // $destination->transaction_currency_id = $source->foreign_currency_id; - // $destination->amount = app('steam')->positive($source->foreign_amount); + // $destination->amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount); // $destination->balance_dirty = true; // $source->balance_dirty = true; // $destination->save(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 934040a0b7..761e17ebbc 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -281,7 +281,7 @@ class Handler extends ExceptionHandler protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse { // protect against open redirect when submitting invalid forms. - $previous = app('steam')->getSafePreviousUrl(); + $previous = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl(); $redirect = $this->getRedirectUrl($exception); return redirect($redirect ?? $previous) diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php index a5a58a96a6..7695786275 100644 --- a/app/Factory/TransactionFactory.php +++ b/app/Factory/TransactionFactory.php @@ -58,10 +58,10 @@ class TransactionFactory $foreignAmount = null; } if (null !== $foreignAmount) { - $foreignAmount = app('steam')->negative($foreignAmount); + $foreignAmount = \FireflyIII\Support\Facades\Steam::negative($foreignAmount); } - return $this->create(app('steam')->negative($amount), $foreignAmount); + return $this->create(\FireflyIII\Support\Facades\Steam::negative($amount), $foreignAmount); } /** @@ -170,10 +170,10 @@ class TransactionFactory $foreignAmount = null; } if (null !== $foreignAmount) { - $foreignAmount = app('steam')->positive($foreignAmount); + $foreignAmount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount); } - return $this->create(app('steam')->positive($amount), $foreignAmount); + return $this->create(\FireflyIII\Support\Facades\Steam::positive($amount), $foreignAmount); } public function setAccount(Account $account): void diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php index 4fd3a258e7..fa971d0d16 100644 --- a/app/Generator/Chart/Basic/ChartJsGenerator.php +++ b/app/Generator/Chart/Basic/ChartJsGenerator.php @@ -56,7 +56,7 @@ class ChartJsGenerator implements GeneratorInterface $index = 0; foreach ($data as $key => $valueArray) { // make larger than 0 - $chartData['datasets'][0]['data'][] = app('steam')->positive((string) $valueArray['amount']); + $chartData['datasets'][0]['data'][] = \FireflyIII\Support\Facades\Steam::positive((string) $valueArray['amount']); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol']; $chartData['labels'][] = $key; @@ -163,7 +163,7 @@ class ChartJsGenerator implements GeneratorInterface $index = 0; foreach ($data as $key => $value) { // make larger than 0 - $chartData['datasets'][0]['data'][] = app('steam')->positive((string) $value); + $chartData['datasets'][0]['data'][] = \FireflyIII\Support\Facades\Steam::positive((string) $value); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['labels'][] = $key; diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index ffc3fe6c24..10e889e850 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -153,13 +153,13 @@ class MonthReportGenerator implements ReportGeneratorInterface // make sure amount is in the right "direction". if ($account->id === $journal['destination_account_id']) { - $transactionAmount = app('steam')->positive($journal['amount']); + $transactionAmount = \FireflyIII\Support\Facades\Steam::positive($journal['amount']); } if ($currency->id === $journal['foreign_currency_id']) { $transactionAmount = $journal['foreign_amount']; if ($account->id === $journal['destination_account_id']) { - $transactionAmount = app('steam')->positive($journal['foreign_amount']); + $transactionAmount = \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']); } } @@ -175,7 +175,7 @@ class MonthReportGenerator implements ReportGeneratorInterface $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date'); $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date'); } - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); // call is correct. Log::debug(sprintf('getAuditReport end: Call finalAccountBalance with date/time "%s"', $this->end->toIso8601String())); diff --git a/app/Helpers/Collector/Extensions/AmountCollection.php b/app/Helpers/Collector/Extensions/AmountCollection.php index 6daf0192a7..60d46b680e 100644 --- a/app/Helpers/Collector/Extensions/AmountCollection.php +++ b/app/Helpers/Collector/Extensions/AmountCollection.php @@ -39,7 +39,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('source.amount', app('steam')->negative($amount)); + $q->where('source.amount', \FireflyIII\Support\Facades\Steam::negative($amount)); } ); @@ -50,7 +50,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('source.amount', '!=', app('steam')->negative($amount)); + $q->where('source.amount', '!=', \FireflyIII\Support\Facades\Steam::negative($amount)); } ); @@ -64,7 +64,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('destination.amount', '<=', app('steam')->positive($amount)); + $q->where('destination.amount', '<=', \FireflyIII\Support\Facades\Steam::positive($amount)); } ); @@ -78,7 +78,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('destination.amount', '>=', app('steam')->positive($amount)); + $q->where('destination.amount', '>=', \FireflyIII\Support\Facades\Steam::positive($amount)); } ); @@ -93,7 +93,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNotNull('source.foreign_amount'); - $q->where('source.foreign_amount', app('steam')->negative($amount)); + $q->where('source.foreign_amount', \FireflyIII\Support\Facades\Steam::negative($amount)); } ); @@ -108,7 +108,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNull('source.foreign_amount'); - $q->orWhere('source.foreign_amount', '!=', app('steam')->negative($amount)); + $q->orWhere('source.foreign_amount', '!=', \FireflyIII\Support\Facades\Steam::negative($amount)); } ); @@ -123,7 +123,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNotNull('destination.foreign_amount'); - $q->where('destination.foreign_amount', '<=', app('steam')->positive($amount)); + $q->where('destination.foreign_amount', '<=', \FireflyIII\Support\Facades\Steam::positive($amount)); } ); @@ -138,7 +138,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNotNull('destination.foreign_amount'); - $q->where('destination.foreign_amount', '>=', app('steam')->positive($amount)); + $q->where('destination.foreign_amount', '>=', \FireflyIII\Support\Facades\Steam::positive($amount)); } ); diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index 2b0c39e870..bc023e3798 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -148,9 +148,9 @@ class EditController extends Controller 'BIC' => $repository->getMetaValue($account, 'BIC'), 'opening_balance_date' => substr((string) $openingBalanceDate, 0, 10), 'liability_type_id' => $account->account_type_id, - 'opening_balance' => app('steam')->bcround($openingBalanceAmount, $currency->decimal_places), + 'opening_balance' => \FireflyIII\Support\Facades\Steam::bcround($openingBalanceAmount, $currency->decimal_places), 'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'), - 'virtual_balance' => app('steam')->bcround($virtualBalance, $currency->decimal_places), + 'virtual_balance' => \FireflyIII\Support\Facades\Steam::bcround($virtualBalance, $currency->decimal_places), 'currency_id' => $currency->id, 'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : $includeNetWorth, 'interest' => $repository->getMetaValue($account, 'interest'), diff --git a/app/Http/Controllers/Bill/EditController.php b/app/Http/Controllers/Bill/EditController.php index 536eabb827..8fde3f7942 100644 --- a/app/Http/Controllers/Bill/EditController.php +++ b/app/Http/Controllers/Bill/EditController.php @@ -84,8 +84,8 @@ class EditController extends Controller $this->rememberPreviousUrl('bills.edit.url'); } - $bill->amount_min = app('steam')->bcround($bill->amount_min, $bill->transactionCurrency->decimal_places); - $bill->amount_max = app('steam')->bcround($bill->amount_max, $bill->transactionCurrency->decimal_places); + $bill->amount_min = \FireflyIII\Support\Facades\Steam::bcround($bill->amount_min, $bill->transactionCurrency->decimal_places); + $bill->amount_max = \FireflyIII\Support\Facades\Steam::bcround($bill->amount_max, $bill->transactionCurrency->decimal_places); $rules = $this->repository->getRulesForBill($bill); // code to handle active-checkboxes diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php index c074746c2a..9d97ba5228 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -274,7 +274,7 @@ class BudgetLimitController extends Controller $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'] = app('steam')->bcround($limit['amount'], $limit->transactionCurrency->decimal_places); + $array['amount'] = \FireflyIII\Support\Facades\Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places); $array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']); if ('true' === $request->get('redirect')) { return redirect(route('budgets.index')); diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index a164365fcd..9804fa2011 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -104,7 +104,7 @@ class EditController extends Controller $amount = '0'; } $amount = (string) $amount; - $preFilled['auto_budget_amount'] = app('steam')->bcround($amount, $autoBudget->transactionCurrency->decimal_places); + $preFilled['auto_budget_amount'] = \FireflyIII\Support\Facades\Steam::bcround($amount, $autoBudget->transactionCurrency->decimal_places); } // put previous url in session if not redirect from store (not "return_to_edit"). diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index 476987f58c..a59ad983d9 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -203,7 +203,7 @@ class IndexController extends Controller foreach ($budgetLimits as $limit) { Log::debug(sprintf('Working on budget limit #%d', $limit->id)); $currency = $limit->transactionCurrency ?? $primaryCurrency; - $amount = app('steam')->bcround($limit->amount, $currency->decimal_places); + $amount = \FireflyIII\Support\Facades\Steam::bcround($limit->amount, $currency->decimal_places); $array['budgeted'][] = [ 'id' => $limit->id, 'amount' => $amount, diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index 3ea69e293f..f5e770deb3 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -113,7 +113,7 @@ class BillController extends Controller if ($cache->has()) { return response()->json($cache->get()); } - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index a2d1ee0911..08d49b3b53 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -166,7 +166,7 @@ class BudgetController extends Controller if ($cache->has()) { return response()->json($cache->get()); } - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); $entries = []; $amount = $budgetLimit->amount ?? '0'; $budgetCollection = new Collection()->push($budget); @@ -531,13 +531,13 @@ class BudgetController extends Controller // get budget limit in this period for this currency. $limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd); if ($limit instanceof BudgetLimit) { - $chartData[1]['entries'][$title] = app('steam')->bcround($limit->amount, $currency->decimal_places); + $chartData[1]['entries'][$title] = \FireflyIII\Support\Facades\Steam::bcround($limit->amount, $currency->decimal_places); } // get spent amount in this period for this currency. $sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency); - $amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0'); - $chartData[0]['entries'][$title] = app('steam')->bcround($amount, $currency->decimal_places); + $amount = \FireflyIII\Support\Facades\Steam::positive($sum[$currency->id]['sum'] ?? '0'); + $chartData[0]['entries'][$title] = \FireflyIII\Support\Facades\Steam::bcround($amount, $currency->decimal_places); $currentStart = clone $currentEnd; $currentStart->addDay()->startOfDay(); @@ -574,8 +574,8 @@ class BudgetController extends Controller $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange); $title = $currentStart->isoFormat($titleFormat); $sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency); - $amount = app('steam')->positive($sum[$currency->id]['sum'] ?? '0'); - $chartData[$title] = app('steam')->bcround($amount, $currency->decimal_places); + $amount = \FireflyIII\Support\Facades\Steam::positive($sum[$currency->id]['sum'] ?? '0'); + $chartData[$title] = \FireflyIII\Support\Facades\Steam::bcround($amount, $currency->decimal_places); $currentStart = Navigation::addPeriod($currentStart, $preferredRange, 0); } diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index ed8a549951..a29e2a2d99 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -70,7 +70,7 @@ class PiggyBankController extends Controller } $set = $repository->getEvents($piggyBank); $set = $set->reverse(); - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); // get first event or start date of piggy bank or today $startDate = $piggyBank->start_date ?? today(config('app.timezone')); diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index 65eeab1fa4..da60ccd5d4 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -105,7 +105,7 @@ class JavascriptController extends Controller if ($account instanceof Account) { $currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency; } - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); $accounting = app('amount')->getJsConfig(); $accounting['frac_digits'] = $currency->decimal_places; $pref = Preferences::get('language', config('firefly.default_language', 'en_US')); diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index 4dd4c2274c..d3fa071e80 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -278,9 +278,9 @@ class ReconcileController extends Controller } if ($inverse) { - $journal['amount'] = app('steam')->positive($journal['amount']); + $journal['amount'] = \FireflyIII\Support\Facades\Steam::positive($journal['amount']); if (null !== $journal['foreign_amount']) { - $journal['foreign_amount'] = app('steam')->positive($journal['foreign_amount']); + $journal['foreign_amount'] = \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']); } } diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php index 8b18a8abef..c687933934 100644 --- a/app/Http/Controllers/Json/RecurrenceController.php +++ b/app/Http/Controllers/Json/RecurrenceController.php @@ -167,7 +167,7 @@ class RecurrenceController extends Controller } $date->startOfDay(); $preSelected = (string) $request->get('pre_select'); - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true))); Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true))); diff --git a/app/Http/Controllers/PiggyBank/EditController.php b/app/Http/Controllers/PiggyBank/EditController.php index 67fee2f363..ac1ed8cbcd 100644 --- a/app/Http/Controllers/PiggyBank/EditController.php +++ b/app/Http/Controllers/PiggyBank/EditController.php @@ -89,7 +89,7 @@ class EditController extends Controller $preFilled = [ 'name' => $piggyBank->name, 'transaction_currency_id' => (int) $piggyBank->transaction_currency_id, - 'target_amount' => app('steam')->bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places), + 'target_amount' => \FireflyIII\Support\Facades\Steam::bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places), 'target_date' => $targetDate, 'start_date' => $startDate, 'accounts' => [], diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 3d3badcd3f..397f8f125e 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -108,7 +108,7 @@ class PreferencesController extends Controller if (!is_array($frontpageAccounts)) { $frontpageAccounts = $accountIds; } - $language = app('steam')->getLanguage(); + $language = \FireflyIII\Support\Facades\Steam::getLanguage(); $languages = config('firefly.languages'); $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; $listPageSize = Preferences::get('listPageSize', 50)->data; diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php index 436d936ece..c45b8c4474 100644 --- a/app/Http/Controllers/Transaction/DeleteController.php +++ b/app/Http/Controllers/Transaction/DeleteController.php @@ -83,7 +83,7 @@ class DeleteController extends Controller } $objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type); $subTitle = (string) trans('firefly.delete_'.$objectType, ['description' => $group->title ?? $journal->description]); - $previous = app('steam')->getSafePreviousUrl(); + $previous = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl(); // put previous url in session Log::debug('Will try to remember previous URL'); $this->rememberPreviousUrl('transactions.delete.url'); diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.php index abe01f4427..6c72783323 100644 --- a/app/Http/Controllers/Transaction/LinkController.php +++ b/app/Http/Controllers/Transaction/LinkController.php @@ -145,6 +145,6 @@ class LinkController extends Controller $linkId = (int) $request->get('id'); $this->repository->switchLinkById($linkId); - return redirect(app('steam')->getSafePreviousUrl()); + return redirect(\FireflyIII\Support\Facades\Steam::getSafePreviousUrl()); } } diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index 5ec860e98e..cdb3bf7daa 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -142,9 +142,9 @@ class MassController extends Controller // reverse amounts foreach ($journals as $index => $journal) { - $journals[$index]['amount'] = app('steam')->bcround(app('steam')->positive($journal['amount']), $journal['currency_decimal_places']); + $journals[$index]['amount'] = \FireflyIII\Support\Facades\Steam::bcround(\FireflyIII\Support\Facades\Steam::positive($journal['amount']), $journal['currency_decimal_places']); $journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] - ? null : app('steam')->positive($journal['foreign_amount']); + ? null : \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']); } $this->rememberPreviousUrl('transactions.mass-edit.url'); diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.php index 02aab37b34..b13ea8f985 100644 --- a/app/Http/Middleware/StartFireflySession.php +++ b/app/Http/Middleware/StartFireflySession.php @@ -42,7 +42,7 @@ class StartFireflySession extends StartSession protected function storeCurrentUrl(Request $request, $session): void { $url = $request->fullUrl(); - $safeUrl = app('steam')->getSafeUrl($url, route('index')); + $safeUrl = \FireflyIII\Support\Facades\Steam::getSafeUrl($url, route('index')); if ($url !== $safeUrl) { return; diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index 8d99bc4765..6d501a7f64 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -87,7 +87,7 @@ class AccountFormRequest extends FormRequest $data['account_type_id'] = $this->convertInteger('liability_type_id'); if ('' !== $data['opening_balance']) { // opening balance is always positive for liabilities - $data['opening_balance'] = app('steam')->positive($data['opening_balance']); + $data['opening_balance'] = \FireflyIII\Support\Facades\Steam::positive($data['opening_balance']); } } diff --git a/app/Mail/NewIPAddressWarningMail.php b/app/Mail/NewIPAddressWarningMail.php index 11af099b21..6466ec4593 100644 --- a/app/Mail/NewIPAddressWarningMail.php +++ b/app/Mail/NewIPAddressWarningMail.php @@ -57,7 +57,7 @@ class NewIPAddressWarningMail extends Mailable $this->host = ''; try { - $hostName = app('steam')->getHostName($this->ipAddress); + $hostName = \FireflyIII\Support\Facades\Steam::getHostName($this->ipAddress); } catch (FireflyException $e) { Log::error($e->getMessage()); $hostName = $this->ipAddress; diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index 15d3ea38f9..361b8daee0 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -157,7 +157,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; foreach ($journals as $journal) { - $amount = app('steam')->negative($journal['amount']); + $amount = \FireflyIII\Support\Facades\Steam::negative($journal['amount']); $journalCurrencyId = (int) $journal['currency_id']; if (false === $convertToPrimary) { $currencyId = $journalCurrencyId; diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index 43c64c27ef..bf3f30fff1 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -78,7 +78,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->negative($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), 'date' => $journal['date'], ]; } @@ -124,7 +124,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->positive($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), 'date' => $journal['date'], ]; } diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php index a1fe709f4c..e12a3e5abe 100644 --- a/app/Repositories/Category/OperationsRepository.php +++ b/app/Repositories/Category/OperationsRepository.php @@ -100,7 +100,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->negative($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'budget_name' => $journal['budget_name'], @@ -178,7 +178,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->positive($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'destination_account_id' => (string) $journal['destination_account_id'], @@ -240,7 +240,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->positive($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'category_name' => $journal['category_name'], @@ -303,7 +303,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->negative($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'category_name' => $journal['category_name'], diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php index 94ba8a0db5..c2aa0d926c 100644 --- a/app/Repositories/Tag/OperationsRepository.php +++ b/app/Repositories/Tag/OperationsRepository.php @@ -97,7 +97,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; $array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->negative($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), 'date' => $journal['date'], 'source_account_id' => $journal['source_account_id'], 'budget_name' => $journal['budget_name'], @@ -182,7 +182,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->positive($journal['amount']), + 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), 'date' => $journal['date'], 'source_account_id' => $journal['source_account_id'], 'budget_name' => $journal['budget_name'], diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index e2f3842a54..f59ce6f048 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -245,9 +245,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $transaction = $journal->transactions->first(); $currency = $transaction->transactionCurrency; $type = $journal->transactionType->type; - $amount = app('steam')->positive($transaction->amount); + $amount = \FireflyIII\Support\Facades\Steam::positive($transaction->amount); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { - return Amount::formatAnything($currency, app('steam')->negative($amount)); + return Amount::formatAnything($currency, \FireflyIII\Support\Facades\Steam::negative($amount)); } return Amount::formatAnything($currency, $amount); @@ -267,9 +267,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $currency = $transaction->foreignCurrency; $type = $journal->transactionType->type; - $amount = app('steam')->positive($transaction->foreign_amount); + $amount = \FireflyIII\Support\Facades\Steam::positive($transaction->foreign_amount); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { - return Amount::formatAnything($currency, app('steam')->negative($amount)); + return Amount::formatAnything($currency, \FireflyIII\Support\Facades\Steam::negative($amount)); } return Amount::formatAnything($currency, $amount); diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index 166792d150..50cd9958ac 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -65,7 +65,7 @@ trait AccountServiceTrait return null; } - return app('steam')->filterSpaces($iban); + return \FireflyIII\Support\Facades\Steam::filterSpaces($iban); } /** @@ -225,7 +225,7 @@ trait AccountServiceTrait } // make amount positive, regardless: - $amount = app('steam')->positive($amount); + $amount = \FireflyIII\Support\Facades\Steam::positive($amount); // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); @@ -371,12 +371,12 @@ trait AccountServiceTrait } // if direction is "debit" (I owe this debt), amount is negative. // which means the liability will have a negative balance which the user must fill. - $openingBalance = app('steam')->negative($openingBalance); + $openingBalance = \FireflyIII\Support\Facades\Steam::negative($openingBalance); // if direction is "credit" (I am owed this debt), amount is positive. // which means the liability will have a positive balance which is drained when its paid back into any asset. if ('credit' === $direction) { - $openingBalance = app('steam')->positive($openingBalance); + $openingBalance = \FireflyIII\Support\Facades\Steam::positive($openingBalance); } // create if not exists: @@ -398,11 +398,11 @@ trait AccountServiceTrait $journal->transactionCurrency()->associate($currency); // account always gains money: - $accountTransaction->amount = app('steam')->positive($openingBalance); + $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; // CL account always loses money: - $clTransaction->amount = app('steam')->negative($openingBalance); + $clTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance); $clTransaction->transaction_currency_id = $currency->id; // save both $accountTransaction->save(); @@ -448,7 +448,7 @@ trait AccountServiceTrait } // amount must be positive for the transaction to work. - $amount = app('steam')->positive($openingBalance); + $amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); @@ -584,21 +584,21 @@ trait AccountServiceTrait if (1 === bccomp('0', $openingBalance)) { Log::debug('Amount is negative.'); // account transaction loses money: - $accountTransaction->amount = app('steam')->negative($openingBalance); + $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; // OB account transaction gains money - $obTransaction->amount = app('steam')->positive($openingBalance); + $obTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); $obTransaction->transaction_currency_id = $currency->id; } if (-1 === bccomp('0', $openingBalance)) { Log::debug('Amount is positive.'); // account gains money: - $accountTransaction->amount = app('steam')->positive($openingBalance); + $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; // OB account loses money: - $obTransaction->amount = app('steam')->negative($openingBalance); + $obTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance); $obTransaction->transaction_currency_id = $currency->id; } // save both @@ -646,7 +646,7 @@ trait AccountServiceTrait } // make amount positive, regardless: - $amount = app('steam')->positive($openingBalance); + $amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php index 711732155d..228c9a0477 100644 --- a/app/Services/Internal/Support/CreditRecalculateService.php +++ b/app/Services/Internal/Support/CreditRecalculateService.php @@ -159,8 +159,8 @@ class CreditRecalculateService $this->validateOpeningBalance($account, $openingBalance); } $startOfDebt = $this->repository->getOpeningBalanceAmount($account, false) ?? '0'; - $leftOfDebt = app('steam')->positive($startOfDebt); - // Log::debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', app('steam')->bcround($startOfDebt, 2), app('steam')->bcround($leftOfDebt, 2))); + $leftOfDebt = \FireflyIII\Support\Facades\Steam::positive($startOfDebt); + // Log::debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', \FireflyIII\Support\Facades\Steam::bcround($startOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2))); /** @var AccountMetaFactory $factory */ $factory = app(AccountMetaFactory::class); @@ -200,17 +200,17 @@ class CreditRecalculateService $dest = $openingBalance->transactions()->where('amount', '>', 0)->first(); if ($source->account_id !== $account->id) { Log::info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id)); - Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, app('steam')->positive($source->amount))); - Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, app('steam')->negative($dest->amount))); - $source->amount = app('steam')->positive($source->amount); - $dest->amount = app('steam')->negative($source->amount); + Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, \FireflyIII\Support\Facades\Steam::positive($source->amount))); + Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, \FireflyIII\Support\Facades\Steam::negative($dest->amount))); + $source->amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); + $dest->amount = \FireflyIII\Support\Facades\Steam::negative($source->amount); if (null !== $source->foreign_amount && '' !== $source->foreign_amount) { - $source->foreign_amount = app('steam')->positive($source->foreign_amount); - Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, app('steam')->positive($source->foreign_amount))); + $source->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount); + Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount))); } if (null !== $dest->foreign_amount && '' !== $dest->foreign_amount) { - $dest->foreign_amount = app('steam')->negative($dest->foreign_amount); - Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, app('steam')->negative($dest->foreign_amount))); + $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::negative($dest->foreign_amount); + Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, \FireflyIII\Support\Facades\Steam::negative($dest->foreign_amount))); } $source->save(); $dest->save(); @@ -241,7 +241,7 @@ class CreditRecalculateService $foreignCurrency = $transaction->foreignCurrency; $accountCurrency = $this->repository->getAccountCurrency($account); $type = $journal->transactionType->type; - // Log::debug(sprintf('Left of debt is: %s', app('steam')->bcround($leftOfDebt, 2))); + // Log::debug(sprintf('Left of debt is: %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2))); if ('' === $direction) { // Log::warning('Direction is empty, so do nothing.'); @@ -262,81 +262,81 @@ class CreditRecalculateService $isCredit = 'credit' === $direction; if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isTransferIn($usedAmount, $type)) { // case 9 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); // 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS. - // Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isTransferOut($usedAmount, $type)) { // case 10 - $usedAmount = app('steam')->positive($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE. - // Log::debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case 10 (transfer out of debit liability, means you owe MORE): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } // in any other case, remove amount from left of debt. if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value], true)) { - $usedAmount = app('steam')->negative($usedAmount); + $usedAmount = \FireflyIII\Support\Facades\Steam::negative($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); - // Log::debug(sprintf('Case X (all other cases): %s + %s = %s', app('steam')->bcround($leftOfDebt, 2), app('steam')->bcround($usedAmount, 2), app('steam')->bcround($result, 2))); + // Log::debug(sprintf('Case X (all other cases): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } - Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, 2))); + Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2))); return $leftOfDebt; } @@ -344,10 +344,10 @@ class CreditRecalculateService private function getAmountToUse(Transaction $transaction, TransactionCurrency $accountCurrency, ?TransactionCurrency $foreignCurrency): string { $usedAmount = $transaction->amount; - // Log::debug(sprintf('Amount of transaction is %s', app('steam')->bcround($usedAmount, 2))); + // Log::debug(sprintf('Amount of transaction is %s', \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2))); if ($foreignCurrency instanceof TransactionCurrency && $foreignCurrency->id === $accountCurrency->id) { $usedAmount = $transaction->foreign_amount; - // Log::debug(sprintf('Overruled by foreign amount. Amount of transaction is now %s', app('steam')->bcround($usedAmount, 2))); + // Log::debug(sprintf('Overruled by foreign amount. Amount of transaction is now %s', \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2))); } return $usedAmount; diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index 44c3dfedab..1d343b1f9b 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -123,7 +123,7 @@ class AccountUpdateService $account->active = $data['active']; } if (array_key_exists('iban', $data)) { - $account->iban = app('steam')->filterSpaces((string) $data['iban']); + $account->iban = \FireflyIII\Support\Facades\Steam::filterSpaces((string) $data['iban']); } // set liability, but account must already be a liability. @@ -269,7 +269,7 @@ class AccountUpdateService // if liability, make sure the amount is positive for a credit, and negative for a debit. if ($this->isLiability($account)) { - $openingBalance = 'credit' === $data['liability_direction'] ? app('steam')->positive($openingBalance) : app('steam')->negative( + $openingBalance = 'credit' === $data['liability_direction'] ? \FireflyIII\Support\Facades\Steam::positive($openingBalance) : \FireflyIII\Support\Facades\Steam::negative( $openingBalance ); } diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index e3b3b21acb..2ee39a6728 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -47,6 +47,7 @@ use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface use FireflyIII\Services\Internal\Support\JournalServiceTrait; use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Preferences; +use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\NullArrayObject; use FireflyIII\Validation\AccountValidator; use Illuminate\Support\Facades\Log; @@ -661,12 +662,12 @@ class JournalUpdateService return; } $origSourceTransaction = $this->getSourceTransaction(); - $origSourceTransaction->amount = app('steam')->negative($amount); + $origSourceTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($amount); $origSourceTransaction->balance_dirty = true; $origSourceTransaction->save(); $destTransaction = $this->getDestinationTransaction(); $originalAmount = $destTransaction->amount; - $destTransaction->amount = app('steam')->positive($amount); + $destTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($amount); $destTransaction->balance_dirty = true; $destTransaction->save(); // refresh transactions. @@ -682,6 +683,7 @@ class JournalUpdateService return; } + // should not return in NULL but seems to do. event(new TriggeredAuditLog( $group->user, $group, @@ -729,7 +731,7 @@ class JournalUpdateService // add foreign currency info to source and destination if possible. if (null !== $foreignCurrency && null !== $foreignAmount) { $source->foreign_currency_id = $foreignCurrency->id; - $source->foreign_amount = app('steam')->negative($foreignAmount); + $source->foreign_amount = \FireflyIII\Support\Facades\Steam::negative($foreignAmount); $source->save(); // if the transaction is a TRANSFER, and the foreign amount and currency are set (like they seem to be) @@ -742,13 +744,13 @@ class JournalUpdateService if ($isTransfer || $isBetween) { Log::debug('Switch amounts, store in amount and not foreign_amount'); $dest->transaction_currency_id = $foreignCurrency->id; - $dest->amount = app('steam')->positive($foreignAmount); - $dest->foreign_amount = app('steam')->positive($source->amount); + $dest->amount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount); + $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); $dest->foreign_currency_id = $source->transaction_currency_id; } if (!$isTransfer && !$isBetween) { $dest->foreign_currency_id = $foreignCurrency->id; - $dest->foreign_amount = app('steam')->positive($foreignAmount); + $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount); } $dest->save(); diff --git a/app/Support/Chart/Budget/FrontpageChartGenerator.php b/app/Support/Chart/Budget/FrontpageChartGenerator.php index 7633e4fb92..3893c10030 100644 --- a/app/Support/Chart/Budget/FrontpageChartGenerator.php +++ b/app/Support/Chart/Budget/FrontpageChartGenerator.php @@ -102,7 +102,7 @@ class FrontpageChartGenerator $this->blRepository->setUser($user); $this->opsRepository->setUser($user); - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); $this->monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale); } diff --git a/app/Support/Chart/Category/WholePeriodChartGenerator.php b/app/Support/Chart/Category/WholePeriodChartGenerator.php index e0ea91ac9a..7ea1f1374e 100644 --- a/app/Support/Chart/Category/WholePeriodChartGenerator.php +++ b/app/Support/Chart/Category/WholePeriodChartGenerator.php @@ -102,8 +102,8 @@ class WholePeriodChartGenerator $earnedInfoKey = sprintf('earned-in-%s', $code); $spentAmount = $spent[$key][$currencyId]['sum'] ?? '0'; $earnedAmount = $earned[$key][$currencyId]['sum'] ?? '0'; - $chartData[$spentInfoKey]['entries'][$label] = app('steam')->bcround($spentAmount, $currency['currency_decimal_places']); - $chartData[$earnedInfoKey]['entries'][$label] = app('steam')->bcround($earnedAmount, $currency['currency_decimal_places']); + $chartData[$spentInfoKey]['entries'][$label] = \FireflyIII\Support\Facades\Steam::bcround($spentAmount, $currency['currency_decimal_places']); + $chartData[$earnedInfoKey]['entries'][$label] = \FireflyIII\Support\Facades\Steam::bcround($earnedAmount, $currency['currency_decimal_places']); } $current = Navigation::addPeriod($current, $step); } diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index c8005211cf..9be6d34aa3 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -150,7 +150,7 @@ class CurrencyForm // make sure value is formatted nicely: if (null !== $value && '' !== $value) { - $value = app('steam')->bcround($value, $primaryCurrency->decimal_places); + $value = \FireflyIII\Support\Facades\Steam::bcround($value, $primaryCurrency->decimal_places); } try { @@ -202,7 +202,7 @@ class CurrencyForm // make sure value is formatted nicely: if (null !== $value && '' !== $value) { - $value = app('steam')->bcround($value, $primaryCurrency->decimal_places); + $value = \FireflyIII\Support\Facades\Steam::bcround($value, $primaryCurrency->decimal_places); } try { diff --git a/app/Support/Http/Controllers/ChartGeneration.php b/app/Support/Http/Controllers/ChartGeneration.php index c117c51171..36524f1ca6 100644 --- a/app/Support/Http/Controllers/ChartGeneration.php +++ b/app/Support/Http/Controllers/ChartGeneration.php @@ -59,7 +59,7 @@ trait ChartGeneration return $cache->get(); } Log::debug('Regenerate chart.account.account-balance-chart from scratch.'); - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); /** @var GeneratorInterface $generator */ $generator = app(GeneratorInterface::class); diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php index 86804c7dbb..0f24d77534 100644 --- a/app/Support/Http/Controllers/UserNavigation.php +++ b/app/Support/Http/Controllers/UserNavigation.php @@ -53,7 +53,7 @@ trait UserNavigation $url = (string)session($identifier); Log::debug(sprintf('The URL is %s', $url)); - return app('steam')->getSafeUrl($url, route('index')); + return \FireflyIII\Support\Facades\Steam::getSafeUrl($url, route('index')); } /** @@ -137,7 +137,7 @@ trait UserNavigation final protected function rememberPreviousUrl(string $identifier): ?string { - $return = app('steam')->getSafePreviousUrl(); + $return = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl(); session()->put($identifier, $return); Log::debug(sprintf('rememberPreviousUrl: %s: "%s"', $identifier, $return)); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 34cbf3d48b..016f218934 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -404,7 +404,7 @@ class Navigation */ public function listOfPeriods(Carbon $start, Carbon $end): array { - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); // define period to increment $increment = 'addDay'; $format = $this->preferredCarbonFormat($start, $end); @@ -536,7 +536,7 @@ class Navigation */ public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string { - $locale = app('steam')->getLocale(); + $locale = \FireflyIII\Support\Facades\Steam::getLocale(); $diff = $start->diffInMonths($end, true); if ($diff >= 1.001 && $diff < 12.001) { return (string)trans('config.month_js', [], $locale); diff --git a/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php b/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php index 52479f2de0..7229b3becc 100644 --- a/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php +++ b/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php @@ -103,7 +103,7 @@ trait RecalculatesAvailableBudgetsTrait return; } Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount)); - $availableBudget->amount = app('steam')->bcround($newAmount, $availableBudget->transactionCurrency->decimal_places); + $availableBudget->amount = \FireflyIII\Support\Facades\Steam::bcround($newAmount, $availableBudget->transactionCurrency->decimal_places); $availableBudget->save(); } diff --git a/app/Support/Report/Summarizer/TransactionSummarizer.php b/app/Support/Report/Summarizer/TransactionSummarizer.php index 326dd9f644..fa4ce5e087 100644 --- a/app/Support/Report/Summarizer/TransactionSummarizer.php +++ b/app/Support/Report/Summarizer/TransactionSummarizer.php @@ -139,7 +139,7 @@ class TransactionSummarizer } } - // $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount)); + // $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], \FireflyIII\Support\Facades\Steam::{$method}($amount)); // Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount)); } Log::debug('End of sumExpenses.', $array); diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 38133e1daf..7169b6120d 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -2287,7 +2287,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. Log::debug(sprintf('Original value "%s"', $value)); $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountIs($amount); @@ -2297,7 +2297,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. Log::debug(sprintf('Original value "%s"', $value)); $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountIsNot($amount); @@ -2307,7 +2307,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountIs($amount); @@ -2317,7 +2317,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountIsNot($amount); @@ -2328,7 +2328,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountLess($amount); @@ -2339,7 +2339,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountLess($amount); @@ -2350,7 +2350,7 @@ class OperatorQuerySearch implements SearchInterface Log::debug(sprintf('Now handling operator "%s"', $operator)); // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountMore($amount); @@ -2361,7 +2361,7 @@ class OperatorQuerySearch implements SearchInterface Log::debug(sprintf('Now handling operator "%s"', $operator)); // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = app('steam')->positive($value); + $amount = \FireflyIII\Support\Facades\Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountMore($amount); diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 98ca0625ae..fb4cc08abf 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -200,7 +200,7 @@ class General extends AbstractExtension } return implode(', ', $strings); - // return app('steam')->balance($account, $date); + // return \FireflyIII\Support\Facades\Steam::balance($account, $date); } ); } diff --git a/app/TransactionRules/Actions/SetAmount.php b/app/TransactionRules/Actions/SetAmount.php index 4c362e74c7..fe0a384d3d 100644 --- a/app/TransactionRules/Actions/SetAmount.php +++ b/app/TransactionRules/Actions/SetAmount.php @@ -66,8 +66,8 @@ class SetAmount implements ActionInterface /** @var TransactionJournal $object */ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); - $positive = app('steam')->positive($value); - $negative = app('steam')->negative($value); + $positive = \FireflyIII\Support\Facades\Steam::positive($value); + $negative = \FireflyIII\Support\Facades\Steam::negative($value); $this->updatePositive($object, $positive); $this->updateNegative($object, $negative); From 012df6bb2485585c42179511613f0be4413a2c16 Mon Sep 17 00:00:00 2001 From: JC5 Date: Wed, 17 Dec 2025 08:47:31 +0100 Subject: [PATCH 03/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/php-cs-fixer/composer.lock | 12 +- .../V1/Controllers/Chart/BudgetController.php | 3 +- .../Commands/Correction/CorrectsAmounts.php | 3 +- .../Commands/Correction/CorrectsIbans.php | 5 +- .../Correction/CorrectsUnevenAmount.php | 4 +- app/Exceptions/Handler.php | 7 +- app/Factory/TransactionFactory.php | 9 +- .../Chart/Basic/ChartJsGenerator.php | 5 +- .../Report/Audit/MonthReportGenerator.php | 6 +- .../Collector/Extensions/AmountCollection.php | 17 +- .../Controllers/Account/EditController.php | 5 +- app/Http/Controllers/Bill/EditController.php | 5 +- .../Budget/BudgetLimitController.php | 3 +- .../Controllers/Budget/EditController.php | 3 +- .../Controllers/Budget/IndexController.php | 3 +- app/Http/Controllers/Chart/BillController.php | 3 +- .../Controllers/Chart/BudgetController.php | 13 +- .../Controllers/Chart/PiggyBankController.php | 3 +- app/Http/Controllers/JavascriptController.php | 2 +- .../Controllers/Json/ReconcileController.php | 4 +- .../Controllers/Json/RecurrenceController.php | 3 +- .../Controllers/PiggyBank/EditController.php | 3 +- .../Controllers/PreferencesController.php | 3 +- .../Transaction/DeleteController.php | 3 +- .../Transaction/LinkController.php | 3 +- .../Transaction/MassController.php | 5 +- app/Http/Middleware/StartFireflySession.php | 3 +- app/Http/Requests/AccountFormRequest.php | 3 +- app/Mail/NewIPAddressWarningMail.php | 3 +- .../Budget/OperationsRepository.php | 3 +- .../Category/NoCategoryRepository.php | 4 +- .../Category/OperationsRepository.php | 8 +- app/Repositories/Tag/OperationsRepository.php | 5 +- .../TransactionGroupRepository.php | 9 +- .../Internal/Support/AccountServiceTrait.php | 25 +- .../Support/CreditRecalculateService.php | 43 +- .../Internal/Update/AccountUpdateService.php | 5 +- .../Internal/Update/JournalUpdateService.php | 12 +- .../Chart/Budget/FrontpageChartGenerator.php | 3 +- .../Category/WholePeriodChartGenerator.php | 5 +- app/Support/Form/CurrencyForm.php | 5 +- .../Http/Controllers/ChartGeneration.php | 2 +- .../Http/Controllers/UserNavigation.php | 5 +- app/Support/Navigation.php | 5 +- .../RecalculatesAvailableBudgetsTrait.php | 3 +- app/Support/Search/OperatorQuerySearch.php | 17 +- app/TransactionRules/Actions/SetAmount.php | 5 +- composer.lock | 276 +---------- config/firefly.php | 4 +- package-lock.json | 452 +++++++++--------- 50 files changed, 419 insertions(+), 621 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 71b023b90e..a96ebd6740 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -402,16 +402,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.92.1", + "version": "v3.92.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "ed33ad03313a019533ba065eba6c86af0a382873" + "reference": "64fab3553dce507ce247f7d1a7d65f74ef658c3f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ed33ad03313a019533ba065eba6c86af0a382873", - "reference": "ed33ad03313a019533ba065eba6c86af0a382873", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/64fab3553dce507ce247f7d1a7d65f74ef658c3f", + "reference": "64fab3553dce507ce247f7d1a7d65f74ef658c3f", "shasum": "" }, "require": { @@ -494,7 +494,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.2" }, "funding": [ { @@ -502,7 +502,7 @@ "type": "github" } ], - "time": "2025-12-15T23:09:01+00:00" + "time": "2025-12-17T00:04:16+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Controllers/Chart/BudgetController.php b/app/Api/V1/Controllers/Chart/BudgetController.php index 952b736ceb..2d62f23d8c 100644 --- a/app/Api/V1/Controllers/Chart/BudgetController.php +++ b/app/Api/V1/Controllers/Chart/BudgetController.php @@ -42,6 +42,7 @@ use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class BudgetController @@ -286,7 +287,7 @@ class BudgetController extends Controller } if (null !== $limit && $this->convertToPrimary) { // convert and add all amounts. - $limit->amount = \FireflyIII\Support\Facades\Steam::positive($amount); + $limit->amount = Steam::positive($amount); Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount)); } diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index 01efb63f45..c46880bf8d 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -43,6 +43,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use ValueError; +use FireflyIII\Support\Facades\Steam; class CorrectsAmounts extends Command { @@ -244,7 +245,7 @@ class CorrectsAmounts extends Command return false; } if (-1 === $check) { - $item->trigger_value = \FireflyIII\Support\Facades\Steam::positive($item->trigger_value); + $item->trigger_value = Steam::positive($item->trigger_value); $item->save(); return true; diff --git a/app/Console/Commands/Correction/CorrectsIbans.php b/app/Console/Commands/Correction/CorrectsIbans.php index e07651840c..edab4ed0c1 100644 --- a/app/Console/Commands/Correction/CorrectsIbans.php +++ b/app/Console/Commands/Correction/CorrectsIbans.php @@ -29,6 +29,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Models\Account; use Illuminate\Console\Command; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\Steam; class CorrectsIbans extends Command { @@ -55,7 +56,7 @@ class CorrectsIbans extends Command /** @var Account $account */ foreach ($accounts as $account) { $iban = (string) $account->iban; - $newIban = \FireflyIII\Support\Facades\Steam::filterSpaces($iban); + $newIban = Steam::filterSpaces($iban); if ('' !== $iban && $iban !== $newIban) { $account->iban = $newIban; $account->save(); @@ -66,7 +67,7 @@ class CorrectsIbans extends Command $accountNumber = $account->accountMeta->where('name', 'account_number')->first(); if (null !== $accountNumber) { $number = (string) $accountNumber->value; - $newNumber = \FireflyIII\Support\Facades\Steam::filterSpaces($number); + $newNumber = Steam::filterSpaces($number); if ('' !== $number && $number !== $newNumber) { $accountNumber->value = $newNumber; $accountNumber->save(); diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 3d82e9c4ff..31f81ca19b 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -112,9 +112,9 @@ class CorrectsUnevenAmount extends Command if ($source->transaction_currency_id === $destination->transaction_currency_id) { Log::debug('Ready to swap data between transactions.'); $destination->foreign_currency_id = $source->transaction_currency_id; - $destination->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); + $destination->foreign_amount = Steam::positive($source->amount); $destination->transaction_currency_id = $source->foreign_currency_id; - $destination->amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount); + $destination->amount = Steam::positive($source->foreign_amount); $destination->balance_dirty = true; $source->balance_dirty = true; $destination->save(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index 761e17ebbc..e17ced5d89 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -49,6 +49,7 @@ use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Throwable; +use FireflyIII\Support\Facades\Steam; use function Safe\json_encode; use function Safe\parse_url; @@ -82,9 +83,7 @@ class Handler extends ExceptionHandler * Register the exception handling callbacks for the application. */ #[Override] - public function register(): void - { - } + public function register(): void {} /** * Render an exception into an HTTP response. It's complex but lucky for us, we never use it because @@ -281,7 +280,7 @@ class Handler extends ExceptionHandler protected function invalid($request, LaravelValidationException $exception): \Illuminate\Http\Response|JsonResponse|RedirectResponse { // protect against open redirect when submitting invalid forms. - $previous = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl(); + $previous = Steam::getSafePreviousUrl(); $redirect = $this->getRedirectUrl($exception); return redirect($redirect ?? $previous) diff --git a/app/Factory/TransactionFactory.php b/app/Factory/TransactionFactory.php index 7695786275..96fcce547f 100644 --- a/app/Factory/TransactionFactory.php +++ b/app/Factory/TransactionFactory.php @@ -34,6 +34,7 @@ use FireflyIII\Services\Internal\Update\AccountUpdateService; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class TransactionFactory @@ -58,10 +59,10 @@ class TransactionFactory $foreignAmount = null; } if (null !== $foreignAmount) { - $foreignAmount = \FireflyIII\Support\Facades\Steam::negative($foreignAmount); + $foreignAmount = Steam::negative($foreignAmount); } - return $this->create(\FireflyIII\Support\Facades\Steam::negative($amount), $foreignAmount); + return $this->create(Steam::negative($amount), $foreignAmount); } /** @@ -170,10 +171,10 @@ class TransactionFactory $foreignAmount = null; } if (null !== $foreignAmount) { - $foreignAmount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount); + $foreignAmount = Steam::positive($foreignAmount); } - return $this->create(\FireflyIII\Support\Facades\Steam::positive($amount), $foreignAmount); + return $this->create(Steam::positive($amount), $foreignAmount); } public function setAccount(Account $account): void diff --git a/app/Generator/Chart/Basic/ChartJsGenerator.php b/app/Generator/Chart/Basic/ChartJsGenerator.php index fa971d0d16..d4faf4b554 100644 --- a/app/Generator/Chart/Basic/ChartJsGenerator.php +++ b/app/Generator/Chart/Basic/ChartJsGenerator.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Generator\Chart\Basic; use FireflyIII\Support\ChartColour; +use FireflyIII\Support\Facades\Steam; /** * Class ChartJsGenerator. @@ -56,7 +57,7 @@ class ChartJsGenerator implements GeneratorInterface $index = 0; foreach ($data as $key => $valueArray) { // make larger than 0 - $chartData['datasets'][0]['data'][] = \FireflyIII\Support\Facades\Steam::positive((string) $valueArray['amount']); + $chartData['datasets'][0]['data'][] = Steam::positive((string) $valueArray['amount']); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['datasets'][0]['currency_symbol'][] = $valueArray['currency_symbol']; $chartData['labels'][] = $key; @@ -163,7 +164,7 @@ class ChartJsGenerator implements GeneratorInterface $index = 0; foreach ($data as $key => $value) { // make larger than 0 - $chartData['datasets'][0]['data'][] = \FireflyIII\Support\Facades\Steam::positive((string) $value); + $chartData['datasets'][0]['data'][] = Steam::positive((string) $value); $chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index); $chartData['labels'][] = $key; diff --git a/app/Generator/Report/Audit/MonthReportGenerator.php b/app/Generator/Report/Audit/MonthReportGenerator.php index 10e889e850..3c35cb8834 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -153,13 +153,13 @@ class MonthReportGenerator implements ReportGeneratorInterface // make sure amount is in the right "direction". if ($account->id === $journal['destination_account_id']) { - $transactionAmount = \FireflyIII\Support\Facades\Steam::positive($journal['amount']); + $transactionAmount = Steam::positive($journal['amount']); } if ($currency->id === $journal['foreign_currency_id']) { $transactionAmount = $journal['foreign_amount']; if ($account->id === $journal['destination_account_id']) { - $transactionAmount = \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']); + $transactionAmount = Steam::positive($journal['foreign_amount']); } } @@ -175,7 +175,7 @@ class MonthReportGenerator implements ReportGeneratorInterface $journals[$index]['payment_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'payment_date'); $journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date'); } - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); // call is correct. Log::debug(sprintf('getAuditReport end: Call finalAccountBalance with date/time "%s"', $this->end->toIso8601String())); diff --git a/app/Helpers/Collector/Extensions/AmountCollection.php b/app/Helpers/Collector/Extensions/AmountCollection.php index 60d46b680e..b3195be07a 100644 --- a/app/Helpers/Collector/Extensions/AmountCollection.php +++ b/app/Helpers/Collector/Extensions/AmountCollection.php @@ -26,6 +26,7 @@ namespace FireflyIII\Helpers\Collector\Extensions; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; +use FireflyIII\Support\Facades\Steam; /** * Trait AmountCollection @@ -39,7 +40,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('source.amount', \FireflyIII\Support\Facades\Steam::negative($amount)); + $q->where('source.amount', Steam::negative($amount)); } ); @@ -50,7 +51,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('source.amount', '!=', \FireflyIII\Support\Facades\Steam::negative($amount)); + $q->where('source.amount', '!=', Steam::negative($amount)); } ); @@ -64,7 +65,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('destination.amount', '<=', \FireflyIII\Support\Facades\Steam::positive($amount)); + $q->where('destination.amount', '<=', Steam::positive($amount)); } ); @@ -78,7 +79,7 @@ trait AmountCollection { $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line - $q->where('destination.amount', '>=', \FireflyIII\Support\Facades\Steam::positive($amount)); + $q->where('destination.amount', '>=', Steam::positive($amount)); } ); @@ -93,7 +94,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNotNull('source.foreign_amount'); - $q->where('source.foreign_amount', \FireflyIII\Support\Facades\Steam::negative($amount)); + $q->where('source.foreign_amount', Steam::negative($amount)); } ); @@ -108,7 +109,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNull('source.foreign_amount'); - $q->orWhere('source.foreign_amount', '!=', \FireflyIII\Support\Facades\Steam::negative($amount)); + $q->orWhere('source.foreign_amount', '!=', Steam::negative($amount)); } ); @@ -123,7 +124,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNotNull('destination.foreign_amount'); - $q->where('destination.foreign_amount', '<=', \FireflyIII\Support\Facades\Steam::positive($amount)); + $q->where('destination.foreign_amount', '<=', Steam::positive($amount)); } ); @@ -138,7 +139,7 @@ trait AmountCollection $this->query->where( static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line $q->whereNotNull('destination.foreign_amount'); - $q->where('destination.foreign_amount', '>=', \FireflyIII\Support\Facades\Steam::positive($amount)); + $q->where('destination.foreign_amount', '>=', Steam::positive($amount)); } ); diff --git a/app/Http/Controllers/Account/EditController.php b/app/Http/Controllers/Account/EditController.php index bc023e3798..77310f8a6b 100644 --- a/app/Http/Controllers/Account/EditController.php +++ b/app/Http/Controllers/Account/EditController.php @@ -38,6 +38,7 @@ use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Log; use Illuminate\View\View; +use FireflyIII\Support\Facades\Steam; /** * Class EditController @@ -148,9 +149,9 @@ class EditController extends Controller 'BIC' => $repository->getMetaValue($account, 'BIC'), 'opening_balance_date' => substr((string) $openingBalanceDate, 0, 10), 'liability_type_id' => $account->account_type_id, - 'opening_balance' => \FireflyIII\Support\Facades\Steam::bcround($openingBalanceAmount, $currency->decimal_places), + 'opening_balance' => Steam::bcround($openingBalanceAmount, $currency->decimal_places), 'liability_direction' => $this->repository->getMetaValue($account, 'liability_direction'), - 'virtual_balance' => \FireflyIII\Support\Facades\Steam::bcround($virtualBalance, $currency->decimal_places), + 'virtual_balance' => Steam::bcround($virtualBalance, $currency->decimal_places), 'currency_id' => $currency->id, 'include_net_worth' => $hasOldInput ? (bool) $request->old('include_net_worth') : $includeNetWorth, 'interest' => $repository->getMetaValue($account, 'interest'), diff --git a/app/Http/Controllers/Bill/EditController.php b/app/Http/Controllers/Bill/EditController.php index 8fde3f7942..475e7c2f3f 100644 --- a/app/Http/Controllers/Bill/EditController.php +++ b/app/Http/Controllers/Bill/EditController.php @@ -35,6 +35,7 @@ use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class EditController @@ -84,8 +85,8 @@ class EditController extends Controller $this->rememberPreviousUrl('bills.edit.url'); } - $bill->amount_min = \FireflyIII\Support\Facades\Steam::bcround($bill->amount_min, $bill->transactionCurrency->decimal_places); - $bill->amount_max = \FireflyIII\Support\Facades\Steam::bcround($bill->amount_max, $bill->transactionCurrency->decimal_places); + $bill->amount_min = Steam::bcround($bill->amount_min, $bill->transactionCurrency->decimal_places); + $bill->amount_max = Steam::bcround($bill->amount_max, $bill->transactionCurrency->decimal_places); $rules = $this->repository->getRulesForBill($bill); // code to handle active-checkboxes diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php index 9d97ba5228..18858e104b 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -44,6 +44,7 @@ use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use Illuminate\Support\Collection; use Illuminate\View\View; +use FireflyIII\Support\Facades\Steam; /** * Class BudgetLimitController @@ -274,7 +275,7 @@ class BudgetLimitController extends Controller $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'] = \FireflyIII\Support\Facades\Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places); + $array['amount'] = Steam::bcround($limit['amount'], $limit->transactionCurrency->decimal_places); $array['left_per_day_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']); if ('true' === $request->get('redirect')) { return redirect(route('budgets.index')); diff --git a/app/Http/Controllers/Budget/EditController.php b/app/Http/Controllers/Budget/EditController.php index 9804fa2011..d327f94edd 100644 --- a/app/Http/Controllers/Budget/EditController.php +++ b/app/Http/Controllers/Budget/EditController.php @@ -37,6 +37,7 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; use Illuminate\View\View; +use FireflyIII\Support\Facades\Steam; /** * Class EditController @@ -104,7 +105,7 @@ class EditController extends Controller $amount = '0'; } $amount = (string) $amount; - $preFilled['auto_budget_amount'] = \FireflyIII\Support\Facades\Steam::bcround($amount, $autoBudget->transactionCurrency->decimal_places); + $preFilled['auto_budget_amount'] = Steam::bcround($amount, $autoBudget->transactionCurrency->decimal_places); } // put previous url in session if not redirect from store (not "return_to_edit"). diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index a59ad983d9..2bce5d8de3 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -46,6 +46,7 @@ use Illuminate\Http\Request; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Illuminate\View\View; +use FireflyIII\Support\Facades\Steam; /** * Class IndexController @@ -203,7 +204,7 @@ class IndexController extends Controller foreach ($budgetLimits as $limit) { Log::debug(sprintf('Working on budget limit #%d', $limit->id)); $currency = $limit->transactionCurrency ?? $primaryCurrency; - $amount = \FireflyIII\Support\Facades\Steam::bcround($limit->amount, $currency->decimal_places); + $amount = Steam::bcround($limit->amount, $currency->decimal_places); $array['budgeted'][] = [ 'id' => $limit->id, 'amount' => $amount, diff --git a/app/Http/Controllers/Chart/BillController.php b/app/Http/Controllers/Chart/BillController.php index f5e770deb3..443a82e32c 100644 --- a/app/Http/Controllers/Chart/BillController.php +++ b/app/Http/Controllers/Chart/BillController.php @@ -31,6 +31,7 @@ use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\CacheProperties; use Illuminate\Http\JsonResponse; +use FireflyIII\Support\Facades\Steam; /** * Class BillController. @@ -113,7 +114,7 @@ class BillController extends Controller if ($cache->has()) { return response()->json($cache->get()); } - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); diff --git a/app/Http/Controllers/Chart/BudgetController.php b/app/Http/Controllers/Chart/BudgetController.php index 08d49b3b53..a7e95c439f 100644 --- a/app/Http/Controllers/Chart/BudgetController.php +++ b/app/Http/Controllers/Chart/BudgetController.php @@ -44,6 +44,7 @@ use FireflyIII\Support\Http\Controllers\DateCalculation; use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class BudgetController. @@ -166,7 +167,7 @@ class BudgetController extends Controller if ($cache->has()) { return response()->json($cache->get()); } - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); $entries = []; $amount = $budgetLimit->amount ?? '0'; $budgetCollection = new Collection()->push($budget); @@ -531,13 +532,13 @@ class BudgetController extends Controller // get budget limit in this period for this currency. $limit = $this->blRepository->find($budget, $currency, $currentStart, $currentEnd); if ($limit instanceof BudgetLimit) { - $chartData[1]['entries'][$title] = \FireflyIII\Support\Facades\Steam::bcround($limit->amount, $currency->decimal_places); + $chartData[1]['entries'][$title] = Steam::bcround($limit->amount, $currency->decimal_places); } // get spent amount in this period for this currency. $sum = $this->opsRepository->sumExpenses($currentStart, $currentEnd, $accounts, new Collection()->push($budget), $currency); - $amount = \FireflyIII\Support\Facades\Steam::positive($sum[$currency->id]['sum'] ?? '0'); - $chartData[0]['entries'][$title] = \FireflyIII\Support\Facades\Steam::bcround($amount, $currency->decimal_places); + $amount = Steam::positive($sum[$currency->id]['sum'] ?? '0'); + $chartData[0]['entries'][$title] = Steam::bcround($amount, $currency->decimal_places); $currentStart = clone $currentEnd; $currentStart->addDay()->startOfDay(); @@ -574,8 +575,8 @@ class BudgetController extends Controller $currentEnd = Navigation::endOfPeriod($currentStart, $preferredRange); $title = $currentStart->isoFormat($titleFormat); $sum = $this->nbRepository->sumExpenses($currentStart, $currentEnd, $accounts, $currency); - $amount = \FireflyIII\Support\Facades\Steam::positive($sum[$currency->id]['sum'] ?? '0'); - $chartData[$title] = \FireflyIII\Support\Facades\Steam::bcround($amount, $currency->decimal_places); + $amount = Steam::positive($sum[$currency->id]['sum'] ?? '0'); + $chartData[$title] = Steam::bcround($amount, $currency->decimal_places); $currentStart = Navigation::addPeriod($currentStart, $preferredRange, 0); } diff --git a/app/Http/Controllers/Chart/PiggyBankController.php b/app/Http/Controllers/Chart/PiggyBankController.php index a29e2a2d99..a0e119fa15 100644 --- a/app/Http/Controllers/Chart/PiggyBankController.php +++ b/app/Http/Controllers/Chart/PiggyBankController.php @@ -33,6 +33,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Http\Controllers\DateCalculation; use Illuminate\Http\JsonResponse; +use FireflyIII\Support\Facades\Steam; /** * Class PiggyBankController. @@ -70,7 +71,7 @@ class PiggyBankController extends Controller } $set = $repository->getEvents($piggyBank); $set = $set->reverse(); - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); // get first event or start date of piggy bank or today $startDate = $piggyBank->start_date ?? today(config('app.timezone')); diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index da60ccd5d4..c44c2aebee 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -105,7 +105,7 @@ class JavascriptController extends Controller if ($account instanceof Account) { $currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency; } - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); $accounting = app('amount')->getJsConfig(); $accounting['frac_digits'] = $currency->decimal_places; $pref = Preferences::get('language', config('firefly.default_language', 'en_US')); diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index d3fa071e80..561cbd48a2 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -278,9 +278,9 @@ class ReconcileController extends Controller } if ($inverse) { - $journal['amount'] = \FireflyIII\Support\Facades\Steam::positive($journal['amount']); + $journal['amount'] = Steam::positive($journal['amount']); if (null !== $journal['foreign_amount']) { - $journal['foreign_amount'] = \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']); + $journal['foreign_amount'] = Steam::positive($journal['foreign_amount']); } } diff --git a/app/Http/Controllers/Json/RecurrenceController.php b/app/Http/Controllers/Json/RecurrenceController.php index c687933934..7e2c80a3c4 100644 --- a/app/Http/Controllers/Json/RecurrenceController.php +++ b/app/Http/Controllers/Json/RecurrenceController.php @@ -33,6 +33,7 @@ use FireflyIII\Models\RecurrenceRepetition; use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface; use Illuminate\Http\JsonResponse; use Illuminate\Http\Request; +use FireflyIII\Support\Facades\Steam; /** * Class RecurrenceController @@ -167,7 +168,7 @@ class RecurrenceController extends Controller } $date->startOfDay(); $preSelected = (string) $request->get('pre_select'); - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true))); Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true))); diff --git a/app/Http/Controllers/PiggyBank/EditController.php b/app/Http/Controllers/PiggyBank/EditController.php index ac1ed8cbcd..e426cf6658 100644 --- a/app/Http/Controllers/PiggyBank/EditController.php +++ b/app/Http/Controllers/PiggyBank/EditController.php @@ -35,6 +35,7 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Log; use Illuminate\View\View; +use FireflyIII\Support\Facades\Steam; /** * Class EditController @@ -89,7 +90,7 @@ class EditController extends Controller $preFilled = [ 'name' => $piggyBank->name, 'transaction_currency_id' => (int) $piggyBank->transaction_currency_id, - 'target_amount' => \FireflyIII\Support\Facades\Steam::bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places), + 'target_amount' => Steam::bcround($piggyBank->target_amount, $piggyBank->transactionCurrency->decimal_places), 'target_date' => $targetDate, 'start_date' => $startDate, 'accounts' => [], diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 397f8f125e..4c526e553d 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -44,6 +44,7 @@ use Illuminate\Support\Facades\Log; use Illuminate\View\View; use JsonException; use Safe\Exceptions\FilesystemException; +use FireflyIII\Support\Facades\Steam; use function Safe\file_get_contents; use function Safe\json_decode; @@ -108,7 +109,7 @@ class PreferencesController extends Controller if (!is_array($frontpageAccounts)) { $frontpageAccounts = $accountIds; } - $language = \FireflyIII\Support\Facades\Steam::getLanguage(); + $language = Steam::getLanguage(); $languages = config('firefly.languages'); $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; $listPageSize = Preferences::get('listPageSize', 50)->data; diff --git a/app/Http/Controllers/Transaction/DeleteController.php b/app/Http/Controllers/Transaction/DeleteController.php index c45b8c4474..b43bcf4249 100644 --- a/app/Http/Controllers/Transaction/DeleteController.php +++ b/app/Http/Controllers/Transaction/DeleteController.php @@ -38,6 +38,7 @@ use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\Steam; /** * Class DeleteController @@ -83,7 +84,7 @@ class DeleteController extends Controller } $objectType = strtolower($journal->transaction_type_type ?? $journal->transactionType->type); $subTitle = (string) trans('firefly.delete_'.$objectType, ['description' => $group->title ?? $journal->description]); - $previous = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl(); + $previous = Steam::getSafePreviousUrl(); // put previous url in session Log::debug('Will try to remember previous URL'); $this->rememberPreviousUrl('transactions.delete.url'); diff --git a/app/Http/Controllers/Transaction/LinkController.php b/app/Http/Controllers/Transaction/LinkController.php index 6c72783323..e2913308b7 100644 --- a/app/Http/Controllers/Transaction/LinkController.php +++ b/app/Http/Controllers/Transaction/LinkController.php @@ -36,6 +36,7 @@ use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use Illuminate\View\View; +use FireflyIII\Support\Facades\Steam; /** * Class LinkController. @@ -145,6 +146,6 @@ class LinkController extends Controller $linkId = (int) $request->get('id'); $this->repository->switchLinkById($linkId); - return redirect(\FireflyIII\Support\Facades\Steam::getSafePreviousUrl()); + return redirect(Steam::getSafePreviousUrl()); } } diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index cdb3bf7daa..063e743b67 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -43,6 +43,7 @@ use Illuminate\Routing\Redirector; use Illuminate\Support\Facades\Log; use Illuminate\View\View as IlluminateView; use InvalidArgumentException; +use FireflyIII\Support\Facades\Steam; /** * Class MassController. @@ -142,9 +143,9 @@ class MassController extends Controller // reverse amounts foreach ($journals as $index => $journal) { - $journals[$index]['amount'] = \FireflyIII\Support\Facades\Steam::bcround(\FireflyIII\Support\Facades\Steam::positive($journal['amount']), $journal['currency_decimal_places']); + $journals[$index]['amount'] = Steam::bcround(Steam::positive($journal['amount']), $journal['currency_decimal_places']); $journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] - ? null : \FireflyIII\Support\Facades\Steam::positive($journal['foreign_amount']); + ? null : Steam::positive($journal['foreign_amount']); } $this->rememberPreviousUrl('transactions.mass-edit.url'); diff --git a/app/Http/Middleware/StartFireflySession.php b/app/Http/Middleware/StartFireflySession.php index b13ea8f985..04847efef9 100644 --- a/app/Http/Middleware/StartFireflySession.php +++ b/app/Http/Middleware/StartFireflySession.php @@ -27,6 +27,7 @@ use Illuminate\Contracts\Session\Session; use Illuminate\Http\Request; use Illuminate\Session\Middleware\StartSession; use Override; +use FireflyIII\Support\Facades\Steam; /** * Class StartFireflySession. @@ -42,7 +43,7 @@ class StartFireflySession extends StartSession protected function storeCurrentUrl(Request $request, $session): void { $url = $request->fullUrl(); - $safeUrl = \FireflyIII\Support\Facades\Steam::getSafeUrl($url, route('index')); + $safeUrl = Steam::getSafeUrl($url, route('index')); if ($url !== $safeUrl) { return; diff --git a/app/Http/Requests/AccountFormRequest.php b/app/Http/Requests/AccountFormRequest.php index 6d501a7f64..fc39adada9 100644 --- a/app/Http/Requests/AccountFormRequest.php +++ b/app/Http/Requests/AccountFormRequest.php @@ -34,6 +34,7 @@ use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class AccountFormRequest. @@ -87,7 +88,7 @@ class AccountFormRequest extends FormRequest $data['account_type_id'] = $this->convertInteger('liability_type_id'); if ('' !== $data['opening_balance']) { // opening balance is always positive for liabilities - $data['opening_balance'] = \FireflyIII\Support\Facades\Steam::positive($data['opening_balance']); + $data['opening_balance'] = Steam::positive($data['opening_balance']); } } diff --git a/app/Mail/NewIPAddressWarningMail.php b/app/Mail/NewIPAddressWarningMail.php index 6466ec4593..b7e5919445 100644 --- a/app/Mail/NewIPAddressWarningMail.php +++ b/app/Mail/NewIPAddressWarningMail.php @@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException; use Illuminate\Bus\Queueable; use Illuminate\Mail\Mailable; use Illuminate\Queue\SerializesModels; +use FireflyIII\Support\Facades\Steam; /** * Class NewIPAddressWarningMail @@ -57,7 +58,7 @@ class NewIPAddressWarningMail extends Mailable $this->host = ''; try { - $hostName = \FireflyIII\Support\Facades\Steam::getHostName($this->ipAddress); + $hostName = Steam::getHostName($this->ipAddress); } catch (FireflyException $e) { Log::error($e->getMessage()); $hostName = $this->ipAddress; diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index 361b8daee0..e3dc0e1e19 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -41,6 +41,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Override; +use FireflyIII\Support\Facades\Steam; /** * Class OperationsRepository @@ -157,7 +158,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; foreach ($journals as $journal) { - $amount = \FireflyIII\Support\Facades\Steam::negative($journal['amount']); + $amount = Steam::negative($journal['amount']); $journalCurrencyId = (int) $journal['currency_id']; if (false === $convertToPrimary) { $currencyId = $journalCurrencyId; diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index bf3f30fff1..9326df43a7 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -78,7 +78,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), + 'amount' => Steam::negative($journal['amount']), 'date' => $journal['date'], ]; } @@ -124,7 +124,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), + 'amount' => Steam::positive($journal['amount']), 'date' => $journal['date'], ]; } diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php index e12a3e5abe..8a67bdcde5 100644 --- a/app/Repositories/Category/OperationsRepository.php +++ b/app/Repositories/Category/OperationsRepository.php @@ -100,7 +100,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), + 'amount' => Steam::negative($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'budget_name' => $journal['budget_name'], @@ -178,7 +178,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), + 'amount' => Steam::positive($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'destination_account_id' => (string) $journal['destination_account_id'], @@ -240,7 +240,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), + 'amount' => Steam::positive($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'category_name' => $journal['category_name'], @@ -303,7 +303,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // only a subset of the fields. $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][$categoryId]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), + 'amount' => Steam::negative($journal['amount']), 'date' => $journal['date'], 'source_account_id' => (string) $journal['source_account_id'], 'category_name' => $journal['category_name'], diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php index c2aa0d926c..441ffd3fa0 100644 --- a/app/Repositories/Tag/OperationsRepository.php +++ b/app/Repositories/Tag/OperationsRepository.php @@ -31,6 +31,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\Steam; /** * Class OperationsRepository @@ -97,7 +98,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; $array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::negative($journal['amount']), + 'amount' => Steam::negative($journal['amount']), 'date' => $journal['date'], 'source_account_id' => $journal['source_account_id'], 'budget_name' => $journal['budget_name'], @@ -182,7 +183,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['tags'][$tagId]['transaction_journals'][$journalId] = [ - 'amount' => \FireflyIII\Support\Facades\Steam::positive($journal['amount']), + 'amount' => Steam::positive($journal['amount']), 'date' => $journal['date'], 'source_account_id' => $journal['source_account_id'], 'budget_name' => $journal['budget_name'], diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index f59ce6f048..b05f20ec83 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -50,6 +50,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use FireflyIII\Support\Facades\Steam; use function Safe\json_decode; @@ -245,9 +246,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $transaction = $journal->transactions->first(); $currency = $transaction->transactionCurrency; $type = $journal->transactionType->type; - $amount = \FireflyIII\Support\Facades\Steam::positive($transaction->amount); + $amount = Steam::positive($transaction->amount); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { - return Amount::formatAnything($currency, \FireflyIII\Support\Facades\Steam::negative($amount)); + return Amount::formatAnything($currency, Steam::negative($amount)); } return Amount::formatAnything($currency, $amount); @@ -267,9 +268,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $currency = $transaction->foreignCurrency; $type = $journal->transactionType->type; - $amount = \FireflyIII\Support\Facades\Steam::positive($transaction->foreign_amount); + $amount = Steam::positive($transaction->foreign_amount); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { - return Amount::formatAnything($currency, \FireflyIII\Support\Facades\Steam::negative($amount)); + return Amount::formatAnything($currency, Steam::negative($amount)); } return Amount::formatAnything($currency, $amount); diff --git a/app/Services/Internal/Support/AccountServiceTrait.php b/app/Services/Internal/Support/AccountServiceTrait.php index 50cd9958ac..5019b7031a 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -43,6 +43,7 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService; use Illuminate\Support\Facades\Validator; +use FireflyIII\Support\Facades\Steam; /** * Trait AccountServiceTrait @@ -65,7 +66,7 @@ trait AccountServiceTrait return null; } - return \FireflyIII\Support\Facades\Steam::filterSpaces($iban); + return Steam::filterSpaces($iban); } /** @@ -225,7 +226,7 @@ trait AccountServiceTrait } // make amount positive, regardless: - $amount = \FireflyIII\Support\Facades\Steam::positive($amount); + $amount = Steam::positive($amount); // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); @@ -371,12 +372,12 @@ trait AccountServiceTrait } // if direction is "debit" (I owe this debt), amount is negative. // which means the liability will have a negative balance which the user must fill. - $openingBalance = \FireflyIII\Support\Facades\Steam::negative($openingBalance); + $openingBalance = Steam::negative($openingBalance); // if direction is "credit" (I am owed this debt), amount is positive. // which means the liability will have a positive balance which is drained when its paid back into any asset. if ('credit' === $direction) { - $openingBalance = \FireflyIII\Support\Facades\Steam::positive($openingBalance); + $openingBalance = Steam::positive($openingBalance); } // create if not exists: @@ -398,11 +399,11 @@ trait AccountServiceTrait $journal->transactionCurrency()->associate($currency); // account always gains money: - $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); + $accountTransaction->amount = Steam::positive($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; // CL account always loses money: - $clTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance); + $clTransaction->amount = Steam::negative($openingBalance); $clTransaction->transaction_currency_id = $currency->id; // save both $accountTransaction->save(); @@ -448,7 +449,7 @@ trait AccountServiceTrait } // amount must be positive for the transaction to work. - $amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); + $amount = Steam::positive($openingBalance); // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); @@ -584,21 +585,21 @@ trait AccountServiceTrait if (1 === bccomp('0', $openingBalance)) { Log::debug('Amount is negative.'); // account transaction loses money: - $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance); + $accountTransaction->amount = Steam::negative($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; // OB account transaction gains money - $obTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); + $obTransaction->amount = Steam::positive($openingBalance); $obTransaction->transaction_currency_id = $currency->id; } if (-1 === bccomp('0', $openingBalance)) { Log::debug('Amount is positive.'); // account gains money: - $accountTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); + $accountTransaction->amount = Steam::positive($openingBalance); $accountTransaction->transaction_currency_id = $currency->id; // OB account loses money: - $obTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($openingBalance); + $obTransaction->amount = Steam::negative($openingBalance); $obTransaction->transaction_currency_id = $currency->id; } // save both @@ -646,7 +647,7 @@ trait AccountServiceTrait } // make amount positive, regardless: - $amount = \FireflyIII\Support\Facades\Steam::positive($openingBalance); + $amount = Steam::positive($openingBalance); // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php index 228c9a0477..feb0f9f0dc 100644 --- a/app/Services/Internal/Support/CreditRecalculateService.php +++ b/app/Services/Internal/Support/CreditRecalculateService.php @@ -34,6 +34,7 @@ use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class CreditRecalculateService @@ -159,7 +160,7 @@ class CreditRecalculateService $this->validateOpeningBalance($account, $openingBalance); } $startOfDebt = $this->repository->getOpeningBalanceAmount($account, false) ?? '0'; - $leftOfDebt = \FireflyIII\Support\Facades\Steam::positive($startOfDebt); + $leftOfDebt = Steam::positive($startOfDebt); // Log::debug(sprintf('Start of debt is "%s", so initial left of debt is "%s"', \FireflyIII\Support\Facades\Steam::bcround($startOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2))); /** @var AccountMetaFactory $factory */ @@ -200,17 +201,17 @@ class CreditRecalculateService $dest = $openingBalance->transactions()->where('amount', '>', 0)->first(); if ($source->account_id !== $account->id) { Log::info(sprintf('Liability #%d has a reversed opening balance. Will fix this now.', $account->id)); - Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, \FireflyIII\Support\Facades\Steam::positive($source->amount))); - Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, \FireflyIII\Support\Facades\Steam::negative($dest->amount))); - $source->amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); - $dest->amount = \FireflyIII\Support\Facades\Steam::negative($source->amount); + Log::debug(sprintf('Source amount "%s" is now "%s"', $source->amount, Steam::positive($source->amount))); + Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->amount, Steam::negative($dest->amount))); + $source->amount = Steam::positive($source->amount); + $dest->amount = Steam::negative($source->amount); if (null !== $source->foreign_amount && '' !== $source->foreign_amount) { - $source->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount); - Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, \FireflyIII\Support\Facades\Steam::positive($source->foreign_amount))); + $source->foreign_amount = Steam::positive($source->foreign_amount); + Log::debug(sprintf('Source foreign amount "%s" is now "%s"', $source->foreign_amount, Steam::positive($source->foreign_amount))); } if (null !== $dest->foreign_amount && '' !== $dest->foreign_amount) { - $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::negative($dest->foreign_amount); - Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, \FireflyIII\Support\Facades\Steam::negative($dest->foreign_amount))); + $dest->foreign_amount = Steam::negative($dest->foreign_amount); + Log::debug(sprintf('Destination amount "%s" is now "%s"', $dest->foreign_amount, Steam::negative($dest->foreign_amount))); } $source->save(); $dest->save(); @@ -262,66 +263,66 @@ class CreditRecalculateService $isCredit = 'credit' === $direction; if ($isSameAccount && $isCredit && $this->isWithdrawalIn($usedAmount, $type)) { // case 1 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 1 (withdrawal into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isWithdrawalOut($usedAmount, $type)) { // case 2 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 2 (withdrawal away from liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isDepositOut($usedAmount, $type)) { // case 3 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 3 (deposit away from liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isDepositIn($usedAmount, $type)) { // case 4 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 4 (deposit into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isCredit && $this->isTransferIn($usedAmount, $type)) { // case 5 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 5 (transfer into credit liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isWithdrawalIn($usedAmount, $type)) { // case 6 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 6 (withdrawal into debit liability): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isDepositOut($usedAmount, $type)) { // case 7 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 7 (deposit away from liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isWithdrawalOut($usedAmount, $type)) { // case 8 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case 8 (withdrawal away from liability): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isTransferIn($usedAmount, $type)) { // case 9 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcsub($leftOfDebt, (string) $usedAmount); // 2024-10-05, #9225 this used to say you would owe more, but a transfer INTO a debit from wherever means you owe LESS. // Log::debug(sprintf('Case 9 (transfer into debit liability, means you owe LESS): %s - %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } if ($isSameAccount && $isDebit && $this->isTransferOut($usedAmount, $type)) { // case 10 - $usedAmount = \FireflyIII\Support\Facades\Steam::positive($usedAmount); + $usedAmount = Steam::positive($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // 2024-10-05, #9225 this used to say you would owe less, but a transfer OUT OF a debit from wherever means you owe MORE. @@ -330,13 +331,13 @@ class CreditRecalculateService // in any other case, remove amount from left of debt. if (in_array($type, [TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value], true)) { - $usedAmount = \FireflyIII\Support\Facades\Steam::negative($usedAmount); + $usedAmount = Steam::negative($usedAmount); return bcadd($leftOfDebt, (string) $usedAmount); // Log::debug(sprintf('Case X (all other cases): %s + %s = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2), \FireflyIII\Support\Facades\Steam::bcround($usedAmount, 2), \FireflyIII\Support\Facades\Steam::bcround($result, 2))); } - Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', \FireflyIII\Support\Facades\Steam::bcround($leftOfDebt, 2))); + Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', Steam::bcround($leftOfDebt, 2))); return $leftOfDebt; } diff --git a/app/Services/Internal/Update/AccountUpdateService.php b/app/Services/Internal/Update/AccountUpdateService.php index 1d343b1f9b..67fe8b0bb3 100644 --- a/app/Services/Internal/Update/AccountUpdateService.php +++ b/app/Services/Internal/Update/AccountUpdateService.php @@ -35,6 +35,7 @@ use FireflyIII\Models\Location; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Services\Internal\Support\AccountServiceTrait; use FireflyIII\User; +use FireflyIII\Support\Facades\Steam; /** * Class AccountUpdateService @@ -123,7 +124,7 @@ class AccountUpdateService $account->active = $data['active']; } if (array_key_exists('iban', $data)) { - $account->iban = \FireflyIII\Support\Facades\Steam::filterSpaces((string) $data['iban']); + $account->iban = Steam::filterSpaces((string) $data['iban']); } // set liability, but account must already be a liability. @@ -269,7 +270,7 @@ class AccountUpdateService // if liability, make sure the amount is positive for a credit, and negative for a debit. if ($this->isLiability($account)) { - $openingBalance = 'credit' === $data['liability_direction'] ? \FireflyIII\Support\Facades\Steam::positive($openingBalance) : \FireflyIII\Support\Facades\Steam::negative( + $openingBalance = 'credit' === $data['liability_direction'] ? Steam::positive($openingBalance) : Steam::negative( $openingBalance ); } diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 2ee39a6728..23e09b01b0 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -662,12 +662,12 @@ class JournalUpdateService return; } $origSourceTransaction = $this->getSourceTransaction(); - $origSourceTransaction->amount = \FireflyIII\Support\Facades\Steam::negative($amount); + $origSourceTransaction->amount = Steam::negative($amount); $origSourceTransaction->balance_dirty = true; $origSourceTransaction->save(); $destTransaction = $this->getDestinationTransaction(); $originalAmount = $destTransaction->amount; - $destTransaction->amount = \FireflyIII\Support\Facades\Steam::positive($amount); + $destTransaction->amount = Steam::positive($amount); $destTransaction->balance_dirty = true; $destTransaction->save(); // refresh transactions. @@ -731,7 +731,7 @@ class JournalUpdateService // add foreign currency info to source and destination if possible. if (null !== $foreignCurrency && null !== $foreignAmount) { $source->foreign_currency_id = $foreignCurrency->id; - $source->foreign_amount = \FireflyIII\Support\Facades\Steam::negative($foreignAmount); + $source->foreign_amount = Steam::negative($foreignAmount); $source->save(); // if the transaction is a TRANSFER, and the foreign amount and currency are set (like they seem to be) @@ -744,13 +744,13 @@ class JournalUpdateService if ($isTransfer || $isBetween) { Log::debug('Switch amounts, store in amount and not foreign_amount'); $dest->transaction_currency_id = $foreignCurrency->id; - $dest->amount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount); - $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($source->amount); + $dest->amount = Steam::positive($foreignAmount); + $dest->foreign_amount = Steam::positive($source->amount); $dest->foreign_currency_id = $source->transaction_currency_id; } if (!$isTransfer && !$isBetween) { $dest->foreign_currency_id = $foreignCurrency->id; - $dest->foreign_amount = \FireflyIII\Support\Facades\Steam::positive($foreignAmount); + $dest->foreign_amount = Steam::positive($foreignAmount); } $dest->save(); diff --git a/app/Support/Chart/Budget/FrontpageChartGenerator.php b/app/Support/Chart/Budget/FrontpageChartGenerator.php index 3893c10030..ed27174151 100644 --- a/app/Support/Chart/Budget/FrontpageChartGenerator.php +++ b/app/Support/Chart/Budget/FrontpageChartGenerator.php @@ -33,6 +33,7 @@ use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use FireflyIII\User; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\Steam; /** * Class FrontpageChartGenerator @@ -102,7 +103,7 @@ class FrontpageChartGenerator $this->blRepository->setUser($user); $this->opsRepository->setUser($user); - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); $this->monthAndDayFormat = (string)trans('config.month_and_day_js', [], $locale); } diff --git a/app/Support/Chart/Category/WholePeriodChartGenerator.php b/app/Support/Chart/Category/WholePeriodChartGenerator.php index 7ea1f1374e..ffea514655 100644 --- a/app/Support/Chart/Category/WholePeriodChartGenerator.php +++ b/app/Support/Chart/Category/WholePeriodChartGenerator.php @@ -31,6 +31,7 @@ use FireflyIII\Models\Category; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Category\OperationsRepositoryInterface; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\Steam; /** * Class WholePeriodChartGenerator @@ -102,8 +103,8 @@ class WholePeriodChartGenerator $earnedInfoKey = sprintf('earned-in-%s', $code); $spentAmount = $spent[$key][$currencyId]['sum'] ?? '0'; $earnedAmount = $earned[$key][$currencyId]['sum'] ?? '0'; - $chartData[$spentInfoKey]['entries'][$label] = \FireflyIII\Support\Facades\Steam::bcround($spentAmount, $currency['currency_decimal_places']); - $chartData[$earnedInfoKey]['entries'][$label] = \FireflyIII\Support\Facades\Steam::bcround($earnedAmount, $currency['currency_decimal_places']); + $chartData[$spentInfoKey]['entries'][$label] = Steam::bcround($spentAmount, $currency['currency_decimal_places']); + $chartData[$earnedInfoKey]['entries'][$label] = Steam::bcround($earnedAmount, $currency['currency_decimal_places']); } $current = Navigation::addPeriod($current, $step); } diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index 9be6d34aa3..0abfa1ca5f 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; use Throwable; +use FireflyIII\Support\Facades\Steam; /** * Class CurrencyForm @@ -150,7 +151,7 @@ class CurrencyForm // make sure value is formatted nicely: if (null !== $value && '' !== $value) { - $value = \FireflyIII\Support\Facades\Steam::bcround($value, $primaryCurrency->decimal_places); + $value = Steam::bcround($value, $primaryCurrency->decimal_places); } try { @@ -202,7 +203,7 @@ class CurrencyForm // make sure value is formatted nicely: if (null !== $value && '' !== $value) { - $value = \FireflyIII\Support\Facades\Steam::bcround($value, $primaryCurrency->decimal_places); + $value = Steam::bcround($value, $primaryCurrency->decimal_places); } try { diff --git a/app/Support/Http/Controllers/ChartGeneration.php b/app/Support/Http/Controllers/ChartGeneration.php index 36524f1ca6..63792ed518 100644 --- a/app/Support/Http/Controllers/ChartGeneration.php +++ b/app/Support/Http/Controllers/ChartGeneration.php @@ -59,7 +59,7 @@ trait ChartGeneration return $cache->get(); } Log::debug('Regenerate chart.account.account-balance-chart from scratch.'); - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); /** @var GeneratorInterface $generator */ $generator = app(GeneratorInterface::class); diff --git a/app/Support/Http/Controllers/UserNavigation.php b/app/Support/Http/Controllers/UserNavigation.php index 0f24d77534..b0f81f163d 100644 --- a/app/Support/Http/Controllers/UserNavigation.php +++ b/app/Support/Http/Controllers/UserNavigation.php @@ -33,6 +33,7 @@ use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use Illuminate\Http\RedirectResponse; use Illuminate\Routing\Redirector; +use FireflyIII\Support\Facades\Steam; /** * Trait UserNavigation @@ -53,7 +54,7 @@ trait UserNavigation $url = (string)session($identifier); Log::debug(sprintf('The URL is %s', $url)); - return \FireflyIII\Support\Facades\Steam::getSafeUrl($url, route('index')); + return Steam::getSafeUrl($url, route('index')); } /** @@ -137,7 +138,7 @@ trait UserNavigation final protected function rememberPreviousUrl(string $identifier): ?string { - $return = \FireflyIII\Support\Facades\Steam::getSafePreviousUrl(); + $return = Steam::getSafePreviousUrl(); session()->put($identifier, $return); Log::debug(sprintf('rememberPreviousUrl: %s: "%s"', $identifier, $return)); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 016f218934..27fd34dd03 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -32,6 +32,7 @@ use FireflyIII\Support\Calendar\Calculator; use FireflyIII\Support\Calendar\Periodicity; use Illuminate\Support\Facades\Log; use Throwable; +use FireflyIII\Support\Facades\Steam; /** * Class Navigation. @@ -404,7 +405,7 @@ class Navigation */ public function listOfPeriods(Carbon $start, Carbon $end): array { - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); // define period to increment $increment = 'addDay'; $format = $this->preferredCarbonFormat($start, $end); @@ -536,7 +537,7 @@ class Navigation */ public function preferredCarbonLocalizedFormat(Carbon $start, Carbon $end): string { - $locale = \FireflyIII\Support\Facades\Steam::getLocale(); + $locale = Steam::getLocale(); $diff = $start->diffInMonths($end, true); if ($diff >= 1.001 && $diff < 12.001) { return (string)trans('config.month_js', [], $locale); diff --git a/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php b/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php index 7229b3becc..ff0fb4b53d 100644 --- a/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php +++ b/app/Support/Observers/RecalculatesAvailableBudgetsTrait.php @@ -38,6 +38,7 @@ use Psr\Container\NotFoundExceptionInterface; use Spatie\Period\Boundaries; use Spatie\Period\Period; use Spatie\Period\Precision; +use FireflyIII\Support\Facades\Steam; trait RecalculatesAvailableBudgetsTrait { @@ -103,7 +104,7 @@ trait RecalculatesAvailableBudgetsTrait return; } Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount)); - $availableBudget->amount = \FireflyIII\Support\Facades\Steam::bcround($newAmount, $availableBudget->transactionCurrency->decimal_places); + $availableBudget->amount = Steam::bcround($newAmount, $availableBudget->transactionCurrency->decimal_places); $availableBudget->save(); } diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 7169b6120d..2ecbf3eace 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -52,6 +52,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use LogicException; use TypeError; +use FireflyIII\Support\Facades\Steam; /** * Class OperatorQuerySearch @@ -2287,7 +2288,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. Log::debug(sprintf('Original value "%s"', $value)); $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountIs($amount); @@ -2297,7 +2298,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. Log::debug(sprintf('Original value "%s"', $value)); $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountIsNot($amount); @@ -2307,7 +2308,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountIs($amount); @@ -2317,7 +2318,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountIsNot($amount); @@ -2328,7 +2329,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountLess($amount); @@ -2339,7 +2340,7 @@ class OperatorQuerySearch implements SearchInterface // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountLess($amount); @@ -2350,7 +2351,7 @@ class OperatorQuerySearch implements SearchInterface Log::debug(sprintf('Now handling operator "%s"', $operator)); // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->amountMore($amount); @@ -2361,7 +2362,7 @@ class OperatorQuerySearch implements SearchInterface Log::debug(sprintf('Now handling operator "%s"', $operator)); // strip comma's, make dots. $value = str_replace(',', '.', $value); - $amount = \FireflyIII\Support\Facades\Steam::positive($value); + $amount = Steam::positive($value); Log::debug(sprintf('Set "%s" using collector with value "%s"', $operator, $amount)); $this->collector->foreignAmountMore($amount); diff --git a/app/TransactionRules/Actions/SetAmount.php b/app/TransactionRules/Actions/SetAmount.php index fe0a384d3d..ea5b6d6de1 100644 --- a/app/TransactionRules/Actions/SetAmount.php +++ b/app/TransactionRules/Actions/SetAmount.php @@ -31,6 +31,7 @@ use FireflyIII\Models\RuleAction; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\TransactionRules\Traits\RefreshNotesTrait; +use FireflyIII\Support\Facades\Steam; class SetAmount implements ActionInterface { @@ -66,8 +67,8 @@ class SetAmount implements ActionInterface /** @var TransactionJournal $object */ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); - $positive = \FireflyIII\Support\Facades\Steam::positive($value); - $negative = \FireflyIII\Support\Facades\Steam::negative($value); + $positive = Steam::positive($value); + $negative = Steam::negative($value); $this->updatePositive($object, $positive); $this->updateNegative($object, $negative); diff --git a/composer.lock b/composer.lock index adb9bbc1e1..257ba749b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8317b89f4d014debebcd301fde669321", + "content-hash": "8fff223d32252d22c0e6028d19a76756", "packages": [ { "name": "bacon/bacon-qr-code", @@ -1809,66 +1809,6 @@ }, "time": "2022-03-31T05:55:34+00:00" }, - { - "name": "jean85/pretty-package-versions", - "version": "2.1.1", - "source": { - "type": "git", - "url": "https://github.com/Jean85/pretty-package-versions.git", - "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a", - "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a", - "shasum": "" - }, - "require": { - "composer-runtime-api": "^2.1.0", - "php": "^7.4|^8.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.2", - "jean85/composer-provided-replaced-stub-package": "^1.0", - "phpstan/phpstan": "^2.0", - "phpunit/phpunit": "^7.5|^8.5|^9.6", - "rector/rector": "^2.0", - "vimeo/psalm": "^4.3 || ^5.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, - "autoload": { - "psr-4": { - "Jean85\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Alessandro Lai", - "email": "alessandro.lai85@gmail.com" - } - ], - "description": "A library to get pretty versions strings of installed dependencies", - "keywords": [ - "composer", - "package", - "release", - "versions" - ], - "support": { - "issues": "https://github.com/Jean85/pretty-package-versions/issues", - "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" - }, - "time": "2025-03-19T14:43:43+00:00" - }, { "name": "laravel-notification-channels/pushover", "version": "4.1.2", @@ -1938,16 +1878,16 @@ }, { "name": "laravel/framework", - "version": "v12.42.0", + "version": "v12.43.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "509b33095564c5165366d81bbaa0afaac28abe75" + "reference": "195b893593a9298edee177c0844132ebaa02102f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/509b33095564c5165366d81bbaa0afaac28abe75", - "reference": "509b33095564c5165366d81bbaa0afaac28abe75", + "url": "https://api.github.com/repos/laravel/framework/zipball/195b893593a9298edee177c0844132ebaa02102f", + "reference": "195b893593a9298edee177c0844132ebaa02102f", "shasum": "" }, "require": { @@ -2156,7 +2096,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-12-09T15:51:23+00:00" + "time": "2025-12-16T18:53:08+00:00" }, { "name": "laravel/passport", @@ -3150,16 +3090,16 @@ }, { "name": "league/fractal", - "version": "0.20.2", + "version": "0.21", "source": { "type": "git", "url": "https://github.com/thephpleague/fractal.git", - "reference": "573ca2e0e348a7fe573a3e8fbc29a6588ece8c4e" + "reference": "9e817358dc451dfdcf656d6757f0c04e92dea0e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/fractal/zipball/573ca2e0e348a7fe573a3e8fbc29a6588ece8c4e", - "reference": "573ca2e0e348a7fe573a3e8fbc29a6588ece8c4e", + "url": "https://api.github.com/repos/thephpleague/fractal/zipball/9e817358dc451dfdcf656d6757f0c04e92dea0e8", + "reference": "9e817358dc451dfdcf656d6757f0c04e92dea0e8", "shasum": "" }, "require": { @@ -3167,13 +3107,13 @@ }, "require-dev": { "doctrine/orm": "^2.5", + "friendsofphp/php-cs-fixer": "^3.91", "illuminate/contracts": "~5.0", "laminas/laminas-paginator": "~2.12", "mockery/mockery": "^1.3", "pagerfanta/pagerfanta": "~1.0.0|~4.0.0", "phpstan/phpstan": "^1.4", "phpunit/phpunit": "^9.5", - "squizlabs/php_codesniffer": "~3.4", "vimeo/psalm": "^4.30" }, "suggest": { @@ -3214,9 +3154,9 @@ ], "support": { "issues": "https://github.com/thephpleague/fractal/issues", - "source": "https://github.com/thephpleague/fractal/tree/0.20.2" + "source": "https://github.com/thephpleague/fractal/tree/0.21" }, - "time": "2025-02-14T21:33:14+00:00" + "time": "2025-12-08T21:14:52+00:00" }, { "name": "league/mime-type-detection", @@ -5972,184 +5912,6 @@ }, "time": "2025-08-20T11:25:49+00:00" }, - { - "name": "sentry/sentry", - "version": "4.19.1", - "source": { - "type": "git", - "url": "https://github.com/getsentry/sentry-php.git", - "reference": "1c21d60bebe67c0122335bd3fe977990435af0a3" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/1c21d60bebe67c0122335bd3fe977990435af0a3", - "reference": "1c21d60bebe67c0122335bd3fe977990435af0a3", - "shasum": "" - }, - "require": { - "ext-curl": "*", - "ext-json": "*", - "ext-mbstring": "*", - "guzzlehttp/psr7": "^1.8.4|^2.1.1", - "jean85/pretty-package-versions": "^1.5|^2.0.4", - "php": "^7.2|^8.0", - "psr/log": "^1.0|^2.0|^3.0", - "symfony/options-resolver": "^4.4.30|^5.0.11|^6.0|^7.0|^8.0" - }, - "conflict": { - "raven/raven": "*" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.4", - "guzzlehttp/promises": "^2.0.3", - "guzzlehttp/psr7": "^1.8.4|^2.1.1", - "monolog/monolog": "^1.6|^2.0|^3.0", - "phpbench/phpbench": "^1.0", - "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^8.5|^9.6", - "vimeo/psalm": "^4.17" - }, - "suggest": { - "monolog/monolog": "Allow sending log messages to Sentry by using the included Monolog handler." - }, - "type": "library", - "autoload": { - "files": [ - "src/functions.php" - ], - "psr-4": { - "Sentry\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Sentry", - "email": "accounts@sentry.io" - } - ], - "description": "PHP SDK for Sentry (http://sentry.io)", - "homepage": "http://sentry.io", - "keywords": [ - "crash-reporting", - "crash-reports", - "error-handler", - "error-monitoring", - "log", - "logging", - "profiling", - "sentry", - "tracing" - ], - "support": { - "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/4.19.1" - }, - "funding": [ - { - "url": "https://sentry.io/", - "type": "custom" - }, - { - "url": "https://sentry.io/pricing/", - "type": "custom" - } - ], - "time": "2025-12-02T15:57:41+00:00" - }, - { - "name": "sentry/sentry-laravel", - "version": "4.20.0", - "source": { - "type": "git", - "url": "https://github.com/getsentry/sentry-laravel.git", - "reference": "95f2542ee1ebc993529b63f5c8543184abd00650" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-laravel/zipball/95f2542ee1ebc993529b63f5c8543184abd00650", - "reference": "95f2542ee1ebc993529b63f5c8543184abd00650", - "shasum": "" - }, - "require": { - "illuminate/support": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0", - "nyholm/psr7": "^1.0", - "php": "^7.2 | ^8.0", - "sentry/sentry": "^4.19.0", - "symfony/psr-http-message-bridge": "^1.0 | ^2.0 | ^6.0 | ^7.0" - }, - "require-dev": { - "friendsofphp/php-cs-fixer": "^3.11", - "guzzlehttp/guzzle": "^7.2", - "laravel/folio": "^1.1", - "laravel/framework": "^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0 | ^11.0 | ^12.0", - "laravel/pennant": "^1.0", - "livewire/livewire": "^2.0 | ^3.0", - "mockery/mockery": "^1.3", - "orchestra/testbench": "^4.7 | ^5.1 | ^6.0 | ^7.0 | ^8.0 | ^9.0 | ^10.0", - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^8.4 | ^9.3 | ^10.4 | ^11.5" - }, - "type": "library", - "extra": { - "laravel": { - "aliases": { - "Sentry": "Sentry\\Laravel\\Facade" - }, - "providers": [ - "Sentry\\Laravel\\ServiceProvider", - "Sentry\\Laravel\\Tracing\\ServiceProvider" - ] - } - }, - "autoload": { - "psr-0": { - "Sentry\\Laravel\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Sentry", - "email": "accounts@sentry.io" - } - ], - "description": "Laravel SDK for Sentry (https://sentry.io)", - "homepage": "https://sentry.io", - "keywords": [ - "crash-reporting", - "crash-reports", - "error-handler", - "error-monitoring", - "laravel", - "log", - "logging", - "profiling", - "sentry", - "tracing" - ], - "support": { - "issues": "https://github.com/getsentry/sentry-laravel/issues", - "source": "https://github.com/getsentry/sentry-laravel/tree/4.20.0" - }, - "funding": [ - { - "url": "https://sentry.io/", - "type": "custom" - }, - { - "url": "https://sentry.io/pricing/", - "type": "custom" - } - ], - "time": "2025-12-02T10:37:40+00:00" - }, { "name": "spatie/backtrace", "version": "1.8.1", @@ -10316,16 +10078,16 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v3.16.1", + "version": "v3.16.2", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "21b2c6fce05453efd4bceb34f9fddaa1cdb44090" + "reference": "730dbf8bf41f5691e026dd771e64dd54ad1b10b3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/21b2c6fce05453efd4bceb34f9fddaa1cdb44090", - "reference": "21b2c6fce05453efd4bceb34f9fddaa1cdb44090", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/730dbf8bf41f5691e026dd771e64dd54ad1b10b3", + "reference": "730dbf8bf41f5691e026dd771e64dd54ad1b10b3", "shasum": "" }, "require": { @@ -10385,7 +10147,7 @@ ], "support": { "issues": "https://github.com/barryvdh/laravel-debugbar/issues", - "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.16.1" + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.16.2" }, "funding": [ { @@ -10397,7 +10159,7 @@ "type": "github" } ], - "time": "2025-11-19T08:31:25+00:00" + "time": "2025-12-03T14:52:46+00:00" }, { "name": "barryvdh/laravel-ide-helper", diff --git a/config/firefly.php b/config/firefly.php index 79c4acf74d..b31e10e7c3 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => '6.4.14', - 'build_time' => 1765863630, + 'version' => 'develop/2025-12-17', + 'build_time' => 1765957552, '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 79d5704fc9..ed1fda10ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1696,9 +1696,9 @@ "license": "MIT" }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.1.tgz", - "integrity": "sha512-HHB50pdsBX6k47S4u5g/CaLjqS3qwaOVE5ILsq64jyzgMhLuCuZ8rGzM9yhsAjfjkbgUPMzZEPa7DAp7yz6vuA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz", + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", "cpu": [ "ppc64" ], @@ -1713,9 +1713,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.1.tgz", - "integrity": "sha512-kFqa6/UcaTbGm/NncN9kzVOODjhZW8e+FRdSeypWe6j33gzclHtwlANs26JrupOntlcWmB0u8+8HZo8s7thHvg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz", + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", "cpu": [ "arm" ], @@ -1730,9 +1730,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.1.tgz", - "integrity": "sha512-45fuKmAJpxnQWixOGCrS+ro4Uvb4Re9+UTieUY2f8AEc+t7d4AaZ6eUJ3Hva7dtrxAAWHtlEFsXFMAgNnGU9uQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz", + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", "cpu": [ "arm64" ], @@ -1747,9 +1747,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.1.tgz", - "integrity": "sha512-LBEpOz0BsgMEeHgenf5aqmn/lLNTFXVfoWMUox8CtWWYK9X4jmQzWjoGoNb8lmAYml/tQ/Ysvm8q7szu7BoxRQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz", + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", "cpu": [ "x64" ], @@ -1764,9 +1764,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.1.tgz", - "integrity": "sha512-veg7fL8eMSCVKL7IW4pxb54QERtedFDfY/ASrumK/SbFsXnRazxY4YykN/THYqFnFwJ0aVjiUrVG2PwcdAEqQQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", "cpu": [ "arm64" ], @@ -1781,9 +1781,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.1.tgz", - "integrity": "sha512-+3ELd+nTzhfWb07Vol7EZ+5PTbJ/u74nC6iv4/lwIU99Ip5uuY6QoIf0Hn4m2HoV0qcnRivN3KSqc+FyCHjoVQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz", + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", "cpu": [ "x64" ], @@ -1798,9 +1798,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.1.tgz", - "integrity": "sha512-/8Rfgns4XD9XOSXlzUDepG8PX+AVWHliYlUkFI3K3GB6tqbdjYqdhcb4BKRd7C0BhZSoaCxhv8kTcBrcZWP+xg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz", + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", "cpu": [ "arm64" ], @@ -1815,9 +1815,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.1.tgz", - "integrity": "sha512-GITpD8dK9C+r+5yRT/UKVT36h/DQLOHdwGVwwoHidlnA168oD3uxA878XloXebK4Ul3gDBBIvEdL7go9gCUFzQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz", + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", "cpu": [ "x64" ], @@ -1832,9 +1832,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.1.tgz", - "integrity": "sha512-ieMID0JRZY/ZeCrsFQ3Y3NlHNCqIhTprJfDgSB3/lv5jJZ8FX3hqPyXWhe+gvS5ARMBJ242PM+VNz/ctNj//eA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz", + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", "cpu": [ "arm" ], @@ -1849,9 +1849,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.1.tgz", - "integrity": "sha512-W9//kCrh/6in9rWIBdKaMtuTTzNj6jSeG/haWBADqLLa9P8O5YSRDzgD5y9QBok4AYlzS6ARHifAb75V6G670Q==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz", + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", "cpu": [ "arm64" ], @@ -1866,9 +1866,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.1.tgz", - "integrity": "sha512-VIUV4z8GD8rtSVMfAj1aXFahsi/+tcoXXNYmXgzISL+KB381vbSTNdeZHHHIYqFyXcoEhu9n5cT+05tRv13rlw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz", + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", "cpu": [ "ia32" ], @@ -1883,9 +1883,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.1.tgz", - "integrity": "sha512-l4rfiiJRN7sTNI//ff65zJ9z8U+k6zcCg0LALU5iEWzY+a1mVZ8iWC1k5EsNKThZ7XCQ6YWtsZ8EWYm7r1UEsg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz", + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", "cpu": [ "loong64" ], @@ -1900,9 +1900,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.1.tgz", - "integrity": "sha512-U0bEuAOLvO/DWFdygTHWY8C067FXz+UbzKgxYhXC0fDieFa0kDIra1FAhsAARRJbvEyso8aAqvPdNxzWuStBnA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz", + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", "cpu": [ "mips64el" ], @@ -1917,9 +1917,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.1.tgz", - "integrity": "sha512-NzdQ/Xwu6vPSf/GkdmRNsOfIeSGnh7muundsWItmBsVpMoNPVpM61qNzAVY3pZ1glzzAxLR40UyYM23eaDDbYQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz", + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", "cpu": [ "ppc64" ], @@ -1934,9 +1934,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.1.tgz", - "integrity": "sha512-7zlw8p3IApcsN7mFw0O1Z1PyEk6PlKMu18roImfl3iQHTnr/yAfYv6s4hXPidbDoI2Q0pW+5xeoM4eTCC0UdrQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz", + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", "cpu": [ "riscv64" ], @@ -1951,9 +1951,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.1.tgz", - "integrity": "sha512-cGj5wli+G+nkVQdZo3+7FDKC25Uh4ZVwOAK6A06Hsvgr8WqBBuOy/1s+PUEd/6Je+vjfm6stX0kmib5b/O2Ykw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz", + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", "cpu": [ "s390x" ], @@ -1968,9 +1968,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.1.tgz", - "integrity": "sha512-z3H/HYI9MM0HTv3hQZ81f+AKb+yEoCRlUby1F80vbQ5XdzEMyY/9iNlAmhqiBKw4MJXwfgsh7ERGEOhrM1niMA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", "cpu": [ "x64" ], @@ -1985,9 +1985,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.1.tgz", - "integrity": "sha512-wzC24DxAvk8Em01YmVXyjl96Mr+ecTPyOuADAvjGg+fyBpGmxmcr2E5ttf7Im8D0sXZihpxzO1isus8MdjMCXQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz", + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", "cpu": [ "arm64" ], @@ -2002,9 +2002,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.1.tgz", - "integrity": "sha512-1YQ8ybGi2yIXswu6eNzJsrYIGFpnlzEWRl6iR5gMgmsrR0FcNoV1m9k9sc3PuP5rUBLshOZylc9nqSgymI+TYg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz", + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", "cpu": [ "x64" ], @@ -2019,9 +2019,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.1.tgz", - "integrity": "sha512-5Z+DzLCrq5wmU7RDaMDe2DVXMRm2tTDvX2KU14JJVBN2CT/qov7XVix85QoJqHltpvAOZUAc3ndU56HSMWrv8g==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz", + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", "cpu": [ "arm64" ], @@ -2036,9 +2036,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.1.tgz", - "integrity": "sha512-Q73ENzIdPF5jap4wqLtsfh8YbYSZ8Q0wnxplOlZUOyZy7B4ZKW8DXGWgTCZmF8VWD7Tciwv5F4NsRf6vYlZtqg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz", + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", "cpu": [ "x64" ], @@ -2053,9 +2053,9 @@ } }, "node_modules/@esbuild/openharmony-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.1.tgz", - "integrity": "sha512-ajbHrGM/XiK+sXM0JzEbJAen+0E+JMQZ2l4RR4VFwvV9JEERx+oxtgkpoKv1SevhjavK2z2ReHk32pjzktWbGg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz", + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", "cpu": [ "arm64" ], @@ -2070,9 +2070,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.1.tgz", - "integrity": "sha512-IPUW+y4VIjuDVn+OMzHc5FV4GubIwPnsz6ubkvN8cuhEqH81NovB53IUlrlBkPMEPxvNnf79MGBoz8rZ2iW8HA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz", + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", "cpu": [ "x64" ], @@ -2087,9 +2087,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.1.tgz", - "integrity": "sha512-RIVRWiljWA6CdVu8zkWcRmGP7iRRIIwvhDKem8UMBjPql2TXM5PkDVvvrzMtj1V+WFPB4K7zkIGM7VzRtFkjdg==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz", + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", "cpu": [ "arm64" ], @@ -2104,9 +2104,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.1.tgz", - "integrity": "sha512-2BR5M8CPbptC1AK5JbJT1fWrHLvejwZidKx3UMSF0ecHMa+smhi16drIrCEggkgviBwLYd5nwrFLSl5Kho96RQ==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz", + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", "cpu": [ "ia32" ], @@ -2121,9 +2121,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.1.tgz", - "integrity": "sha512-d5X6RMYv6taIymSk8JBP+nxv8DQAMY6A51GPgusqLdK9wBz5wWIXy1KjTck6HnjE9hqJzJRdk+1p/t5soSbCtw==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", "cpu": [ "x64" ], @@ -2592,9 +2592,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.53.4.tgz", - "integrity": "sha512-PWU3Y92H4DD0bOqorEPp1Y0tbzwAurFmIYpjcObv5axGVOtcTlB0b2UKMd2echo08MgN7jO8WQZSSysvfisFSQ==", + "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==", "cpu": [ "arm" ], @@ -2606,9 +2606,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.4.tgz", - "integrity": "sha512-Gw0/DuVm3rGsqhMGYkSOXXIx20cC3kTlivZeuaGt4gEgILivykNyBWxeUV5Cf2tDA2nPLah26vq3emlRrWVbng==", + "version": "4.53.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.53.5.tgz", + "integrity": "sha512-wrSAViWvZHBMMlWk6EJhvg8/rjxzyEhEdgfMMjREHEq11EtJ6IP6yfcCH57YAEca2Oe3FNCE9DSTgU70EIGmVw==", "cpu": [ "arm64" ], @@ -2620,9 +2620,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.53.4.tgz", - "integrity": "sha512-+w06QvXsgzKwdVg5qRLZpTHh1bigHZIqoIUPtiqh05ZiJVUQ6ymOxaPkXTvRPRLH88575ZCRSRM3PwIoNma01Q==", + "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==", "cpu": [ "arm64" ], @@ -2634,9 +2634,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.53.4.tgz", - "integrity": "sha512-EB4Na9G2GsrRNRNFPuxfwvDRDUwQEzJPpiK1vo2zMVhEeufZ1k7J1bKnT0JYDfnPC7RNZ2H5YNQhW6/p2QKATw==", + "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==", "cpu": [ "x64" ], @@ -2648,9 +2648,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.53.4.tgz", - "integrity": "sha512-bldA8XEqPcs6OYdknoTMaGhjytnwQ0NClSPpWpmufOuGPN5dDmvIa32FygC2gneKK4A1oSx86V1l55hyUWUYFQ==", + "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==", "cpu": [ "arm64" ], @@ -2662,9 +2662,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.53.4.tgz", - "integrity": "sha512-3T8GPjH6mixCd0YPn0bXtcuSXi1Lj+15Ujw2CEb7dd24j9thcKscCf88IV7n76WaAdorOzAgSSbuVRg4C8V8Qw==", + "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==", "cpu": [ "x64" ], @@ -2676,9 +2676,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.53.4.tgz", - "integrity": "sha512-UPMMNeC4LXW7ZSHxeP3Edv09aLsFUMaD1TSVW6n1CWMECnUIJMFFB7+XC2lZTdPtvB36tYC0cJWc86mzSsaviw==", + "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==", "cpu": [ "arm" ], @@ -2690,9 +2690,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.53.4.tgz", - "integrity": "sha512-H8uwlV0otHs5Q7WAMSoyvjV9DJPiy5nJ/xnHolY0QptLPjaSsuX7tw+SPIfiYH6cnVx3fe4EWFafo6gH6ekZKA==", + "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==", "cpu": [ "arm" ], @@ -2704,9 +2704,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.53.4.tgz", - "integrity": "sha512-BLRwSRwICXz0TXkbIbqJ1ibK+/dSBpTJqDClF61GWIrxTXZWQE78ROeIhgl5MjVs4B4gSLPCFeD4xML9vbzvCQ==", + "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==", "cpu": [ "arm64" ], @@ -2718,9 +2718,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.53.4.tgz", - "integrity": "sha512-6bySEjOTbmVcPJAywjpGLckK793A0TJWSbIa0sVwtVGfe/Nz6gOWHOwkshUIAp9j7wg2WKcA4Snu7Y1nUZyQew==", + "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==", "cpu": [ "arm64" ], @@ -2732,9 +2732,9 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.53.4.tgz", - "integrity": "sha512-U0ow3bXYJZ5MIbchVusxEycBw7bO6C2u5UvD31i5IMTrnt2p4Fh4ZbHSdc/31TScIJQYHwxbj05BpevB3201ug==", + "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==", "cpu": [ "loong64" ], @@ -2746,9 +2746,9 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.53.4.tgz", - "integrity": "sha512-iujDk07ZNwGLVn0YIWM80SFN039bHZHCdCCuX9nyx3Jsa2d9V/0Y32F+YadzwbvDxhSeVo9zefkoPnXEImnM5w==", + "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==", "cpu": [ "ppc64" ], @@ -2760,9 +2760,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.53.4.tgz", - "integrity": "sha512-MUtAktiOUSu+AXBpx1fkuG/Bi5rhlorGs3lw5QeJ2X3ziEGAq7vFNdWVde6XGaVqi0LGSvugwjoxSNJfHFTC0g==", + "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==", "cpu": [ "riscv64" ], @@ -2774,9 +2774,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.53.4.tgz", - "integrity": "sha512-btm35eAbDfPtcFEgaXCI5l3c2WXyzwiE8pArhd66SDtoLWmgK5/M7CUxmUglkwtniPzwvWioBKKl6IXLbPf2sQ==", + "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==", "cpu": [ "riscv64" ], @@ -2788,9 +2788,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.53.4.tgz", - "integrity": "sha512-uJlhKE9ccUTCUlK+HUz/80cVtx2RayadC5ldDrrDUFaJK0SNb8/cCmC9RhBhIWuZ71Nqj4Uoa9+xljKWRogdhA==", + "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==", "cpu": [ "s390x" ], @@ -2802,9 +2802,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.53.4.tgz", - "integrity": "sha512-jjEMkzvASQBbzzlzf4os7nzSBd/cvPrpqXCUOqoeCh1dQ4BP3RZCJk8XBeik4MUln3m+8LeTJcY54C/u8wb3DQ==", + "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==", "cpu": [ "x64" ], @@ -2816,9 +2816,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.53.4.tgz", - "integrity": "sha512-lu90KG06NNH19shC5rBPkrh6mrTpq5kviFylPBXQVpdEu0yzb0mDgyxLr6XdcGdBIQTH/UAhDJnL+APZTBu1aQ==", + "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==", "cpu": [ "x64" ], @@ -2830,9 +2830,9 @@ ] }, "node_modules/@rollup/rollup-openharmony-arm64": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.4.tgz", - "integrity": "sha512-dFDcmLwsUzhAm/dn0+dMOQZoONVYBtgik0VuY/d5IJUUb787L3Ko/ibvTvddqhb3RaB7vFEozYevHN4ox22R/w==", + "version": "4.53.5", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.53.5.tgz", + "integrity": "sha512-3DFiLPnTxiOQV993fMc+KO8zXHTcIjgaInrqlG8zDp1TlhYl6WgrOHuJkJQ6M8zHEcntSJsUp1XFZSY8C1DYbg==", "cpu": [ "arm64" ], @@ -2844,9 +2844,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.53.4.tgz", - "integrity": "sha512-WvUpUAWmUxZKtRnQWpRKnLW2DEO8HB/l8z6oFFMNuHndMzFTJEXzaYJ5ZAmzNw0L21QQJZsUQFt2oPf3ykAD/w==", + "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==", "cpu": [ "arm64" ], @@ -2858,9 +2858,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.53.4.tgz", - "integrity": "sha512-JGbeF2/FDU0x2OLySw/jgvkwWUo05BSiJK0dtuI4LyuXbz3wKiC1xHhLB1Tqm5VU6ZZDmAorj45r/IgWNWku5g==", + "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==", "cpu": [ "ia32" ], @@ -2872,9 +2872,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.53.4.tgz", - "integrity": "sha512-zuuC7AyxLWLubP+mlUwEyR8M1ixW1ERNPHJfXm8x7eQNP4Pzkd7hS3qBuKBR70VRiQ04Kw8FNfRMF5TNxuZq2g==", + "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==", "cpu": [ "x64" ], @@ -2886,9 +2886,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.53.4.tgz", - "integrity": "sha512-Sbx45u/Lbb5RyptSbX7/3deP+/lzEmZ0BTSHxwxN/IMOZDZf8S0AGo0hJD5n/LQssxb5Z3B4og4P2X6Dd8acCA==", + "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==", "cpu": [ "x64" ], @@ -3176,9 +3176,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "25.0.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.2.tgz", - "integrity": "sha512-gWEkeiyYE4vqjON/+Obqcoeffmk0NF15WSBwSs7zwVA2bAbTaE0SJ7P0WNGoJn8uE7fiaV5a7dKYIJriEqOrmA==", + "version": "25.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.3.tgz", + "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", "dev": true, "license": "MIT", "dependencies": { @@ -3778,9 +3778,9 @@ } }, "node_modules/alpinejs": { - "version": "3.15.2", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.2.tgz", - "integrity": "sha512-2kYF2aG+DTFkE6p0rHG5XmN4VEb6sO9b02aOdU4+i8QN6rL0DbRZQiypDE1gBcGO65yDcqMz5KKYUYgMUxgNkw==", + "version": "3.15.3", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.15.3.tgz", + "integrity": "sha512-fSI6F5213FdpMC4IWaup92KhuH3jBX0VVqajRJ6cOTCy1cL6888KyXdGO+seAAkn+g6fnrxBqQEx6gRpQ5EZoQ==", "license": "MIT", "dependencies": { "@vue/reactivity": "~3.1.1" @@ -4075,9 +4075,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.9.7", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.7.tgz", - "integrity": "sha512-k9xFKplee6KIio3IDbwj+uaCLpqzOwakOgmqzPezM0sFJlFKcg30vk2wOiAJtkTSfx0SSQDSe8q+mWA/fSH5Zg==", + "version": "2.9.8", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.8.tgz", + "integrity": "sha512-Y1fOuNDowLfgKOypdc9SPABfoWXuZHBOyCS4cD52IeZBhr4Md6CLLs6atcxVrzRmQ06E7hSlm5bHHApPKR/byA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4215,9 +4215,9 @@ "license": "MIT" }, "node_modules/bootstrap5-autocomplete": { - "version": "1.1.40", - "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.40.tgz", - "integrity": "sha512-fp2HDZule/qwC/hEftIO2gCcqsuBOH0Hv1KgoyiqI6Ny5s0THZYjQyqAE1RnN8qnR0mQXc/cEJTd7EKbqpoj0g==", + "version": "1.1.41", + "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.41.tgz", + "integrity": "sha512-GnjG9/oNOzDPdNumGeWyUhLct6q2y+HrYsznEbmNVhS51IEa6kls9txnogFZLxAXhH93F1RRt4BQMyTBMu5DDg==", "license": "MIT" }, "node_modules/bootstrap5-tags": { @@ -5841,9 +5841,9 @@ } }, "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.0.0.tgz", + "integrity": "sha512-5POEcUuZybH7IdmGsD8wlf0AI55wMecM9rVBTI/qEAy2c1kTOm3DjFYjrBdI2K3BaJjJYfYFeRtM0t9ssnRuxw==", "dev": true, "license": "MIT" }, @@ -5876,9 +5876,9 @@ } }, "node_modules/esbuild": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.1.tgz", - "integrity": "sha512-yY35KZckJJuVVPXpvjgxiCuVEJT67F6zDeVTv4rizyPrfGBUpZQsvmxnN+C371c2esD/hNMjj4tpBhuueLN7aA==", + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.2.tgz", + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5889,32 +5889,32 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.27.1", - "@esbuild/android-arm": "0.27.1", - "@esbuild/android-arm64": "0.27.1", - "@esbuild/android-x64": "0.27.1", - "@esbuild/darwin-arm64": "0.27.1", - "@esbuild/darwin-x64": "0.27.1", - "@esbuild/freebsd-arm64": "0.27.1", - "@esbuild/freebsd-x64": "0.27.1", - "@esbuild/linux-arm": "0.27.1", - "@esbuild/linux-arm64": "0.27.1", - "@esbuild/linux-ia32": "0.27.1", - "@esbuild/linux-loong64": "0.27.1", - "@esbuild/linux-mips64el": "0.27.1", - "@esbuild/linux-ppc64": "0.27.1", - "@esbuild/linux-riscv64": "0.27.1", - "@esbuild/linux-s390x": "0.27.1", - "@esbuild/linux-x64": "0.27.1", - "@esbuild/netbsd-arm64": "0.27.1", - "@esbuild/netbsd-x64": "0.27.1", - "@esbuild/openbsd-arm64": "0.27.1", - "@esbuild/openbsd-x64": "0.27.1", - "@esbuild/openharmony-arm64": "0.27.1", - "@esbuild/sunos-x64": "0.27.1", - "@esbuild/win32-arm64": "0.27.1", - "@esbuild/win32-ia32": "0.27.1", - "@esbuild/win32-x64": "0.27.1" + "@esbuild/aix-ppc64": "0.27.2", + "@esbuild/android-arm": "0.27.2", + "@esbuild/android-arm64": "0.27.2", + "@esbuild/android-x64": "0.27.2", + "@esbuild/darwin-arm64": "0.27.2", + "@esbuild/darwin-x64": "0.27.2", + "@esbuild/freebsd-arm64": "0.27.2", + "@esbuild/freebsd-x64": "0.27.2", + "@esbuild/linux-arm": "0.27.2", + "@esbuild/linux-arm64": "0.27.2", + "@esbuild/linux-ia32": "0.27.2", + "@esbuild/linux-loong64": "0.27.2", + "@esbuild/linux-mips64el": "0.27.2", + "@esbuild/linux-ppc64": "0.27.2", + "@esbuild/linux-riscv64": "0.27.2", + "@esbuild/linux-s390x": "0.27.2", + "@esbuild/linux-x64": "0.27.2", + "@esbuild/netbsd-arm64": "0.27.2", + "@esbuild/netbsd-x64": "0.27.2", + "@esbuild/openbsd-arm64": "0.27.2", + "@esbuild/openbsd-x64": "0.27.2", + "@esbuild/openharmony-arm64": "0.27.2", + "@esbuild/sunos-x64": "0.27.2", + "@esbuild/win32-arm64": "0.27.2", + "@esbuild/win32-ia32": "0.27.2", + "@esbuild/win32-x64": "0.27.2" } }, "node_modules/escalade": { @@ -10036,9 +10036,9 @@ } }, "node_modules/rollup": { - "version": "4.53.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.4.tgz", - "integrity": "sha512-YpXaaArg0MvrnJpvduEDYIp7uGOqKXbH9NsHGQ6SxKCOsNAjZF018MmxefFUulVP2KLtiGw1UvZbr+/ekjvlDg==", + "version": "4.53.5", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.53.5.tgz", + "integrity": "sha512-iTNAbFSlRpcHeeWu73ywU/8KuU/LZmNCSxp6fjQkJBD3ivUb8tpDrXhIxEzA05HlYMEwmtaUnb3RP+YNv162OQ==", "dev": true, "license": "MIT", "dependencies": { @@ -10052,28 +10052,28 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.53.4", - "@rollup/rollup-android-arm64": "4.53.4", - "@rollup/rollup-darwin-arm64": "4.53.4", - "@rollup/rollup-darwin-x64": "4.53.4", - "@rollup/rollup-freebsd-arm64": "4.53.4", - "@rollup/rollup-freebsd-x64": "4.53.4", - "@rollup/rollup-linux-arm-gnueabihf": "4.53.4", - "@rollup/rollup-linux-arm-musleabihf": "4.53.4", - "@rollup/rollup-linux-arm64-gnu": "4.53.4", - "@rollup/rollup-linux-arm64-musl": "4.53.4", - "@rollup/rollup-linux-loong64-gnu": "4.53.4", - "@rollup/rollup-linux-ppc64-gnu": "4.53.4", - "@rollup/rollup-linux-riscv64-gnu": "4.53.4", - "@rollup/rollup-linux-riscv64-musl": "4.53.4", - "@rollup/rollup-linux-s390x-gnu": "4.53.4", - "@rollup/rollup-linux-x64-gnu": "4.53.4", - "@rollup/rollup-linux-x64-musl": "4.53.4", - "@rollup/rollup-openharmony-arm64": "4.53.4", - "@rollup/rollup-win32-arm64-msvc": "4.53.4", - "@rollup/rollup-win32-ia32-msvc": "4.53.4", - "@rollup/rollup-win32-x64-gnu": "4.53.4", - "@rollup/rollup-win32-x64-msvc": "4.53.4", + "@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", "fsevents": "~2.3.2" } }, @@ -10129,9 +10129,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.96.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.96.0.tgz", - "integrity": "sha512-8u4xqqUeugGNCYwr9ARNtQKTOj4KmYiJAVKXf2CTIivTCR51j96htbMKWDru8H5SaQWpyVgTfOF8Ylyf5pun1Q==", + "version": "1.97.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.97.0.tgz", + "integrity": "sha512-KR0igP1z4avUJetEuIeOdDlwaUDvkH8wSx7FdSjyYBS3dpyX3TzHfAMO0G1Q4/3cdjcmi3r7idh+KCmKqS+KeQ==", "dev": true, "license": "MIT", "dependencies": { @@ -11291,9 +11291,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.2.tgz", - "integrity": "sha512-E85pfNzMQ9jpKkA7+TJAi4TJN+tBCuWh5rUcS/sv6cFi+1q9LYDwDI5dpUL0u/73EElyQ8d3TEaeW4sPedBqYA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz", + "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==", "dev": true, "funding": [ { @@ -11740,9 +11740,9 @@ "license": "BSD-2-Clause" }, "node_modules/webpack": { - "version": "5.103.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.103.0.tgz", - "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", + "version": "5.104.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.104.0.tgz", + "integrity": "sha512-5DeICTX8BVgNp6afSPYXAFjskIgWGlygQH58bcozPOXgo2r/6xx39Y1+cULZ3gTxUYQP88jmwLj2anu4Xaq84g==", "dev": true, "license": "MIT", "dependencies": { @@ -11754,10 +11754,10 @@ "@webassemblyjs/wasm-parser": "^1.14.1", "acorn": "^8.15.0", "acorn-import-phases": "^1.0.3", - "browserslist": "^4.26.3", + "browserslist": "^4.28.1", "chrome-trace-event": "^1.0.2", - "enhanced-resolve": "^5.17.3", - "es-module-lexer": "^1.2.1", + "enhanced-resolve": "^5.17.4", + "es-module-lexer": "^2.0.0", "eslint-scope": "5.1.1", "events": "^3.2.0", "glob-to-regexp": "^0.4.1", @@ -11768,7 +11768,7 @@ "neo-async": "^2.6.2", "schema-utils": "^4.3.3", "tapable": "^2.3.0", - "terser-webpack-plugin": "^5.3.11", + "terser-webpack-plugin": "^5.3.16", "watchpack": "^2.4.4", "webpack-sources": "^3.3.3" }, From 1daacb80b12f58cb44af511106a9e203013fdc88 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 17 Dec 2025 19:27:59 +0100 Subject: [PATCH 04/58] Fix #11383 --- app/Http/Controllers/Auth/LoginController.php | 56 ++++-- app/Support/Steam.php | 176 +++++++++--------- 2 files changed, 125 insertions(+), 107 deletions(-) diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 2c330a516b..a4276e461b 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -31,6 +31,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Providers\RouteServiceProvider; use FireflyIII\Repositories\User\UserRepositoryInterface; +use FireflyIII\Support\Facades\Steam; use FireflyIII\User; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; @@ -68,7 +69,7 @@ class LoginController extends Controller protected string $redirectTo = RouteServiceProvider::HOME; private UserRepositoryInterface $repository; - private string $username = 'email'; + private string $username = 'email'; /** * Create a new controller instance. @@ -85,7 +86,7 @@ class LoginController extends Controller * * @throws ValidationException */ - public function login(Request $request): JsonResponse|RedirectResponse + public function login(Request $request): JsonResponse | RedirectResponse { $username = $request->get($this->username()); Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $username)); @@ -103,8 +104,7 @@ class LoginController extends Controller $this->username => trans('auth.failed'), ] ) - ->onlyInput($this->username) - ; + ->onlyInput($this->username); } Log::debug('Login data is present.'); @@ -128,11 +128,10 @@ class LoginController extends Controller // send a custom login event because laravel will also fire a login event if a "remember me"-cookie // restores the event. event(new ActuallyLoggedIn($this->guard()->user())); - return $this->sendLoginResponse($request); } Log::warning('Login attempt failed.'); - $username = (string) $request->get($this->username()); + $username = (string)$request->get($this->username()); $user = $this->repository->findByEmail($username); if (!$user instanceof User) { // send event to owner. @@ -185,10 +184,10 @@ class LoginController extends Controller /** * Log the user out of the application. */ - public function logout(Request $request): Redirector|RedirectResponse|Response + public function logout(Request $request): Redirector | RedirectResponse | Response { - $authGuard = config('firefly.authentication_guard'); - $logoutUrl = config('firefly.custom_logout_url'); + $authGuard = config('firefly.authentication_guard'); + $logoutUrl = config('firefly.custom_logout_url'); if ('remote_user_guard' === $authGuard && '' !== $logoutUrl) { return redirect($logoutUrl); } @@ -222,13 +221,13 @@ class LoginController extends Controller * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function showLoginForm(Request $request): Factory|Redirector|RedirectResponse|View + public function showLoginForm(Request $request): Factory | Redirector | RedirectResponse | View { Log::channel('audit')->info('Show login form (1.1).'); - $count = DB::table('users')->count(); - $guard = config('auth.defaults.guard'); - $title = (string) trans('firefly.login_page_title'); + $count = DB::table('users')->count(); + $guard = config('auth.defaults.guard'); + $title = (string)trans('firefly.login_page_title'); if (0 === $count && 'web' === $guard) { return redirect(route('register')); @@ -248,16 +247,37 @@ class LoginController extends Controller $allowReset = false; } - $email = $request->old('email'); - $remember = $request->old('remember'); + $email = $request->old('email'); + $remember = $request->old('remember'); - $storeInCookie = config('google2fa.store_in_cookie', false); + $storeInCookie = config('google2fa.store_in_cookie', false); if (false !== $storeInCookie) { $cookieName = config('google2fa.cookie_name', 'google2fa_token'); - Cookie::queue(Cookie::make($cookieName, 'invalid-'.Carbon::now()->getTimestamp())); + Cookie::queue(Cookie::make($cookieName, 'invalid-' . Carbon::now()->getTimestamp())); } - $usernameField = $this->username(); + $usernameField = $this->username(); return view('auth.login', ['allowRegistration' => $allowRegistration, 'email' => $email, 'remember' => $remember, 'allowReset' => $allowReset, 'title' => $title, 'usernameField' => $usernameField]); } + + /** + * Send the response after the user was authenticated. + * + * @param \Illuminate\Http\Request $request + * + * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + */ + protected function sendLoginResponse(Request $request) + { + $request->session()->regenerate(); + $this->clearLoginAttempts($request); + + if ($response = $this->authenticated($request, $this->guard()->user())) { + return $response; + } + $path = Steam::getSafeUrl(session()->pull('url.intended', route('index')), route('index')); + Log::debug(sprintf('SafeURL is %s', $path)); + return $request->wantsJson() ? new JsonResponse([], 204) : redirect()->to($path); + } + } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 939a9069b4..f89c94d349 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -23,9 +23,8 @@ declare(strict_types=1); namespace FireflyIII\Support; -use FireflyIII\Support\Facades\Preferences; -use Deprecated; use Carbon\Carbon; +use Deprecated; use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; @@ -33,6 +32,7 @@ use FireflyIII\Models\AccountMeta; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Facades\Amount; +use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Singleton\PreferencesSingleton; use Illuminate\Support\Collection; @@ -43,7 +43,6 @@ use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Safe\Exceptions\UrlException; use ValueError; - use function Safe\parse_url; use function Safe\preg_replace; @@ -55,38 +54,37 @@ class Steam public function accountsBalancesOptimized(Collection $accounts, Carbon $date, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null, bool $inclusive = true): array { Log::debug(sprintf('accountsBalancesOptimized: Called for %d account(s) with date/time "%s" (inclusive: %s)', $accounts->count(), $date->toIso8601String(), var_export($inclusive, true))); - $result = []; + $result = []; $convertToPrimary ??= Amount::convertToPrimary(); $primary ??= Amount::getPrimaryCurrency(); - $currencies = $this->getCurrencies($accounts); + $currencies = $this->getCurrencies($accounts); // balance(s) in all currencies for ALL accounts. $arrayOfSums = Transaction::whereIn('account_id', $accounts->pluck('id')->toArray()) - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') - ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) - ->groupBy(['transactions.account_id', 'transaction_currencies.code']) - ->get(['transactions.account_id', 'transaction_currencies.code', DB::raw('SUM(transactions.amount) as sum_of_amount')])->toArray() - ; + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') + ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) + ->groupBy(['transactions.account_id', 'transaction_currencies.code']) + ->get(['transactions.account_id', 'transaction_currencies.code', DB::raw('SUM(transactions.amount) as sum_of_amount')])->toArray(); Log::debug('Array of sums: ', $arrayOfSums); /** @var Account $account */ foreach ($accounts as $account) { - $return = [ + $return = [ 'pc_balance' => '0', 'balance' => '0', // this key is overwritten right away, but I must remember it is always created. ]; - $currency = $currencies[$account->id]; + $currency = $currencies[$account->id]; // second array - $accountSums = array_filter($arrayOfSums, fn (array $entry): bool => $entry['account_id'] === $account->id); + $accountSums = array_filter($arrayOfSums, fn(array $entry): bool => $entry['account_id'] === $account->id); if (0 === count($accountSums)) { $result[$account->id] = $return; continue; } - $sumsByCode = []; + $sumsByCode = []; foreach ($accountSums as $accountSum) { // $accountSum = array_values($accountSum)[0]; $sumOfAmount = (string)$accountSum['sum_of_amount']; @@ -95,7 +93,7 @@ class Steam } // Log::debug('All balances are (joined)', $others); // if there is no request to convert, take this as "balance" and "pc_balance". - $return['balance'] = $sumsByCode[$currency->code] ?? '0'; + $return['balance'] = $sumsByCode[$currency->code] ?? '0'; if (!$convertToPrimary) { unset($return['pc_balance']); // Log::debug(sprintf('Set balance to %s, unset pc_balance', $return['balance'])); @@ -108,7 +106,7 @@ class Steam } // either way, the balance is always combined with the virtual balance: - $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); + $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); if ($convertToPrimary) { // the primary currency balance is combined with a converted virtual_balance: @@ -131,7 +129,8 @@ class Steam } /** - * Calls accountsBalancesOptimized for the given accounts and makes sure that inclusive is set to false, so it properly gets the balance of a range. + * Calls accountsBalancesOptimized for the given accounts and makes sure that inclusive is set to false, so it + * properly gets the balance of a range. */ public function accountsBalancesInRange(Collection $accounts, Carbon $start, Carbon $end, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null): array { @@ -160,10 +159,10 @@ class Steam // Log::debug(sprintf('Trying bcround("%s",%d)', $number, $precision)); if (str_contains($number, '.')) { if ('-' !== $number[0]) { - return bcadd($number, '0.'.str_repeat('0', $precision).'5', $precision); + return bcadd($number, '0.' . str_repeat('0', $precision) . '5', $precision); } - return bcsub($number, '0.'.str_repeat('0', $precision).'5', $precision); + return bcsub($number, '0.' . str_repeat('0', $precision) . '5', $precision); } return $number; @@ -305,11 +304,12 @@ class Steam "balance": balance in the account's currency OR user's primary currency if the account has no currency --> "pc_balance": balance in the user's primary currency, with all amounts converted to the primary currency. "EUR": balance in EUR (or whatever currencies the account has balance in) - TXT)] + TXT + )] public function finalAccountBalance(Account $account, Carbon $date, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null, bool $inclusive = true): array { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty($date); if ($cache->has()) { @@ -324,27 +324,26 @@ class Steam $primary = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // account balance thing. - $currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency']; + $currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency']; if ($currencyPresent) { $accountCurrency = $account->meta['currency']; } if (!$currencyPresent) { $accountCurrency = $this->getAccountCurrency($account); } - $hasCurrency = null !== $accountCurrency; - $currency = $hasCurrency ? $accountCurrency : $primary; - $return = [ + $hasCurrency = null !== $accountCurrency; + $currency = $hasCurrency ? $accountCurrency : $primary; + $return = [ 'pc_balance' => '0', 'balance' => '0', // this key is overwritten right away, but I must remember it is always created. ]; // balance(s) in all currencies. - $array = $account->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') - ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) - ->get(['transaction_currencies.code', 'transactions.amount'])->toArray() - ; - $others = $this->groupAndSumTransactions($array, 'code', 'amount'); + $array = $account->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') + ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) + ->get(['transaction_currencies.code', 'transactions.amount'])->toArray(); + $others = $this->groupAndSumTransactions($array, 'code', 'amount'); Log::debug('All balances are (joined)', $others); // if there is no request to convert, take this as "balance" and "pc_balance". $return['balance'] = $others[$currency->code] ?? '0'; @@ -359,7 +358,7 @@ class Steam } // either way, the balance is always combined with the virtual balance: - $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); + $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); if ($convertToPrimary) { // the primary currency balance is combined with a converted virtual_balance: @@ -373,7 +372,7 @@ class Steam $return['balance'] = bcadd($return['balance'], $virtualBalance); // Log::debug(sprintf('Virtual balance makes the (primary currency) total %s', $return['balance'])); } - $final = array_merge($return, $others); + $final = array_merge($return, $others); Log::debug('Final balance is', $final); $cache->store($final); @@ -391,7 +390,7 @@ class Steam Log::debug(sprintf('called finalAccountBalanceInRange(#%d, %s, %s)', $account->id, $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); // set up cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty('final-balance-in-range'); $cache->addProperty($start); @@ -402,15 +401,15 @@ class Steam // return $cache->get(); } - $balances = []; - $formatted = $start->format('Y-m-d'); + $balances = []; + $formatted = $start->format('Y-m-d'); Log::debug('Get first balance to start.'); // 2025-10-08 replaced finalAccountBalance with accountsBalancesOptimized: - $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); - $startBalance = $this->accountsBalancesOptimized(new Collection()->push($account), $start, $primaryCurrency, $convertToPrimary, false)[$account->id]; - $accountCurrency = $this->getAccountCurrency($account); - $hasCurrency = $accountCurrency instanceof TransactionCurrency; - $currency = $accountCurrency ?? $primaryCurrency; + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $startBalance = $this->accountsBalancesOptimized(new Collection()->push($account), $start, $primaryCurrency, $convertToPrimary, false)[$account->id]; + $accountCurrency = $this->getAccountCurrency($account); + $hasCurrency = $accountCurrency instanceof TransactionCurrency; + $currency = $accountCurrency ?? $primaryCurrency; Log::debug(sprintf('Currency is %s', $currency->code)); // set start balances: @@ -422,7 +421,7 @@ class Steam Log::debug(sprintf('Also set start balance in %s', $primaryCurrency->code)); $startBalance[$primaryCurrency->code] ??= '0'; } - $currencies = [ + $currencies = [ $currency->id => $currency, $primaryCurrency->id => $primaryCurrency, ]; @@ -432,48 +431,47 @@ class Steam // sums up the balance changes per day. Log::debug(sprintf('Date >= %s and <= %s', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); - $set = $account->transactions() - ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d H:i:s')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d H:i:s')) - ->groupBy('transaction_journals.date') - ->groupBy('transactions.transaction_currency_id') - ->orderBy('transaction_journals.date', 'ASC') - ->whereNull('transaction_journals.deleted_at') - ->get( - [ // @phpstan-ignore-line - 'transaction_journals.date', - 'transactions.transaction_currency_id', - DB::raw('SUM(transactions.amount) AS sum_of_day'), - ] - ) - ; + $set = $account->transactions() + ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transaction_journals.date', '>=', $start->format('Y-m-d H:i:s')) + ->where('transaction_journals.date', '<=', $end->format('Y-m-d H:i:s')) + ->groupBy('transaction_journals.date') + ->groupBy('transactions.transaction_currency_id') + ->orderBy('transaction_journals.date', 'ASC') + ->whereNull('transaction_journals.deleted_at') + ->get( + [ // @phpstan-ignore-line + 'transaction_journals.date', + 'transactions.transaction_currency_id', + DB::raw('SUM(transactions.amount) AS sum_of_day'), + ] + ); - $currentBalance = $startBalance; - $converter = new ExchangeRateConverter(); + $currentBalance = $startBalance; + $converter = new ExchangeRateConverter(); /** @var Transaction $entry */ foreach ($set as $entry) { // get date object - $carbon = new Carbon($entry->date, $entry->date_tz); - $carbonKey = $carbon->format('Y-m-d'); + $carbon = new Carbon($entry->date, $entry->date_tz); + $carbonKey = $carbon->format('Y-m-d'); // make sure sum is a string: - $sumOfDay = (string)($entry->sum_of_day ?? '0'); + $sumOfDay = (string)($entry->sum_of_day ?? '0'); // #10426 make sure sum is not in scientific notation. - $sumOfDay = $this->floatalize($sumOfDay); + $sumOfDay = $this->floatalize($sumOfDay); // find currency of this entry, does not have to exist. $currencies[$entry->transaction_currency_id] ??= Amount::getTransactionCurrencyById($entry->transaction_currency_id); // make sure this $entry has its own $entryCurrency /** @var TransactionCurrency $entryCurrency */ - $entryCurrency = $currencies[$entry->transaction_currency_id]; + $entryCurrency = $currencies[$entry->transaction_currency_id]; Log::debug(sprintf('Processing transaction(s) on moment %s', $carbon->format('Y-m-d H:i:s'))); // add amount to current balance in currency code. - $currentBalance[$entryCurrency->code] ??= '0'; + $currentBalance[$entryCurrency->code] ??= '0'; $currentBalance[$entryCurrency->code] = bcadd($sumOfDay, (string)$currentBalance[$entryCurrency->code]); // if not requested to convert to primary currency, add the amount to "balance", do nothing else. @@ -491,7 +489,7 @@ class Steam } } // add to final array. - $balances[$carbonKey] = $currentBalance; + $balances[$carbonKey] = $currentBalance; Log::debug(sprintf('Updated entry [%s]', $carbonKey), $currentBalance); } $cache->store($balances); @@ -508,7 +506,7 @@ class Steam */ public function floatalize(string $value): string { - $value = strtoupper($value); + $value = strtoupper($value); if (!str_contains($value, 'E')) { return $value; } @@ -532,8 +530,8 @@ class Steam public function getAccountCurrency(Account $account): ?TransactionCurrency { - $type = $account->accountType->type; - $list = config('firefly.valid_currency_account_types'); + $type = $account->accountType->type; + $list = config('firefly.valid_currency_account_types'); // return null if not in this list. if (!in_array($type, $list, true)) { @@ -586,15 +584,15 @@ class Steam { $list = []; - $set = auth()->user()->transactions() - ->whereIn('transactions.account_id', $accounts) - ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) - ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line + $set = auth()->user()->transactions() + ->whereIn('transactions.account_id', $accounts) + ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line ; /** @var Transaction $entry */ foreach ($set as $entry) { - $date = new Carbon($entry->max_date, config('app.timezone')); + $date = new Carbon($entry->max_date, config('app.timezone')); $date->setTimezone(config('app.timezone')); $list[(int)$entry->account_id] = $date; } @@ -612,14 +610,14 @@ class Steam if (null !== $cached) { return $cached; } - $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; + $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; if (is_array($locale)) { $locale = 'equal'; } if ('equal' === $locale) { $locale = $this->getLanguage(); } - $locale = (string)$locale; + $locale = (string)$locale; // Check for Windows to replace the locale correctly. if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) { @@ -663,8 +661,8 @@ class Steam */ public function getSafePreviousUrl(): string { - // Log::debug(sprintf('getSafePreviousUrl: "%s"', session()->previousUrl())); - return session()->previousUrl() ?? route('index'); + $res = $this->getSafeUrl(session()->previousUrl() ?? route('index'), route('index')); + Log::debug(sprintf('getSafePreviousUrl: "%s"', $res)); } /** @@ -673,8 +671,8 @@ class Steam public function getSafeUrl(string $unknownUrl, string $safeUrl): string { // Log::debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl)); - $returnUrl = $safeUrl; - + $returnUrl = $safeUrl; +// die('in get safe url'); try { $unknownHost = parse_url($unknownUrl, PHP_URL_HOST); } catch (UrlException $e) { @@ -791,12 +789,12 @@ class Steam if (null === $preference) { $singleton->setPreference($key, $currency); } - $current = $amount; + $current = $amount; if ($currency->id !== $primary->id) { $current = $converter->convert($currency, $primary, $date, $amount); Log::debug(sprintf('Convert %s %s to %s %s', $currency->code, $amount, $primary->code, $current)); } - $total = bcadd((string)$current, $total); + $total = bcadd((string)$current, $total); } return $total; @@ -810,8 +808,8 @@ class Steam $primary = Amount::getPrimaryCurrency(); $currencies[$primary->id] = $primary; - $ids = $accounts->pluck('id')->toArray(); - $result = AccountMeta::whereIn('account_id', $ids)->where('name', 'currency_id')->get(); + $ids = $accounts->pluck('id')->toArray(); + $result = AccountMeta::whereIn('account_id', $ids)->where('name', 'currency_id')->get(); /** @var AccountMeta $item */ foreach ($result as $item) { @@ -821,7 +819,7 @@ class Steam } } // collect those currencies, skip primary because we already have it. - $set = TransactionCurrency::whereIn('id', $accountPreferences)->where('id', '!=', $primary->id)->get(); + $set = TransactionCurrency::whereIn('id', $accountPreferences)->where('id', '!=', $primary->id)->get(); foreach ($set as $item) { $currencies[$item->id] = $item; } @@ -832,7 +830,7 @@ class Steam $currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency']; if ($currencyPresent) { $currencyId = $account->meta['currency']->id; - $currencies[$currencyId] ??= $account->meta['currency']; + $currencies[$currencyId] ??= $account->meta['currency']; $accountCurrencies[$accountId] = $account->meta['currency']; } if (!$currencyPresent && !array_key_exists($accountId, $accountPreferences)) { From 0acd07405bc9bb172e6e7f58cc376a701d3cf508 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 19 Dec 2025 16:30:39 +0100 Subject: [PATCH 05/58] Fix #11388 --- .../Commands/Correction/CorrectsAmounts.php | 4 ++ .../Correction/CorrectsUnevenAmount.php | 28 ++------ .../Upgrade/RemovesDatabaseDecryption.php | 7 +- .../Upgrade/RepairsAccountBalances.php | 2 +- .../Upgrade/UpgradesLiabilitiesEight.php | 65 +++++++++---------- .../Account/AccountRepository.php | 5 -- .../Account/AccountRepositoryInterface.php | 1 - app/Support/Balance.php | 1 + .../Models/AccountBalanceCalculator.php | 2 +- 9 files changed, 45 insertions(+), 70 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index c46880bf8d..b140344b17 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -100,6 +100,10 @@ class CorrectsAmounts extends Command if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { continue; } + if(null === $source->foreign_amount || null === $destination->foreign_amount) { + continue; + } + $sourceAccount = $source->account; $destAccount = $destination->account; if (null === $sourceAccount || null === $destAccount) { diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 31f81ca19b..d96f2b6599 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -132,11 +132,7 @@ class CorrectsUnevenAmount extends Command private function fixUnevenAmounts(): void { Log::debug('fixUnevenAmounts()'); - $journals = DB::table('transactions') - ->groupBy('transaction_journal_id') - ->whereNull('deleted_at') - ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]) - ; + $journals = DB::table('transactions')->groupBy('transaction_journal_id')->whereNull('deleted_at')->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]); /** @var stdClass $entry */ foreach ($journals as $entry) { @@ -146,11 +142,7 @@ class CorrectsUnevenAmount extends Command || '' === $sum // @phpstan-ignore-line || str_contains($sum, 'e') || str_contains($sum, ',')) { - $message = sprintf( - 'Journal #%d has an invalid sum ("%s"). No sure what to do.', - $entry->transaction_journal_id, - $entry->the_sum - ); + $message = sprintf('Journal #%d has an invalid sum ("%s"). No sure what to do.', $entry->transaction_journal_id, $entry->the_sum); $this->friendlyWarning($message); Log::warning($message); ++$this->count; @@ -184,13 +176,7 @@ class CorrectsUnevenAmount extends Command $source = $journal->transactions()->where('amount', '<', 0)->first(); if (null === $source) { - $this->friendlyError( - sprintf( - 'Journal #%d ("%s") has no source transaction. It will be deleted to maintain database consistency.', - $journal->id ?? 0, - $journal->description ?? '' - ) - ); + $this->friendlyError(sprintf('Journal #%d ("%s") has no source transaction. It will be deleted to maintain database consistency.', $journal->id ?? 0, $journal->description ?? '')); Transaction::where('transaction_journal_id', $journal->id ?? 0)->forceDelete(); TransactionJournal::where('id', $journal->id ?? 0)->forceDelete(); ++$this->count; @@ -205,13 +191,7 @@ class CorrectsUnevenAmount extends Command $destination = $journal->transactions()->where('amount', '>', 0)->first(); if (null === $destination) { - $this->friendlyError( - sprintf( - 'Journal #%d ("%s") has no destination transaction. It will be deleted to maintain database consistency.', - $journal->id ?? 0, - $journal->description ?? '' - ) - ); + $this->friendlyError(sprintf('Journal #%d ("%s") has no destination transaction. It will be deleted to maintain database consistency.', $journal->id ?? 0, $journal->description ?? '')); Transaction::where('transaction_journal_id', $journal->id ?? 0)->forceDelete(); TransactionJournal::where('id', $journal->id ?? 0)->forceDelete(); diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index 03070692ef..6ef235f0be 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -34,7 +34,6 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use JsonException; use stdClass; - use function Safe\json_decode; class RemovesDatabaseDecryption extends Command @@ -120,8 +119,8 @@ class RemovesDatabaseDecryption extends Command if (null === $original) { return; } - $id = (int) $row->id; - $value = ''; + $id = (int)$row->id; + $value = ''; try { $value = $this->tryDecrypt($original); @@ -133,7 +132,7 @@ class RemovesDatabaseDecryption extends Command } // A separate routine for preferences table: - if ('preferences' === $table) { + if ('preferences' === $table && is_string($value)) { $this->decryptPreferencesRow($id, $value); return; diff --git a/app/Console/Commands/Upgrade/RepairsAccountBalances.php b/app/Console/Commands/Upgrade/RepairsAccountBalances.php index 1e35520f09..3282b2f00f 100644 --- a/app/Console/Commands/Upgrade/RepairsAccountBalances.php +++ b/app/Console/Commands/Upgrade/RepairsAccountBalances.php @@ -1,7 +1,7 @@ accounts() - ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->whereIn('account_types.type', config('firefly.valid_liabilities')) - ->get(['accounts.*']) - ; + ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') + ->whereIn('account_types.type', config('firefly.valid_liabilities')) + ->get(['accounts.*']); /** @var Account $account */ foreach ($accounts as $account) { @@ -102,7 +101,7 @@ class UpgradesLiabilitiesEight extends Command $repository = app(AccountRepositoryInterface::class); $repository->setUser($account->user); - $direction = $repository->getMetaValue($account, 'liability_direction'); + $direction = $repository->getMetaValue($account, 'liability_direction'); if ('credit' === $direction && $this->hasBadOpening($account)) { $this->deleteCreditTransaction($account); $this->reverseOpeningBalance($account); @@ -121,34 +120,31 @@ class UpgradesLiabilitiesEight extends Command $openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first(); $liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first(); $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) - ->first(['transaction_journals.*']) - ; + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) + ->first(['transaction_journals.*']); if (null === $openingJournal) { return false; } - $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $liabilityType->id) - ->first(['transaction_journals.*']) - ; + $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $liabilityType->id) + ->first(['transaction_journals.*']); if (null === $liabilityJournal) { return false; } - return (bool) $openingJournal->date->isSameDay($liabilityJournal->date); + return (bool)$openingJournal->date->isSameDay($liabilityJournal->date); } private function deleteCreditTransaction(Account $account): void { $liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first(); $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $liabilityType->id) - ->first(['transaction_journals.*']) - ; - if (null !== $liabilityJournal) { + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $liabilityType->id) + ->first(['transaction_journals.*']); + if (null !== $liabilityJournal && null !== $liabilityJournal->transactionGroup) { $group = $liabilityJournal->transactionGroup; $service = new TransactionGroupDestroyService(); $service->destroy($group); @@ -161,17 +157,16 @@ class UpgradesLiabilitiesEight extends Command $openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first(); /** @var TransactionJournal $openingJournal */ - $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) - ->first(['transaction_journals.*']) - ; + $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) + ->first(['transaction_journals.*']); /** @var null|Transaction $source */ - $source = $openingJournal->transactions()->where('amount', '<', 0)->first(); + $source = $openingJournal->transactions()->where('amount', '<', 0)->first(); /** @var null|Transaction $dest */ - $dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); + $dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); if (null !== $source && null !== $dest) { $sourceId = $source->account_id; $destId = $dest->account_id; @@ -189,14 +184,16 @@ class UpgradesLiabilitiesEight extends Command { $count = 0; $journals = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->where('transactions.account_id', $account->id)->get(['transaction_journals.*']) - ; + ->where('transactions.account_id', $account->id)->get(['transaction_journals.*']); + + $service = app(TransactionGroupDestroyService::class); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { - $service = app(TransactionGroupDestroyService::class); - $service->destroy($journal->transactionGroup); - ++$count; + if (null !== $journal->transactionGroup) { + $service->destroy($journal->transactionGroup); + ++$count; + } } return $count; diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 546953a8c8..14d61f3791 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -167,11 +167,6 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return $account; } - #[Override] - public function getAccountBalances(Account $account): Collection - { - return $account->accountBalances; - } /** * Return account type or null if not found. diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 3a16896695..97a0e69c03 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -71,7 +71,6 @@ interface AccountRepositoryInterface public function findByName(string $name, array $types): ?Account; - public function getAccountBalances(Account $account): Collection; public function getAccountCurrency(Account $account): ?TransactionCurrency; diff --git a/app/Support/Balance.php b/app/Support/Balance.php index 0a9a97d0ee..2c400e7c81 100644 --- a/app/Support/Balance.php +++ b/app/Support/Balance.php @@ -34,6 +34,7 @@ class Balance { /** * Returns the accounts balances as an array, on the account ID. + * @deprecated */ public function getAccountBalances(Collection $accounts, Carbon $date): array { diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index 5675f92adc..a828eead5b 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -161,7 +161,7 @@ class AccountBalanceCalculator // then update all transactions. // save all collected balances in their respective account objects. - $this->storeAccountBalances($balances); + // $this->storeAccountBalances($balances); } private function storeAccountBalances(array $balances): void From 476a9ac6e4b65c57befb96fb8320b8f05419a4d3 Mon Sep 17 00:00:00 2001 From: JC5 Date: Fri, 19 Dec 2025 16:34:41 +0100 Subject: [PATCH 06/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/php-cs-fixer/composer.lock | 12 +- .../Commands/Correction/CorrectsAmounts.php | 2 +- .../Upgrade/RemovesDatabaseDecryption.php | 5 +- .../Upgrade/UpgradesLiabilitiesEight.php | 54 ++--- app/Http/Controllers/Auth/LoginController.php | 38 ++-- .../Account/AccountRepository.php | 1 - .../Account/AccountRepositoryInterface.php | 1 - app/Support/Balance.php | 1 + app/Support/Steam.php | 188 +++++++++--------- composer.lock | 12 +- config/firefly.php | 4 +- package-lock.json | 74 +++---- 12 files changed, 202 insertions(+), 190 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index a96ebd6740..882c19b221 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -402,16 +402,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.92.2", + "version": "v3.92.3", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "64fab3553dce507ce247f7d1a7d65f74ef658c3f" + "reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/64fab3553dce507ce247f7d1a7d65f74ef658c3f", - "reference": "64fab3553dce507ce247f7d1a7d65f74ef658c3f", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8", + "reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8", "shasum": "" }, "require": { @@ -494,7 +494,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.2" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.3" }, "funding": [ { @@ -502,7 +502,7 @@ "type": "github" } ], - "time": "2025-12-17T00:04:16+00:00" + "time": "2025-12-18T10:45:02+00:00" }, { "name": "psr/container", diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index b140344b17..785df6803e 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -100,7 +100,7 @@ class CorrectsAmounts extends Command if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { continue; } - if(null === $source->foreign_amount || null === $destination->foreign_amount) { + if (null === $source->foreign_amount || null === $destination->foreign_amount) { continue; } diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index 6ef235f0be..e1451c94a5 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -34,6 +34,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use JsonException; use stdClass; + use function Safe\json_decode; class RemovesDatabaseDecryption extends Command @@ -119,8 +120,8 @@ class RemovesDatabaseDecryption extends Command if (null === $original) { return; } - $id = (int)$row->id; - $value = ''; + $id = (int)$row->id; + $value = ''; try { $value = $this->tryDecrypt($original); diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php index 6fa32bbfa8..fc986e5260 100644 --- a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php @@ -42,8 +42,8 @@ class UpgradesLiabilitiesEight extends Command use ShowsFriendlyMessages; public const string CONFIG_NAME = '600_upgrade_liabilities'; - protected $description = 'Upgrade liabilities to new 6.0.0 structure.'; - protected $signature = 'upgrade:600-liabilities {--F|force : Force the execution of this command.}'; + protected $description = 'Upgrade liabilities to new 6.0.0 structure.'; + protected $signature = 'upgrade:600-liabilities {--F|force : Force the execution of this command.}'; /** * Execute the console command. @@ -82,9 +82,10 @@ class UpgradesLiabilitiesEight extends Command private function upgradeForUser(User $user): void { $accounts = $user->accounts() - ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->whereIn('account_types.type', config('firefly.valid_liabilities')) - ->get(['accounts.*']); + ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') + ->whereIn('account_types.type', config('firefly.valid_liabilities')) + ->get(['accounts.*']) + ; /** @var Account $account */ foreach ($accounts as $account) { @@ -101,7 +102,7 @@ class UpgradesLiabilitiesEight extends Command $repository = app(AccountRepositoryInterface::class); $repository->setUser($account->user); - $direction = $repository->getMetaValue($account, 'liability_direction'); + $direction = $repository->getMetaValue($account, 'liability_direction'); if ('credit' === $direction && $this->hasBadOpening($account)) { $this->deleteCreditTransaction($account); $this->reverseOpeningBalance($account); @@ -120,16 +121,18 @@ class UpgradesLiabilitiesEight extends Command $openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first(); $liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first(); $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) - ->first(['transaction_journals.*']); + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) + ->first(['transaction_journals.*']) + ; if (null === $openingJournal) { return false; } - $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $liabilityType->id) - ->first(['transaction_journals.*']); + $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $liabilityType->id) + ->first(['transaction_journals.*']) + ; if (null === $liabilityJournal) { return false; } @@ -141,9 +144,10 @@ class UpgradesLiabilitiesEight extends Command { $liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first(); $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $liabilityType->id) - ->first(['transaction_journals.*']); + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $liabilityType->id) + ->first(['transaction_journals.*']) + ; if (null !== $liabilityJournal && null !== $liabilityJournal->transactionGroup) { $group = $liabilityJournal->transactionGroup; $service = new TransactionGroupDestroyService(); @@ -157,16 +161,17 @@ class UpgradesLiabilitiesEight extends Command $openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first(); /** @var TransactionJournal $openingJournal */ - $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) - ->first(['transaction_journals.*']); + $openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) + ->first(['transaction_journals.*']) + ; /** @var null|Transaction $source */ - $source = $openingJournal->transactions()->where('amount', '<', 0)->first(); + $source = $openingJournal->transactions()->where('amount', '<', 0)->first(); /** @var null|Transaction $dest */ - $dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); + $dest = $openingJournal->transactions()->where('amount', '>', 0)->first(); if (null !== $source && null !== $dest) { $sourceId = $source->account_id; $destId = $dest->account_id; @@ -184,9 +189,10 @@ class UpgradesLiabilitiesEight extends Command { $count = 0; $journals = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->where('transactions.account_id', $account->id)->get(['transaction_journals.*']); + ->where('transactions.account_id', $account->id)->get(['transaction_journals.*']) + ; - $service = app(TransactionGroupDestroyService::class); + $service = app(TransactionGroupDestroyService::class); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index a4276e461b..59c02428e1 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -69,7 +69,7 @@ class LoginController extends Controller protected string $redirectTo = RouteServiceProvider::HOME; private UserRepositoryInterface $repository; - private string $username = 'email'; + private string $username = 'email'; /** * Create a new controller instance. @@ -86,7 +86,7 @@ class LoginController extends Controller * * @throws ValidationException */ - public function login(Request $request): JsonResponse | RedirectResponse + public function login(Request $request): JsonResponse|RedirectResponse { $username = $request->get($this->username()); Log::channel('audit')->info(sprintf('User is trying to login using "%s"', $username)); @@ -104,7 +104,8 @@ class LoginController extends Controller $this->username => trans('auth.failed'), ] ) - ->onlyInput($this->username); + ->onlyInput($this->username) + ; } Log::debug('Login data is present.'); @@ -128,6 +129,7 @@ class LoginController extends Controller // send a custom login event because laravel will also fire a login event if a "remember me"-cookie // restores the event. event(new ActuallyLoggedIn($this->guard()->user())); + return $this->sendLoginResponse($request); } Log::warning('Login attempt failed.'); @@ -184,10 +186,10 @@ class LoginController extends Controller /** * Log the user out of the application. */ - public function logout(Request $request): Redirector | RedirectResponse | Response + public function logout(Request $request): Redirector|RedirectResponse|Response { - $authGuard = config('firefly.authentication_guard'); - $logoutUrl = config('firefly.custom_logout_url'); + $authGuard = config('firefly.authentication_guard'); + $logoutUrl = config('firefly.custom_logout_url'); if ('remote_user_guard' === $authGuard && '' !== $logoutUrl) { return redirect($logoutUrl); } @@ -221,13 +223,13 @@ class LoginController extends Controller * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ - public function showLoginForm(Request $request): Factory | Redirector | RedirectResponse | View + public function showLoginForm(Request $request): Factory|Redirector|RedirectResponse|View { Log::channel('audit')->info('Show login form (1.1).'); - $count = DB::table('users')->count(); - $guard = config('auth.defaults.guard'); - $title = (string)trans('firefly.login_page_title'); + $count = DB::table('users')->count(); + $guard = config('auth.defaults.guard'); + $title = (string)trans('firefly.login_page_title'); if (0 === $count && 'web' === $guard) { return redirect(route('register')); @@ -247,15 +249,15 @@ class LoginController extends Controller $allowReset = false; } - $email = $request->old('email'); - $remember = $request->old('remember'); + $email = $request->old('email'); + $remember = $request->old('remember'); - $storeInCookie = config('google2fa.store_in_cookie', false); + $storeInCookie = config('google2fa.store_in_cookie', false); if (false !== $storeInCookie) { $cookieName = config('google2fa.cookie_name', 'google2fa_token'); - Cookie::queue(Cookie::make($cookieName, 'invalid-' . Carbon::now()->getTimestamp())); + Cookie::queue(Cookie::make($cookieName, 'invalid-'.Carbon::now()->getTimestamp())); } - $usernameField = $this->username(); + $usernameField = $this->username(); return view('auth.login', ['allowRegistration' => $allowRegistration, 'email' => $email, 'remember' => $remember, 'allowReset' => $allowReset, 'title' => $title, 'usernameField' => $usernameField]); } @@ -263,9 +265,7 @@ class LoginController extends Controller /** * Send the response after the user was authenticated. * - * @param \Illuminate\Http\Request $request - * - * @return \Illuminate\Http\RedirectResponse|\Illuminate\Http\JsonResponse + * @return JsonResponse|RedirectResponse */ protected function sendLoginResponse(Request $request) { @@ -277,7 +277,7 @@ class LoginController extends Controller } $path = Steam::getSafeUrl(session()->pull('url.intended', route('index')), route('index')); Log::debug(sprintf('SafeURL is %s', $path)); + return $request->wantsJson() ? new JsonResponse([], 204) : redirect()->to($path); } - } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 14d61f3791..e2572d9450 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -167,7 +167,6 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return $account; } - /** * Return account type or null if not found. */ diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 97a0e69c03..43b3334f15 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -71,7 +71,6 @@ interface AccountRepositoryInterface public function findByName(string $name, array $types): ?Account; - public function getAccountCurrency(Account $account): ?TransactionCurrency; /** diff --git a/app/Support/Balance.php b/app/Support/Balance.php index 2c400e7c81..96fc7d35e6 100644 --- a/app/Support/Balance.php +++ b/app/Support/Balance.php @@ -34,6 +34,7 @@ class Balance { /** * Returns the accounts balances as an array, on the account ID. + * * @deprecated */ public function getAccountBalances(Collection $accounts, Carbon $date): array diff --git a/app/Support/Steam.php b/app/Support/Steam.php index f89c94d349..9bff484fe4 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -43,6 +43,7 @@ use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Safe\Exceptions\UrlException; use ValueError; + use function Safe\parse_url; use function Safe\preg_replace; @@ -54,37 +55,38 @@ class Steam public function accountsBalancesOptimized(Collection $accounts, Carbon $date, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null, bool $inclusive = true): array { Log::debug(sprintf('accountsBalancesOptimized: Called for %d account(s) with date/time "%s" (inclusive: %s)', $accounts->count(), $date->toIso8601String(), var_export($inclusive, true))); - $result = []; + $result = []; $convertToPrimary ??= Amount::convertToPrimary(); $primary ??= Amount::getPrimaryCurrency(); - $currencies = $this->getCurrencies($accounts); + $currencies = $this->getCurrencies($accounts); // balance(s) in all currencies for ALL accounts. $arrayOfSums = Transaction::whereIn('account_id', $accounts->pluck('id')->toArray()) - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') - ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) - ->groupBy(['transactions.account_id', 'transaction_currencies.code']) - ->get(['transactions.account_id', 'transaction_currencies.code', DB::raw('SUM(transactions.amount) as sum_of_amount')])->toArray(); + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') + ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) + ->groupBy(['transactions.account_id', 'transaction_currencies.code']) + ->get(['transactions.account_id', 'transaction_currencies.code', DB::raw('SUM(transactions.amount) as sum_of_amount')])->toArray() + ; Log::debug('Array of sums: ', $arrayOfSums); /** @var Account $account */ foreach ($accounts as $account) { - $return = [ + $return = [ 'pc_balance' => '0', 'balance' => '0', // this key is overwritten right away, but I must remember it is always created. ]; - $currency = $currencies[$account->id]; + $currency = $currencies[$account->id]; // second array - $accountSums = array_filter($arrayOfSums, fn(array $entry): bool => $entry['account_id'] === $account->id); + $accountSums = array_filter($arrayOfSums, fn (array $entry): bool => $entry['account_id'] === $account->id); if (0 === count($accountSums)) { $result[$account->id] = $return; continue; } - $sumsByCode = []; + $sumsByCode = []; foreach ($accountSums as $accountSum) { // $accountSum = array_values($accountSum)[0]; $sumOfAmount = (string)$accountSum['sum_of_amount']; @@ -93,7 +95,7 @@ class Steam } // Log::debug('All balances are (joined)', $others); // if there is no request to convert, take this as "balance" and "pc_balance". - $return['balance'] = $sumsByCode[$currency->code] ?? '0'; + $return['balance'] = $sumsByCode[$currency->code] ?? '0'; if (!$convertToPrimary) { unset($return['pc_balance']); // Log::debug(sprintf('Set balance to %s, unset pc_balance', $return['balance'])); @@ -106,7 +108,7 @@ class Steam } // either way, the balance is always combined with the virtual balance: - $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); + $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); if ($convertToPrimary) { // the primary currency balance is combined with a converted virtual_balance: @@ -159,10 +161,10 @@ class Steam // Log::debug(sprintf('Trying bcround("%s",%d)', $number, $precision)); if (str_contains($number, '.')) { if ('-' !== $number[0]) { - return bcadd($number, '0.' . str_repeat('0', $precision) . '5', $precision); + return bcadd($number, '0.'.str_repeat('0', $precision).'5', $precision); } - return bcsub($number, '0.' . str_repeat('0', $precision) . '5', $precision); + return bcsub($number, '0.'.str_repeat('0', $precision).'5', $precision); } return $number; @@ -290,26 +292,27 @@ class Steam return str_replace($search, '', $string); } - #[Deprecated(message: <<<'TXT' + #[Deprecated( + message: <<<'TXT' - By default this method returns "smaller than or equal to", so be careful with END OF DAY. - If you need end of day balance, use "inclusive = false". + By default this method returns "smaller than or equal to", so be careful with END OF DAY. + If you need end of day balance, use "inclusive = false". - Returns the balance of an account at exact moment given. Array with at least one value. - Always returns: - "balance": balance in the account's currency OR user's primary currency if the account has no currency - "EUR": balance in EUR (or whatever currencies the account has balance in) + Returns the balance of an account at exact moment given. Array with at least one value. + Always returns: + "balance": balance in the account's currency OR user's primary currency if the account has no currency + "EUR": balance in EUR (or whatever currencies the account has balance in) - If the user has $convertToPrimary: - "balance": balance in the account's currency OR user's primary currency if the account has no currency - --> "pc_balance": balance in the user's primary currency, with all amounts converted to the primary currency. - "EUR": balance in EUR (or whatever currencies the account has balance in) - TXT + If the user has $convertToPrimary: + "balance": balance in the account's currency OR user's primary currency if the account has no currency + --> "pc_balance": balance in the user's primary currency, with all amounts converted to the primary currency. + "EUR": balance in EUR (or whatever currencies the account has balance in) + TXT )] public function finalAccountBalance(Account $account, Carbon $date, ?TransactionCurrency $primary = null, ?bool $convertToPrimary = null, bool $inclusive = true): array { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty($date); if ($cache->has()) { @@ -324,26 +327,27 @@ class Steam $primary = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // account balance thing. - $currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency']; + $currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency']; if ($currencyPresent) { $accountCurrency = $account->meta['currency']; } if (!$currencyPresent) { $accountCurrency = $this->getAccountCurrency($account); } - $hasCurrency = null !== $accountCurrency; - $currency = $hasCurrency ? $accountCurrency : $primary; - $return = [ + $hasCurrency = null !== $accountCurrency; + $currency = $hasCurrency ? $accountCurrency : $primary; + $return = [ 'pc_balance' => '0', 'balance' => '0', // this key is overwritten right away, but I must remember it is always created. ]; // balance(s) in all currencies. - $array = $account->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') - ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) - ->get(['transaction_currencies.code', 'transactions.amount'])->toArray(); - $others = $this->groupAndSumTransactions($array, 'code', 'amount'); + $array = $account->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') + ->where('transaction_journals.date', $inclusive ? '<=' : '<', $date->format('Y-m-d H:i:s')) + ->get(['transaction_currencies.code', 'transactions.amount'])->toArray() + ; + $others = $this->groupAndSumTransactions($array, 'code', 'amount'); Log::debug('All balances are (joined)', $others); // if there is no request to convert, take this as "balance" and "pc_balance". $return['balance'] = $others[$currency->code] ?? '0'; @@ -358,7 +362,7 @@ class Steam } // either way, the balance is always combined with the virtual balance: - $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); + $virtualBalance = (string)('' === (string)$account->virtual_balance ? '0' : $account->virtual_balance); if ($convertToPrimary) { // the primary currency balance is combined with a converted virtual_balance: @@ -372,7 +376,7 @@ class Steam $return['balance'] = bcadd($return['balance'], $virtualBalance); // Log::debug(sprintf('Virtual balance makes the (primary currency) total %s', $return['balance'])); } - $final = array_merge($return, $others); + $final = array_merge($return, $others); Log::debug('Final balance is', $final); $cache->store($final); @@ -390,7 +394,7 @@ class Steam Log::debug(sprintf('called finalAccountBalanceInRange(#%d, %s, %s)', $account->id, $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); // set up cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($account->id); $cache->addProperty('final-balance-in-range'); $cache->addProperty($start); @@ -401,15 +405,15 @@ class Steam // return $cache->get(); } - $balances = []; - $formatted = $start->format('Y-m-d'); + $balances = []; + $formatted = $start->format('Y-m-d'); Log::debug('Get first balance to start.'); // 2025-10-08 replaced finalAccountBalance with accountsBalancesOptimized: - $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); - $startBalance = $this->accountsBalancesOptimized(new Collection()->push($account), $start, $primaryCurrency, $convertToPrimary, false)[$account->id]; - $accountCurrency = $this->getAccountCurrency($account); - $hasCurrency = $accountCurrency instanceof TransactionCurrency; - $currency = $accountCurrency ?? $primaryCurrency; + $primaryCurrency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); + $startBalance = $this->accountsBalancesOptimized(new Collection()->push($account), $start, $primaryCurrency, $convertToPrimary, false)[$account->id]; + $accountCurrency = $this->getAccountCurrency($account); + $hasCurrency = $accountCurrency instanceof TransactionCurrency; + $currency = $accountCurrency ?? $primaryCurrency; Log::debug(sprintf('Currency is %s', $currency->code)); // set start balances: @@ -421,7 +425,7 @@ class Steam Log::debug(sprintf('Also set start balance in %s', $primaryCurrency->code)); $startBalance[$primaryCurrency->code] ??= '0'; } - $currencies = [ + $currencies = [ $currency->id => $currency, $primaryCurrency->id => $primaryCurrency, ]; @@ -431,47 +435,48 @@ class Steam // sums up the balance changes per day. Log::debug(sprintf('Date >= %s and <= %s', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); - $set = $account->transactions() - ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transaction_journals.date', '>=', $start->format('Y-m-d H:i:s')) - ->where('transaction_journals.date', '<=', $end->format('Y-m-d H:i:s')) - ->groupBy('transaction_journals.date') - ->groupBy('transactions.transaction_currency_id') - ->orderBy('transaction_journals.date', 'ASC') - ->whereNull('transaction_journals.deleted_at') - ->get( - [ // @phpstan-ignore-line - 'transaction_journals.date', - 'transactions.transaction_currency_id', - DB::raw('SUM(transactions.amount) AS sum_of_day'), - ] - ); + $set = $account->transactions() + ->leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transaction_journals.date', '>=', $start->format('Y-m-d H:i:s')) + ->where('transaction_journals.date', '<=', $end->format('Y-m-d H:i:s')) + ->groupBy('transaction_journals.date') + ->groupBy('transactions.transaction_currency_id') + ->orderBy('transaction_journals.date', 'ASC') + ->whereNull('transaction_journals.deleted_at') + ->get( + [ // @phpstan-ignore-line + 'transaction_journals.date', + 'transactions.transaction_currency_id', + DB::raw('SUM(transactions.amount) AS sum_of_day'), + ] + ) + ; - $currentBalance = $startBalance; - $converter = new ExchangeRateConverter(); + $currentBalance = $startBalance; + $converter = new ExchangeRateConverter(); /** @var Transaction $entry */ foreach ($set as $entry) { // get date object - $carbon = new Carbon($entry->date, $entry->date_tz); - $carbonKey = $carbon->format('Y-m-d'); + $carbon = new Carbon($entry->date, $entry->date_tz); + $carbonKey = $carbon->format('Y-m-d'); // make sure sum is a string: - $sumOfDay = (string)($entry->sum_of_day ?? '0'); + $sumOfDay = (string)($entry->sum_of_day ?? '0'); // #10426 make sure sum is not in scientific notation. - $sumOfDay = $this->floatalize($sumOfDay); + $sumOfDay = $this->floatalize($sumOfDay); // find currency of this entry, does not have to exist. $currencies[$entry->transaction_currency_id] ??= Amount::getTransactionCurrencyById($entry->transaction_currency_id); // make sure this $entry has its own $entryCurrency /** @var TransactionCurrency $entryCurrency */ - $entryCurrency = $currencies[$entry->transaction_currency_id]; + $entryCurrency = $currencies[$entry->transaction_currency_id]; Log::debug(sprintf('Processing transaction(s) on moment %s', $carbon->format('Y-m-d H:i:s'))); // add amount to current balance in currency code. - $currentBalance[$entryCurrency->code] ??= '0'; + $currentBalance[$entryCurrency->code] ??= '0'; $currentBalance[$entryCurrency->code] = bcadd($sumOfDay, (string)$currentBalance[$entryCurrency->code]); // if not requested to convert to primary currency, add the amount to "balance", do nothing else. @@ -489,7 +494,7 @@ class Steam } } // add to final array. - $balances[$carbonKey] = $currentBalance; + $balances[$carbonKey] = $currentBalance; Log::debug(sprintf('Updated entry [%s]', $carbonKey), $currentBalance); } $cache->store($balances); @@ -506,7 +511,7 @@ class Steam */ public function floatalize(string $value): string { - $value = strtoupper($value); + $value = strtoupper($value); if (!str_contains($value, 'E')) { return $value; } @@ -530,8 +535,8 @@ class Steam public function getAccountCurrency(Account $account): ?TransactionCurrency { - $type = $account->accountType->type; - $list = config('firefly.valid_currency_account_types'); + $type = $account->accountType->type; + $list = config('firefly.valid_currency_account_types'); // return null if not in this list. if (!in_array($type, $list, true)) { @@ -584,15 +589,15 @@ class Steam { $list = []; - $set = auth()->user()->transactions() - ->whereIn('transactions.account_id', $accounts) - ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) - ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line + $set = auth()->user()->transactions() + ->whereIn('transactions.account_id', $accounts) + ->groupBy(['transactions.account_id', 'transaction_journals.user_id']) + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line ; /** @var Transaction $entry */ foreach ($set as $entry) { - $date = new Carbon($entry->max_date, config('app.timezone')); + $date = new Carbon($entry->max_date, config('app.timezone')); $date->setTimezone(config('app.timezone')); $list[(int)$entry->account_id] = $date; } @@ -610,14 +615,14 @@ class Steam if (null !== $cached) { return $cached; } - $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; + $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; if (is_array($locale)) { $locale = 'equal'; } if ('equal' === $locale) { $locale = $this->getLanguage(); } - $locale = (string)$locale; + $locale = (string)$locale; // Check for Windows to replace the locale correctly. if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) { @@ -671,8 +676,9 @@ class Steam public function getSafeUrl(string $unknownUrl, string $safeUrl): string { // Log::debug(sprintf('getSafeUrl(%s, %s)', $unknownUrl, $safeUrl)); - $returnUrl = $safeUrl; -// die('in get safe url'); + $returnUrl = $safeUrl; + + // die('in get safe url'); try { $unknownHost = parse_url($unknownUrl, PHP_URL_HOST); } catch (UrlException $e) { @@ -789,12 +795,12 @@ class Steam if (null === $preference) { $singleton->setPreference($key, $currency); } - $current = $amount; + $current = $amount; if ($currency->id !== $primary->id) { $current = $converter->convert($currency, $primary, $date, $amount); Log::debug(sprintf('Convert %s %s to %s %s', $currency->code, $amount, $primary->code, $current)); } - $total = bcadd((string)$current, $total); + $total = bcadd((string)$current, $total); } return $total; @@ -808,8 +814,8 @@ class Steam $primary = Amount::getPrimaryCurrency(); $currencies[$primary->id] = $primary; - $ids = $accounts->pluck('id')->toArray(); - $result = AccountMeta::whereIn('account_id', $ids)->where('name', 'currency_id')->get(); + $ids = $accounts->pluck('id')->toArray(); + $result = AccountMeta::whereIn('account_id', $ids)->where('name', 'currency_id')->get(); /** @var AccountMeta $item */ foreach ($result as $item) { @@ -819,7 +825,7 @@ class Steam } } // collect those currencies, skip primary because we already have it. - $set = TransactionCurrency::whereIn('id', $accountPreferences)->where('id', '!=', $primary->id)->get(); + $set = TransactionCurrency::whereIn('id', $accountPreferences)->where('id', '!=', $primary->id)->get(); foreach ($set as $item) { $currencies[$item->id] = $item; } @@ -830,7 +836,7 @@ class Steam $currencyPresent = isset($account->meta) && array_key_exists('currency', $account->meta) && null !== $account->meta['currency']; if ($currencyPresent) { $currencyId = $account->meta['currency']->id; - $currencies[$currencyId] ??= $account->meta['currency']; + $currencies[$currencyId] ??= $account->meta['currency']; $accountCurrencies[$accountId] = $account->meta['currency']; } if (!$currencyPresent && !array_key_exists($accountId, $accountPreferences)) { diff --git a/composer.lock b/composer.lock index 257ba749b2..3d41f1cc0b 100644 --- a/composer.lock +++ b/composer.lock @@ -10515,16 +10515,16 @@ }, { "name": "driftingly/rector-laravel", - "version": "2.1.7", + "version": "2.1.8", "source": { "type": "git", "url": "https://github.com/driftingly/rector-laravel.git", - "reference": "2a64c96fa363bc85e4e6d4162c6a6bb7a78fd122" + "reference": "5c5f97354e562b6742b2b7989959061bde60fa71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/2a64c96fa363bc85e4e6d4162c6a6bb7a78fd122", - "reference": "2a64c96fa363bc85e4e6d4162c6a6bb7a78fd122", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/5c5f97354e562b6742b2b7989959061bde60fa71", + "reference": "5c5f97354e562b6742b2b7989959061bde60fa71", "shasum": "" }, "require": { @@ -10545,9 +10545,9 @@ "description": "Rector upgrades rules for Laravel Framework", "support": { "issues": "https://github.com/driftingly/rector-laravel/issues", - "source": "https://github.com/driftingly/rector-laravel/tree/2.1.7" + "source": "https://github.com/driftingly/rector-laravel/tree/2.1.8" }, - "time": "2025-12-10T11:30:42+00:00" + "time": "2025-12-17T15:29:24+00:00" }, { "name": "fakerphp/faker", diff --git a/config/firefly.php b/config/firefly.php index b31e10e7c3..7dd4f7c48a 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-17', - 'build_time' => 1765957552, + 'version' => 'develop/2025-12-19', + 'build_time' => 1766158365, '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 ed1fda10ec..78072dae5f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3294,42 +3294,42 @@ } }, "node_modules/@vue/compiler-core": { - "version": "3.5.25", - "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.25.tgz", - "integrity": "sha512-vay5/oQJdsNHmliWoZfHPoVZZRmnSWhug0BYT34njkYTPqClh3DNWLkZNJBVSjsNMrg0CCrBfoKkjZQPM/QVUw==", + "version": "3.5.26", + "resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.26.tgz", + "integrity": "sha512-vXyI5GMfuoBCnv5ucIT7jhHKl55Y477yxP6fc4eUswjP8FG3FFVFd41eNDArR+Uk3QKn2Z85NavjaxLxOC19/w==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.28.5", - "@vue/shared": "3.5.25", - "entities": "^4.5.0", + "@vue/shared": "3.5.26", + "entities": "^7.0.0", "estree-walker": "^2.0.2", "source-map-js": "^1.2.1" } }, "node_modules/@vue/compiler-dom": { - "version": "3.5.25", - "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.25.tgz", - "integrity": "sha512-4We0OAcMZsKgYoGlMjzYvaoErltdFI2/25wqanuTu+S4gismOTRTBPi4IASOjxWdzIwrYSjnqONfKvuqkXzE2Q==", + "version": "3.5.26", + "resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.26.tgz", + "integrity": "sha512-y1Tcd3eXs834QjswshSilCBnKGeQjQXB6PqFn/1nxcQw4pmG42G8lwz+FZPAZAby6gZeHSt/8LMPfZ4Rb+Bd/A==", "dev": true, "license": "MIT", "dependencies": { - "@vue/compiler-core": "3.5.25", - "@vue/shared": "3.5.25" + "@vue/compiler-core": "3.5.26", + "@vue/shared": "3.5.26" } }, "node_modules/@vue/compiler-sfc": { - "version": "3.5.25", - "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.25.tgz", - "integrity": "sha512-PUgKp2rn8fFsI++lF2sO7gwO2d9Yj57Utr5yEsDf3GNaQcowCLKL7sf+LvVFvtJDXUp/03+dC6f2+LCv5aK1ag==", + "version": "3.5.26", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.26.tgz", + "integrity": "sha512-egp69qDTSEZcf4bGOSsprUr4xI73wfrY5oRs6GSgXFTiHrWj4Y3X5Ydtip9QMqiCMCPVwLglB9GBxXtTadJ3mA==", "dev": true, "license": "MIT", "dependencies": { "@babel/parser": "^7.28.5", - "@vue/compiler-core": "3.5.25", - "@vue/compiler-dom": "3.5.25", - "@vue/compiler-ssr": "3.5.25", - "@vue/shared": "3.5.25", + "@vue/compiler-core": "3.5.26", + "@vue/compiler-dom": "3.5.26", + "@vue/compiler-ssr": "3.5.26", + "@vue/shared": "3.5.26", "estree-walker": "^2.0.2", "magic-string": "^0.30.21", "postcss": "^8.5.6", @@ -3337,14 +3337,14 @@ } }, "node_modules/@vue/compiler-ssr": { - "version": "3.5.25", - "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.25.tgz", - "integrity": "sha512-ritPSKLBcParnsKYi+GNtbdbrIE1mtuFEJ4U1sWeuOMlIziK5GtOL85t5RhsNy4uWIXPgk+OUdpnXiTdzn8o3A==", + "version": "3.5.26", + "resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.26.tgz", + "integrity": "sha512-lZT9/Y0nSIRUPVvapFJEVDbEXruZh2IYHMk2zTtEgJSlP5gVOqeWXH54xDKAaFS4rTnDeDBQUYDtxKyoW9FwDw==", "dev": true, "license": "MIT", "dependencies": { - "@vue/compiler-dom": "3.5.25", - "@vue/shared": "3.5.25" + "@vue/compiler-dom": "3.5.26", + "@vue/shared": "3.5.26" } }, "node_modules/@vue/component-compiler-utils": { @@ -3426,9 +3426,9 @@ "license": "MIT" }, "node_modules/@vue/shared": { - "version": "3.5.25", - "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.25.tgz", - "integrity": "sha512-AbOPdQQnAnzs58H2FrrDxYj/TJfmeS2jdfEEhgiKINy+bnOANmVizIEgq1r+C5zsbs6l1CCQxtcj71rwNQ4jWg==", + "version": "3.5.26", + "resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.26.tgz", + "integrity": "sha512-7Z6/y3uFI5PRoKeorTOSXKcDj0MSasfNNltcslbFrPpcw6aXRUALq4IfJlaTRspiWIUOEZbrpM+iQGmCOiWe4A==", "dev": true, "license": "MIT" }, @@ -4075,9 +4075,9 @@ "license": "MIT" }, "node_modules/baseline-browser-mapping": { - "version": "2.9.8", - "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.8.tgz", - "integrity": "sha512-Y1fOuNDowLfgKOypdc9SPABfoWXuZHBOyCS4cD52IeZBhr4Md6CLLs6atcxVrzRmQ06E7hSlm5bHHApPKR/byA==", + "version": "2.9.11", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.9.11.tgz", + "integrity": "sha512-Sg0xJUNDU1sJNGdfGWhVHX0kkZ+HWcvmVymJbj6NSgZZmW/8S9Y2HQ5euytnIgakgxN6papOAWiwDo1ctFDcoQ==", "dev": true, "license": "Apache-2.0", "bin": { @@ -4508,9 +4508,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001760", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001760.tgz", - "integrity": "sha512-7AAMPcueWELt1p3mi13HR/LHH0TJLT11cnwDJEs3xA4+CK/PLKeO9Kl1oru24htkyUKtkGCvAx4ohB0Ttry8Dw==", + "version": "1.0.30001761", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz", + "integrity": "sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==", "dev": true, "funding": [ { @@ -5787,9 +5787,9 @@ } }, "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.0.tgz", + "integrity": "sha512-FDWG5cmEYf2Z00IkYRhbFrwIwvdFKH07uV8dvNy0omp/Qb1xcyCWp2UDtcwJF4QZZvk0sLudP6/hAu42TaqVhQ==", "dev": true, "license": "BSD-2-Clause", "engines": { @@ -11740,9 +11740,9 @@ "license": "BSD-2-Clause" }, "node_modules/webpack": { - "version": "5.104.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.104.0.tgz", - "integrity": "sha512-5DeICTX8BVgNp6afSPYXAFjskIgWGlygQH58bcozPOXgo2r/6xx39Y1+cULZ3gTxUYQP88jmwLj2anu4Xaq84g==", + "version": "5.104.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.104.1.tgz", + "integrity": "sha512-Qphch25abbMNtekmEGJmeRUhLDbe+QfiWTiqpKYkpCOWY64v9eyl+KRRLmqOFA2AvKPpc9DC6+u2n76tQLBoaA==", "dev": true, "license": "MIT", "dependencies": { From 87cb1e1a2bf5384dc5b5db06d435358a626d6c48 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 19 Dec 2025 18:13:04 +0100 Subject: [PATCH 07/58] Fix #11378 --- .../Commands/Correction/CorrectsAmounts.php | 106 ++++++++++++++---- app/Support/Steam.php | 1 + 2 files changed, 83 insertions(+), 24 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index b140344b17..92513e0ad5 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -39,11 +39,11 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Facades\Amount; +use FireflyIII\Support\Facades\Steam; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use ValueError; -use FireflyIII\Support\Facades\Steam; class CorrectsAmounts extends Command { @@ -79,6 +79,7 @@ class CorrectsAmounts extends Command private function correctTransfers(): void { + Log::debug('Will now correct transfers.'); /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $type = TransactionType::where('type', TransactionTypeEnum::TRANSFER->value)->first(); @@ -87,35 +88,27 @@ class CorrectsAmounts extends Command /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $repository->setUser($journal->user); - $primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup); + $primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup); - /** @var null|Transaction $source */ - $source = $journal->transactions()->where('amount', '<', 0)->first(); - - /** @var null|Transaction $destination */ - $destination = $journal->transactions()->where('amount', '>', 0)->first(); - if (null === $source || null === $destination) { + $valid = $this->validateJournal($journal); + if (false === $valid) { + Log::debug(sprintf('Journal #%d does not need to be fixed or is invalid (see previous messages)', $journal->id)); continue; } - if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { - continue; - } - if(null === $source->foreign_amount || null === $destination->foreign_amount) { - continue; - } - + Log::debug(sprintf('Journal #%d is ready to be corrected (if necessary).', $journal->id)); + $source = $journal->transactions()->where('amount', '<', '0')->first(); + $destination = $journal->transactions()->where('amount', '>', '0')->first(); $sourceAccount = $source->account; $destAccount = $destination->account; - if (null === $sourceAccount || null === $destAccount) { - continue; - } $sourceCurrency = $repository->getAccountCurrency($sourceAccount) ?? $primary; $destCurrency = $repository->getAccountCurrency($destAccount) ?? $primary; + Log::debug(sprintf('Currency of source account #%d "%s" is %s', $sourceAccount->id, $sourceAccount->name, $sourceCurrency->code)); + Log::debug(sprintf('Currency of destination account #%d "%s" is %s', $destAccount->id, $destAccount->name, $destCurrency->code)); if ($sourceCurrency->id === $destCurrency->id) { Log::debug('Both accounts have the same currency. Removing foreign currency info.'); - $source->foreign_currency_id = null; - $source->foreign_amount = null; + $source->foreign_currency_id = null; + $source->foreign_amount = null; $source->save(); $destination->foreign_currency_id = null; $destination->foreign_amount = null; @@ -124,22 +117,40 @@ class CorrectsAmounts extends Command continue; } - // validate source + // validate source transaction if ($destCurrency->id !== $source->foreign_currency_id) { - Log::debug(sprintf('Journal #%d: Transaction #%d refers to "%s" but should refer to "%s".', $journal->id, $source->id, $source->foreignCurrency->code, $destCurrency->code)); + Log::debug(sprintf('[a] Journal #%d: transaction #%d refers to foreign currency "%s" but should refer to "%s".', $journal->id, $source->id, $source->foreignCurrency->code, $destCurrency->code)); $source->foreign_currency_id = $destCurrency->id; $source->save(); } + if ($sourceCurrency->id !== $source->transaction_currency_id) { + Log::debug(sprintf('[b] Journal #%d: transaction #%d refers to currency "%s" but should refer to "%s".', $journal->id, $source->id, $source->transactionCurrency->code, $sourceCurrency->code)); + $source->transaction_currency_id = $sourceCurrency->id; + $source->save(); + } // validate destination: if ($sourceCurrency->id !== $destination->foreign_currency_id) { - Log::debug(sprintf('Journal #%d: Transaction #%d refers to "%s" but should refer to "%s".', $journal->id, $destination->id, $destination->foreignCurrency->code, $sourceCurrency->code)); + Log::debug(sprintf('[c] Journal #%d: transaction #%d refers to foreign currency "%s" but should refer to "%s".', $journal->id, $destination->id, $destination->foreignCurrency->code, $sourceCurrency->code)); $destination->foreign_currency_id = $sourceCurrency->id; $destination->save(); } + + if ($destCurrency->id !== $destination->transaction_currency_id) { + Log::debug(sprintf('[d] Journal #%d: transaction #%d refers to currency "%s" but should refer to "%s".', $journal->id, $destination->id, $destination->transactionCurrency->code, $destCurrency->code)); + $destination->transaction_currency_id = $destCurrency->id; + $destination->save(); + } + Log::debug(sprintf('Done with journal #%d.', $journal->id)); } } + private function deleteJournal(TransactionJournal $journal): void + { + $journal->transactionGroup?->delete(); + $journal->delete(); + } + private function fixAutoBudgets(): void { $count = AutoBudget::where('amount', '<', 0)->update(['amount' => DB::raw('amount * -1')]); @@ -239,7 +250,7 @@ class CorrectsAmounts extends Command private function fixRuleTrigger(RuleTrigger $item): bool { try { - $check = bccomp((string) $item->trigger_value, '0'); + $check = bccomp((string)$item->trigger_value, '0'); } catch (ValueError) { $this->friendlyError(sprintf('Rule #%d contained invalid %s-trigger "%s". The trigger has been removed, and the rule is disabled.', $item->rule_id, $item->trigger_type, $item->trigger_value)); $item->rule->active = false; @@ -257,4 +268,51 @@ class CorrectsAmounts extends Command return false; } + + private function validateJournal(TransactionJournal $journal): bool + { + $countSource = $journal->transactions()->where('amount', '<', 0)->count(); + $countDest = $journal->transactions()->where('amount', '>', 0)->count(); + + if (1 !== $countSource || 1 !== $countDest) { + $this->friendlyError(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id)); + $this->deleteJournal($journal); + Log::error(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id)); + return false; + } + + /** @var null|Transaction $source */ + $source = $journal->transactions()->where('amount', '<', 0)->first(); + + /** @var null|Transaction $destination */ + $destination = $journal->transactions()->where('amount', '>', 0)->first(); + + if (null === $source || null === $destination) { + $this->friendlyError(sprintf('Could not find source OR destination for journal #%d .', $journal->id)); + Log::error(sprintf('Could not find source OR destination for journal #%d .', $journal->id)); + $this->deleteJournal($journal); + return false; + } + if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { + Log::debug('No foreign currency information is present, can safely continue with other transactions.'); + return false; + } + if (null === $source->foreign_amount || null === $destination->foreign_amount) { + $this->friendlyError(sprintf('Transactions of journal #%d have no foreign amount, but have foreign currency info. Will reset this.', $journal->id)); + $source->foreign_currency_id = null; + $source->save(); + $destination->foreign_currency_id = null; + $source->save(); + return false; + } + + $sourceAccount = $source->account; + $destAccount = $destination->account; + if (null === $sourceAccount || null === $destAccount) { + $this->friendlyError(sprintf('Could not find accounts for journal #%d,', $journal->id)); + $this->deleteJournal($journal); + return false; + } + return true; + } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index f89c94d349..de1247deb5 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -663,6 +663,7 @@ class Steam { $res = $this->getSafeUrl(session()->previousUrl() ?? route('index'), route('index')); Log::debug(sprintf('getSafePreviousUrl: "%s"', $res)); + return $res; } /** From e34b89da083bbf4803cb86a7f7684b827835cbff Mon Sep 17 00:00:00 2001 From: JC5 Date: Fri, 19 Dec 2025 18:18:02 +0100 Subject: [PATCH 08/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-19?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/Correction/CorrectsAmounts.php | 26 ++++++++++++------- app/Support/Steam.php | 1 + config/firefly.php | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index 92513e0ad5..db544dca49 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -80,6 +80,7 @@ class CorrectsAmounts extends Command private function correctTransfers(): void { Log::debug('Will now correct transfers.'); + /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $type = TransactionType::where('type', TransactionTypeEnum::TRANSFER->value)->first(); @@ -88,11 +89,12 @@ class CorrectsAmounts extends Command /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $repository->setUser($journal->user); - $primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup); + $primary = Amount::getPrimaryCurrencyByUserGroup($journal->userGroup); - $valid = $this->validateJournal($journal); + $valid = $this->validateJournal($journal); if (false === $valid) { Log::debug(sprintf('Journal #%d does not need to be fixed or is invalid (see previous messages)', $journal->id)); + continue; } Log::debug(sprintf('Journal #%d is ready to be corrected (if necessary).', $journal->id)); @@ -107,8 +109,8 @@ class CorrectsAmounts extends Command if ($sourceCurrency->id === $destCurrency->id) { Log::debug('Both accounts have the same currency. Removing foreign currency info.'); - $source->foreign_currency_id = null; - $source->foreign_amount = null; + $source->foreign_currency_id = null; + $source->foreign_amount = null; $source->save(); $destination->foreign_currency_id = null; $destination->foreign_amount = null; @@ -271,38 +273,42 @@ class CorrectsAmounts extends Command private function validateJournal(TransactionJournal $journal): bool { - $countSource = $journal->transactions()->where('amount', '<', 0)->count(); - $countDest = $journal->transactions()->where('amount', '>', 0)->count(); + $countSource = $journal->transactions()->where('amount', '<', 0)->count(); + $countDest = $journal->transactions()->where('amount', '>', 0)->count(); if (1 !== $countSource || 1 !== $countDest) { $this->friendlyError(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id)); $this->deleteJournal($journal); Log::error(sprintf('Transaction journal #%d has bad transaction information. Will delete.', $journal->id)); + return false; } /** @var null|Transaction $source */ - $source = $journal->transactions()->where('amount', '<', 0)->first(); + $source = $journal->transactions()->where('amount', '<', 0)->first(); /** @var null|Transaction $destination */ - $destination = $journal->transactions()->where('amount', '>', 0)->first(); + $destination = $journal->transactions()->where('amount', '>', 0)->first(); if (null === $source || null === $destination) { $this->friendlyError(sprintf('Could not find source OR destination for journal #%d .', $journal->id)); Log::error(sprintf('Could not find source OR destination for journal #%d .', $journal->id)); $this->deleteJournal($journal); + return false; } if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { Log::debug('No foreign currency information is present, can safely continue with other transactions.'); + return false; } if (null === $source->foreign_amount || null === $destination->foreign_amount) { $this->friendlyError(sprintf('Transactions of journal #%d have no foreign amount, but have foreign currency info. Will reset this.', $journal->id)); - $source->foreign_currency_id = null; + $source->foreign_currency_id = null; $source->save(); $destination->foreign_currency_id = null; $source->save(); + return false; } @@ -311,8 +317,10 @@ class CorrectsAmounts extends Command if (null === $sourceAccount || null === $destAccount) { $this->friendlyError(sprintf('Could not find accounts for journal #%d,', $journal->id)); $this->deleteJournal($journal); + return false; } + return true; } } diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 6251370206..43f960f0c6 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -668,6 +668,7 @@ class Steam { $res = $this->getSafeUrl(session()->previousUrl() ?? route('index'), route('index')); Log::debug(sprintf('getSafePreviousUrl: "%s"', $res)); + return $res; } diff --git a/config/firefly.php b/config/firefly.php index 7dd4f7c48a..556eefacd9 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -79,7 +79,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-19', - 'build_time' => 1766158365, + 'build_time' => 1766164572, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From be9078fe990ecfe39084653296406fc34f77e654 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 06:10:51 +0100 Subject: [PATCH 09/58] Remove unused settings. --- .env.example | 9 --------- app/Providers/SearchServiceProvider.php | 14 ++++++++------ config/firefly.php | 3 --- config/search.php | 2 -- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/.env.example b/.env.example index e6737be1e7..f323006adc 100644 --- a/.env.example +++ b/.env.example @@ -188,9 +188,6 @@ MAILERSEND_API_KEY= # Firefly III can send you the following messages. SEND_ERROR_MESSAGE=true -# These messages contain (sensitive) transaction information: -SEND_REPORT_JOURNALS=true - # Set this value to true if you want to set the location of certain things, like transactions. # Since this involves an external service, it's optional and disabled by default. ENABLE_EXTERNAL_MAP=false @@ -326,12 +323,6 @@ USE_RUNNING_BALANCE=false # FIREFLY_III_LAYOUT=v1 -# -# Which Query Parser implementation to use for the search engine and rules -# 'new' is experimental, 'legacy' is the classic one -# -QUERY_PARSER_IMPLEMENTATION=new - # # Please make sure this URL matches the external URL of your Firefly III installation. # It is used to validate specific requests and to generate URLs in emails. diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index baf32f811b..295c00c936 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -50,12 +50,14 @@ class SearchServiceProvider extends ServiceProvider { $this->app->bind( static function (): QueryParserInterface { - $implementation = config('search.query_parser'); - - return match ($implementation) { - 'new' => app(QueryParser::class), - default => app(GdbotsQueryParser::class), - }; + return app(QueryParser::class); + // 2025-12-20 ignore this setting. +// $implementation = config('search.query_parser'); +// +// return match ($implementation) { +// 'new' => app(QueryParser::class), +// default => app(GdbotsQueryParser::class), +// }; } ); diff --git a/config/firefly.php b/config/firefly.php index 556eefacd9..9522bf9cf7 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -99,9 +99,6 @@ return [ 'disable_csp_header' => env('DISABLE_CSP_HEADER', false), 'allow_webhooks' => env('ALLOW_WEBHOOKS', false), - // flags - 'send_report_journals' => envNonEmpty('SEND_REPORT_JOURNALS', true), - // info for demo site 'demo_username' => env('DEMO_USERNAME', ''), 'demo_password' => env('DEMO_PASSWORD', ''), diff --git a/config/search.php b/config/search.php index e6386d5240..05bd7eb0f1 100644 --- a/config/search.php +++ b/config/search.php @@ -261,6 +261,4 @@ return [ 'destination_balance_lt' => ['alias' => false, 'needs_context' => true], 'destination_balance_is' => ['alias' => false, 'needs_context' => true], ], - // Which query parser to use - 'new' or 'legacy' - 'query_parser' => env('QUERY_PARSER_IMPLEMENTATION', 'legacy'), ]; From 71c5bdb198ab16d39d219c650f858b4a79aaa3ce Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 06:39:05 +0100 Subject: [PATCH 10/58] Move settings to the settings page, out of the .env file. --- .../Admin/ConfigurationController.php | 42 ++++- app/Http/Requests/ConfigurationRequest.php | 26 +++- resources/lang/en_US/firefly.php | 19 +++ resources/lang/en_US/form.php | 9 +- .../views/settings/configuration/index.twig | 147 +++++++++++++----- 5 files changed, 195 insertions(+), 48 deletions(-) diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index fe4f9dc3ca..fd9ba3063d 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -23,11 +23,11 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers\Admin; -use FireflyIII\Support\Facades\Preferences; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Requests\ConfigurationRequest; use FireflyIII\Support\Facades\FireflyConfig; +use FireflyIII\Support\Facades\Preferences; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Support\Facades\Log; @@ -47,7 +47,7 @@ class ConfigurationController extends Controller $this->middleware( static function ($request, $next) { - app('view')->share('title', (string) trans('firefly.system_settings')); + app('view')->share('title', (string)trans('firefly.system_settings')); app('view')->share('mainTitleIcon', 'fa-hand-spock-o'); return $next($request); @@ -61,10 +61,10 @@ class ConfigurationController extends Controller * * @return Factory|View */ - public function index(): Factory|\Illuminate\Contracts\View\View + public function index(): Factory | \Illuminate\Contracts\View\View { - $subTitle = (string) trans('firefly.instance_configuration'); - $subTitleIcon = 'fa-wrench'; + $subTitle = (string)trans('firefly.instance_configuration'); + $subTitleIcon = 'fa-wrench'; Log::channel('audit')->info('User visits admin config index.'); @@ -74,9 +74,28 @@ class ConfigurationController extends Controller $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $siteOwner = config('firefly.site_owner'); + $enableExchangeRates = FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; + $useRunningBalance = FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data; + $enableExternalMap = FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; + $enableExternalRates = FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data; + $allowWebhooks = FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data; + $validUrlProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;; + return view( 'settings.configuration.index', - ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'singleUserMode' => $singleUserMode, 'isDemoSite' => $isDemoSite, 'siteOwner' => $siteOwner] + [ + 'subTitle' => $subTitle, + 'subTitleIcon' => $subTitleIcon, + 'singleUserMode' => $singleUserMode, + 'isDemoSite' => $isDemoSite, + 'siteOwner' => $siteOwner, + 'enableExchangeRates' => $enableExchangeRates, + 'useRunningBalance' => $useRunningBalance, + 'enableExternalMap' => $enableExternalMap, + 'enableExternalRates' => $enableExternalRates, + 'allowWebhooks' => $allowWebhooks, + 'validUrlProtocols' => $validUrlProtocols, + ] ); } @@ -92,10 +111,19 @@ class ConfigurationController extends Controller // store config values FireflyConfig::set('single_user_mode', $data['single_user_mode']); + + FireflyConfig::set('enable_exchange_rates', $data['enable_exchange_rates']); + FireflyConfig::set('use_running_balance', $data['use_running_balance']); + + FireflyConfig::set('enable_external_map', $data['enable_external_map']); + FireflyConfig::set('enable_external_rates', $data['enable_external_rates']); + FireflyConfig::set('allow_webhooks', $data['allow_webhooks']); + + FireflyConfig::set('valid_url_protocols', $data['valid_url_protocols']); FireflyConfig::set('is_demo_site', $data['is_demo_site']); // flash message - session()->flash('success', (string) trans('firefly.configuration_updated')); + session()->flash('success', (string)trans('firefly.configuration_updated')); Preferences::mark(); return redirect()->route('settings.configuration.index'); diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.php index 212b706b5f..346a5ed261 100644 --- a/app/Http/Requests/ConfigurationRequest.php +++ b/app/Http/Requests/ConfigurationRequest.php @@ -23,8 +23,8 @@ declare(strict_types=1); namespace FireflyIII\Http\Requests; -use Illuminate\Contracts\Validation\Validator; use FireflyIII\Support\Request\ChecksLogin; +use Illuminate\Contracts\Validation\Validator; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Log; @@ -42,7 +42,16 @@ class ConfigurationRequest extends FormRequest { return [ 'single_user_mode' => $this->boolean('single_user_mode'), - 'is_demo_site' => $this->boolean('is_demo_site'), + + 'enable_exchange_rates' => $this->boolean('enable_exchange_rates'), + 'use_running_balance' => $this->boolean('use_running_balance'), + + 'enable_external_map' => $this->boolean('enable_external_map'), + 'enable_external_rates' => $this->boolean('enable_external_rates'), + 'allow_webhooks' => $this->boolean('allow_webhooks'), + + 'valid_url_protocols' => $this->string('valid_url_protocols'), + 'is_demo_site' => $this->boolean('is_demo_site'), ]; } @@ -54,7 +63,18 @@ class ConfigurationRequest extends FormRequest // fixed return [ 'single_user_mode' => 'min:0|max:1|numeric', - 'is_demo_site' => 'min:0|max:1|numeric', + + 'enable_exchange_rates' => 'min:0|max:1|numeric', + 'use_running_balance' => 'min:0|max:1|numeric', + + 'enable_external_map' => 'min:0|max:1|numeric', + 'enable_external_rates' => 'min:0|max:1|numeric', + 'allow_webhooks' => 'min:0|max:1|numeric', + + 'valid_url_protocols' => 'min:0|max:255', + 'is_demo_site' => 'min:0|max:1|numeric', + + ]; } diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 645560d033..25bb670e47 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -2567,6 +2567,25 @@ return [ 'all_users' => 'All users', 'instance_configuration' => 'Configuration', 'firefly_instance_configuration' => 'Firefly III configuration', + 'config_security' => 'Security configuration', + 'config_features' => 'Enabled features', + 'config_tech' => 'Tech related features', + 'config_external_connections' => 'Privacy-sensitive settings (connects to the internet)', + + 'setting_enable_exchange_rates' => 'Enable exchange rates', + 'setting_enable_exchange_rates_explain' => 'Firefly III has the capability of calculating exchange rates for you.', + 'setting_use_running_balance' => 'Use "running balance"-column and data', + 'setting_use_running_balance_explain' => 'Firefly III can calculate the current running balance for you, and display this in various places. It is still slightly experimental, so disabled by default. You may need to restart your container or fire the initial command manually (see the docs).', + 'setting_enable_external_map' => 'Use external map service', + 'setting_enable_external_map_explain' => 'Firefly III uses an external service to display locations. Is this OK?', + 'setting_enable_external_rates' => 'Download exchange rates from the web', + 'setting_enable_external_rates_explain' => 'Firefly III can download exchange rates for the built-in currencies. This needs the cron job to work.', + 'setting_allow_webhooks' => 'Allow webhooks', + 'setting_allow_webhooks_explain' => 'Allow Firefly III to fire webhooks?', + 'setting_valid_url_protocols' => 'Allowed URL protocols', + 'setting_valid_url_protocols_explain' => 'Firefly III only allows urls to have standard protocols like https and ftp etc. If you\'re a techie you may want to allow others as well.', + + 'setting_single_user_mode' => 'Single user mode', 'setting_single_user_mode_explain' => 'By default, Firefly III only accepts one (1) registration: you. This is a security measure, preventing others from using your instance unless you allow them to. Future registrations are blocked. When you uncheck this box, others can use your instance as well, assuming they can reach it (when it is connected to the internet).', 'store_configuration' => 'Store configuration', diff --git a/resources/lang/en_US/form.php b/resources/lang/en_US/form.php index 38960dfc44..44cb536f65 100644 --- a/resources/lang/en_US/form.php +++ b/resources/lang/en_US/form.php @@ -67,9 +67,12 @@ return [ 'tag_mode' => 'Tag mode', 'virtual_balance' => 'Virtual balance', 'run_after_form' => 'Run this rule', - - - + 'valid_url_protocols' => 'Valid URL protocols', + 'allow_webhooks' => 'Allow webhooks', + 'enable_external_rates' => 'Enable external exchange rates', + 'enable_external_map' => 'Enable external map', + 'use_running_balance' => 'Calculate running balances', + 'enable_exchange_rates' => 'Enable exchange rates', 'targetamount' => 'Target amount', 'target_amount' => 'Target amount', 'account_role' => 'Account role', diff --git a/resources/views/settings/configuration/index.twig b/resources/views/settings/configuration/index.twig index 63c1d67104..cae2db21f1 100644 --- a/resources/views/settings/configuration/index.twig +++ b/resources/views/settings/configuration/index.twig @@ -4,66 +4,143 @@ {{ Breadcrumbs.render }} {% endblock %} {% block content %} + + + +
- + + {# security #}
- - - - {# single user mode #} -
+
-

{{ 'setting_single_user_mode'|_ }}

+

{{ 'config_security'|_ }}

-

+

+ {{ 'setting_single_user_mode'|_ }} +

+

{{ 'setting_single_user_mode_explain'|_ }}

{{ ExpandedForm.checkbox('single_user_mode','1', singleUserMode) }}
+
- {# installation is demo site #} -
+
+
-

{{ 'setting_is_demo_site'|_ }}

+

{{ 'config_features'|_ }}

-

+

+ {{ 'setting_enable_exchange_rates'|_ }} +

+

+ {{ 'setting_enable_exchange_rates_explain'|_ }} +

+ {{ ExpandedForm.checkbox('enable_exchange_rates','1', enableExchangeRates) }} + +

+ {{ 'setting_use_running_balance'|_ }} +

+

+ {{ 'setting_use_running_balance_explain'|_ }} +

+ {{ ExpandedForm.checkbox('use_running_balance','1', useRunningBalance) }} +
+
+
+
+ +
+
+
+
+

{{ 'config_external_connections'|_ }}

+
+
+

+ {{ 'setting_enable_external_map'|_ }} +

+

+ {{ 'setting_enable_external_map_explain'|_ }} +

+ {{ ExpandedForm.checkbox('enable_external_map','1', enableExternalMap) }} + +

+ {{ 'setting_enable_external_rates'|_ }} +

+

+ {{ 'setting_enable_external_rates_explain'|_ }} +

+ {{ ExpandedForm.checkbox('enable_external_rates','1', enableExternalRates) }} + +

+ {{ 'setting_allow_webhooks'|_ }} +

+

+ {{ 'setting_allow_webhooks_explain'|_ }} +

+ {{ ExpandedForm.checkbox('allow_webhooks','1', allowWebhooks) }} +
+
+
+
+ +
+
+
+
+

{{ 'config_tech'|_ }}

+
+
+

+ {{ 'setting_valid_url_protocols'|_ }} +

+

+ {{ 'setting_valid_url_protocols_explain'|_ }} +

+ {{ ExpandedForm.text('valid_url_protocols', validUrlProtocols) }} + +

+ {{ 'setting_is_demo_site'|_ }} +

+

{{ 'setting_is_demo_site_explain'|_ }}

{{ ExpandedForm.checkbox('is_demo_site','1', isDemoSite) }} -
-
-
- - {# block for config setting #} - {# -
-
-
-

{{ 'setting_x'|_ }}

-
-
-

- {{ 'setting_x_explain'|_ }} +

+

- #}
-
-
- -
-
- {% endblock %} From b0cc5f3a46563fd7e94f133ead389e51e00772cd Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 06:39:58 +0100 Subject: [PATCH 11/58] Remove entries from .env file. --- .env.example | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/.env.example b/.env.example index f323006adc..742a3dd322 100644 --- a/.env.example +++ b/.env.example @@ -188,36 +188,11 @@ MAILERSEND_API_KEY= # Firefly III can send you the following messages. SEND_ERROR_MESSAGE=true -# Set this value to true if you want to set the location of certain things, like transactions. -# Since this involves an external service, it's optional and disabled by default. -ENABLE_EXTERNAL_MAP=false - -# -# Enable or disable exchange rate conversion. -# -ENABLE_EXCHANGE_RATES=false - -# Set this value to true if you want Firefly III to download currency exchange rates -# from the internet. These rates are hosted by the creator of Firefly III inside -# an Azure Storage Container. -# Not all currencies may be available. Rates may be wrong. -ENABLE_EXTERNAL_RATES=false - # The map will default to this location: MAP_DEFAULT_LAT=51.983333 MAP_DEFAULT_LONG=5.916667 MAP_DEFAULT_ZOOM=6 -# -# Some objects have room for an URL, like transactions and webhooks. -# By default, the following protocols are allowed: -# http, https, ftp, ftps, mailto -# -# To change this, set your preferred comma separated set below. -# Be sure to include http, https and other default ones if you need to. -# -VALID_URL_PROTOCOLS= - # # Firefly III authentication settings # @@ -272,11 +247,6 @@ DISABLE_CSP_HEADER=false TRACKER_SITE_ID= TRACKER_URL= -# -# Firefly III supports webhooks. These are security sensitive and must be enabled manually first. -# -ALLOW_WEBHOOKS=false - # # The static cron job token can be useful when you use Docker and wish to manage cron jobs. # 1. Set this token to any 32-character value (this is important!). @@ -310,13 +280,6 @@ PUSHER_ID= DEMO_USERNAME= DEMO_PASSWORD= -# -# Disable or enable the running balance column data. -# If you enable this, please also run "php artisan firefly-iii:correct-database" -# This will take some time the first run. -# -USE_RUNNING_BALANCE=false - # # The v2 layout is very experimental. If it breaks you get to keep both parts. # Be wary of data loss. From 0f0cdb8e96babb5fa4b05ac368be39ddfdeb24f1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 06:42:11 +0100 Subject: [PATCH 12/58] Replace config calls. --- app/Console/Commands/System/VerifySecurityAlerts.php | 8 ++++---- .../Commands/Upgrade/AddsTransactionIdentifiers.php | 4 ++-- .../Commands/Upgrade/RemovesDatabaseDecryption.php | 4 ++-- .../Commands/Upgrade/RepairsAccountBalances.php | 4 ++-- app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub | 4 ++-- .../Commands/Upgrade/UpgradesAccountCurrencies.php | 4 ++-- .../Commands/Upgrade/UpgradesAccountMetaData.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesAttachments.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesBillsToRules.php | 4 ++-- .../Commands/Upgrade/UpgradesBudgetLimitPeriods.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesBudgetLimits.php | 4 ++-- .../Commands/Upgrade/UpgradesCreditCardLiabilities.php | 4 ++-- .../Commands/Upgrade/UpgradesCurrencyPreferences.php | 4 ++-- .../Commands/Upgrade/UpgradesJournalMetaData.php | 6 +++--- app/Console/Commands/Upgrade/UpgradesJournalNotes.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesLiabilities.php | 4 ++-- .../Commands/Upgrade/UpgradesLiabilitiesEight.php | 4 ++-- .../Commands/Upgrade/UpgradesMultiPiggyBanks.php | 4 ++-- .../Upgrade/UpgradesPrimaryCurrencyAmounts.php | 4 ++-- .../Commands/Upgrade/UpgradesRecurrenceMetaData.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesRuleActions.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesTagLocations.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesToGroups.php | 4 ++-- .../Commands/Upgrade/UpgradesTransferCurrencies.php | 4 ++-- .../Upgrade/UpgradesVariousCurrencyInformation.php | 4 ++-- app/Console/Commands/Upgrade/UpgradesWebhooks.php | 4 ++-- app/Handlers/Events/AdminEventHandler.php | 4 ++-- app/Handlers/Events/UserEventHandler.php | 4 ++-- app/Handlers/Events/VersionCheckEventHandler.php | 10 +++++----- app/Helpers/Update/UpdateTrait.php | 2 +- app/Http/Controllers/Admin/UserController.php | 2 +- app/Http/Controllers/Auth/ForgotPasswordController.php | 2 +- app/Http/Controllers/Auth/LoginController.php | 2 +- app/Http/Controllers/Auth/RegisterController.php | 6 +++--- app/Http/Controllers/Auth/ResetPasswordController.php | 2 +- app/Http/Controllers/Controller.php | 2 +- app/Http/Controllers/DebugController.php | 2 +- app/Http/Middleware/Range.php | 8 ++++---- app/Notifications/Notifiables/OwnerNotifiable.php | 6 +++--- app/Notifications/ReturnsAvailableChannels.php | 10 +++++----- app/Support/System/GeneratesInstallationId.php | 4 ++-- app/User.php | 3 ++- 42 files changed, 90 insertions(+), 89 deletions(-) diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index ff801050b9..53c09d7da0 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -107,8 +107,8 @@ class VerifySecurityAlerts extends Command private function removeOldAdvisory(): void { try { - app('fireflyconfig')->delete('upgrade_security_message'); - app('fireflyconfig')->delete('upgrade_security_level'); + \FireflyIII\Support\Facades\FireflyConfig::delete('upgrade_security_message'); + \FireflyIII\Support\Facades\FireflyConfig::delete('upgrade_security_level'); } catch (QueryException $e) { Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage())); } @@ -117,8 +117,8 @@ class VerifySecurityAlerts extends Command private function saveSecurityAdvisory(array $array): void { try { - app('fireflyconfig')->set('upgrade_security_message', $array['message']); - app('fireflyconfig')->set('upgrade_security_level', $array['level']); + \FireflyIII\Support\Facades\FireflyConfig::set('upgrade_security_message', $array['message']); + \FireflyIII\Support\Facades\FireflyConfig::set('upgrade_security_level', $array['level']); } catch (QueryException $e) { Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage())); } diff --git a/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php b/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php index baef09da3d..c07952b28b 100644 --- a/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php +++ b/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php @@ -97,7 +97,7 @@ class AddsTransactionIdentifiers extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -157,6 +157,6 @@ class AddsTransactionIdentifiers extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index e1451c94a5..ff051b324e 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -86,7 +86,7 @@ class RemovesDatabaseDecryption extends Command $this->friendlyPositive(sprintf('Decrypted the data in table "%s".', $table)); // mark as decrypted: $configName = sprintf('is_decrypted_%s', $table); - app('fireflyconfig')->set($configName, true); + \FireflyIII\Support\Facades\FireflyConfig::set($configName, true); } private function isDecrypted(string $table): bool @@ -95,7 +95,7 @@ class RemovesDatabaseDecryption extends Command $configVar = null; try { - $configVar = app('fireflyconfig')->get($configName, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get($configName, false); } catch (FireflyException $e) { Log::error($e->getMessage()); } diff --git a/app/Console/Commands/Upgrade/RepairsAccountBalances.php b/app/Console/Commands/Upgrade/RepairsAccountBalances.php index 3282b2f00f..88a5a040d3 100644 --- a/app/Console/Commands/Upgrade/RepairsAccountBalances.php +++ b/app/Console/Commands/Upgrade/RepairsAccountBalances.php @@ -58,14 +58,14 @@ class RepairsAccountBalances extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar?->data; } private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } private function correctBalanceAmounts(): void diff --git a/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub b/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub index 6a9c3897df..9cd5d0f483 100644 --- a/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub +++ b/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub @@ -41,7 +41,7 @@ class UpgradeSkeleton extends Command */ private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); if (null !== $configVar) { return (bool)$configVar->data; } @@ -55,6 +55,6 @@ class UpgradeSkeleton extends Command */ private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php index cb1a35cc55..7ab7392f4d 100644 --- a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php +++ b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php @@ -85,7 +85,7 @@ class UpgradesAccountCurrencies extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar?->data; } @@ -155,6 +155,6 @@ class UpgradesAccountCurrencies extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php b/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php index 234fc3cba8..d62504694d 100644 --- a/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php @@ -82,7 +82,7 @@ class UpgradesAccountMetaData extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -90,6 +90,6 @@ class UpgradesAccountMetaData extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAttachments.php b/app/Console/Commands/Upgrade/UpgradesAttachments.php index 5c8022345b..13856443e0 100644 --- a/app/Console/Commands/Upgrade/UpgradesAttachments.php +++ b/app/Console/Commands/Upgrade/UpgradesAttachments.php @@ -92,7 +92,7 @@ class UpgradesAttachments extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -100,6 +100,6 @@ class UpgradesAttachments extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesBillsToRules.php b/app/Console/Commands/Upgrade/UpgradesBillsToRules.php index 7575dc31e3..b73b56f221 100644 --- a/app/Console/Commands/Upgrade/UpgradesBillsToRules.php +++ b/app/Console/Commands/Upgrade/UpgradesBillsToRules.php @@ -99,7 +99,7 @@ class UpgradesBillsToRules extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -206,6 +206,6 @@ class UpgradesBillsToRules extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php index d3581741b3..2578ab0b25 100644 --- a/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php +++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php @@ -58,7 +58,7 @@ class UpgradesBudgetLimitPeriods extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar->data; } @@ -152,6 +152,6 @@ class UpgradesBudgetLimitPeriods extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php index 2b55dabfd5..c9756098c7 100644 --- a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php +++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php @@ -84,7 +84,7 @@ class UpgradesBudgetLimits extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -92,6 +92,6 @@ class UpgradesBudgetLimits extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php b/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php index 7b3b8e65b1..9b60caf1bd 100644 --- a/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php @@ -80,13 +80,13 @@ class UpgradesCreditCardLiabilities extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar?->data; } private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php index 92b8b0445b..f6fc42a7d1 100644 --- a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php +++ b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php @@ -65,7 +65,7 @@ class UpgradesCurrencyPreferences extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -144,6 +144,6 @@ class UpgradesCurrencyPreferences extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php b/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php index 3f199e57a1..8c02368773 100644 --- a/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php @@ -69,14 +69,14 @@ class UpgradesJournalMetaData extends Command private function isMigrated(): bool { - $configVar = app('fireflyconfig')->get(UpgradesToGroups::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(UpgradesToGroups::CONFIG_NAME, false); return (bool) $configVar->data; } private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar->data; } @@ -218,6 +218,6 @@ class UpgradesJournalMetaData extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesJournalNotes.php b/app/Console/Commands/Upgrade/UpgradesJournalNotes.php index 2190cea5e1..6cd7dfcbea 100644 --- a/app/Console/Commands/Upgrade/UpgradesJournalNotes.php +++ b/app/Console/Commands/Upgrade/UpgradesJournalNotes.php @@ -86,7 +86,7 @@ class UpgradesJournalNotes extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -94,6 +94,6 @@ class UpgradesJournalNotes extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilities.php b/app/Console/Commands/Upgrade/UpgradesLiabilities.php index 23b94883f7..89a10e9359 100644 --- a/app/Console/Commands/Upgrade/UpgradesLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradesLiabilities.php @@ -61,7 +61,7 @@ class UpgradesLiabilities extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -148,6 +148,6 @@ class UpgradesLiabilities extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php index fc986e5260..3a24482b7b 100644 --- a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php @@ -63,7 +63,7 @@ class UpgradesLiabilitiesEight extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -207,6 +207,6 @@ class UpgradesLiabilitiesEight extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php index 61f7ba4b0e..26a1fa929f 100644 --- a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php +++ b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php @@ -64,7 +64,7 @@ class UpgradesMultiPiggyBanks extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -112,6 +112,6 @@ class UpgradesMultiPiggyBanks extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php b/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php index 40e768aefc..55647c6b99 100644 --- a/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php +++ b/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php @@ -60,7 +60,7 @@ class UpgradesPrimaryCurrencyAmounts extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -68,6 +68,6 @@ class UpgradesPrimaryCurrencyAmounts extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php index c6126388ec..c3f6419f63 100644 --- a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php @@ -65,7 +65,7 @@ class UpgradesRecurrenceMetaData extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -117,6 +117,6 @@ class UpgradesRecurrenceMetaData extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesRuleActions.php b/app/Console/Commands/Upgrade/UpgradesRuleActions.php index 0be7c55811..70e1b7c52f 100644 --- a/app/Console/Commands/Upgrade/UpgradesRuleActions.php +++ b/app/Console/Commands/Upgrade/UpgradesRuleActions.php @@ -63,7 +63,7 @@ class UpgradesRuleActions extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -183,6 +183,6 @@ class UpgradesRuleActions extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesTagLocations.php b/app/Console/Commands/Upgrade/UpgradesTagLocations.php index 1bba349b76..ef2fbd28de 100644 --- a/app/Console/Commands/Upgrade/UpgradesTagLocations.php +++ b/app/Console/Commands/Upgrade/UpgradesTagLocations.php @@ -57,7 +57,7 @@ class UpgradesTagLocations extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -97,6 +97,6 @@ class UpgradesTagLocations extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesToGroups.php b/app/Console/Commands/Upgrade/UpgradesToGroups.php index b1411a7b25..accae5e614 100644 --- a/app/Console/Commands/Upgrade/UpgradesToGroups.php +++ b/app/Console/Commands/Upgrade/UpgradesToGroups.php @@ -97,7 +97,7 @@ class UpgradesToGroups extends Command private function isMigrated(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -379,6 +379,6 @@ class UpgradesToGroups extends Command private function markAsMigrated(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php b/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php index 2b4b566c8b..9e796b82c7 100644 --- a/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php +++ b/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php @@ -105,7 +105,7 @@ class UpgradesTransferCurrencies extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -480,6 +480,6 @@ class UpgradesTransferCurrencies extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php b/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php index f0e669797d..5a157029d1 100644 --- a/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php +++ b/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php @@ -86,7 +86,7 @@ class UpgradesVariousCurrencyInformation extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -246,6 +246,6 @@ class UpgradesVariousCurrencyInformation extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesWebhooks.php b/app/Console/Commands/Upgrade/UpgradesWebhooks.php index bd4773a3f9..abbcc8cd34 100644 --- a/app/Console/Commands/Upgrade/UpgradesWebhooks.php +++ b/app/Console/Commands/Upgrade/UpgradesWebhooks.php @@ -63,7 +63,7 @@ class UpgradesWebhooks extends Command private function isExecuted(): bool { - $configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); + $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -109,6 +109,6 @@ class UpgradesWebhooks extends Command private function markAsExecuted(): void { - app('fireflyconfig')->set(self::CONFIG_NAME, true); + \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index 6c71077ca2..807019e794 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -45,7 +45,7 @@ class AdminEventHandler { public function sendInvitationNotification(InvitationCreated $event): void { - $sendMail = app('fireflyconfig')->get('notification_invite_created', true)->data; + $sendMail = \FireflyIII\Support\Facades\FireflyConfig::get('notification_invite_created', true)->data; if (false === $sendMail) { return; } @@ -96,7 +96,7 @@ class AdminEventHandler */ public function sendNewVersion(NewVersionAvailable $event): void { - $sendMail = app('fireflyconfig')->get('notification_new_version', true)->data; + $sendMail = \FireflyIII\Support\Facades\FireflyConfig::get('notification_new_version', true)->data; if (false === $sendMail) { return; } diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index 398298fc6d..b1833b65e2 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -224,7 +224,7 @@ class UserEventHandler public function sendAdminRegistrationNotification(RegisteredUser $event): void { - $sendMail = (bool)app('fireflyconfig')->get('notification_admin_new_reg', true)->data; + $sendMail = (bool)\FireflyIII\Support\Facades\FireflyConfig::get('notification_admin_new_reg', true)->data; if ($sendMail) { $owner = $event->owner; @@ -367,7 +367,7 @@ class UserEventHandler */ public function sendRegistrationMail(RegisteredUser $event): void { - $sendMail = (bool)app('fireflyconfig')->get('notification_user_new_reg', true)->data; + $sendMail = (bool)\FireflyIII\Support\Facades\FireflyConfig::get('notification_user_new_reg', true)->data; if ($sendMail) { try { Notification::send($event->user, new UserRegistrationNotification()); diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php index 3a2d7c42d4..d15fca083b 100644 --- a/app/Handlers/Events/VersionCheckEventHandler.php +++ b/app/Handlers/Events/VersionCheckEventHandler.php @@ -54,7 +54,7 @@ class VersionCheckEventHandler Log::debug('Now in checkForUpdates()'); // should not check for updates: - $permission = app('fireflyconfig')->get('permission_update_check', -1); + $permission = \FireflyIII\Support\Facades\FireflyConfig::get('permission_update_check', -1); $value = (int) $permission->data; if (1 !== $value) { Log::debug('Update check is not enabled.'); @@ -73,7 +73,7 @@ class VersionCheckEventHandler } /** @var Configuration $lastCheckTime */ - $lastCheckTime = app('fireflyconfig')->get('last_update_check', Carbon::now()->getTimestamp()); + $lastCheckTime = \FireflyIII\Support\Facades\FireflyConfig::get('last_update_check', Carbon::now()->getTimestamp()); $now = Carbon::now()->getTimestamp(); $diff = $now - $lastCheckTime->data; Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); @@ -87,7 +87,7 @@ class VersionCheckEventHandler $release = $this->getLatestRelease(); session()->flash($release['level'], $release['message']); - app('fireflyconfig')->set('last_update_check', Carbon::now()->getTimestamp()); + \FireflyIII\Support\Facades\FireflyConfig::set('last_update_check', Carbon::now()->getTimestamp()); } /** @@ -107,7 +107,7 @@ class VersionCheckEventHandler } /** @var Configuration $lastCheckTime */ - $lastCheckTime = app('fireflyconfig')->get('last_update_warning', Carbon::now()->getTimestamp()); + $lastCheckTime = \FireflyIII\Support\Facades\FireflyConfig::get('last_update_warning', Carbon::now()->getTimestamp()); $now = Carbon::now()->getTimestamp(); $diff = $now - $lastCheckTime->data; Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); @@ -120,6 +120,6 @@ class VersionCheckEventHandler Log::debug('Have warned about a new version in four weeks!'); session()->flash('info', (string) trans('firefly.disabled_but_check')); - app('fireflyconfig')->set('last_update_warning', Carbon::now()->getTimestamp()); + \FireflyIII\Support\Facades\FireflyConfig::set('last_update_warning', Carbon::now()->getTimestamp()); } } diff --git a/app/Helpers/Update/UpdateTrait.php b/app/Helpers/Update/UpdateTrait.php index 20b65fb024..f94ce56e80 100644 --- a/app/Helpers/Update/UpdateTrait.php +++ b/app/Helpers/Update/UpdateTrait.php @@ -43,7 +43,7 @@ trait UpdateTrait /** @var UpdateRequestInterface $checker */ $checker = app(UpdateRequestInterface::class); - $channelConfig = app('fireflyconfig')->get('update_channel', 'stable'); + $channelConfig = \FireflyIII\Support\Facades\FireflyConfig::get('update_channel', 'stable'); $channel = (string) $channelConfig->data; return $checker->getUpdateInformation($channel); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 380ac6dc3e..eee9c0f498 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -164,7 +164,7 @@ class UserController extends Controller $subTitle = (string) trans('firefly.user_administration'); $subTitleIcon = 'fa-users'; $users = $this->repository->all(); - $singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = (bool) \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $allowInvites = false; if (!$this->externalIdentity && $singleUserMode) { // also registration enabled. diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index 303bad7505..c55665f712 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -142,7 +142,7 @@ class ForgotPasswordController extends Controller } // is allowed to? - $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); $allowRegistration = true; $pageTitle = (string) trans('firefly.forgot_pw_page_title'); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 59c02428e1..94c034b108 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -236,7 +236,7 @@ class LoginController extends Controller } // is allowed to register, etc. - $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $allowRegistration = true; $allowReset = true; if (true === $singleUserMode && $count > 0) { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index 314f6cab2b..fe431c500a 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -121,7 +121,7 @@ class RegisterController extends Controller $allowRegistration = true; try { - $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; } catch (ContainerExceptionInterface|NotFoundExceptionInterface) { $singleUserMode = true; } @@ -148,7 +148,7 @@ class RegisterController extends Controller */ public function showInviteForm(Request $request, string $code): Factory|\Illuminate\Contracts\View\View { - $isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; + $isDemoSite = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $pageTitle = (string) trans('firefly.register_page_title'); $repository = app(UserRepositoryInterface::class); $allowRegistration = $this->allowedToRegister(); @@ -182,7 +182,7 @@ class RegisterController extends Controller */ public function showRegistrationForm(?Request $request = null): Factory|\Illuminate\Contracts\View\View { - $isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; + $isDemoSite = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $pageTitle = (string) trans('firefly.register_page_title'); $allowRegistration = $this->allowedToRegister(); diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index 2b82d826bf..f9204c9d99 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -131,7 +131,7 @@ class ResetPasswordController extends Controller } // is allowed to register? - $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); $allowRegistration = true; $pageTitle = (string) trans('firefly.reset_pw_page_title'); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 3a148e0168..dd80fec692 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -71,7 +71,7 @@ abstract class Controller extends BaseController public function __construct() { // is site a demo site? - $isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false)); + $isDemoSiteConfig = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site', false)); $isDemoSite = (bool) $isDemoSiteConfig->data; View::share('IS_DEMO_SITE', $isDemoSite); View::share('DEMO_USERNAME', config('firefly.demo_username')); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index a721ac7d83..c3f96fc3a2 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -241,7 +241,7 @@ class DebugController extends Controller { $userGuard = config('auth.defaults.guard'); - $config = app('fireflyconfig')->get('last_rt_job', 0); + $config = \FireflyIII\Support\Facades\FireflyConfig::get('last_rt_job', 0); $lastTime = (int) $config->data; $lastCronjob = 'never'; $lastCronjobAgo = 'never'; diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 10f859435d..9ba6ad25e8 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -144,11 +144,11 @@ class Range // share security message: if ( - app('fireflyconfig')->has('upgrade_security_message') - && app('fireflyconfig')->has('upgrade_security_level') + \FireflyIII\Support\Facades\FireflyConfig::has('upgrade_security_message') + && \FireflyIII\Support\Facades\FireflyConfig::has('upgrade_security_level') ) { - app('view')->share('upgrade_security_message', app('fireflyconfig')->get('upgrade_security_message')->data); - app('view')->share('upgrade_security_level', app('fireflyconfig')->get('upgrade_security_level')->data); + app('view')->share('upgrade_security_message', \FireflyIII\Support\Facades\FireflyConfig::get('upgrade_security_message')->data); + app('view')->share('upgrade_security_level', \FireflyIII\Support\Facades\FireflyConfig::get('upgrade_security_level')->data); } } } diff --git a/app/Notifications/Notifiables/OwnerNotifiable.php b/app/Notifications/Notifiables/OwnerNotifiable.php index 96198c5d39..5e82e725d3 100644 --- a/app/Notifications/Notifiables/OwnerNotifiable.php +++ b/app/Notifications/Notifiables/OwnerNotifiable.php @@ -58,8 +58,8 @@ class OwnerNotifiable public function routeNotificationForPushover(): PushoverReceiver { Log::debug('Return settings for routeNotificationForPushover'); - $pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data; + $pushoverAppToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_user_token', '')->data; return PushoverReceiver::withUserKey($pushoverUserToken) ->withApplicationToken($pushoverAppToken) @@ -68,7 +68,7 @@ class OwnerNotifiable public function routeNotificationForSlack(): string { - $res = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; + $res = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data; if (is_array($res)) { $res = ''; } diff --git a/app/Notifications/ReturnsAvailableChannels.php b/app/Notifications/ReturnsAvailableChannels.php index 0d4d5dd523..7341b5b04d 100644 --- a/app/Notifications/ReturnsAvailableChannels.php +++ b/app/Notifications/ReturnsAvailableChannels.php @@ -54,7 +54,7 @@ class ReturnsAvailableChannels $channels = ['mail']; if (true === config('notifications.channels.slack.enabled', false)) { - $slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; + $slackUrl = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data; if (UrlValidator::isValidWebhookURL($slackUrl)) { $channels[] = 'slack'; } @@ -62,19 +62,19 @@ class ReturnsAvailableChannels // if (true === config('notifications.channels.ntfy.enabled', false)) { // // validate presence of of Ntfy settings. - // if ('' !== (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) { + // if ('' !== (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('ntfy_topic', '')->data) { // Log::debug('Enabled ntfy.'); // $channels[] = NtfyChannel::class; // } - // if ('' === (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) { + // if ('' === (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('ntfy_topic', '')->data) { // Log::warning('No topic name for Ntfy, channel is disabled.'); // } // } // pushover if (true === config('notifications.channels.pushover.enabled', false)) { - $pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data; + $pushoverAppToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_user_token', '')->data; if ('' === $pushoverAppToken || '' === $pushoverUserToken) { Log::warning('[b] No Pushover token, channel is disabled.'); } diff --git a/app/Support/System/GeneratesInstallationId.php b/app/Support/System/GeneratesInstallationId.php index 32ca760483..2a5fc8eedf 100644 --- a/app/Support/System/GeneratesInstallationId.php +++ b/app/Support/System/GeneratesInstallationId.php @@ -36,7 +36,7 @@ trait GeneratesInstallationId protected function generateInstallationId(): void { try { - $config = app('fireflyconfig')->get('installation_id'); + $config = \FireflyIII\Support\Facades\FireflyConfig::get('installation_id'); } catch (FireflyException) { Log::info('Could not create or generate installation ID. Do not continue.'); @@ -52,7 +52,7 @@ trait GeneratesInstallationId $uuid4 = Uuid::uuid4(); $uniqueId = (string)$uuid4; Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId)); - app('fireflyconfig')->set('installation_id', $uniqueId); + \FireflyIII\Support\Facades\FireflyConfig::set('installation_id', $uniqueId); } } } diff --git a/app/User.php b/app/User.php index d97b9a767b..12a3ed2ee1 100644 --- a/app/User.php +++ b/app/User.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII; +use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Preferences; use Illuminate\Support\Facades\Log; use Deprecated; @@ -403,7 +404,7 @@ class User extends Authenticatable public function routeNotificationForSlack(Notification $notification): ?string { // this check does not validate if the user is owner, Should be done by notification itself. - $res = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; + $res = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data; if (is_array($res)) { $res = ''; } From 8e729d6bbfceb7868b628de242af1cffba74ecf8 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 07:00:53 +0100 Subject: [PATCH 13/58] Replace references to hard coded config with variables. --- app/Api/V1/Controllers/System/CronController.php | 2 +- app/Api/V1/Controllers/Webhook/AttemptController.php | 4 ++-- app/Api/V1/Controllers/Webhook/DestroyController.php | 6 +++--- app/Api/V1/Controllers/Webhook/MessageController.php | 4 ++-- app/Api/V1/Controllers/Webhook/ShowController.php | 6 +++--- app/Api/V1/Controllers/Webhook/StoreController.php | 2 +- app/Api/V1/Controllers/Webhook/SubmitController.php | 2 +- app/Api/V1/Controllers/Webhook/UpdateController.php | 2 +- app/Api/V1/Requests/Models/Transaction/StoreRequest.php | 2 +- app/Api/V1/Requests/Models/Transaction/UpdateRequest.php | 2 +- app/Api/V1/Requests/Models/Webhook/CreateRequest.php | 2 +- app/Api/V1/Requests/Models/Webhook/UpdateRequest.php | 2 +- .../Correction/CorrectsPrimaryCurrencyAmounts.php | 2 +- app/Console/Commands/Correction/CorrectsUnevenAmount.php | 3 ++- .../Commands/System/RecalculatesRunningBalance.php | 2 +- app/Console/Commands/Tools/Cron.php | 2 +- app/Console/Commands/Upgrade/RepairsAccountBalances.php | 2 +- app/Handlers/Events/WebhookEventHandler.php | 2 +- app/Handlers/Observer/TransactionObserver.php | 4 ++-- app/Http/Controllers/Controller.php | 2 +- app/Http/Controllers/ExchangeRates/IndexController.php | 2 +- app/Http/Controllers/Transaction/CreateController.php | 2 +- app/Http/Controllers/Transaction/EditController.php | 2 +- app/Http/Controllers/Webhooks/CreateController.php | 2 +- app/Http/Controllers/Webhooks/DeleteController.php | 2 +- app/Http/Controllers/Webhooks/EditController.php | 2 +- app/Http/Controllers/Webhooks/IndexController.php | 2 +- app/Http/Controllers/Webhooks/ShowController.php | 2 +- app/Support/Amount.php | 4 ++-- app/Support/Http/Api/ExchangeRateConverter.php | 2 +- config/cer.php | 4 ++-- config/firefly.php | 8 ++++---- resources/views/list/groups.twig | 4 ++-- resources/views/partials/debug-table.twig | 4 ++-- resources/views/partials/menu-sidebar.twig | 2 +- resources/views/preferences/index.twig | 2 +- 36 files changed, 51 insertions(+), 50 deletions(-) diff --git a/app/Api/V1/Controllers/System/CronController.php b/app/Api/V1/Controllers/System/CronController.php index 941211efbd..7fa41e4c7a 100644 --- a/app/Api/V1/Controllers/System/CronController.php +++ b/app/Api/V1/Controllers/System/CronController.php @@ -50,7 +50,7 @@ class CronController extends Controller $return = []; $return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']); $return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']); - if (true === config('cer.download_enabled')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data) { $return['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']); } $return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']); diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 2a8f949176..123f570a98 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -71,7 +71,7 @@ class AttemptController extends Controller if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -115,7 +115,7 @@ class AttemptController extends Controller throw new FireflyException('200041: Webhook message and webhook attempt are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index 98ee5f0586..1154ae2caa 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -63,7 +63,7 @@ class DestroyController extends Controller */ public function destroy(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -93,7 +93,7 @@ class DestroyController extends Controller throw new FireflyException('200041: Webhook message and webhook attempt are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -121,7 +121,7 @@ class DestroyController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index 475724f4c5..c9c404be5f 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -65,7 +65,7 @@ class MessageController extends Controller */ public function index(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -105,7 +105,7 @@ class MessageController extends Controller if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index 62c39258b4..d33bbdbd84 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -72,7 +72,7 @@ class ShowController extends Controller */ public function index(): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -114,7 +114,7 @@ class ShowController extends Controller */ public function show(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -146,7 +146,7 @@ class ShowController extends Controller */ public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index 12c7b1bf75..25692f748c 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -63,7 +63,7 @@ class StoreController extends Controller public function store(CreateRequest $request): JsonResponse { $data = $request->getData(); - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/SubmitController.php b/app/Api/V1/Controllers/Webhook/SubmitController.php index 034bea04b6..51cdb6c70e 100644 --- a/app/Api/V1/Controllers/Webhook/SubmitController.php +++ b/app/Api/V1/Controllers/Webhook/SubmitController.php @@ -58,7 +58,7 @@ class SubmitController extends Controller */ public function submit(Webhook $webhook): JsonResponse { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/UpdateController.php b/app/Api/V1/Controllers/Webhook/UpdateController.php index c8da474ff4..5b6c7067b7 100644 --- a/app/Api/V1/Controllers/Webhook/UpdateController.php +++ b/app/Api/V1/Controllers/Webhook/UpdateController.php @@ -63,7 +63,7 @@ class UpdateController extends Controller public function update(Webhook $webhook, UpdateRequest $request): JsonResponse { $data = $request->getData(); - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php index 22fc2030b8..223e8ab7bb 100644 --- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php @@ -176,7 +176,7 @@ class StoreRequest extends FormRequest public function rules(): array { Log::debug('Collect rules of TransactionStoreRequest'); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; $locationRules = Location::requestRules([]); return [ diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index fbde30a61b..1f674da33f 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -248,7 +248,7 @@ class UpdateRequest extends FormRequest public function rules(): array { Log::debug(sprintf('Now in %s', __METHOD__)); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return [ // basic fields for group: diff --git a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php index a0b66b50a2..5b059648c5 100644 --- a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php @@ -73,7 +73,7 @@ class CreateRequest extends FormRequest $triggers = implode(',', array_values(Webhook::getTriggers())); $responses = implode(',', array_values(Webhook::getResponses())); $deliveries = implode(',', array_values(Webhook::getDeliveries())); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return [ 'title' => 'required|min:1|max:255|uniqueObjectForUser:webhooks,title', diff --git a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php index 07dcf74b0c..e7b5a3d661 100644 --- a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php @@ -73,7 +73,7 @@ class UpdateRequest extends FormRequest $triggers = implode(',', array_values(Webhook::getTriggers())); $responses = implode(',', array_values(Webhook::getResponses())); $deliveries = implode(',', array_values(Webhook::getDeliveries())); - $validProtocols = config('firefly.valid_url_protocols'); + $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; /** @var Webhook $webhook */ $webhook = $this->route()->parameter('webhook'); diff --git a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php index bfb7ed2007..f9150c55bc 100644 --- a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php +++ b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php @@ -62,7 +62,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command */ public function handle(): int { - if (false === config('cer.enabled')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { $this->friendlyInfo('This command will not run because currency exchange rates are disabled.'); return 0; diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index d96f2b6599..d5fef32fe2 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Console\Command; @@ -60,7 +61,7 @@ class CorrectsUnevenAmount extends Command $this->fixUnevenAmounts(); $this->matchCurrencies(); - if (true === config('firefly.feature_flags.running_balance_column')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate transaction running balance columns. This may take a LONG time. Please be patient.'); AccountBalanceCalculator::recalculateAll(false); $this->friendlyInfo('Done recalculating transaction running balance columns.'); diff --git a/app/Console/Commands/System/RecalculatesRunningBalance.php b/app/Console/Commands/System/RecalculatesRunningBalance.php index f14bba0ee7..4453e1e50d 100644 --- a/app/Console/Commands/System/RecalculatesRunningBalance.php +++ b/app/Console/Commands/System/RecalculatesRunningBalance.php @@ -52,7 +52,7 @@ class RecalculatesRunningBalance extends Command */ public function handle(): int { - if (true === config('firefly.feature_flags.running_balance_column')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->correctBalanceAmounts($this->option('force')); $this->friendlyInfo('Done recalculating account balances.'); diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php index ec91c4ebde..9348ac95b5 100644 --- a/app/Console/Commands/Tools/Cron.php +++ b/app/Console/Commands/Tools/Cron.php @@ -72,7 +72,7 @@ class Cron extends Command $force = (bool) $this->option('force'); // @phpstan-ignore-line // Fire exchange rates cron job. - if (true === config('cer.download_enabled') && ($doAll || $this->option('download-cer'))) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) { try { $this->exchangeRatesCronJob($force, $date); } catch (FireflyException $e) { diff --git a/app/Console/Commands/Upgrade/RepairsAccountBalances.php b/app/Console/Commands/Upgrade/RepairsAccountBalances.php index 88a5a040d3..28a0354559 100644 --- a/app/Console/Commands/Upgrade/RepairsAccountBalances.php +++ b/app/Console/Commands/Upgrade/RepairsAccountBalances.php @@ -43,7 +43,7 @@ class RepairsAccountBalances extends Command return 0; } - if (true === config('firefly.feature_flags.running_balance_column')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->markAsExecuted(); $this->correctBalanceAmounts(); diff --git a/app/Handlers/Events/WebhookEventHandler.php b/app/Handlers/Events/WebhookEventHandler.php index 41f5d1ccf8..db1a25fd44 100644 --- a/app/Handlers/Events/WebhookEventHandler.php +++ b/app/Handlers/Events/WebhookEventHandler.php @@ -39,7 +39,7 @@ class WebhookEventHandler public function sendWebhookMessages(): void { Log::debug(sprintf('Now in %s', __METHOD__)); - if (false === config('firefly.feature_flags.webhooks') || false === config('firefly.allow_webhooks')) { + if (false === config('firefly.feature_flags.webhooks') || false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::debug('Webhook event handler is disabled, do not run sendWebhookMessages().'); return; diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index dc34b29e61..bca1eb866f 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -39,7 +39,7 @@ class TransactionObserver public function created(Transaction $transaction): void { Log::debug('Observe "created" of a transaction.'); - if (true === config('firefly.feature_flags.running_balance_column') && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } @@ -82,7 +82,7 @@ class TransactionObserver public function updated(Transaction $transaction): void { // Log::debug('Observe "updated" of a transaction.'); - if (true === config('firefly.feature_flags.running_balance_column') && self::$recalculate && 1 === bccomp($transaction->amount, '0')) { + if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && self::$recalculate && 1 === bccomp($transaction->amount, '0')) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index dd80fec692..2fd0076d0e 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -80,7 +80,7 @@ abstract class Controller extends BaseController View::share('FF_BUILD_TIME', config('firefly.build_time')); // is webhooks enabled? - View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === config('firefly.allow_webhooks')); + View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data); // share custom auth guard info. $authGuard = config('firefly.authentication_guard'); diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.php index e8dbf13382..a83737a21a 100644 --- a/app/Http/Controllers/ExchangeRates/IndexController.php +++ b/app/Http/Controllers/ExchangeRates/IndexController.php @@ -47,7 +47,7 @@ class IndexController extends Controller return $next($request); } ); - if (false === config('cer.enabled')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { throw new NotFoundHttpException(); } } diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php index 878e589c04..80e26160ab 100644 --- a/app/Http/Controllers/Transaction/CreateController.php +++ b/app/Http/Controllers/Transaction/CreateController.php @@ -140,7 +140,7 @@ class CreateController extends Controller ]; $optionalFields['external_url'] ??= false; $optionalFields['location'] ??= false; - $optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map'); + $optionalFields['location'] = $optionalFields['location'] && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; // map info: $longitude = config('firefly.default_location.longitude'); diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php index a217962960..e1332c67da 100644 --- a/app/Http/Controllers/Transaction/EditController.php +++ b/app/Http/Controllers/Transaction/EditController.php @@ -114,7 +114,7 @@ class EditController extends Controller ]; $optionalFields['external_url'] ??= false; $optionalFields['location'] ??= false; - $optionalFields['location'] = $optionalFields['location'] && true === config('firefly.enable_external_map'); + $optionalFields['location'] = $optionalFields['location'] && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; // map info voor v2: $longitude = config('firefly.default_location.longitude'); diff --git a/app/Http/Controllers/Webhooks/CreateController.php b/app/Http/Controllers/Webhooks/CreateController.php index 6d84d4bbd1..d25cd8e0fa 100644 --- a/app/Http/Controllers/Webhooks/CreateController.php +++ b/app/Http/Controllers/Webhooks/CreateController.php @@ -59,7 +59,7 @@ class CreateController extends Controller */ public function index(): Factory|\Illuminate\Contracts\View\View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 472a4826d5..055d6bc661 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -64,7 +64,7 @@ class DeleteController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index fd6c8e377d..b8ad6bf40b 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -63,7 +63,7 @@ class EditController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index 14ae4b279b..f264c59556 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -55,7 +55,7 @@ class IndexController extends Controller */ public function index(): Factory|\Illuminate\Contracts\View\View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index 051f6651ea..4de27b139b 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -63,7 +63,7 @@ class ShowController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === config('firefly.allow_webhooks')) { + if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Support/Amount.php b/app/Support/Amount.php index ad117d2a39..5bb7815df0 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -117,7 +117,7 @@ class Amount if (!$user instanceof User) { $pref = $instance->getPreference('convert_to_primary_no_user'); if (null === $pref) { - $res = true === Preferences::get('convert_to_primary', false)->data && true === config('cer.enabled'); + $res = true === Preferences::get('convert_to_primary', false)->data && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $instance->setPreference('convert_to_primary_no_user', $res); return $res; @@ -128,7 +128,7 @@ class Amount $key = sprintf('convert_to_primary_%d', $user->id); $pref = $instance->getPreference($key); if (null === $pref) { - $res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === config('cer.enabled'); + $res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $instance->setPreference($key, $res); return $res; diff --git a/app/Support/Http/Api/ExchangeRateConverter.php b/app/Support/Http/Api/ExchangeRateConverter.php index deb9457f58..5fb488d223 100644 --- a/app/Support/Http/Api/ExchangeRateConverter.php +++ b/app/Support/Http/Api/ExchangeRateConverter.php @@ -71,7 +71,7 @@ class ExchangeRateConverter public function enabled(): bool { - return false !== config('cer.enabled') || $this->ignoreSettings; + return false !== \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data || $this->ignoreSettings; } /** diff --git a/config/cer.php b/config/cer.php index 5f358897fd..e1e5508a6e 100644 --- a/config/cer.php +++ b/config/cer.php @@ -24,8 +24,8 @@ declare(strict_types=1); return [ 'url' => 'https://ff3exchangerates.z6.web.core.windows.net', - 'enabled' => env('ENABLE_EXCHANGE_RATES', false), - 'download_enabled' => env('ENABLE_EXTERNAL_RATES', false), + 'enabled' => env('ENABLE_EXCHANGE_RATES', false), // no longer used, is the default. + 'download_enabled' => env('ENABLE_EXTERNAL_RATES', false), // no longer used, only for default. // if currencies are added, default rates must be added as well! // source: https://www.xe.com/currencyconverter/ diff --git a/config/firefly.php b/config/firefly.php index 9522bf9cf7..9cde0fef73 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -75,7 +75,7 @@ return [ 'webhooks' => true, 'handle_debts' => true, 'expression_engine' => true, - 'running_balance_column' => env('USE_RUNNING_BALANCE', false), + '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-19', @@ -94,10 +94,10 @@ return [ 'static_cron_token' => envNonEmpty('STATIC_CRON_TOKEN'), // flags - 'enable_external_map' => env('ENABLE_EXTERNAL_MAP', false), + 'enable_external_map' => env('ENABLE_EXTERNAL_MAP', false), // no longer used, only for default. 'disable_frame_header' => env('DISABLE_FRAME_HEADER', false), 'disable_csp_header' => env('DISABLE_CSP_HEADER', false), - 'allow_webhooks' => env('ALLOW_WEBHOOKS', false), + 'allow_webhooks' => env('ALLOW_WEBHOOKS', false), // no longer used, only for default. // info for demo site 'demo_username' => env('DEMO_USERNAME', ''), @@ -218,7 +218,7 @@ return [ 'available_dark_modes' => ['light', 'dark', 'browser'], 'bill_reminder_periods' => [90, 30, 14, 7, 0], 'valid_view_ranges' => ['1D', '1W', '1M', '3M', '6M', '1Y'], - 'valid_url_protocols' => envNonEmpty('VALID_URL_PROTOCOLS', 'http,https,ftp,ftps,mailto'), + 'valid_url_protocols' => envNonEmpty('VALID_URL_PROTOCOLS', 'http,https,ftp,ftps,mailto'), // no longer used, only for default. 'allowedMimes' => [ // plain files 'text/plain', diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 58e217609a..92cfb0b960 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -33,7 +33,7 @@   {{ trans('list.description') }} {{ trans('list.amount') }} - {% if config('firefly.feature_flags.running_balance_column') %} + {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %} {{ trans('list.running_balance') }} {% endif %} {{ trans('list.date') }} @@ -266,7 +266,7 @@ {% endif %} {% endif %} - {% if config('firefly.feature_flags.running_balance_column') %} + {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %} {% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %} {% if transaction.transaction_type_type == 'Deposit' %} diff --git a/resources/views/partials/debug-table.twig b/resources/views/partials/debug-table.twig index a7404e9fb5..79eeed4364 100644 --- a/resources/views/partials/debug-table.twig +++ b/resources/views/partials/debug-table.twig @@ -119,11 +119,11 @@ Exchange rates - {% if config('cer.enabled') %}Enabled{% else %}Disabled{% endif %}, downloads {% if config('cer.download_enabled') %}enabled{% else %}disabled{% endif %} + {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}Enabled{% else %}Disabled{% endif %}, downloads {% if FireflyConfig.get('enable_external_rates', config('cer.download_enabled')) %}enabled{% else %}disabled{% endif %} RB-column - {% if config('firefly.feature_flags.running_balance_column') %}Enabled{% else %}Disabled{% endif %} + {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %}Enabled{% else %}Disabled{% endif %} diff --git a/resources/views/partials/menu-sidebar.twig b/resources/views/partials/menu-sidebar.twig index 5b262fc05d..8320682e98 100644 --- a/resources/views/partials/menu-sidebar.twig +++ b/resources/views/partials/menu-sidebar.twig @@ -226,7 +226,7 @@ {{ 'currencies'|_ }} - {% if config('cer.enabled') %} + {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}
  • diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig index 2e7895d29d..62ccec7945 100644 --- a/resources/views/preferences/index.twig +++ b/resources/views/preferences/index.twig @@ -101,7 +101,7 @@
  • {# conversion back to primary currency #} - {% if config('cer.enabled') %} + {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}

    {{ 'pref_convert_to_primary'|_ }}

    From 3b8caba37c6381f18a9774579f885557f7aec0f9 Mon Sep 17 00:00:00 2001 From: JC5 Date: Sat, 20 Dec 2025 07:06:47 +0100 Subject: [PATCH 14/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Api/V1/Controllers/System/CronController.php | 3 ++- .../V1/Controllers/Webhook/AttemptController.php | 5 +++-- .../V1/Controllers/Webhook/DestroyController.php | 7 ++++--- .../V1/Controllers/Webhook/MessageController.php | 5 +++-- app/Api/V1/Controllers/Webhook/ShowController.php | 7 ++++--- app/Api/V1/Controllers/Webhook/StoreController.php | 3 ++- .../V1/Controllers/Webhook/SubmitController.php | 3 ++- .../V1/Controllers/Webhook/UpdateController.php | 3 ++- .../Requests/Models/Transaction/StoreRequest.php | 3 ++- .../Requests/Models/Transaction/UpdateRequest.php | 3 ++- .../V1/Requests/Models/Webhook/CreateRequest.php | 3 ++- .../V1/Requests/Models/Webhook/UpdateRequest.php | 3 ++- .../Correction/CorrectsPrimaryCurrencyAmounts.php | 3 ++- .../Commands/Correction/CorrectsUnevenAmount.php | 2 +- .../Commands/System/RecalculatesRunningBalance.php | 3 ++- .../Commands/System/VerifySecurityAlerts.php | 9 +++++---- app/Console/Commands/Tools/Cron.php | 3 ++- .../Upgrade/AddsTransactionIdentifiers.php | 5 +++-- .../Commands/Upgrade/RemovesDatabaseDecryption.php | 5 +++-- .../Commands/Upgrade/RepairsAccountBalances.php | 7 ++++--- .../Commands/Upgrade/UpgradesAccountCurrencies.php | 5 +++-- .../Commands/Upgrade/UpgradesAccountMetaData.php | 5 +++-- .../Commands/Upgrade/UpgradesAttachments.php | 5 +++-- .../Commands/Upgrade/UpgradesBillsToRules.php | 5 +++-- .../Upgrade/UpgradesBudgetLimitPeriods.php | 5 +++-- .../Commands/Upgrade/UpgradesBudgetLimits.php | 5 +++-- .../Upgrade/UpgradesCreditCardLiabilities.php | 5 +++-- .../Upgrade/UpgradesCurrencyPreferences.php | 5 +++-- .../Commands/Upgrade/UpgradesJournalMetaData.php | 7 ++++--- .../Commands/Upgrade/UpgradesJournalNotes.php | 5 +++-- .../Commands/Upgrade/UpgradesLiabilities.php | 5 +++-- .../Commands/Upgrade/UpgradesLiabilitiesEight.php | 5 +++-- .../Commands/Upgrade/UpgradesMultiPiggyBanks.php | 5 +++-- .../Upgrade/UpgradesPrimaryCurrencyAmounts.php | 5 +++-- .../Upgrade/UpgradesRecurrenceMetaData.php | 5 +++-- .../Commands/Upgrade/UpgradesRuleActions.php | 5 +++-- .../Commands/Upgrade/UpgradesTagLocations.php | 5 +++-- app/Console/Commands/Upgrade/UpgradesToGroups.php | 5 +++-- .../Upgrade/UpgradesTransferCurrencies.php | 5 +++-- .../Upgrade/UpgradesVariousCurrencyInformation.php | 5 +++-- app/Console/Commands/Upgrade/UpgradesWebhooks.php | 5 +++-- app/Handlers/Events/AdminEventHandler.php | 5 +++-- app/Handlers/Events/UserEventHandler.php | 5 +++-- app/Handlers/Events/VersionCheckEventHandler.php | 11 ++++++----- app/Handlers/Events/WebhookEventHandler.php | 3 ++- app/Handlers/Observer/TransactionObserver.php | 5 +++-- app/Helpers/Update/UpdateTrait.php | 3 ++- .../Controllers/Admin/ConfigurationController.php | 14 +++++++------- app/Http/Controllers/Admin/UserController.php | 3 ++- .../Controllers/Auth/ForgotPasswordController.php | 3 ++- app/Http/Controllers/Auth/LoginController.php | 3 ++- app/Http/Controllers/Auth/RegisterController.php | 7 ++++--- .../Controllers/Auth/ResetPasswordController.php | 3 ++- app/Http/Controllers/Controller.php | 5 +++-- app/Http/Controllers/DebugController.php | 3 ++- .../Controllers/ExchangeRates/IndexController.php | 3 ++- .../Controllers/Transaction/CreateController.php | 3 ++- .../Controllers/Transaction/EditController.php | 3 ++- app/Http/Controllers/Webhooks/CreateController.php | 3 ++- app/Http/Controllers/Webhooks/DeleteController.php | 3 ++- app/Http/Controllers/Webhooks/EditController.php | 3 ++- app/Http/Controllers/Webhooks/IndexController.php | 3 ++- app/Http/Controllers/Webhooks/ShowController.php | 3 ++- app/Http/Middleware/Range.php | 9 +++++---- app/Http/Requests/ConfigurationRequest.php | 12 ++++++------ app/Notifications/Notifiables/OwnerNotifiable.php | 7 ++++--- app/Notifications/ReturnsAvailableChannels.php | 7 ++++--- app/Providers/SearchServiceProvider.php | 12 ++++++------ app/Support/Amount.php | 5 +++-- app/Support/Http/Api/ExchangeRateConverter.php | 3 ++- app/Support/System/GeneratesInstallationId.php | 5 +++-- app/User.php | 2 +- config/firefly.php | 4 ++-- package-lock.json | 6 +++--- 74 files changed, 214 insertions(+), 147 deletions(-) diff --git a/app/Api/V1/Controllers/System/CronController.php b/app/Api/V1/Controllers/System/CronController.php index 7fa41e4c7a..5f520fad85 100644 --- a/app/Api/V1/Controllers/System/CronController.php +++ b/app/Api/V1/Controllers/System/CronController.php @@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\System\CronRequest; use FireflyIII\Support\Http\Controllers\CronRunner; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class CronController @@ -50,7 +51,7 @@ class CronController extends Controller $return = []; $return['recurring_transactions'] = $this->runRecurring($config['force'], $config['date']); $return['auto_budgets'] = $this->runAutoBudget($config['force'], $config['date']); - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data) { + if (true === FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data) { $return['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']); } $return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']); diff --git a/app/Api/V1/Controllers/Webhook/AttemptController.php b/app/Api/V1/Controllers/Webhook/AttemptController.php index 123f570a98..5f0c376d2b 100644 --- a/app/Api/V1/Controllers/Webhook/AttemptController.php +++ b/app/Api/V1/Controllers/Webhook/AttemptController.php @@ -38,6 +38,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Resource\Collection as FractalCollection; use League\Fractal\Resource\Item; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class AttemptController @@ -71,7 +72,7 @@ class AttemptController extends Controller if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User lists webhook attempts of webhook #%d and message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -115,7 +116,7 @@ class AttemptController extends Controller throw new FireflyException('200041: Webhook message and webhook attempt are no match'); } - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User views single webhook attempt #%d of webhook #%d and message #%d, but webhooks are DISABLED', $attempt->id, $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/DestroyController.php b/app/Api/V1/Controllers/Webhook/DestroyController.php index 1154ae2caa..002458fa86 100644 --- a/app/Api/V1/Controllers/Webhook/DestroyController.php +++ b/app/Api/V1/Controllers/Webhook/DestroyController.php @@ -34,6 +34,7 @@ use FireflyIII\Support\Facades\Preferences; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class DestroyController @@ -63,7 +64,7 @@ class DestroyController extends Controller */ public function destroy(Webhook $webhook): JsonResponse { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d. but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -93,7 +94,7 @@ class DestroyController extends Controller throw new FireflyException('200041: Webhook message and webhook attempt are no match'); } - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, attempt #%d, but webhooks are DISABLED.', $webhook->id, $message->id, $attempt->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -121,7 +122,7 @@ class DestroyController extends Controller throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to destroy webhook #%d, message #%d, but webhooks are DISABLED.', $webhook->id, $message->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/MessageController.php b/app/Api/V1/Controllers/Webhook/MessageController.php index c9c404be5f..48c1dd155e 100644 --- a/app/Api/V1/Controllers/Webhook/MessageController.php +++ b/app/Api/V1/Controllers/Webhook/MessageController.php @@ -37,6 +37,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Resource\Collection as FractalCollection; use League\Fractal\Resource\Item; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class MessageController @@ -65,7 +66,7 @@ class MessageController extends Controller */ public function index(Webhook $webhook): JsonResponse { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to view messages of webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -105,7 +106,7 @@ class MessageController extends Controller if ($message->webhook_id !== $webhook->id) { throw new FireflyException('200040: Webhook and webhook message are no match'); } - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User tries to view message #%d of webhook #%d, but webhooks are DISABLED.', $message->id, $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/ShowController.php b/app/Api/V1/Controllers/Webhook/ShowController.php index d33bbdbd84..260d26e413 100644 --- a/app/Api/V1/Controllers/Webhook/ShowController.php +++ b/app/Api/V1/Controllers/Webhook/ShowController.php @@ -42,6 +42,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Resource\Collection as FractalCollection; use League\Fractal\Resource\Item; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class ShowController @@ -72,7 +73,7 @@ class ShowController extends Controller */ public function index(): JsonResponse { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info('User tries to view all webhooks, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -114,7 +115,7 @@ class ShowController extends Controller */ public function show(Webhook $webhook): JsonResponse { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to view webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); @@ -146,7 +147,7 @@ class ShowController extends Controller */ public function triggerTransaction(Webhook $webhook, TransactionGroup $group): JsonResponse { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to trigger webhook #%d on transaction group #%d, but webhooks are DISABLED.', $webhook->id, $group->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/StoreController.php b/app/Api/V1/Controllers/Webhook/StoreController.php index 25692f748c..4f46d23ebc 100644 --- a/app/Api/V1/Controllers/Webhook/StoreController.php +++ b/app/Api/V1/Controllers/Webhook/StoreController.php @@ -34,6 +34,7 @@ use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; use League\Fractal\Resource\Item; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class StoreController @@ -63,7 +64,7 @@ class StoreController extends Controller public function store(CreateRequest $request): JsonResponse { $data = $request->getData(); - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info('User tries to store new webhook, but webhooks are DISABLED.', $data); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/SubmitController.php b/app/Api/V1/Controllers/Webhook/SubmitController.php index 51cdb6c70e..472af55dca 100644 --- a/app/Api/V1/Controllers/Webhook/SubmitController.php +++ b/app/Api/V1/Controllers/Webhook/SubmitController.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class SubmitController @@ -58,7 +59,7 @@ class SubmitController extends Controller */ public function submit(Webhook $webhook): JsonResponse { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to submit webhook #%d, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Controllers/Webhook/UpdateController.php b/app/Api/V1/Controllers/Webhook/UpdateController.php index 5b6c7067b7..15e39c02f0 100644 --- a/app/Api/V1/Controllers/Webhook/UpdateController.php +++ b/app/Api/V1/Controllers/Webhook/UpdateController.php @@ -35,6 +35,7 @@ use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; use League\Fractal\Resource\Item; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class UpdateController @@ -63,7 +64,7 @@ class UpdateController extends Controller public function update(Webhook $webhook, UpdateRequest $request): JsonResponse { $data = $request->getData(); - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->info(sprintf('User tries to update webhook #%d, but webhooks are DISABLED.', $webhook->id), $data); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php index 223e8ab7bb..cf341ed7ac 100644 --- a/app/Api/V1/Requests/Models/Transaction/StoreRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/StoreRequest.php @@ -40,6 +40,7 @@ use FireflyIII\Validation\GroupValidation; use FireflyIII\Validation\TransactionValidation; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class StoreRequest @@ -176,7 +177,7 @@ class StoreRequest extends FormRequest public function rules(): array { Log::debug('Collect rules of TransactionStoreRequest'); - $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; + $validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; $locationRules = Location::requestRules([]); return [ diff --git a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php index 1f674da33f..7ea7b26988 100644 --- a/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Transaction/UpdateRequest.php @@ -38,6 +38,7 @@ use FireflyIII\Validation\GroupValidation; use FireflyIII\Validation\TransactionValidation; use Illuminate\Foundation\Http\FormRequest; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class UpdateRequest @@ -248,7 +249,7 @@ class UpdateRequest extends FormRequest public function rules(): array { Log::debug(sprintf('Now in %s', __METHOD__)); - $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; + $validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return [ // basic fields for group: diff --git a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php index 5b059648c5..586de7e348 100644 --- a/app/Api/V1/Requests/Models/Webhook/CreateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/CreateRequest.php @@ -31,6 +31,7 @@ use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ValidatesWebhooks; use Illuminate\Foundation\Http\FormRequest; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class CreateRequest @@ -73,7 +74,7 @@ class CreateRequest extends FormRequest $triggers = implode(',', array_values(Webhook::getTriggers())); $responses = implode(',', array_values(Webhook::getResponses())); $deliveries = implode(',', array_values(Webhook::getDeliveries())); - $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; + $validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return [ 'title' => 'required|min:1|max:255|uniqueObjectForUser:webhooks,title', diff --git a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php index e7b5a3d661..f5e6d21666 100644 --- a/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/Webhook/UpdateRequest.php @@ -31,6 +31,7 @@ use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ValidatesWebhooks; use Illuminate\Foundation\Http\FormRequest; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class UpdateRequest @@ -73,7 +74,7 @@ class UpdateRequest extends FormRequest $triggers = implode(',', array_values(Webhook::getTriggers())); $responses = implode(',', array_values(Webhook::getResponses())); $deliveries = implode(',', array_values(Webhook::getDeliveries())); - $validProtocols = \FireflyIII\Support\Facades\FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; + $validProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; /** @var Webhook $webhook */ $webhook = $this->route()->parameter('webhook'); diff --git a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php index f9150c55bc..ab19957bd2 100644 --- a/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php +++ b/app/Console/Commands/Correction/CorrectsPrimaryCurrencyAmounts.php @@ -48,6 +48,7 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Query\Builder as DatabaseBuilder; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class CorrectsPrimaryCurrencyAmounts extends Command { @@ -62,7 +63,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command */ public function handle(): int { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { + if (false === FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { $this->friendlyInfo('This command will not run because currency exchange rates are disabled.'); return 0; diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index d5fef32fe2..1bc8505f6b 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -61,7 +61,7 @@ class CorrectsUnevenAmount extends Command $this->fixUnevenAmounts(); $this->matchCurrencies(); - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { + if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate transaction running balance columns. This may take a LONG time. Please be patient.'); AccountBalanceCalculator::recalculateAll(false); $this->friendlyInfo('Done recalculating transaction running balance columns.'); diff --git a/app/Console/Commands/System/RecalculatesRunningBalance.php b/app/Console/Commands/System/RecalculatesRunningBalance.php index 4453e1e50d..2f60436f0d 100644 --- a/app/Console/Commands/System/RecalculatesRunningBalance.php +++ b/app/Console/Commands/System/RecalculatesRunningBalance.php @@ -28,6 +28,7 @@ namespace FireflyIII\Console\Commands\System; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class RecalculatesRunningBalance extends Command { @@ -52,7 +53,7 @@ class RecalculatesRunningBalance extends Command */ public function handle(): int { - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { + if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->correctBalanceAmounts($this->option('force')); $this->friendlyInfo('Done recalculating account balances.'); diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index 53c09d7da0..b7de7849c0 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use League\Flysystem\FilesystemException; use Safe\Exceptions\JsonException; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\json_decode; @@ -107,8 +108,8 @@ class VerifySecurityAlerts extends Command private function removeOldAdvisory(): void { try { - \FireflyIII\Support\Facades\FireflyConfig::delete('upgrade_security_message'); - \FireflyIII\Support\Facades\FireflyConfig::delete('upgrade_security_level'); + FireflyConfig::delete('upgrade_security_message'); + FireflyConfig::delete('upgrade_security_level'); } catch (QueryException $e) { Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage())); } @@ -117,8 +118,8 @@ class VerifySecurityAlerts extends Command private function saveSecurityAdvisory(array $array): void { try { - \FireflyIII\Support\Facades\FireflyConfig::set('upgrade_security_message', $array['message']); - \FireflyIII\Support\Facades\FireflyConfig::set('upgrade_security_level', $array['level']); + FireflyConfig::set('upgrade_security_message', $array['message']); + FireflyConfig::set('upgrade_security_level', $array['level']); } catch (QueryException $e) { Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage())); } diff --git a/app/Console/Commands/Tools/Cron.php b/app/Console/Commands/Tools/Cron.php index 9348ac95b5..f889e00e88 100644 --- a/app/Console/Commands/Tools/Cron.php +++ b/app/Console/Commands/Tools/Cron.php @@ -36,6 +36,7 @@ use FireflyIII\Support\Cronjobs\WebhookCronjob; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; use InvalidArgumentException; +use FireflyIII\Support\Facades\FireflyConfig; class Cron extends Command { @@ -72,7 +73,7 @@ class Cron extends Command $force = (bool) $this->option('force'); // @phpstan-ignore-line // Fire exchange rates cron job. - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) { + if (true === FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) { try { $this->exchangeRatesCronJob($force, $date); } catch (FireflyException $e) { diff --git a/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php b/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php index c07952b28b..bb48c3d529 100644 --- a/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php +++ b/app/Console/Commands/Upgrade/AddsTransactionIdentifiers.php @@ -32,6 +32,7 @@ use Illuminate\Console\Command; use Illuminate\Database\QueryException; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Schema; +use FireflyIII\Support\Facades\FireflyConfig; class AddsTransactionIdentifiers extends Command { @@ -97,7 +98,7 @@ class AddsTransactionIdentifiers extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -157,6 +158,6 @@ class AddsTransactionIdentifiers extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index ff051b324e..477ae31893 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -34,6 +34,7 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use JsonException; use stdClass; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\json_decode; @@ -86,7 +87,7 @@ class RemovesDatabaseDecryption extends Command $this->friendlyPositive(sprintf('Decrypted the data in table "%s".', $table)); // mark as decrypted: $configName = sprintf('is_decrypted_%s', $table); - \FireflyIII\Support\Facades\FireflyConfig::set($configName, true); + FireflyConfig::set($configName, true); } private function isDecrypted(string $table): bool @@ -95,7 +96,7 @@ class RemovesDatabaseDecryption extends Command $configVar = null; try { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get($configName, false); + $configVar = FireflyConfig::get($configName, false); } catch (FireflyException $e) { Log::error($e->getMessage()); } diff --git a/app/Console/Commands/Upgrade/RepairsAccountBalances.php b/app/Console/Commands/Upgrade/RepairsAccountBalances.php index 28a0354559..89a3e57951 100644 --- a/app/Console/Commands/Upgrade/RepairsAccountBalances.php +++ b/app/Console/Commands/Upgrade/RepairsAccountBalances.php @@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\Upgrade; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class RepairsAccountBalances extends Command { @@ -43,7 +44,7 @@ class RepairsAccountBalances extends Command return 0; } - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { + if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data) { $this->friendlyInfo('Will recalculate account balances. This may take a LONG time. Please be patient.'); $this->markAsExecuted(); $this->correctBalanceAmounts(); @@ -58,14 +59,14 @@ class RepairsAccountBalances extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar?->data; } private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } private function correctBalanceAmounts(): void diff --git a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php index 7ab7392f4d..833f87ab4a 100644 --- a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php +++ b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\User; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesAccountCurrencies extends Command { @@ -85,7 +86,7 @@ class UpgradesAccountCurrencies extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar?->data; } @@ -155,6 +156,6 @@ class UpgradesAccountCurrencies extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php b/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php index d62504694d..0317392225 100644 --- a/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesAccountMetaData.php @@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\AccountMeta; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesAccountMetaData extends Command { @@ -82,7 +83,7 @@ class UpgradesAccountMetaData extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -90,6 +91,6 @@ class UpgradesAccountMetaData extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAttachments.php b/app/Console/Commands/Upgrade/UpgradesAttachments.php index 13856443e0..4a8b19eb04 100644 --- a/app/Console/Commands/Upgrade/UpgradesAttachments.php +++ b/app/Console/Commands/Upgrade/UpgradesAttachments.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Attachment; use FireflyIII\Models\Note; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesAttachments extends Command { @@ -92,7 +93,7 @@ class UpgradesAttachments extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -100,6 +101,6 @@ class UpgradesAttachments extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesBillsToRules.php b/app/Console/Commands/Upgrade/UpgradesBillsToRules.php index b73b56f221..eba532e037 100644 --- a/app/Console/Commands/Upgrade/UpgradesBillsToRules.php +++ b/app/Console/Commands/Upgrade/UpgradesBillsToRules.php @@ -36,6 +36,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Facades\Preferences; use FireflyIII\User; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesBillsToRules extends Command { @@ -99,7 +100,7 @@ class UpgradesBillsToRules extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -206,6 +207,6 @@ class UpgradesBillsToRules extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php index 2578ab0b25..982ad58f46 100644 --- a/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php +++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimitPeriods.php @@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\BudgetLimit; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesBudgetLimitPeriods extends Command { @@ -58,7 +59,7 @@ class UpgradesBudgetLimitPeriods extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar->data; } @@ -152,6 +153,6 @@ class UpgradesBudgetLimitPeriods extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php index c9756098c7..1f0d670b42 100644 --- a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php +++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\User; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesBudgetLimits extends Command { @@ -84,7 +85,7 @@ class UpgradesBudgetLimits extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -92,6 +93,6 @@ class UpgradesBudgetLimits extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php b/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php index 9b60caf1bd..c7cf0a89e4 100644 --- a/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradesCreditCardLiabilities.php @@ -31,6 +31,7 @@ use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use Illuminate\Console\Command; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesCreditCardLiabilities extends Command { @@ -80,13 +81,13 @@ class UpgradesCreditCardLiabilities extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar?->data; } private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php index f6fc42a7d1..465a18e7c7 100644 --- a/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php +++ b/app/Console/Commands/Upgrade/UpgradesCurrencyPreferences.php @@ -33,6 +33,7 @@ use FireflyIII\Support\Facades\Amount; use FireflyIII\User; use Illuminate\Console\Command; use Illuminate\Support\Collection; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesCurrencyPreferences extends Command { @@ -65,7 +66,7 @@ class UpgradesCurrencyPreferences extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -144,6 +145,6 @@ class UpgradesCurrencyPreferences extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php b/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php index 8c02368773..4ee5d9f50b 100644 --- a/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesJournalMetaData.php @@ -32,6 +32,7 @@ use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesJournalMetaData extends Command { @@ -69,14 +70,14 @@ class UpgradesJournalMetaData extends Command private function isMigrated(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(UpgradesToGroups::CONFIG_NAME, false); + $configVar = FireflyConfig::get(UpgradesToGroups::CONFIG_NAME, false); return (bool) $configVar->data; } private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool) $configVar->data; } @@ -218,6 +219,6 @@ class UpgradesJournalMetaData extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesJournalNotes.php b/app/Console/Commands/Upgrade/UpgradesJournalNotes.php index 6cd7dfcbea..8302818752 100644 --- a/app/Console/Commands/Upgrade/UpgradesJournalNotes.php +++ b/app/Console/Commands/Upgrade/UpgradesJournalNotes.php @@ -29,6 +29,7 @@ use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournalMeta; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesJournalNotes extends Command { @@ -86,7 +87,7 @@ class UpgradesJournalNotes extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -94,6 +95,6 @@ class UpgradesJournalNotes extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilities.php b/app/Console/Commands/Upgrade/UpgradesLiabilities.php index 89a10e9359..c5e811ea82 100644 --- a/app/Console/Commands/Upgrade/UpgradesLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradesLiabilities.php @@ -33,6 +33,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Services\Internal\Support\CreditRecalculateService; use FireflyIII\User; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesLiabilities extends Command { @@ -61,7 +62,7 @@ class UpgradesLiabilities extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -148,6 +149,6 @@ class UpgradesLiabilities extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php index 3a24482b7b..65dc51b655 100644 --- a/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradesLiabilitiesEight.php @@ -36,6 +36,7 @@ use FireflyIII\Services\Internal\Support\CreditRecalculateService; use FireflyIII\User; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesLiabilitiesEight extends Command { @@ -63,7 +64,7 @@ class UpgradesLiabilitiesEight extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -207,6 +208,6 @@ class UpgradesLiabilitiesEight extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php index 26a1fa929f..1207bc9c76 100644 --- a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php +++ b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php @@ -31,6 +31,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesMultiPiggyBanks extends Command { @@ -64,7 +65,7 @@ class UpgradesMultiPiggyBanks extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -112,6 +113,6 @@ class UpgradesMultiPiggyBanks extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php b/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php index 55647c6b99..6243e5f499 100644 --- a/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php +++ b/app/Console/Commands/Upgrade/UpgradesPrimaryCurrencyAmounts.php @@ -28,6 +28,7 @@ namespace FireflyIII\Console\Commands\Upgrade; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use Illuminate\Console\Command; use Illuminate\Support\Facades\Artisan; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesPrimaryCurrencyAmounts extends Command { @@ -60,7 +61,7 @@ class UpgradesPrimaryCurrencyAmounts extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -68,6 +69,6 @@ class UpgradesPrimaryCurrencyAmounts extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php index c3f6419f63..b063fd4ded 100644 --- a/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php +++ b/app/Console/Commands/Upgrade/UpgradesRecurrenceMetaData.php @@ -29,6 +29,7 @@ use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceMeta; use FireflyIII\Models\RecurrenceTransactionMeta; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\json_encode; @@ -65,7 +66,7 @@ class UpgradesRecurrenceMetaData extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -117,6 +118,6 @@ class UpgradesRecurrenceMetaData extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesRuleActions.php b/app/Console/Commands/Upgrade/UpgradesRuleActions.php index 70e1b7c52f..54d6135a08 100644 --- a/app/Console/Commands/Upgrade/UpgradesRuleActions.php +++ b/app/Console/Commands/Upgrade/UpgradesRuleActions.php @@ -28,6 +28,7 @@ namespace FireflyIII\Console\Commands\Upgrade; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\RuleAction; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesRuleActions extends Command { @@ -63,7 +64,7 @@ class UpgradesRuleActions extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -183,6 +184,6 @@ class UpgradesRuleActions extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesTagLocations.php b/app/Console/Commands/Upgrade/UpgradesTagLocations.php index ef2fbd28de..3756ec092f 100644 --- a/app/Console/Commands/Upgrade/UpgradesTagLocations.php +++ b/app/Console/Commands/Upgrade/UpgradesTagLocations.php @@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\Location; use FireflyIII\Models\Tag; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesTagLocations extends Command { @@ -57,7 +58,7 @@ class UpgradesTagLocations extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -97,6 +98,6 @@ class UpgradesTagLocations extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesToGroups.php b/app/Console/Commands/Upgrade/UpgradesToGroups.php index accae5e614..a3fd772afb 100644 --- a/app/Console/Commands/Upgrade/UpgradesToGroups.php +++ b/app/Console/Commands/Upgrade/UpgradesToGroups.php @@ -39,6 +39,7 @@ use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesToGroups extends Command { @@ -97,7 +98,7 @@ class UpgradesToGroups extends Command private function isMigrated(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -379,6 +380,6 @@ class UpgradesToGroups extends Command private function markAsMigrated(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php b/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php index 9e796b82c7..1fbd7dbafb 100644 --- a/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php +++ b/app/Console/Commands/Upgrade/UpgradesTransferCurrencies.php @@ -34,6 +34,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesTransferCurrencies extends Command { @@ -105,7 +106,7 @@ class UpgradesTransferCurrencies extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -480,6 +481,6 @@ class UpgradesTransferCurrencies extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php b/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php index 5a157029d1..6b72e47e6b 100644 --- a/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php +++ b/app/Console/Commands/Upgrade/UpgradesVariousCurrencyInformation.php @@ -35,6 +35,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesVariousCurrencyInformation extends Command { @@ -86,7 +87,7 @@ class UpgradesVariousCurrencyInformation extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -246,6 +247,6 @@ class UpgradesVariousCurrencyInformation extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/UpgradesWebhooks.php b/app/Console/Commands/Upgrade/UpgradesWebhooks.php index abbcc8cd34..826aaa9be9 100644 --- a/app/Console/Commands/Upgrade/UpgradesWebhooks.php +++ b/app/Console/Commands/Upgrade/UpgradesWebhooks.php @@ -34,6 +34,7 @@ use FireflyIII\Models\WebhookDelivery as WebhookDeliveryModel; use FireflyIII\Models\WebhookResponse as WebhookResponseModel; use FireflyIII\Models\WebhookTrigger as WebhookTriggerModel; use Illuminate\Console\Command; +use FireflyIII\Support\Facades\FireflyConfig; class UpgradesWebhooks extends Command { @@ -63,7 +64,7 @@ class UpgradesWebhooks extends Command private function isExecuted(): bool { - $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false); + $configVar = FireflyConfig::get(self::CONFIG_NAME, false); return (bool)$configVar?->data; @@ -109,6 +110,6 @@ class UpgradesWebhooks extends Command private function markAsExecuted(): void { - \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true); + FireflyConfig::set(self::CONFIG_NAME, true); } } diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.php index 807019e794..eb713c7524 100644 --- a/app/Handlers/Events/AdminEventHandler.php +++ b/app/Handlers/Events/AdminEventHandler.php @@ -37,6 +37,7 @@ use FireflyIII\Notifications\Test\OwnerTestNotificationPushover; use FireflyIII\Notifications\Test\OwnerTestNotificationSlack; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Notification; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class AdminEventHandler. @@ -45,7 +46,7 @@ class AdminEventHandler { public function sendInvitationNotification(InvitationCreated $event): void { - $sendMail = \FireflyIII\Support\Facades\FireflyConfig::get('notification_invite_created', true)->data; + $sendMail = FireflyConfig::get('notification_invite_created', true)->data; if (false === $sendMail) { return; } @@ -96,7 +97,7 @@ class AdminEventHandler */ public function sendNewVersion(NewVersionAvailable $event): void { - $sendMail = \FireflyIII\Support\Facades\FireflyConfig::get('notification_new_version', true)->data; + $sendMail = FireflyConfig::get('notification_new_version', true)->data; if (false === $sendMail) { return; } diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.php index b1833b65e2..d72de4e307 100644 --- a/app/Handlers/Events/UserEventHandler.php +++ b/app/Handlers/Events/UserEventHandler.php @@ -57,6 +57,7 @@ use Illuminate\Auth\Events\Login; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Notification; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class UserEventHandler. @@ -224,7 +225,7 @@ class UserEventHandler public function sendAdminRegistrationNotification(RegisteredUser $event): void { - $sendMail = (bool)\FireflyIII\Support\Facades\FireflyConfig::get('notification_admin_new_reg', true)->data; + $sendMail = (bool)FireflyConfig::get('notification_admin_new_reg', true)->data; if ($sendMail) { $owner = $event->owner; @@ -367,7 +368,7 @@ class UserEventHandler */ public function sendRegistrationMail(RegisteredUser $event): void { - $sendMail = (bool)\FireflyIII\Support\Facades\FireflyConfig::get('notification_user_new_reg', true)->data; + $sendMail = (bool)FireflyConfig::get('notification_user_new_reg', true)->data; if ($sendMail) { try { Notification::send($event->user, new UserRegistrationNotification()); diff --git a/app/Handlers/Events/VersionCheckEventHandler.php b/app/Handlers/Events/VersionCheckEventHandler.php index d15fca083b..e5a681aefc 100644 --- a/app/Handlers/Events/VersionCheckEventHandler.php +++ b/app/Handlers/Events/VersionCheckEventHandler.php @@ -33,6 +33,7 @@ use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Support\Facades\Log; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class VersionCheckEventHandler @@ -54,7 +55,7 @@ class VersionCheckEventHandler Log::debug('Now in checkForUpdates()'); // should not check for updates: - $permission = \FireflyIII\Support\Facades\FireflyConfig::get('permission_update_check', -1); + $permission = FireflyConfig::get('permission_update_check', -1); $value = (int) $permission->data; if (1 !== $value) { Log::debug('Update check is not enabled.'); @@ -73,7 +74,7 @@ class VersionCheckEventHandler } /** @var Configuration $lastCheckTime */ - $lastCheckTime = \FireflyIII\Support\Facades\FireflyConfig::get('last_update_check', Carbon::now()->getTimestamp()); + $lastCheckTime = FireflyConfig::get('last_update_check', Carbon::now()->getTimestamp()); $now = Carbon::now()->getTimestamp(); $diff = $now - $lastCheckTime->data; Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); @@ -87,7 +88,7 @@ class VersionCheckEventHandler $release = $this->getLatestRelease(); session()->flash($release['level'], $release['message']); - \FireflyIII\Support\Facades\FireflyConfig::set('last_update_check', Carbon::now()->getTimestamp()); + FireflyConfig::set('last_update_check', Carbon::now()->getTimestamp()); } /** @@ -107,7 +108,7 @@ class VersionCheckEventHandler } /** @var Configuration $lastCheckTime */ - $lastCheckTime = \FireflyIII\Support\Facades\FireflyConfig::get('last_update_warning', Carbon::now()->getTimestamp()); + $lastCheckTime = FireflyConfig::get('last_update_warning', Carbon::now()->getTimestamp()); $now = Carbon::now()->getTimestamp(); $diff = $now - $lastCheckTime->data; Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); @@ -120,6 +121,6 @@ class VersionCheckEventHandler Log::debug('Have warned about a new version in four weeks!'); session()->flash('info', (string) trans('firefly.disabled_but_check')); - \FireflyIII\Support\Facades\FireflyConfig::set('last_update_warning', Carbon::now()->getTimestamp()); + FireflyConfig::set('last_update_warning', Carbon::now()->getTimestamp()); } } diff --git a/app/Handlers/Events/WebhookEventHandler.php b/app/Handlers/Events/WebhookEventHandler.php index db1a25fd44..341258bfb7 100644 --- a/app/Handlers/Events/WebhookEventHandler.php +++ b/app/Handlers/Events/WebhookEventHandler.php @@ -27,6 +27,7 @@ namespace FireflyIII\Handlers\Events; use FireflyIII\Jobs\SendWebhookMessage; use FireflyIII\Models\WebhookMessage; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class WebhookEventHandler @@ -39,7 +40,7 @@ class WebhookEventHandler public function sendWebhookMessages(): void { Log::debug(sprintf('Now in %s', __METHOD__)); - if (false === config('firefly.feature_flags.webhooks') || false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === config('firefly.feature_flags.webhooks') || false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::debug('Webhook event handler is disabled, do not run sendWebhookMessages().'); return; diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index bca1eb866f..63ffebfd1a 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -28,6 +28,7 @@ use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class TransactionObserver @@ -39,7 +40,7 @@ class TransactionObserver public function created(Transaction $transaction): void { Log::debug('Observe "created" of a transaction.'); - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { + if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } @@ -82,7 +83,7 @@ class TransactionObserver public function updated(Transaction $transaction): void { // Log::debug('Observe "updated" of a transaction.'); - if (true === \FireflyIII\Support\Facades\FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && self::$recalculate && 1 === bccomp($transaction->amount, '0')) { + if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && self::$recalculate && 1 === bccomp($transaction->amount, '0')) { Log::debug('Trigger recalculateForJournal'); AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); } diff --git a/app/Helpers/Update/UpdateTrait.php b/app/Helpers/Update/UpdateTrait.php index f94ce56e80..e21de39b55 100644 --- a/app/Helpers/Update/UpdateTrait.php +++ b/app/Helpers/Update/UpdateTrait.php @@ -26,6 +26,7 @@ namespace FireflyIII\Helpers\Update; use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Trait UpdateTrait @@ -43,7 +44,7 @@ trait UpdateTrait /** @var UpdateRequestInterface $checker */ $checker = app(UpdateRequestInterface::class); - $channelConfig = \FireflyIII\Support\Facades\FireflyConfig::get('update_channel', 'stable'); + $channelConfig = FireflyConfig::get('update_channel', 'stable'); $channel = (string) $channelConfig->data; return $checker->getUpdateInformation($channel); diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index fd9ba3063d..7adb10426b 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -61,25 +61,25 @@ class ConfigurationController extends Controller * * @return Factory|View */ - public function index(): Factory | \Illuminate\Contracts\View\View + public function index(): Factory|\Illuminate\Contracts\View\View { - $subTitle = (string)trans('firefly.instance_configuration'); - $subTitleIcon = 'fa-wrench'; + $subTitle = (string)trans('firefly.instance_configuration'); + $subTitleIcon = 'fa-wrench'; Log::channel('audit')->info('User visits admin config index.'); // all available configuration and their default value in case // they don't exist yet. - $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; - $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; - $siteOwner = config('firefly.site_owner'); + $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; + $siteOwner = config('firefly.site_owner'); $enableExchangeRates = FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $useRunningBalance = FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data; $enableExternalMap = FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; $enableExternalRates = FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data; $allowWebhooks = FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data; - $validUrlProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data;; + $validUrlProtocols = FireflyConfig::get('valid_url_protocols', config('firefly.valid_url_protocols'))->data; return view( 'settings.configuration.index', diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index eee9c0f498..1a1e96f2f9 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -42,6 +42,7 @@ use Illuminate\Routing\Redirector; use Illuminate\View\View; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class UserController. @@ -164,7 +165,7 @@ class UserController extends Controller $subTitle = (string) trans('firefly.user_administration'); $subTitleIcon = 'fa-users'; $users = $this->repository->all(); - $singleUserMode = (bool) \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = (bool) FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $allowInvites = false; if (!$this->externalIdentity && $singleUserMode) { // also registration enabled. diff --git a/app/Http/Controllers/Auth/ForgotPasswordController.php b/app/Http/Controllers/Auth/ForgotPasswordController.php index c55665f712..14810e8e35 100644 --- a/app/Http/Controllers/Auth/ForgotPasswordController.php +++ b/app/Http/Controllers/Auth/ForgotPasswordController.php @@ -36,6 +36,7 @@ use Illuminate\View\View; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Safe\Exceptions\UrlException; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\parse_url; @@ -142,7 +143,7 @@ class ForgotPasswordController extends Controller } // is allowed to? - $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); $allowRegistration = true; $pageTitle = (string) trans('firefly.forgot_pw_page_title'); diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 94c034b108..44d67f9a26 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -50,6 +50,7 @@ use Illuminate\Validation\ValidationException; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Symfony\Component\HttpFoundation\Response as ResponseAlias; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class LoginController @@ -236,7 +237,7 @@ class LoginController extends Controller } // is allowed to register, etc. - $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $allowRegistration = true; $allowReset = true; if (true === $singleUserMode && $count > 0) { diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php index fe431c500a..69c0258d2d 100644 --- a/app/Http/Controllers/Auth/RegisterController.php +++ b/app/Http/Controllers/Auth/RegisterController.php @@ -41,6 +41,7 @@ use Illuminate\Validation\ValidationException; use Illuminate\View\View; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class RegisterController @@ -121,7 +122,7 @@ class RegisterController extends Controller $allowRegistration = true; try { - $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; } catch (ContainerExceptionInterface|NotFoundExceptionInterface) { $singleUserMode = true; } @@ -148,7 +149,7 @@ class RegisterController extends Controller */ public function showInviteForm(Request $request, string $code): Factory|\Illuminate\Contracts\View\View { - $isDemoSite = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; + $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $pageTitle = (string) trans('firefly.register_page_title'); $repository = app(UserRepositoryInterface::class); $allowRegistration = $this->allowedToRegister(); @@ -182,7 +183,7 @@ class RegisterController extends Controller */ public function showRegistrationForm(?Request $request = null): Factory|\Illuminate\Contracts\View\View { - $isDemoSite = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; + $isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $pageTitle = (string) trans('firefly.register_page_title'); $allowRegistration = $this->allowedToRegister(); diff --git a/app/Http/Controllers/Auth/ResetPasswordController.php b/app/Http/Controllers/Auth/ResetPasswordController.php index f9204c9d99..8e4d7eb7f7 100644 --- a/app/Http/Controllers/Auth/ResetPasswordController.php +++ b/app/Http/Controllers/Auth/ResetPasswordController.php @@ -36,6 +36,7 @@ use Illuminate\Validation\ValidationException; use Illuminate\View\View; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class ResetPasswordController @@ -131,7 +132,7 @@ class ResetPasswordController extends Controller } // is allowed to register? - $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; + $singleUserMode = FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $userCount = User::count(); $allowRegistration = true; $pageTitle = (string) trans('firefly.reset_pw_page_title'); diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 2fd0076d0e..5da60a33ab 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -38,6 +38,7 @@ use Illuminate\Support\Facades\Config; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\View; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\ini_get; use function Safe\realpath; @@ -71,7 +72,7 @@ abstract class Controller extends BaseController public function __construct() { // is site a demo site? - $isDemoSiteConfig = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site', false)); + $isDemoSiteConfig = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site', false)); $isDemoSite = (bool) $isDemoSiteConfig->data; View::share('IS_DEMO_SITE', $isDemoSite); View::share('DEMO_USERNAME', config('firefly.demo_username')); @@ -80,7 +81,7 @@ abstract class Controller extends BaseController View::share('FF_BUILD_TIME', config('firefly.build_time')); // is webhooks enabled? - View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data); + View::share('featuringWebhooks', true === config('firefly.feature_flags.webhooks') && true === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data); // share custom auth guard info. $authGuard = config('firefly.authentication_guard'); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index c3f96fc3a2..a4da0d865a 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -51,6 +51,7 @@ use Illuminate\View\View; use Monolog\Handler\RotatingFileHandler; use Safe\Exceptions\FilesystemException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\file_get_contents; use function Safe\ini_get; @@ -241,7 +242,7 @@ class DebugController extends Controller { $userGuard = config('auth.defaults.guard'); - $config = \FireflyIII\Support\Facades\FireflyConfig::get('last_rt_job', 0); + $config = FireflyConfig::get('last_rt_job', 0); $lastTime = (int) $config->data; $lastCronjob = 'never'; $lastCronjobAgo = 'never'; diff --git a/app/Http/Controllers/ExchangeRates/IndexController.php b/app/Http/Controllers/ExchangeRates/IndexController.php index a83737a21a..31c763e241 100644 --- a/app/Http/Controllers/ExchangeRates/IndexController.php +++ b/app/Http/Controllers/ExchangeRates/IndexController.php @@ -28,6 +28,7 @@ use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; use Illuminate\View\View; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; class IndexController extends Controller { @@ -47,7 +48,7 @@ class IndexController extends Controller return $next($request); } ); - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { + if (false === FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data) { throw new NotFoundHttpException(); } } diff --git a/app/Http/Controllers/Transaction/CreateController.php b/app/Http/Controllers/Transaction/CreateController.php index 80e26160ab..499c033008 100644 --- a/app/Http/Controllers/Transaction/CreateController.php +++ b/app/Http/Controllers/Transaction/CreateController.php @@ -38,6 +38,7 @@ use Illuminate\Http\Request; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Safe\Exceptions\UrlException; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\parse_url; @@ -140,7 +141,7 @@ class CreateController extends Controller ]; $optionalFields['external_url'] ??= false; $optionalFields['location'] ??= false; - $optionalFields['location'] = $optionalFields['location'] && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; + $optionalFields['location'] = $optionalFields['location'] && true === FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; // map info: $longitude = config('firefly.default_location.longitude'); diff --git a/app/Http/Controllers/Transaction/EditController.php b/app/Http/Controllers/Transaction/EditController.php index e1332c67da..c7064c8459 100644 --- a/app/Http/Controllers/Transaction/EditController.php +++ b/app/Http/Controllers/Transaction/EditController.php @@ -38,6 +38,7 @@ use Illuminate\View\View; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; use Safe\Exceptions\UrlException; +use FireflyIII\Support\Facades\FireflyConfig; use function Safe\parse_url; @@ -114,7 +115,7 @@ class EditController extends Controller ]; $optionalFields['external_url'] ??= false; $optionalFields['location'] ??= false; - $optionalFields['location'] = $optionalFields['location'] && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; + $optionalFields['location'] = $optionalFields['location'] && true === FireflyConfig::get('enable_external_map', config('firefly.enable_external_map'))->data; // map info voor v2: $longitude = config('firefly.default_location.longitude'); diff --git a/app/Http/Controllers/Webhooks/CreateController.php b/app/Http/Controllers/Webhooks/CreateController.php index d25cd8e0fa..bdae300496 100644 --- a/app/Http/Controllers/Webhooks/CreateController.php +++ b/app/Http/Controllers/Webhooks/CreateController.php @@ -29,6 +29,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Support\Facades\Log; use Illuminate\View\View; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class CreateController @@ -59,7 +60,7 @@ class CreateController extends Controller */ public function index(): Factory|\Illuminate\Contracts\View\View { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook create page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/DeleteController.php b/app/Http/Controllers/Webhooks/DeleteController.php index 055d6bc661..c8b399879a 100644 --- a/app/Http/Controllers/Webhooks/DeleteController.php +++ b/app/Http/Controllers/Webhooks/DeleteController.php @@ -31,6 +31,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class DeleteController @@ -64,7 +65,7 @@ class DeleteController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook delete page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/EditController.php b/app/Http/Controllers/Webhooks/EditController.php index b8ad6bf40b..a00497b7de 100644 --- a/app/Http/Controllers/Webhooks/EditController.php +++ b/app/Http/Controllers/Webhooks/EditController.php @@ -31,6 +31,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class EditController @@ -63,7 +64,7 @@ class EditController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook edit page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/IndexController.php b/app/Http/Controllers/Webhooks/IndexController.php index f264c59556..5211a3a89b 100644 --- a/app/Http/Controllers/Webhooks/IndexController.php +++ b/app/Http/Controllers/Webhooks/IndexController.php @@ -29,6 +29,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Support\Facades\Log; use Illuminate\View\View; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class IndexController @@ -55,7 +56,7 @@ class IndexController extends Controller */ public function index(): Factory|\Illuminate\Contracts\View\View { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning('User visits webhook index page, but webhooks are DISABLED.'); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Controllers/Webhooks/ShowController.php b/app/Http/Controllers/Webhooks/ShowController.php index 4de27b139b..f0bc69a4cb 100644 --- a/app/Http/Controllers/Webhooks/ShowController.php +++ b/app/Http/Controllers/Webhooks/ShowController.php @@ -31,6 +31,7 @@ use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class ShowController @@ -63,7 +64,7 @@ class ShowController extends Controller */ public function index(Webhook $webhook): Factory|View { - if (false === \FireflyIII\Support\Facades\FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { + if (false === FireflyConfig::get('allow_webhooks', config('firefly.allow_webhooks'))->data) { Log::channel('audit')->warning(sprintf('User visits webhook #%d page, but webhooks are DISABLED.', $webhook->id)); throw new NotFoundHttpException('Webhooks are not enabled.'); diff --git a/app/Http/Middleware/Range.php b/app/Http/Middleware/Range.php index 9ba6ad25e8..3f8c30d595 100644 --- a/app/Http/Middleware/Range.php +++ b/app/Http/Middleware/Range.php @@ -34,6 +34,7 @@ use FireflyIII\Support\Http\Controllers\RequestInformation; use Illuminate\Http\Request; use Illuminate\Support\Facades\App; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class SessionFilter. @@ -144,11 +145,11 @@ class Range // share security message: if ( - \FireflyIII\Support\Facades\FireflyConfig::has('upgrade_security_message') - && \FireflyIII\Support\Facades\FireflyConfig::has('upgrade_security_level') + FireflyConfig::has('upgrade_security_message') + && FireflyConfig::has('upgrade_security_level') ) { - app('view')->share('upgrade_security_message', \FireflyIII\Support\Facades\FireflyConfig::get('upgrade_security_message')->data); - app('view')->share('upgrade_security_level', \FireflyIII\Support\Facades\FireflyConfig::get('upgrade_security_level')->data); + app('view')->share('upgrade_security_message', FireflyConfig::get('upgrade_security_message')->data); + app('view')->share('upgrade_security_level', FireflyConfig::get('upgrade_security_level')->data); } } } diff --git a/app/Http/Requests/ConfigurationRequest.php b/app/Http/Requests/ConfigurationRequest.php index 346a5ed261..1ac957a441 100644 --- a/app/Http/Requests/ConfigurationRequest.php +++ b/app/Http/Requests/ConfigurationRequest.php @@ -41,7 +41,7 @@ class ConfigurationRequest extends FormRequest public function getConfigurationData(): array { return [ - 'single_user_mode' => $this->boolean('single_user_mode'), + 'single_user_mode' => $this->boolean('single_user_mode'), 'enable_exchange_rates' => $this->boolean('enable_exchange_rates'), 'use_running_balance' => $this->boolean('use_running_balance'), @@ -50,8 +50,8 @@ class ConfigurationRequest extends FormRequest 'enable_external_rates' => $this->boolean('enable_external_rates'), 'allow_webhooks' => $this->boolean('allow_webhooks'), - 'valid_url_protocols' => $this->string('valid_url_protocols'), - 'is_demo_site' => $this->boolean('is_demo_site'), + 'valid_url_protocols' => $this->string('valid_url_protocols'), + 'is_demo_site' => $this->boolean('is_demo_site'), ]; } @@ -62,7 +62,7 @@ class ConfigurationRequest extends FormRequest { // fixed return [ - 'single_user_mode' => 'min:0|max:1|numeric', + 'single_user_mode' => 'min:0|max:1|numeric', 'enable_exchange_rates' => 'min:0|max:1|numeric', 'use_running_balance' => 'min:0|max:1|numeric', @@ -71,8 +71,8 @@ class ConfigurationRequest extends FormRequest 'enable_external_rates' => 'min:0|max:1|numeric', 'allow_webhooks' => 'min:0|max:1|numeric', - 'valid_url_protocols' => 'min:0|max:255', - 'is_demo_site' => 'min:0|max:1|numeric', + 'valid_url_protocols' => 'min:0|max:255', + 'is_demo_site' => 'min:0|max:1|numeric', ]; diff --git a/app/Notifications/Notifiables/OwnerNotifiable.php b/app/Notifications/Notifiables/OwnerNotifiable.php index 5e82e725d3..9216c19015 100644 --- a/app/Notifications/Notifiables/OwnerNotifiable.php +++ b/app/Notifications/Notifiables/OwnerNotifiable.php @@ -28,6 +28,7 @@ use Illuminate\Notifications\Notification; use Illuminate\Support\Facades\Log; use Illuminate\Support\Str; use NotificationChannels\Pushover\PushoverReceiver; +use FireflyIII\Support\Facades\FireflyConfig; class OwnerNotifiable { @@ -58,8 +59,8 @@ class OwnerNotifiable public function routeNotificationForPushover(): PushoverReceiver { Log::debug('Return settings for routeNotificationForPushover'); - $pushoverAppToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_user_token', '')->data; + $pushoverAppToken = (string) FireflyConfig::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = (string) FireflyConfig::getEncrypted('pushover_user_token', '')->data; return PushoverReceiver::withUserKey($pushoverUserToken) ->withApplicationToken($pushoverAppToken) @@ -68,7 +69,7 @@ class OwnerNotifiable public function routeNotificationForSlack(): string { - $res = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data; + $res = FireflyConfig::getEncrypted('slack_webhook_url', '')->data; if (is_array($res)) { $res = ''; } diff --git a/app/Notifications/ReturnsAvailableChannels.php b/app/Notifications/ReturnsAvailableChannels.php index 7341b5b04d..2ca7f0e0b6 100644 --- a/app/Notifications/ReturnsAvailableChannels.php +++ b/app/Notifications/ReturnsAvailableChannels.php @@ -29,6 +29,7 @@ use FireflyIII\Support\Notifications\UrlValidator; use FireflyIII\User; use Illuminate\Support\Facades\Log; use NotificationChannels\Pushover\PushoverChannel; +use FireflyIII\Support\Facades\FireflyConfig; // use Wijourdil\NtfyNotificationChannel\Channels\NtfyChannel; @@ -54,7 +55,7 @@ class ReturnsAvailableChannels $channels = ['mail']; if (true === config('notifications.channels.slack.enabled', false)) { - $slackUrl = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data; + $slackUrl = FireflyConfig::getEncrypted('slack_webhook_url', '')->data; if (UrlValidator::isValidWebhookURL($slackUrl)) { $channels[] = 'slack'; } @@ -73,8 +74,8 @@ class ReturnsAvailableChannels // pushover if (true === config('notifications.channels.pushover.enabled', false)) { - $pushoverAppToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_user_token', '')->data; + $pushoverAppToken = (string) FireflyConfig::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = (string) FireflyConfig::getEncrypted('pushover_user_token', '')->data; if ('' === $pushoverAppToken || '' === $pushoverUserToken) { Log::warning('[b] No Pushover token, channel is disabled.'); } diff --git a/app/Providers/SearchServiceProvider.php b/app/Providers/SearchServiceProvider.php index 295c00c936..32f4850864 100644 --- a/app/Providers/SearchServiceProvider.php +++ b/app/Providers/SearchServiceProvider.php @@ -52,12 +52,12 @@ class SearchServiceProvider extends ServiceProvider static function (): QueryParserInterface { return app(QueryParser::class); // 2025-12-20 ignore this setting. -// $implementation = config('search.query_parser'); -// -// return match ($implementation) { -// 'new' => app(QueryParser::class), -// default => app(GdbotsQueryParser::class), -// }; + // $implementation = config('search.query_parser'); + // + // return match ($implementation) { + // 'new' => app(QueryParser::class), + // default => app(GdbotsQueryParser::class), + // }; } ); diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 5bb7815df0..5858407750 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -35,6 +35,7 @@ use FireflyIII\User; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use NumberFormatter; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class Amount. @@ -117,7 +118,7 @@ class Amount if (!$user instanceof User) { $pref = $instance->getPreference('convert_to_primary_no_user'); if (null === $pref) { - $res = true === Preferences::get('convert_to_primary', false)->data && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; + $res = true === Preferences::get('convert_to_primary', false)->data && true === FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $instance->setPreference('convert_to_primary_no_user', $res); return $res; @@ -128,7 +129,7 @@ class Amount $key = sprintf('convert_to_primary_%d', $user->id); $pref = $instance->getPreference($key); if (null === $pref) { - $res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; + $res = true === Preferences::getForUser($user, 'convert_to_primary', false)->data && true === FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data; $instance->setPreference($key, $res); return $res; diff --git a/app/Support/Http/Api/ExchangeRateConverter.php b/app/Support/Http/Api/ExchangeRateConverter.php index 5fb488d223..752aafd3b0 100644 --- a/app/Support/Http/Api/ExchangeRateConverter.php +++ b/app/Support/Http/Api/ExchangeRateConverter.php @@ -34,6 +34,7 @@ use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Facades\Steam; use Illuminate\Support\Facades\Cache; use Illuminate\Support\Facades\Log; +use FireflyIII\Support\Facades\FireflyConfig; /** * Class ExchangeRateConverter @@ -71,7 +72,7 @@ class ExchangeRateConverter public function enabled(): bool { - return false !== \FireflyIII\Support\Facades\FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data || $this->ignoreSettings; + return false !== FireflyConfig::get('enable_exchange_rates', config('cer.enabled'))->data || $this->ignoreSettings; } /** diff --git a/app/Support/System/GeneratesInstallationId.php b/app/Support/System/GeneratesInstallationId.php index 2a5fc8eedf..93cde62b2e 100644 --- a/app/Support/System/GeneratesInstallationId.php +++ b/app/Support/System/GeneratesInstallationId.php @@ -27,6 +27,7 @@ namespace FireflyIII\Support\System; use Illuminate\Support\Facades\Log; use FireflyIII\Exceptions\FireflyException; use Ramsey\Uuid\Uuid; +use FireflyIII\Support\Facades\FireflyConfig; /** * Trait GeneratesInstallationId @@ -36,7 +37,7 @@ trait GeneratesInstallationId protected function generateInstallationId(): void { try { - $config = \FireflyIII\Support\Facades\FireflyConfig::get('installation_id'); + $config = FireflyConfig::get('installation_id'); } catch (FireflyException) { Log::info('Could not create or generate installation ID. Do not continue.'); @@ -52,7 +53,7 @@ trait GeneratesInstallationId $uuid4 = Uuid::uuid4(); $uniqueId = (string)$uuid4; Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId)); - \FireflyIII\Support\Facades\FireflyConfig::set('installation_id', $uniqueId); + FireflyConfig::set('installation_id', $uniqueId); } } } diff --git a/app/User.php b/app/User.php index 12a3ed2ee1..4d1a0c55bd 100644 --- a/app/User.php +++ b/app/User.php @@ -404,7 +404,7 @@ class User extends Authenticatable public function routeNotificationForSlack(Notification $notification): ?string { // this check does not validate if the user is owner, Should be done by notification itself. - $res = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data; + $res = FireflyConfig::getEncrypted('slack_webhook_url', '')->data; if (is_array($res)) { $res = ''; } diff --git a/config/firefly.php b/config/firefly.php index 9cde0fef73..088fbbfa1a 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-19', - 'build_time' => 1766164572, + 'version' => 'develop/2025-12-20', + 'build_time' => 1766210708, '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 78072dae5f..79cf4ad7e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10129,9 +10129,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.97.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.97.0.tgz", - "integrity": "sha512-KR0igP1z4avUJetEuIeOdDlwaUDvkH8wSx7FdSjyYBS3dpyX3TzHfAMO0G1Q4/3cdjcmi3r7idh+KCmKqS+KeQ==", + "version": "1.97.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.97.1.tgz", + "integrity": "sha512-uf6HoO8fy6ClsrShvMgaKUn14f2EHQLQRtpsZZLeU/Mv0Q1K5P0+x2uvH6Cub39TVVbWNSrraUhDAoFph6vh0A==", "dev": true, "license": "MIT", "dependencies": { From 31c1e28c7608b3673e67e7d89826ab201a0f1a77 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 08:08:20 +0100 Subject: [PATCH 15/58] Add message. --- app/Support/Amount.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 5bb7815df0..ecdcd3c944 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -333,6 +333,10 @@ class Amount public function getTransactionCurrencyById(int $currencyId): TransactionCurrency { + 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(); $key = sprintf('transaction_currency_%d', $currencyId); From c63f4a941b75166674705753a1baf94bc669be80 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 08:08:57 +0100 Subject: [PATCH 16/58] Expand debug info for currency search. --- app/Factory/TransactionJournalFactory.php | 2 +- .../Currency/CurrencyRepository.php | 58 ++++++++++--------- app/Validation/TransactionValidation.php | 4 +- 3 files changed, 33 insertions(+), 31 deletions(-) diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index 8e7a28b281..491fe16b79 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -251,7 +251,7 @@ class TransactionJournalFactory $foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount); $description = $this->getDescription($description); - Log::debug(sprintf('Currency is #%d "%s", foreign currency is #%d "%s"', $currency->id, $currency->code, $foreignCurrency?->id, $foreignCurrency)); + Log::debug(sprintf('Currency is #%d "%s", foreign currency is #%d "%s"', $currency->id, $currency->code, $foreignCurrency?->id, $foreignCurrency?->code)); Log::debug(sprintf('Date: %s (%s)', $carbon->toW3cString(), $carbon->getTimezone()->getName())); /** Create a basic journal. */ diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 942bdccd5d..9f131de94c 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -45,7 +45,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Override; use Safe\Exceptions\JsonException; - use function Safe\json_encode; /** @@ -71,7 +70,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)); @@ -86,7 +85,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)); @@ -94,7 +93,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)); @@ -102,7 +101,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)); @@ -120,10 +119,9 @@ 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)); @@ -139,7 +137,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)); @@ -147,7 +145,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.'); @@ -155,7 +153,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.'); @@ -184,8 +182,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; @@ -260,22 +258,27 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf public function findCurrencyNull(?int $currencyId, ?string $currencyCode): ?TransactionCurrency { Log::debug(sprintf('Now in findCurrencyNull(%s, "%s")', var_export($currencyId, true), $currencyCode)); - $result = $this->find((int)$currencyId); - if ($result instanceof TransactionCurrency) { - Log::debug(sprintf('Found currency by ID: %s', $result->code)); + if (null !== $currencyId && 0 !== $currencyId) { + $result = $this->find((int)$currencyId); + if ($result instanceof TransactionCurrency) { + Log::debug(sprintf('Found currency by ID: %s', $result->code)); - return $result; + return $result; + } } - Log::debug(sprintf('Searching for currency with code "%s"...', $currencyCode)); - $result = $this->findByCode((string)$currencyCode); + if (null !== $currencyCode && '' !== $currencyCode) { + Log::debug(sprintf('Searching for currency with code "%s"...', $currencyCode)); + $result = $this->findByCode($currencyCode); - if ($result instanceof TransactionCurrency && false === $result->enabled) { - Log::debug(sprintf('Also enabled currency %s', $result->code)); - $this->enable($result); + if ($result instanceof TransactionCurrency && false === $result->enabled) { + Log::debug(sprintf('Also enabled currency %s', $result->code)); + $this->enable($result); + } + return $result; } Log::debug('Found no currency, returning NULL.'); - return $result; + return null; } #[Override] @@ -335,10 +338,9 @@ 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'))); diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php index 373df8f9fe..7689ed048e 100644 --- a/app/Validation/TransactionValidation.php +++ b/app/Validation/TransactionValidation.php @@ -254,7 +254,7 @@ trait TransactionValidation // wrong currency information is present $foreignCurrencyCode = $transaction['foreign_currency_code'] ?? false; $foreignCurrencyId = (int) ($transaction['foreign_currency_id'] ?? 0); - Log::debug(sprintf('Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction); + Log::debug(sprintf('[a] Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction); if ($foreignCurrencyCode !== $destinationCurrency->code && $foreignCurrencyId !== $destinationCurrency->id) { $validator->errors()->add(sprintf('transactions.%d.foreign_currency_code', $index), (string) trans('validation.require_foreign_src')); @@ -281,7 +281,7 @@ trait TransactionValidation // wrong currency information is present $foreignCurrencyCode = $transaction['foreign_currency_code'] ?? false; $foreignCurrencyId = (int) ($transaction['foreign_currency_id'] ?? 0); - Log::debug(sprintf('Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction); + Log::debug(sprintf('[b] Foreign currency code seems to be #%d "%s"', $foreignCurrencyId, $foreignCurrencyCode), $transaction); if ($foreignCurrencyCode !== $destinationCurrency->code && $foreignCurrencyId !== $destinationCurrency->id) { Log::debug(sprintf('No match on code, "%s" vs "%s"', $foreignCurrencyCode, $destinationCurrency->code)); Log::debug(sprintf('No match on ID, #%d vs #%d', $foreignCurrencyId, $destinationCurrency->id)); From 340540bd5aca59f20f0874e92afd402975f8272a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 08:21:05 +0100 Subject: [PATCH 17/58] Replace calls to Amount facade. --- .../Commands/Correction/CorrectsCurrencies.php | 2 +- .../CorrectsOpeningBalanceCurrencies.php | 2 +- .../Upgrade/UpgradesAccountCurrencies.php | 2 +- .../Commands/Upgrade/UpgradesBudgetLimits.php | 2 +- .../Commands/Upgrade/UpgradesMultiPiggyBanks.php | 2 +- app/Factory/BillFactory.php | 2 +- app/Factory/PiggyBankFactory.php | 2 +- app/Factory/TransactionJournalFactory.php | 2 +- .../Report/Audit/MonthReportGenerator.php | 2 +- 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 +- app/Handlers/Observer/PiggyBankEventObserver.php | 2 +- app/Handlers/Observer/PiggyBankObserver.php | 2 +- app/Handlers/Observer/TransactionObserver.php | 2 +- .../Controllers/Budget/BudgetLimitController.php | 16 ++++++++-------- app/Http/Controllers/JavascriptController.php | 2 +- app/Http/Controllers/Json/BoxController.php | 14 +++++++------- app/Http/Controllers/Json/BudgetController.php | 4 ++-- .../Controllers/PiggyBank/AmountController.php | 8 ++++---- app/Models/TransactionCurrency.php | 2 +- app/Repositories/Account/AccountRepository.php | 2 +- app/Repositories/Account/AccountTasker.php | 6 +++--- app/Repositories/Bill/BillRepository.php | 4 ++-- app/Repositories/Budget/BudgetRepository.php | 6 +++--- app/Repositories/Currency/CurrencyRepository.php | 4 ++-- .../PiggyBank/ModifiesPiggyBanks.php | 4 ++-- .../PiggyBank/PiggyBankRepository.php | 4 ++-- .../Internal/Support/AccountServiceTrait.php | 12 ++++++------ .../Support/RecurringTransactionTrait.php | 2 +- .../Internal/Update/BillUpdateService.php | 2 +- app/Support/Form/CurrencyForm.php | 8 ++++---- app/Support/Http/Controllers/ChartGeneration.php | 2 +- .../Report/Budget/BudgetReportGenerator.php | 2 +- app/Support/Twig/General.php | 6 +++--- app/Support/Twig/TransactionGroupTwig.php | 8 ++++---- app/Validation/TransactionValidation.php | 2 +- 39 files changed, 77 insertions(+), 77 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsCurrencies.php b/app/Console/Commands/Correction/CorrectsCurrencies.php index d1ee224081..c9df75fdc7 100644 --- a/app/Console/Commands/Correction/CorrectsCurrencies.php +++ b/app/Console/Commands/Correction/CorrectsCurrencies.php @@ -63,7 +63,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 = app('amount')->getPrimaryCurrencyByUserGroup($userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\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 9857fa2209..a52e8b04a4 100644 --- a/app/Console/Commands/Correction/CorrectsOpeningBalanceCurrencies.php +++ b/app/Console/Commands/Correction/CorrectsOpeningBalanceCurrencies.php @@ -133,6 +133,6 @@ class CorrectsOpeningBalanceCurrencies extends Command $repos = app(AccountRepositoryInterface::class); $repos->setUser($account->user); - return $repos->getAccountCurrency($account) ?? app('amount')->getPrimaryCurrencyByUserGroup($account->userGroup); + return $repos->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->userGroup); } } diff --git a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php index 833f87ab4a..46b7736562 100644 --- a/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php +++ b/app/Console/Commands/Upgrade/UpgradesAccountCurrencies.php @@ -105,7 +105,7 @@ class UpgradesAccountCurrencies extends Command $accounts = $this->accountRepos->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value]); // get user's currency preference: - $primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($user->userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\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 1f0d670b42..4bb1017bbe 100644 --- a/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php +++ b/app/Console/Commands/Upgrade/UpgradesBudgetLimits.php @@ -67,7 +67,7 @@ class UpgradesBudgetLimits extends Command /** @var null|User $user */ $user = $budget->user; if (null !== $user) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($user->userGroup); + $currency = \FireflyIII\Support\Facades\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 1207bc9c76..1d746b4b9e 100644 --- a/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php +++ b/app/Console/Commands/Upgrade/UpgradesMultiPiggyBanks.php @@ -95,7 +95,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) ?? app('amount')->getPrimaryCurrencyByUserGroup($piggyBank->account->user->userGroup); + $currency = $this->accountRepository->getAccountCurrency($piggyBank->account) ?? \FireflyIII\Support\Facades\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 e7fe5cfa59..48f3a4e6f8 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -51,7 +51,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)) - ?? app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + ?? \FireflyIII\Support\Facades\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 d74cba948e..9eb807725a 100644 --- a/app/Factory/PiggyBankFactory.php +++ b/app/Factory/PiggyBankFactory.php @@ -126,7 +126,7 @@ class PiggyBankFactory private function getCurrency(array $data): TransactionCurrency { // currency: - $primaryCurrency = app('amount')->getPrimaryCurrency(); + $primaryCurrency = \FireflyIII\Support\Facades\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 491fe16b79..7d890b95ce 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -502,7 +502,7 @@ class TransactionJournalFactory $preference = $this->accountRepository->getAccountCurrency($account); if (null === $preference && !$currency instanceof TransactionCurrency) { // return user's default: - return app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + return \FireflyIII\Support\Facades\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 3c35cb8834..9bc9ec1546 100644 --- a/app/Generator/Report/Audit/MonthReportGenerator.php +++ b/app/Generator/Report/Audit/MonthReportGenerator.php @@ -144,7 +144,7 @@ class MonthReportGenerator implements ReportGeneratorInterface $dayBeforeBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $date)[$account->id]; $startBalance = $dayBeforeBalance['balance']; - $primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\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 6380b77755..0cc686a618 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 = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 ca030ba70e..003767c1d9 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 = app('amount')->getPrimaryCurrencyByUserGroup($autoBudget->budget->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 02fc32d0b1..e310962c16 100644 --- a/app/Handlers/Observer/AvailableBudgetObserver.php +++ b/app/Handlers/Observer/AvailableBudgetObserver.php @@ -44,7 +44,7 @@ class AvailableBudgetObserver return; } - $userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($availableBudget->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 ac9e98d3e1..265957a367 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 = app('amount')->getPrimaryCurrencyByUserGroup($bill->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 3c6558f0e9..83783e5640 100644 --- a/app/Handlers/Observer/BudgetLimitObserver.php +++ b/app/Handlers/Observer/BudgetLimitObserver.php @@ -72,7 +72,7 @@ class BudgetLimitObserver return; } - $userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($budgetLimit->budget->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 acd8656727..1c60c90414 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 = app('amount')->getPrimaryCurrencyByUserGroup($event->piggyBank->accounts()->first()->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 003f46ee88..a48686c132 100644 --- a/app/Handlers/Observer/PiggyBankObserver.php +++ b/app/Handlers/Observer/PiggyBankObserver.php @@ -49,7 +49,7 @@ class PiggyBankObserver return; } - $userCurrency = app('amount')->getPrimaryCurrencyByUserGroup($group); + $userCurrency = \FireflyIII\Support\Facades\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 63ffebfd1a..703d5b2b81 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 = app('amount')->getPrimaryCurrencyByUserGroup($transaction->transactionJournal->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 18858e104b..0c6c0b6491 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -205,14 +205,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'] = app('amount')->formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); - $array['amount_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $limit['amount']); + $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['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'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']); + $array['left_per_day_formatted'] = \FireflyIII\Support\Facades\Amount::formatAnything($limit->transactionCurrency, $array['left_per_day']); // notes: $array['notes'] = $this->blRepository->getNoteText($limit); @@ -239,8 +239,8 @@ class BudgetLimitController extends Controller $this->blRepository->destroyBudgetLimit($budgetLimit); $array = [ 'budget_id' => $budgetId, - 'left_formatted' => app('amount')->formatAnything($currency, '0'), - 'left_per_day_formatted' => app('amount')->formatAnything($currency, '0'), + 'left_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'), + 'left_per_day_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, '0'), 'transaction_currency_id' => $currency->id, ]; @@ -269,14 +269,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'] = app('amount')->formatAnything($limit->transactionCurrency, bcadd($array['spent'], (string) $array['amount'])); - $array['amount_formatted'] = app('amount')->formatAnything($limit->transactionCurrency, $limit['amount']); + $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['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'] = app('amount')->formatAnything($limit->transactionCurrency, $array['left_per_day']); + $array['left_per_day_formatted'] = \FireflyIII\Support\Facades\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 c44c2aebee..271b27c902 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -106,7 +106,7 @@ class JavascriptController extends Controller $currency = $repository->getAccountCurrency($account) ?? $this->primaryCurrency; } $locale = Steam::getLocale(); - $accounting = app('amount')->getJsConfig(); + $accounting = \FireflyIII\Support\Facades\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 a7a631a193..4db6418a8a 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] = app('amount')->formatAnything($currency, $sums[$currencyId], false); - $incomes[$currencyId] = app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false); - $expenses[$currencyId] = app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false); + $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); } if (0 === count($sums)) { $currency = $this->primaryCurrency; - $sums[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false); - $incomes[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false); - $expenses[$this->primaryCurrency->id] = app('amount')->formatAnything($this->primaryCurrency, '0', false); + $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); } $response = [ @@ -187,7 +187,7 @@ class BoxController extends Controller if ('primary' === $key) { continue; } - $return[$data['currency_id']] = app('amount')->formatFlat($data['currency_symbol'], $data['currency_decimal_places'], $data['balance'], false); + $return[$data['currency_id']] = \FireflyIII\Support\Facades\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 6a0b494194..6eaffdacc1 100644 --- a/app/Http/Controllers/Json/BudgetController.php +++ b/app/Http/Controllers/Json/BudgetController.php @@ -84,9 +84,9 @@ class BudgetController extends Controller return response()->json( [ 'budgeted' => $budgeted, - 'budgeted_formatted' => app('amount')->formatAnything($currency, $budgeted, true), + 'budgeted_formatted' => \FireflyIII\Support\Facades\Amount::formatAnything($currency, $budgeted, true), 'available' => $available, - 'available_formatted' => app('amount')->formatAnything($currency, $available, true), + 'available_formatted' => \FireflyIII\Support\Facades\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 659da06f57..2f40a833bd 100644 --- a/app/Http/Controllers/PiggyBank/AmountController.php +++ b/app/Http/Controllers/PiggyBank/AmountController.php @@ -167,7 +167,7 @@ class AmountController extends Controller $piggyBank->refresh(); } if (0 !== bccomp($total, '0')) { - session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name])); + session()->flash('success', (string) trans('firefly.added_amount_to_piggy', ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name])); Preferences::mark(); return redirect(route('piggy-banks.index')); @@ -177,7 +177,7 @@ class AmountController extends Controller 'error', (string) trans( 'firefly.cannot_add_amount_piggy', - ['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] + ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] ) ); @@ -214,7 +214,7 @@ class AmountController extends Controller 'success', (string) trans( 'firefly.removed_amount_from_piggy', - ['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name] + ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => $piggyBank->name] ) ); Preferences::mark(); @@ -226,7 +226,7 @@ class AmountController extends Controller 'error', (string) trans( 'firefly.cannot_remove_from_piggy', - ['amount' => app('amount')->formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] + ['amount' => \FireflyIII\Support\Facades\Amount::formatAnything($piggyBank->transactionCurrency, $total, false), 'name' => e($piggyBank->name)] ) ); diff --git a/app/Models/TransactionCurrency.php b/app/Models/TransactionCurrency.php index 418442db77..f1d610e56c 100644 --- a/app/Models/TransactionCurrency.php +++ b/app/Models/TransactionCurrency.php @@ -65,7 +65,7 @@ class TransactionCurrency extends Model public function refreshForUser(User $user): void { $current = $user->userGroup->currencies()->where('transaction_currencies.id', $this->id)->first(); - $native = app('amount')->getPrimaryCurrencyByUserGroup($user->userGroup); + $native = \FireflyIII\Support\Facades\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 e2572d9450..63e0db9724 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) ?? app('amount')->getPrimaryCurrency(); + $currency = $this->getAccountCurrency($account) ?? \FireflyIII\Support\Facades\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 4278ac4183..f984053215 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -59,7 +59,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); - $primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); $return = [ 'accounts' => [], @@ -146,7 +146,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface private function groupExpenseByDestination(array $array): array { - $primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ $currencyRepos = app(CurrencyRepositoryInterface::class); @@ -231,7 +231,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface private function groupIncomeBySource(array $array): array { - $primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\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 0f8fe684b8..a5a4988ec1 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 = app('amount')->getPrimaryCurrency(); + $primary = \FireflyIII\Support\Facades\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 = app('amount')->getPrimaryCurrency(); + $primary = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); /** @var Bill $bill */ foreach ($bills as $bill) { diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 36d7cd9f00..006a725a51 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -94,7 +94,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $limitRepository = app(BudgetLimitRepository::class); $limitRepository->setUser($this->user); $budgets = $this->getActiveBudgets(); - $primaryCurrency = app('amount')->getPrimaryCurrency(); + $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $converter = new ExchangeRateConverter(); /** @var Budget $budget */ @@ -393,7 +393,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $autoBudget = $this->getAutoBudget($budget); // grab default currency: - $currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $currency = \FireflyIII\Support\Facades\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 +778,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $currency = $repos->findByCode((string) $data['currency_code']); } if (null === $currency) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } $autoBudget = new AutoBudget(); diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 9f131de94c..dc7876aed5 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -240,7 +240,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf Log::debug('Grabbing default currency for this user...'); /** @var null|TransactionCurrency $result */ - $result = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $result = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } Log::debug(sprintf('Final result: %s', $result->code)); @@ -440,7 +440,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf public function makePrimary(TransactionCurrency $currency): void { - $current = app('amount')->getPrimaryCurrencyByUserGroup($this->userGroup); + $current = \FireflyIII\Support\Facades\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 734cfe8b0f..1800085966 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 = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $userCurrency = \FireflyIII\Support\Facades\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 fb4c4e7305..f6d314e2f5 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -171,7 +171,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte $accountRepos = app(AccountRepositoryInterface::class); $accountRepos->setUser($this->user); - $primaryCurrency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); Log::debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code)); @@ -302,7 +302,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte /** @var PiggyBank $piggy */ foreach ($set as $piggy) { $currentAmount = $this->getCurrentAmount($piggy); - $piggy->name = sprintf('%s (%s)', $piggy->name, app('amount')->formatAnything($piggy->transactionCurrency, $currentAmount, false)); + $piggy->name = sprintf('%s (%s)', $piggy->name, \FireflyIII\Support\Facades\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 5019b7031a..5fbc87f1f4 100644 --- a/app/Services/Internal/Support/AccountServiceTrait.php +++ b/app/Services/Internal/Support/AccountServiceTrait.php @@ -231,7 +231,7 @@ trait AccountServiceTrait // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // submit to factory: @@ -348,7 +348,7 @@ trait AccountServiceTrait if (null === $currency) { // use default currency: - $currency = app('amount')->getPrimaryCurrencyByUserGroup($this->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($this->user->userGroup); } $currency->enabled = true; $currency->save(); @@ -388,7 +388,7 @@ trait AccountServiceTrait // if exists, update: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // simply grab the first journal and change it: @@ -454,7 +454,7 @@ trait AccountServiceTrait // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // submit to factory: $submission = [ @@ -571,7 +571,7 @@ trait AccountServiceTrait // if exists, update: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup); } // simply grab the first journal and change it: @@ -652,7 +652,7 @@ trait AccountServiceTrait // get or grab currency: $currency = $this->accountRepository->getAccountCurrency($account); if (null === $currency) { - $currency = app('amount')->getPrimaryCurrencyByUserGroup($account->user->userGroup); + $currency = \FireflyIII\Support\Facades\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 25f0fb75db..da4e9ef091 100644 --- a/app/Services/Internal/Support/RecurringTransactionTrait.php +++ b/app/Services/Internal/Support/RecurringTransactionTrait.php @@ -107,7 +107,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 = app('amount')->getPrimaryCurrencyByUserGroup($recurrence->user->userGroup); + $currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($recurrence->user->userGroup); } Log::debug( diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index cdf2118cc8..71d9771666 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -53,7 +53,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) - ?? app('amount')->getPrimaryCurrencyByUserGroup($bill->user->userGroup); + ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($bill->user->userGroup); // enable the currency if it isn't. $currency->enabled = true; diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index 0abfa1ca5f..d487bc7b15 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -123,10 +123,10 @@ class CurrencyForm $classes = $this->getHolderClasses($name); $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; - $primaryCurrency = $options['currency'] ?? app('amount')->getPrimaryCurrency(); + $primaryCurrency = $options['currency'] ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); /** @var Collection $currencies */ - $currencies = app('amount')->getAllCurrencies(); + $currencies = \FireflyIII\Support\Facades\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 +176,10 @@ class CurrencyForm $classes = $this->getHolderClasses($name); $value = $this->fillFieldValue($name, $value); $options['step'] = 'any'; - $primaryCurrency = $options['currency'] ?? app('amount')->getPrimaryCurrency(); + $primaryCurrency = $options['currency'] ?? \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); /** @var Collection $currencies */ - $currencies = app('amount')->getCurrencies(); + $currencies = \FireflyIII\Support\Facades\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 63792ed518..fd98a732fc 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 = app('amount')->getPrimaryCurrency(); + $primary = \FireflyIII\Support\Facades\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 246f05dd0d..c839853eb7 100644 --- a/app/Support/Report/Budget/BudgetReportGenerator.php +++ b/app/Support/Report/Budget/BudgetReportGenerator.php @@ -136,7 +136,7 @@ class BudgetReportGenerator $this->blRepository->setUser($user); $this->opsRepository->setUser($user); $this->nbRepository->setUser($user); - $this->currency = app('amount')->getPrimaryCurrencyByUserGroup($user->userGroup); + $this->currency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrencyByUserGroup($user->userGroup); } /** diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index fb4cc08abf..d4d5c9c553 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[] = app('amount')->formatAnything($currency, $balance, false); + $strings[] = \FireflyIII\Support\Facades\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[] = app('amount')->formatAnything($primary, $balance, false); + $strings[] = \FireflyIII\Support\Facades\Amount::formatAnything($primary, $balance, false); } continue; } // for multi currency accounts. if ($usePrimary && $key !== $primary->code) { - $strings[] = app('amount')->formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false); + $strings[] = \FireflyIII\Support\Facades\Amount::formatAnything(Amount::getTransactionCurrencyByCode($key), $balance, false); } } diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index f22a0618d1..891525bf71 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -172,7 +172,7 @@ class TransactionGroupTwig extends AbstractExtension if (TransactionTypeEnum::TRANSFER->value === $type) { $colored = false; } - $result = app('amount')->formatFlat($array['foreign_currency_symbol'], (int)$array['foreign_currency_decimal_places'], $amount, $colored); + $result = \FireflyIII\Support\Facades\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 +199,7 @@ class TransactionGroupTwig extends AbstractExtension if (TransactionTypeEnum::TRANSFER->value === $type) { $colored = false; } - $result = app('amount')->formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); + $result = \FireflyIII\Support\Facades\Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } @@ -230,7 +230,7 @@ class TransactionGroupTwig extends AbstractExtension $colored = false; } - $result = app('amount')->formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored); + $result = \FireflyIII\Support\Facades\Amount::formatFlat($array['currency_symbol'], (int)$array['currency_decimal_places'], $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } @@ -257,7 +257,7 @@ class TransactionGroupTwig extends AbstractExtension if (TransactionTypeEnum::TRANSFER->value === $type) { $colored = false; } - $result = app('amount')->formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); + $result = \FireflyIII\Support\Facades\Amount::formatFlat($currency->symbol, $currency->decimal_places, $amount, $colored); if (TransactionTypeEnum::TRANSFER->value === $type) { return sprintf('%s', $result); } diff --git a/app/Validation/TransactionValidation.php b/app/Validation/TransactionValidation.php index 7689ed048e..e95a826ffb 100644 --- a/app/Validation/TransactionValidation.php +++ b/app/Validation/TransactionValidation.php @@ -224,7 +224,7 @@ trait TransactionValidation /** @var AccountRepository $accountRepository */ $accountRepository = app(AccountRepositoryInterface::class); - $primaryCurrency = app('amount')->getPrimaryCurrency(); + $primaryCurrency = \FireflyIII\Support\Facades\Amount::getPrimaryCurrency(); $sourceCurrency = $accountRepository->getAccountCurrency($source) ?? $primaryCurrency; $destinationCurrency = $accountRepository->getAccountCurrency($destination) ?? $primaryCurrency; // if both accounts have the same currency, continue. From 92a535c644e13e3a87a816b530c603ed1511248d Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 20 Dec 2025 20:12:07 +0100 Subject: [PATCH 18/58] Only update amount when it's actually changed. --- .../Internal/Update/JournalUpdateService.php | 119 +++++++++--------- app/TransactionRules/Actions/SetAmount.php | 44 +++---- composer.lock | 29 ++--- 3 files changed, 98 insertions(+), 94 deletions(-) diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 23e09b01b0..84552f79d2 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; } @@ -684,22 +684,23 @@ class JournalUpdateService } // should not return in NULL but seems to do. - 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, - ] - )); - + 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, + ] + )); + } } private function updateForeignAmount(): void @@ -737,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'); @@ -775,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)); } @@ -790,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(); @@ -805,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/TransactionRules/Actions/SetAmount.php b/app/TransactionRules/Actions/SetAmount.php index ea5b6d6de1..c20ef68a29 100644 --- a/app/TransactionRules/Actions/SetAmount.php +++ b/app/TransactionRules/Actions/SetAmount.php @@ -24,14 +24,14 @@ declare(strict_types=1); namespace FireflyIII\TransactionRules\Actions; -use Illuminate\Support\Facades\Log; use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray; use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; -use FireflyIII\TransactionRules\Traits\RefreshNotesTrait; use FireflyIII\Support\Facades\Steam; +use FireflyIII\TransactionRules\Traits\RefreshNotesTrait; +use Illuminate\Support\Facades\Log; class SetAmount implements ActionInterface { @@ -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,31 +65,33 @@ 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); $object->transactionGroup->touch(); // event for audit log entry - 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, - ] - )); + 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, + ] + )); + } return true; } diff --git a/composer.lock b/composer.lock index 3d41f1cc0b..38072b6877 100644 --- a/composer.lock +++ b/composer.lock @@ -3486,22 +3486,22 @@ }, { "name": "mailersend/laravel-driver", - "version": "v2.12.0", + "version": "v2.9.1", "source": { "type": "git", "url": "https://github.com/mailersend/mailersend-laravel-driver.git", - "reference": "15e1ec41e29e65d3ca226929c65804190aaa93eb" + "reference": "87fd5ab76808bbaac9221be0d306baef13e98725" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mailersend/mailersend-laravel-driver/zipball/15e1ec41e29e65d3ca226929c65804190aaa93eb", - "reference": "15e1ec41e29e65d3ca226929c65804190aaa93eb", + "url": "https://api.github.com/repos/mailersend/mailersend-laravel-driver/zipball/87fd5ab76808bbaac9221be0d306baef13e98725", + "reference": "87fd5ab76808bbaac9221be0d306baef13e98725", "shasum": "" }, "require": { "ext-json": "*", "illuminate/support": "^9.0 || ^10.0 || ^11.0 || ^12.0", - "mailersend/mailersend": "^0.35.0", + "mailersend/mailersend": "^0.31.0", "nyholm/psr7": "^1.5", "php": ">=8.0", "php-http/guzzle7-adapter": "^1.0", @@ -3549,28 +3549,29 @@ ], "support": { "issues": "https://github.com/mailersend/mailersend-laravel-driver/issues", - "source": "https://github.com/mailersend/mailersend-laravel-driver/tree/v2.12.0" + "source": "https://github.com/mailersend/mailersend-laravel-driver/tree/v2.9.1" }, - "time": "2025-10-28T14:59:16+00:00" + "time": "2025-04-09T09:33:07+00:00" }, { "name": "mailersend/mailersend", - "version": "v0.35.0", + "version": "v0.31.0", "source": { "type": "git", "url": "https://github.com/mailersend/mailersend-php.git", - "reference": "f1696cf9e727e9503fbc5882d2a111bd966ad276" + "reference": "513ff83ee768526055ad52987cde401ea7218c67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mailersend/mailersend-php/zipball/f1696cf9e727e9503fbc5882d2a111bd966ad276", - "reference": "f1696cf9e727e9503fbc5882d2a111bd966ad276", + "url": "https://api.github.com/repos/mailersend/mailersend-php/zipball/513ff83ee768526055ad52987cde401ea7218c67", + "reference": "513ff83ee768526055ad52987cde401ea7218c67", "shasum": "" }, "require": { "beberlei/assert": "^3.2", "ext-json": "*", - "php": "^7.4 || ^8.0 <8.5", + "illuminate/collections": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "php": "^7.4|^8.0", "php-http/client-common": "^2.2", "php-http/discovery": "^1.9", "php-http/httplug": "^2.1", @@ -3615,9 +3616,9 @@ ], "support": { "issues": "https://github.com/mailersend/mailersend-php/issues", - "source": "https://github.com/mailersend/mailersend-php/tree/v0.35.0" + "source": "https://github.com/mailersend/mailersend-php/tree/v0.31.0" }, - "time": "2025-10-28T13:11:43+00:00" + "time": "2025-04-03T12:16:11+00:00" }, { "name": "monolog/monolog", From 6b7aed765864bc8d52ed3d94d5c34799713e9048 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 22 Dec 2025 03:01:04 +0000 Subject: [PATCH 19/58] Bump mailersend/laravel-driver from 2.9.1 to 2.12.0 Bumps [mailersend/laravel-driver](https://github.com/mailersend/mailersend-laravel-driver) from 2.9.1 to 2.12.0. - [Release notes](https://github.com/mailersend/mailersend-laravel-driver/releases) - [Commits](https://github.com/mailersend/mailersend-laravel-driver/compare/v2.9.1...v2.12.0) --- updated-dependencies: - dependency-name: mailersend/laravel-driver dependency-version: 2.12.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 33 ++++++++++++++++----------------- 2 files changed, 17 insertions(+), 18 deletions(-) diff --git a/composer.json b/composer.json index 0208b1e63d..78faaa43d8 100644 --- a/composer.json +++ b/composer.json @@ -96,7 +96,7 @@ "league/commonmark": "^2", "league/csv": "^9.10", "league/fractal": "0.*", - "mailersend/laravel-driver": "^2.7", + "mailersend/laravel-driver": "^2.12", "nunomaduro/collision": "^8", "pragmarx/google2fa": "^8.0", "predis/predis": "^3", diff --git a/composer.lock b/composer.lock index 38072b6877..07b1430a0a 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8fff223d32252d22c0e6028d19a76756", + "content-hash": "434b4c996dad2af3b38326bd81c57534", "packages": [ { "name": "bacon/bacon-qr-code", @@ -3486,22 +3486,22 @@ }, { "name": "mailersend/laravel-driver", - "version": "v2.9.1", + "version": "v2.12.0", "source": { "type": "git", "url": "https://github.com/mailersend/mailersend-laravel-driver.git", - "reference": "87fd5ab76808bbaac9221be0d306baef13e98725" + "reference": "15e1ec41e29e65d3ca226929c65804190aaa93eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mailersend/mailersend-laravel-driver/zipball/87fd5ab76808bbaac9221be0d306baef13e98725", - "reference": "87fd5ab76808bbaac9221be0d306baef13e98725", + "url": "https://api.github.com/repos/mailersend/mailersend-laravel-driver/zipball/15e1ec41e29e65d3ca226929c65804190aaa93eb", + "reference": "15e1ec41e29e65d3ca226929c65804190aaa93eb", "shasum": "" }, "require": { "ext-json": "*", "illuminate/support": "^9.0 || ^10.0 || ^11.0 || ^12.0", - "mailersend/mailersend": "^0.31.0", + "mailersend/mailersend": "^0.35.0", "nyholm/psr7": "^1.5", "php": ">=8.0", "php-http/guzzle7-adapter": "^1.0", @@ -3549,29 +3549,28 @@ ], "support": { "issues": "https://github.com/mailersend/mailersend-laravel-driver/issues", - "source": "https://github.com/mailersend/mailersend-laravel-driver/tree/v2.9.1" + "source": "https://github.com/mailersend/mailersend-laravel-driver/tree/v2.12.0" }, - "time": "2025-04-09T09:33:07+00:00" + "time": "2025-10-28T14:59:16+00:00" }, { "name": "mailersend/mailersend", - "version": "v0.31.0", + "version": "v0.35.0", "source": { "type": "git", "url": "https://github.com/mailersend/mailersend-php.git", - "reference": "513ff83ee768526055ad52987cde401ea7218c67" + "reference": "f1696cf9e727e9503fbc5882d2a111bd966ad276" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mailersend/mailersend-php/zipball/513ff83ee768526055ad52987cde401ea7218c67", - "reference": "513ff83ee768526055ad52987cde401ea7218c67", + "url": "https://api.github.com/repos/mailersend/mailersend-php/zipball/f1696cf9e727e9503fbc5882d2a111bd966ad276", + "reference": "f1696cf9e727e9503fbc5882d2a111bd966ad276", "shasum": "" }, "require": { "beberlei/assert": "^3.2", "ext-json": "*", - "illuminate/collections": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", - "php": "^7.4|^8.0", + "php": "^7.4 || ^8.0 <8.5", "php-http/client-common": "^2.2", "php-http/discovery": "^1.9", "php-http/httplug": "^2.1", @@ -3616,9 +3615,9 @@ ], "support": { "issues": "https://github.com/mailersend/mailersend-php/issues", - "source": "https://github.com/mailersend/mailersend-php/tree/v0.31.0" + "source": "https://github.com/mailersend/mailersend-php/tree/v0.35.0" }, - "time": "2025-04-03T12:16:11+00:00" + "time": "2025-10-28T13:11:43+00:00" }, { "name": "monolog/monolog", @@ -13087,5 +13086,5 @@ "ext-xmlwriter": "*" }, "platform-dev": {}, - "plugin-api-version": "2.9.0" + "plugin-api-version": "2.6.0" } From bc4018481f69546b80c460a21fba30870859fbec Mon Sep 17 00:00:00 2001 From: JC5 Date: Mon, 22 Dec 2025 04:36:14 +0100 Subject: [PATCH 20/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'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" } }, From 7dac164556d6464fca4316426e86858cddb9fd1c Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 22 Dec 2025 15:39:41 +0100 Subject: [PATCH 21/58] Remove maxlength --- app/Api/V1/Controllers/Webhook/SubmitController.php | 2 +- resources/views/search/index.twig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Api/V1/Controllers/Webhook/SubmitController.php b/app/Api/V1/Controllers/Webhook/SubmitController.php index 472af55dca..0d528820bc 100644 --- a/app/Api/V1/Controllers/Webhook/SubmitController.php +++ b/app/Api/V1/Controllers/Webhook/SubmitController.php @@ -28,10 +28,10 @@ use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Jobs\SendWebhookMessage; use FireflyIII\Models\Webhook; use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface; +use FireflyIII\Support\Facades\FireflyConfig; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use FireflyIII\Support\Facades\FireflyConfig; /** * Class SubmitController diff --git a/resources/views/search/index.twig b/resources/views/search/index.twig index 203c31ce6d..582656d5cf 100644 --- a/resources/views/search/index.twig +++ b/resources/views/search/index.twig @@ -20,7 +20,7 @@

    -
    From 86f1d8a1bc73bc4f3e5bc6cb50a6f2dc4c86861f Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 24 Dec 2025 07:45:03 +0100 Subject: [PATCH 22/58] Fix ALE amount logging. --- .../Internal/Update/JournalUpdateService.php | 149 ++++++++++-------- resources/lang/en_US/firefly.php | 1 + resources/views/list/ale.twig | 14 +- 3 files changed, 98 insertions(+), 66 deletions(-) diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 3029cf1a37..d69a70779b 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,8 +651,8 @@ class JournalUpdateService return; } - $value = $this->data['amount'] ?? ''; - Log::debug(sprintf('Amount is now "%s"', $value)); + $value = $this->data['amount'] ?? ''; + Log::debug(sprintf('[a] Amount is now "%s"', $value)); try { $amount = $this->getAmount($value); @@ -661,46 +661,71 @@ class JournalUpdateService return; } + Log::debug(sprintf('[b] Amount is now "%s"', $value)); $origSourceTransaction = $this->getSourceTransaction(); + $destTransaction = $this->getDestinationTransaction(); + $originalSourceAmount = $origSourceTransaction->amount; + $originalDestAmount = $destTransaction->amount; $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->save(); + $origSourceTransaction->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; } - if (null === $group) { + if (null === $group || null === $this->transactionJournal) { return; } - - // 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, - ] - )); + if (0 === bccomp($origSourceTransaction->amount, $originalSourceAmount)) { + Log::debug('Amount was not actually changed, return.'); + return; } + Log::debug('Amount was changed.'); + $transfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type; + $withdrawal = TransactionTypeEnum::WITHDRAWAL->value === $this->transactionJournal->transactionType->type; + $deposit = TransactionTypeEnum::DEPOSIT->value === $this->transactionJournal->transactionType->type; + $makePositive = $transfer || $deposit ? true : false; + + // assume withdrawal, use the source for amount (negative), and destination for currency. + $originalAmount = $originalSourceAmount; + $recordCurrency = $destTransaction->transactionCurrency; + Log::debug(sprintf('Transaction is a %s, original amount is %s and currency is %s', $this->transactionJournal->transactionType->type, $originalAmount, $recordCurrency->code)); + if ($withdrawal || $transfer) { + Log::debug('Use these values to record a changed withdrawal amount'); + } + if (!$withdrawal && !$transfer) { + $originalAmount = $originalDestAmount; + $recordCurrency = $origSourceTransaction->transactionCurrency; + Log::debug('Use destination amount to record a changed withdrawal amount'); + Log::debug(sprintf('Transaction is a %s, original amount now is %s and currency is now %s', $this->transactionJournal->transactionType->type, $originalAmount, $recordCurrency->code)); + } + $originalAmount = $makePositive ? Steam::positive($originalAmount) : Steam::negative($originalAmount); + $value = $makePositive ? Steam::positive($value) : Steam::negative($value); + // should not return in NULL but seems to do. + event(new TriggeredAuditLog( + $group->user, + $group, + 'update_amount', + [ + 'currency_symbol' => $recordCurrency->symbol, + 'decimal_places' => $recordCurrency->decimal_places, + 'amount' => $originalAmount, + ], + [ + 'currency_symbol' => $recordCurrency->symbol, + 'decimal_places' => $recordCurrency->decimal_places, + 'amount' => $value, + ] + )); } private function updateForeignAmount(): void @@ -738,9 +763,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 +801,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 +816,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 +831,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/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index 25bb670e47..a26b76a875 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -2908,6 +2908,7 @@ return [ 'placeholder' => '[Placeholder]', // audit log entries + 'incomplete_ale' => 'Not all events are recorded as audit log entries.', 'audit_log_entries' => 'Audit log entries', 'ale_action_log_add' => 'Added :amount to piggy bank ":name"', 'ale_action_log_remove' => 'Removed :amount from piggy bank ":name"', diff --git a/resources/views/list/ale.twig b/resources/views/list/ale.twig index 7be50457b0..495515c4da 100644 --- a/resources/views/list/ale.twig +++ b/resources/views/list/ale.twig @@ -1,16 +1,21 @@ + + + + + + {% for logEntry in logEntries %} {% endfor %} +
    {{ 'incomplete_ale'|_ }}
    {# link to object: #} {% if 'FireflyIII\\Models\\Rule' == logEntry.changer_type %} - - {% endif %} + + {% endif %} {% if 'FireflyIII\\User' == logEntry.changer_type %} {% endif %} - {{ logEntry.changer_type|replace({"FireflyIII\\Models\\": ""})|replace({"FireflyIII\\": ""}) }} - #{{ logEntry.changer_id }} + {{ logEntry.changer_type|replace({"FireflyIII\\Models\\": ""})|replace({"FireflyIII\\": ""}) }} #{{ logEntry.changer_id }} @@ -103,4 +108,5 @@
    From 456e73ac162304d8e20fb0c870b1f52f1e73ad4b Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 26 Dec 2025 07:09:04 +0100 Subject: [PATCH 23/58] Fix #11403 --- resources/views/piggy-banks/show.twig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/views/piggy-banks/show.twig b/resources/views/piggy-banks/show.twig index c36632fed5..4620b4a670 100644 --- a/resources/views/piggy-banks/show.twig +++ b/resources/views/piggy-banks/show.twig @@ -36,7 +36,7 @@ {{ 'saveOnAccounts'|_ }} {% for account in piggy.accounts %} -
    {{ account.name }}
    + {{ account.name }}
    {% endfor %} @@ -58,7 +58,7 @@ {{ 'saved_so_far'|_ }} - ({{ account.name }}) + ({{ account.name }}) {{ formatAmountBySymbol(account.current_amount, piggy.currency_symbol, piggy.currency_decimal_places) }} From 4d2dd1d8f72e307eadb59e3ffaf0de6a9a5ce440 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 26 Dec 2025 20:02:09 +0100 Subject: [PATCH 24/58] Fix view of running balance column --- app/Http/Controllers/HomeController.php | 1 + app/Support/Twig/General.php | 11 +++++++++++ config/firefly.php | 2 +- resources/views/list/groups.twig | 4 ++-- resources/views/partials/debug-table.twig | 4 ++-- resources/views/partials/menu-sidebar.twig | 2 +- resources/views/preferences/index.twig | 2 +- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 67118821c6..df6b973e92 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; +use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; diff --git a/app/Support/Twig/General.php b/app/Support/Twig/General.php index 1f53977b15..cbd22d9119 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -28,6 +28,7 @@ use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\User\UserRepositoryInterface; use FireflyIII\Support\Facades\Amount; +use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Search\OperatorQuerySearch; use Illuminate\Support\Collection; @@ -72,6 +73,7 @@ class General extends AbstractExtension $this->hasRole(), $this->getRootSearchOperator(), $this->carbonize(), + $this->fireflyIIIConfig(), ]; } @@ -393,4 +395,13 @@ class General extends AbstractExtension static fn (string $str): string => date($str) ); } + + private function fireflyIIIConfig() { + return new TwigFunction( + 'fireflyiiiconfig', + static function (string $string, mixed $default): mixed { + return FireflyConfig::get($string, $default)->data; + } + ); + } } diff --git a/config/firefly.php b/config/firefly.php index 55e3e15307..0767441194 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -75,7 +75,7 @@ return [ 'webhooks' => true, 'handle_debts' => true, 'expression_engine' => true, - 'running_balance_column' => env('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. + 'running_balance_column' =>(bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-22', diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 92cfb0b960..9c28b65a85 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -33,7 +33,7 @@   {{ trans('list.description') }} {{ trans('list.amount') }} - {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %} + {% if fireflyiiiconfig('use_running_balance', true) %} {{ trans('list.running_balance') }} {% endif %} {{ trans('list.date') }} @@ -266,7 +266,7 @@ {% endif %} {% endif %} - {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %} + {% if (fireflyiiiconfig('use_running_balance', true)) %} {% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %} {% if transaction.transaction_type_type == 'Deposit' %} diff --git a/resources/views/partials/debug-table.twig b/resources/views/partials/debug-table.twig index 79eeed4364..9b8f605f67 100644 --- a/resources/views/partials/debug-table.twig +++ b/resources/views/partials/debug-table.twig @@ -119,11 +119,11 @@ Exchange rates - {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %}Enabled{% else %}Disabled{% endif %}, downloads {% if FireflyConfig.get('enable_external_rates', config('cer.download_enabled')) %}enabled{% else %}disabled{% endif %} + {% if fireflyiiiconfig('enable_exchange_rates', true) %}Enabled{% else %}Disabled{% endif %}, downloads {% if FireflyConfig.get('enable_external_rates', config('cer.download_enabled')) %}enabled{% else %}disabled{% endif %} RB-column - {% if FireflyConfig.get('use_running_balance', config('firefly.feature_flags.running_balance_column')) %}Enabled{% else %}Disabled{% endif %} + {% if fireflyiiiconfig('use_running_balance', true) %}Enabled{% else %}Disabled{% endif %} diff --git a/resources/views/partials/menu-sidebar.twig b/resources/views/partials/menu-sidebar.twig index 8320682e98..97a344edcd 100644 --- a/resources/views/partials/menu-sidebar.twig +++ b/resources/views/partials/menu-sidebar.twig @@ -226,7 +226,7 @@ {{ 'currencies'|_ }} - {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %} + {% if (fireflyiiiconfig('enable_exchange_rates', true)) %}
  • diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig index 62ccec7945..4316a7c390 100644 --- a/resources/views/preferences/index.twig +++ b/resources/views/preferences/index.twig @@ -101,7 +101,7 @@
  • {# conversion back to primary currency #} - {% if FireflyConfig.get('enable_exchange_rates', config('cer.enabled')) %} + {% if fireflyiiiconfig('enable_exchange_rates', true) %}

    {{ 'pref_convert_to_primary'|_ }}

    From 75c76bb6dde8660431e91b790d58d95d9f09c48b Mon Sep 17 00:00:00 2001 From: JC5 Date: Fri, 26 Dec 2025 20:07:06 +0100 Subject: [PATCH 25/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-26?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/php-cs-fixer/composer.lock | 12 +- app/Http/Controllers/HomeController.php | 1 - .../Internal/Update/JournalUpdateService.php | 123 +++++++++--------- app/Support/Twig/General.php | 3 +- composer.lock | 100 +++++++------- config/firefly.php | 6 +- package-lock.json | 12 +- 7 files changed, 129 insertions(+), 128 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 882c19b221..fbdfac4a68 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -731,16 +731,16 @@ }, { "name": "react/child-process", - "version": "v0.6.6", + "version": "v0.6.7", "source": { "type": "git", "url": "https://github.com/reactphp/child-process.git", - "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159" + "reference": "970f0e71945556422ee4570ccbabaedc3cf04ad3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/child-process/zipball/1721e2b93d89b745664353b9cfc8f155ba8a6159", - "reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/970f0e71945556422ee4570ccbabaedc3cf04ad3", + "reference": "970f0e71945556422ee4570ccbabaedc3cf04ad3", "shasum": "" }, "require": { @@ -794,7 +794,7 @@ ], "support": { "issues": "https://github.com/reactphp/child-process/issues", - "source": "https://github.com/reactphp/child-process/tree/v0.6.6" + "source": "https://github.com/reactphp/child-process/tree/v0.6.7" }, "funding": [ { @@ -802,7 +802,7 @@ "type": "open_collective" } ], - "time": "2025-01-01T16:37:48+00:00" + "time": "2025-12-23T15:25:20+00:00" }, { "name": "react/dns", diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index df6b973e92..67118821c6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; -use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index d69a70779b..c528cd2e40 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('[a] Amount is now "%s"', $value)); try { @@ -678,7 +678,7 @@ class JournalUpdateService $this->destinationTransaction->refresh(); Log::debug(sprintf('Updated amount to "%s"', $amount)); - $group = $this->transactionGroup; + $group = $this->transactionGroup; if (null === $group) { $group = $this->transactionJournal?->transactionGroup; } @@ -687,17 +687,18 @@ class JournalUpdateService } if (0 === bccomp($origSourceTransaction->amount, $originalSourceAmount)) { Log::debug('Amount was not actually changed, return.'); + return; } Log::debug('Amount was changed.'); - $transfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type; - $withdrawal = TransactionTypeEnum::WITHDRAWAL->value === $this->transactionJournal->transactionType->type; - $deposit = TransactionTypeEnum::DEPOSIT->value === $this->transactionJournal->transactionType->type; - $makePositive = $transfer || $deposit ? true : false; + $transfer = TransactionTypeEnum::TRANSFER->value === $this->transactionJournal->transactionType->type; + $withdrawal = TransactionTypeEnum::WITHDRAWAL->value === $this->transactionJournal->transactionType->type; + $deposit = TransactionTypeEnum::DEPOSIT->value === $this->transactionJournal->transactionType->type; + $makePositive = $transfer || $deposit ? true : false; // assume withdrawal, use the source for amount (negative), and destination for currency. - $originalAmount = $originalSourceAmount; - $recordCurrency = $destTransaction->transactionCurrency; + $originalAmount = $originalSourceAmount; + $recordCurrency = $destTransaction->transactionCurrency; Log::debug(sprintf('Transaction is a %s, original amount is %s and currency is %s', $this->transactionJournal->transactionType->type, $originalAmount, $recordCurrency->code)); if ($withdrawal || $transfer) { Log::debug('Use these values to record a changed withdrawal amount'); @@ -708,24 +709,24 @@ class JournalUpdateService Log::debug('Use destination amount to record a changed withdrawal amount'); Log::debug(sprintf('Transaction is a %s, original amount now is %s and currency is now %s', $this->transactionJournal->transactionType->type, $originalAmount, $recordCurrency->code)); } - $originalAmount = $makePositive ? Steam::positive($originalAmount) : Steam::negative($originalAmount); - $value = $makePositive ? Steam::positive($value) : Steam::negative($value); + $originalAmount = $makePositive ? Steam::positive($originalAmount) : Steam::negative($originalAmount); + $value = $makePositive ? Steam::positive($value) : Steam::negative($value); // should not return in NULL but seems to do. event(new TriggeredAuditLog( - $group->user, - $group, - 'update_amount', - [ - 'currency_symbol' => $recordCurrency->symbol, - 'decimal_places' => $recordCurrency->decimal_places, - 'amount' => $originalAmount, - ], - [ - 'currency_symbol' => $recordCurrency->symbol, - 'decimal_places' => $recordCurrency->decimal_places, - 'amount' => $value, - ] - )); + $group->user, + $group, + 'update_amount', + [ + 'currency_symbol' => $recordCurrency->symbol, + 'decimal_places' => $recordCurrency->decimal_places, + 'amount' => $originalAmount, + ], + [ + 'currency_symbol' => $recordCurrency->symbol, + 'decimal_places' => $recordCurrency->decimal_places, + 'amount' => $value, + ] + )); } private function updateForeignAmount(): void @@ -763,9 +764,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'); @@ -801,8 +802,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)); } @@ -816,7 +817,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(); @@ -831,15 +832,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/Twig/General.php b/app/Support/Twig/General.php index cbd22d9119..e9caec56ff 100644 --- a/app/Support/Twig/General.php +++ b/app/Support/Twig/General.php @@ -396,7 +396,8 @@ class General extends AbstractExtension ); } - private function fireflyIIIConfig() { + private function fireflyIIIConfig() + { return new TwigFunction( 'fireflyiiiconfig', static function (string $string, mixed $default): mixed { diff --git a/composer.lock b/composer.lock index 680e4272fb..961b646e9a 100644 --- a/composer.lock +++ b/composer.lock @@ -1878,16 +1878,16 @@ }, { "name": "laravel/framework", - "version": "v12.43.1", + "version": "v12.44.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "195b893593a9298edee177c0844132ebaa02102f" + "reference": "592bbf1c036042958332eb98e3e8131b29102f33" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/195b893593a9298edee177c0844132ebaa02102f", - "reference": "195b893593a9298edee177c0844132ebaa02102f", + "url": "https://api.github.com/repos/laravel/framework/zipball/592bbf1c036042958332eb98e3e8131b29102f33", + "reference": "592bbf1c036042958332eb98e3e8131b29102f33", "shasum": "" }, "require": { @@ -2096,7 +2096,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-12-16T18:53:08+00:00" + "time": "2025-12-23T15:29:43+00:00" }, { "name": "laravel/passport", @@ -3894,16 +3894,16 @@ }, { "name": "nette/utils", - "version": "v4.1.0", + "version": "v4.1.1", "source": { "type": "git", "url": "https://github.com/nette/utils.git", - "reference": "fa1f0b8261ed150447979eb22e373b7b7ad5a8e0" + "reference": "c99059c0315591f1a0db7ad6002000288ab8dc72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nette/utils/zipball/fa1f0b8261ed150447979eb22e373b7b7ad5a8e0", - "reference": "fa1f0b8261ed150447979eb22e373b7b7ad5a8e0", + "url": "https://api.github.com/repos/nette/utils/zipball/c99059c0315591f1a0db7ad6002000288ab8dc72", + "reference": "c99059c0315591f1a0db7ad6002000288ab8dc72", "shasum": "" }, "require": { @@ -3977,9 +3977,9 @@ ], "support": { "issues": "https://github.com/nette/utils/issues", - "source": "https://github.com/nette/utils/tree/v4.1.0" + "source": "https://github.com/nette/utils/tree/v4.1.1" }, - "time": "2025-12-01T17:49:23+00:00" + "time": "2025-12-22T12:14:32+00:00" }, { "name": "nunomaduro/collision", @@ -6204,16 +6204,16 @@ }, { "name": "spatie/laravel-html", - "version": "3.12.1", + "version": "3.12.3", "source": { "type": "git", "url": "https://github.com/spatie/laravel-html.git", - "reference": "72af3cad24d153c230ff6e1da9fa3b7b702834c9" + "reference": "dd4a946ea9e2d7af8945fdfcf282663c69fac26a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-html/zipball/72af3cad24d153c230ff6e1da9fa3b7b702834c9", - "reference": "72af3cad24d153c230ff6e1da9fa3b7b702834c9", + "url": "https://api.github.com/repos/spatie/laravel-html/zipball/dd4a946ea9e2d7af8945fdfcf282663c69fac26a", + "reference": "dd4a946ea9e2d7af8945fdfcf282663c69fac26a", "shasum": "" }, "require": { @@ -6270,7 +6270,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/laravel-html/tree/3.12.1" + "source": "https://github.com/spatie/laravel-html/tree/3.12.3" }, "funding": [ { @@ -6278,7 +6278,7 @@ "type": "custom" } ], - "time": "2025-10-02T07:26:38+00:00" + "time": "2025-12-22T12:05:50+00:00" }, { "name": "spatie/laravel-ignition", @@ -10078,16 +10078,16 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v3.16.2", + "version": "v3.16.3", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "730dbf8bf41f5691e026dd771e64dd54ad1b10b3" + "reference": "c91e57ea113edd6526f5b8cd6b1c6ee02c67b28e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/730dbf8bf41f5691e026dd771e64dd54ad1b10b3", - "reference": "730dbf8bf41f5691e026dd771e64dd54ad1b10b3", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/c91e57ea113edd6526f5b8cd6b1c6ee02c67b28e", + "reference": "c91e57ea113edd6526f5b8cd6b1c6ee02c67b28e", "shasum": "" }, "require": { @@ -10096,7 +10096,7 @@ "illuminate/support": "^10|^11|^12", "php": "^8.1", "php-debugbar/php-debugbar": "^2.2.4", - "symfony/finder": "^6|^7" + "symfony/finder": "^6|^7|^8" }, "require-dev": { "mockery/mockery": "^1.3.3", @@ -10147,7 +10147,7 @@ ], "support": { "issues": "https://github.com/barryvdh/laravel-debugbar/issues", - "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.16.2" + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.16.3" }, "funding": [ { @@ -10159,7 +10159,7 @@ "type": "github" } ], - "time": "2025-12-03T14:52:46+00:00" + "time": "2025-12-23T17:37:00+00:00" }, { "name": "barryvdh/laravel-ide-helper", @@ -10515,16 +10515,16 @@ }, { "name": "driftingly/rector-laravel", - "version": "2.1.8", + "version": "2.1.9", "source": { "type": "git", "url": "https://github.com/driftingly/rector-laravel.git", - "reference": "5c5f97354e562b6742b2b7989959061bde60fa71" + "reference": "aee9d4a1d489e7ec484fc79f33137f8ee051b3f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/5c5f97354e562b6742b2b7989959061bde60fa71", - "reference": "5c5f97354e562b6742b2b7989959061bde60fa71", + "url": "https://api.github.com/repos/driftingly/rector-laravel/zipball/aee9d4a1d489e7ec484fc79f33137f8ee051b3f7", + "reference": "aee9d4a1d489e7ec484fc79f33137f8ee051b3f7", "shasum": "" }, "require": { @@ -10545,9 +10545,9 @@ "description": "Rector upgrades rules for Laravel Framework", "support": { "issues": "https://github.com/driftingly/rector-laravel/issues", - "source": "https://github.com/driftingly/rector-laravel/tree/2.1.8" + "source": "https://github.com/driftingly/rector-laravel/tree/2.1.9" }, - "time": "2025-12-17T15:29:24+00:00" + "time": "2025-12-25T23:31:36+00:00" }, { "name": "fakerphp/faker", @@ -11180,16 +11180,16 @@ }, { "name": "php-debugbar/php-debugbar", - "version": "v2.2.5", + "version": "v2.2.6", "source": { "type": "git", "url": "https://github.com/php-debugbar/php-debugbar.git", - "reference": "c5dce08e98dd101c771e55949fd89124b216271d" + "reference": "abb9fa3c5c8dbe7efe03ddba56782917481de3e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/c5dce08e98dd101c771e55949fd89124b216271d", - "reference": "c5dce08e98dd101c771e55949fd89124b216271d", + "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/abb9fa3c5c8dbe7efe03ddba56782917481de3e8", + "reference": "abb9fa3c5c8dbe7efe03ddba56782917481de3e8", "shasum": "" }, "require": { @@ -11248,9 +11248,9 @@ ], "support": { "issues": "https://github.com/php-debugbar/php-debugbar/issues", - "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.5" + "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.2.6" }, - "time": "2025-12-21T08:50:08+00:00" + "time": "2025-12-22T13:21:32+00:00" }, { "name": "phpstan/extension-installer", @@ -11450,16 +11450,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "12.5.1", + "version": "12.5.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "c467c59a4f6e04b942be422844e7a6352fa01b57" + "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c467c59a4f6e04b942be422844e7a6352fa01b57", - "reference": "c467c59a4f6e04b942be422844e7a6352fa01b57", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/4a9739b51cbcb355f6e95659612f92e282a7077b", + "reference": "4a9739b51cbcb355f6e95659612f92e282a7077b", "shasum": "" }, "require": { @@ -11474,7 +11474,7 @@ "sebastian/environment": "^8.0.3", "sebastian/lines-of-code": "^4.0", "sebastian/version": "^6.0", - "theseer/tokenizer": "^2.0" + "theseer/tokenizer": "^2.0.1" }, "require-dev": { "phpunit/phpunit": "^12.5.1" @@ -11515,7 +11515,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.1" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/12.5.2" }, "funding": [ { @@ -11535,7 +11535,7 @@ "type": "tidelift" } ], - "time": "2025-12-08T07:17:58+00:00" + "time": "2025-12-24T07:03:04+00:00" }, { "name": "phpunit/php-file-iterator", @@ -11889,16 +11889,16 @@ }, { "name": "rector/rector", - "version": "2.2.14", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "6d56bb0e94d4df4f57a78610550ac76ab403657d" + "reference": "f7166355dcf47482f27be59169b0825995f51c7d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/6d56bb0e94d4df4f57a78610550ac76ab403657d", - "reference": "6d56bb0e94d4df4f57a78610550ac76ab403657d", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/f7166355dcf47482f27be59169b0825995f51c7d", + "reference": "f7166355dcf47482f27be59169b0825995f51c7d", "shasum": "" }, "require": { @@ -11937,7 +11937,7 @@ ], "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/2.2.14" + "source": "https://github.com/rectorphp/rector/tree/2.3.0" }, "funding": [ { @@ -11945,7 +11945,7 @@ "type": "github" } ], - "time": "2025-12-09T10:57:55+00:00" + "time": "2025-12-25T22:00:18+00:00" }, { "name": "sebastian/cli-parser", @@ -13087,5 +13087,5 @@ "ext-xmlwriter": "*" }, "platform-dev": {}, - "plugin-api-version": "2.6.0" + "plugin-api-version": "2.9.0" } diff --git a/config/firefly.php b/config/firefly.php index 0767441194..f6fd825751 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -75,11 +75,11 @@ return [ 'webhooks' => true, 'handle_debts' => true, 'expression_engine' => true, - 'running_balance_column' =>(bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. + 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-22', - 'build_time' => 1766374469, + 'version' => 'develop/2025-12-26', + 'build_time' => 1766775913, '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 9b556be2e2..a32d405071 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6183,9 +6183,9 @@ } }, "node_modules/fastq": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", - "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", + "version": "1.20.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz", + "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==", "dev": true, "license": "ISC", "dependencies": { @@ -11710,9 +11710,9 @@ } }, "node_modules/watchpack": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz", - "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.5.0.tgz", + "integrity": "sha512-e6vZvY6xboSwLz2GD36c16+O/2Z6fKvIf4pOXptw2rY9MVwE/TXc6RGqxD3I3x0a28lwBY7DE+76uTPSsBrrCA==", "dev": true, "license": "MIT", "dependencies": { From d9efd63fadbd14cf30adfd217ada1e8cd4cad883 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 27 Dec 2025 12:45:46 +0100 Subject: [PATCH 26/58] Add debug details. --- resources/views/list/groups.twig | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/resources/views/list/groups.twig b/resources/views/list/groups.twig index 9c28b65a85..a5178409db 100644 --- a/resources/views/list/groups.twig +++ b/resources/views/list/groups.twig @@ -268,12 +268,13 @@ {% if (fireflyiiiconfig('use_running_balance', true)) %} + {# RUNNING BALANCE #} {% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %} {% if transaction.transaction_type_type == 'Deposit' %} {% if transaction.source_account_id == account.id %} - {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% else %} - {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% endif %} {% elseif transaction.transaction_type_type == 'Withdrawal' %} @@ -281,39 +282,39 @@ {% if 'Loan' == transaction.destination_account_type or 'Mortgage' == transaction.destination_account_type or 'Debt' == transaction.destination_account_type %} {% if currency.id == transaction.currency_id %} {% if account.id == transaction.source_account_id %} - {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% elseif account.id == transaction.destination_account_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% else %} - {% endif %} {% endif %} {% if currency.id == transaction.foreign_currency_id and null != transaction.destination_balance_after and null != transaction.destination_balance_after %} - {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.foreign_currency_symbol ?? transaction.currency_symbol, transaction.foreign_currency_decimal_places ?? transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.foreign_currency_symbol ?? transaction.currency_symbol, transaction.foreign_currency_decimal_places ?? transaction.currency_decimal_places) }} {% endif %} {# withdrawal into an expense account #} {% else %} {% if account.id == transaction.source_account_id %} - {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% elseif account.id == transaction.destination_account_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% else %} - {% endif %} {% endif %} {% elseif transaction.transaction_type_type == 'Opening balance' %} {% if account.id == transaction.source_account_id %} - {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% elseif account.id == transaction.destination_account_id %} - {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} - {% else %} + {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {% else %} - {% endif %} {% elseif transaction.transaction_type_type == 'Transfer' %} {% if account.id == transaction.source_account_id %} - {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% else %} - {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} + {{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }} {% endif %} {% else %}   From 6e6e42dab6d7a57395bcad8b7208df0280c3bd66 Mon Sep 17 00:00:00 2001 From: JC5 Date: Sat, 27 Dec 2025 12:49:53 +0100 Subject: [PATCH 27/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-27?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/firefly.php b/config/firefly.php index f6fd825751..55b44c07b0 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-26', - 'build_time' => 1766775913, + 'version' => 'develop/2025-12-27', + 'build_time' => 1766836093, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From f0e2f09da7a64175250e0d58febc998e7420985d Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 28 Dec 2025 06:54:03 +0100 Subject: [PATCH 28/58] Fix some end of period stuff. --- .../Commands/Correction/CorrectsAmounts.php | 7 +- app/Http/Controllers/HomeController.php | 1 + .../Models/AccountBalanceCalculator.php | 1 + app/Support/Navigation.php | 78 ++++++++++++------- 4 files changed, 54 insertions(+), 33 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index db544dca49..522794c082 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -84,7 +84,8 @@ class CorrectsAmounts extends Command /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $type = TransactionType::where('type', TransactionTypeEnum::TRANSFER->value)->first(); - $journals = TransactionJournal::where('transaction_type_id', $type->id)->get(); + $journals = TransactionJournal:: + leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')->whereNotNull('transactions.foreign_amount')->where('transaction_journals.transaction_type_id', $type->id)->distinct()->get(['transaction_journals.*']); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { @@ -93,7 +94,7 @@ class CorrectsAmounts extends Command $valid = $this->validateJournal($journal); if (false === $valid) { - Log::debug(sprintf('Journal #%d does not need to be fixed or is invalid (see previous messages)', $journal->id)); + // Log::debug(sprintf('Journal #%d does not need to be fixed or is invalid (see previous messages)', $journal->id)); continue; } @@ -298,7 +299,7 @@ class CorrectsAmounts extends Command return false; } if (null === $source->foreign_currency_id || null === $destination->foreign_currency_id) { - Log::debug('No foreign currency information is present, can safely continue with other transactions.'); + // Log::debug('No foreign currency information is present, can safely continue with other transactions.'); return false; } diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 67118821c6..f96f0e501d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; +use FireflyIII\Support\Facades\Navigation; use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index a828eead5b..93d8b32b74 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -78,6 +78,7 @@ class AccountBalanceCalculator private function getLatestBalance(int $accountId, int $currencyId, ?Carbon $notBefore): string { if (!$notBefore instanceof Carbon) { + Log::debug(sprintf('Start balance for account #%d and currency #%d is 0.', $accountId, $currencyId)); return '0'; } Log::debug(sprintf('getLatestBalance: notBefore date is "%s", calculating', $notBefore->format('Y-m-d'))); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 27fd34dd03..b62da66414 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -23,16 +23,16 @@ declare(strict_types=1); namespace FireflyIII\Support; -use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\IntervalException; use FireflyIII\Helpers\Fiscal\FiscalHelperInterface; use FireflyIII\Support\Calendar\Calculator; use FireflyIII\Support\Calendar\Periodicity; +use FireflyIII\Support\Facades\Preferences; +use FireflyIII\Support\Facades\Steam; use Illuminate\Support\Facades\Log; use Throwable; -use FireflyIII\Support\Facades\Steam; /** * Class Navigation. @@ -79,10 +79,10 @@ class Navigation if (!array_key_exists($repeatFreq, $functionMap)) { Log::error(sprintf( - 'The periodicity %s is unknown. Choose one of available periodicity: %s', - $repeatFreq, - implode(', ', array_keys($functionMap)) - )); + 'The periodicity %s is unknown. Choose one of available periodicity: %s', + $repeatFreq, + implode(', ', array_keys($functionMap)) + )); return $theDate; } @@ -95,7 +95,7 @@ class Navigation if ($end < $start) { [$start, $end] = [$end, $start]; } - $periods = []; + $periods = []; // first, 13 periods of [range] $loopCount = 0; $loopDate = clone $end; @@ -153,7 +153,7 @@ class Navigation public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int { Log::debug(sprintf('diffInPeriods: %s (skip: %d), between %s and %s.', $period, $skip, $beginning->format('Y-m-d'), $end->format('Y-m-d'))); - $map = [ + $map = [ 'daily' => 'diffInDays', 'weekly' => 'diffInWeeks', 'monthly' => 'diffInMonths', @@ -166,7 +166,7 @@ class Navigation return 1; } - $func = $map[$period]; + $func = $map[$period]; // first do the diff $floatDiff = $beginning->{$func}($end, true); // @phpstan-ignore-line @@ -181,7 +181,7 @@ class Navigation } // then do ceil() - $diff = ceil($floatDiff); + $diff = ceil($floatDiff); Log::debug(sprintf('Diff is %f periods (%d rounded up)', $floatDiff, $diff)); @@ -189,11 +189,11 @@ class Navigation $parameter = $skip + 1; $diff = ceil($diff / $parameter) * $parameter; Log::debug(sprintf( - 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d', - $skip, - $parameter, - $diff - )); + 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d', + $skip, + $parameter, + $diff + )); } return (int)$diff; @@ -201,7 +201,7 @@ class Navigation public function endOfPeriod(Carbon $end, string $repeatFreq): Carbon { - $currentEnd = clone $end; + $currentEnd = clone $end; // Log::debug(sprintf('Now in endOfPeriod("%s", "%s").', $currentEnd->toIso8601String(), $repeatFreq)); if ('MTD' === $repeatFreq && $end->isFuture()) { @@ -214,6 +214,11 @@ class Navigation Log::debug('endOfPeriod() requests "YTD" + future, set it to "1Y" instead.'); $repeatFreq = '1Y'; } + if ('QTD' === $repeatFreq && $end->isFuture()) { + // fall back to a yearly schedule if the requested period is YTD. + Log::debug('endOfPeriod() requests "YTD" + future, set it to "3M" instead.'); + $repeatFreq = '3M'; + } $functionMap = [ '1D' => 'endOfDay', @@ -246,7 +251,7 @@ class Navigation Log::debug('Session data available.'); /** @var Carbon $tStart */ - $tStart = session('start', today(config('app.timezone'))->startOfMonth()); + $tStart = session('start', today(config('app.timezone'))->startOfMonth()); /** @var Carbon $tEnd */ $tEnd = session('end', today(config('app.timezone'))->endOfMonth()); @@ -282,7 +287,7 @@ class Navigation return $end->endOfMonth(); } - $result = match ($repeatFreq) { + $result = match ($repeatFreq) { 'last7' => $currentEnd->addDays(7)->startOfDay(), 'last30' => $currentEnd->addDays(30)->startOfDay(), 'last90' => $currentEnd->addDays(90)->startOfDay(), @@ -295,7 +300,20 @@ class Navigation if (null !== $result) { // add sanity check. if ($currentEnd->lt($end)) { - throw new FireflyException(sprintf('[d] endOfPeriod(%s, %s) failed, because it resulted in %s.', $end->toW3cString(), $repeatFreq, $currentEnd->toW3cString())); + switch ($repeatFreq) { + case 'QTD': + $currentEnd->endOfQuarter()->setMilli(0); + break; + case 'MTD': + $currentEnd->endOfMonth()->setMilli(0); + break; + case 'YTD': + $currentEnd->endOfYear()->setMilli(0); + break; + } + if ($currentEnd->lt($end)) { + throw new FireflyException(sprintf('[d] endOfPeriod(%s, %s) failed, because it resulted in %s.', $end->toW3cString(), $repeatFreq, $currentEnd->toW3cString())); + } } return $result; @@ -312,7 +330,7 @@ class Navigation return $end; } - $function = $functionMap[$repeatFreq]; + $function = $functionMap[$repeatFreq]; if (array_key_exists($repeatFreq, $modifierMap)) { $currentEnd->{$function}($modifierMap[$repeatFreq])->milli(0); // @phpstan-ignore-line @@ -362,7 +380,7 @@ class Navigation 'yearly' => 'endOfYear', ]; - $currentEnd = clone $theCurrentEnd; + $currentEnd = clone $theCurrentEnd; if (array_key_exists($repeatFreq, $functionMap)) { $function = $functionMap[$repeatFreq]; @@ -405,7 +423,7 @@ class Navigation */ public function listOfPeriods(Carbon $start, Carbon $end): array { - $locale = Steam::getLocale(); + $locale = Steam::getLocale(); // define period to increment $increment = 'addDay'; $format = $this->preferredCarbonFormat($start, $end); @@ -422,8 +440,8 @@ class Navigation $increment = 'addYear'; $displayFormat = (string)trans('config.year_js'); } - $begin = clone $start; - $entries = []; + $begin = clone $start; + $entries = []; while ($begin < $end) { $formatted = $begin->format($format); $displayed = $begin->isoFormat($displayFormat); @@ -606,9 +624,9 @@ class Navigation public function startOfPeriod(Carbon $theDate, string $repeatFreq): Carbon { - $date = clone $theDate; + $date = clone $theDate; // Log::debug(sprintf('Now in startOfPeriod("%s", "%s")', $date->toIso8601String(), $repeatFreq)); - $functionMap = [ + $functionMap = [ '1D' => 'startOfDay', 'daily' => 'startOfDay', '1W' => 'startOfWeek', @@ -655,7 +673,7 @@ class Navigation return $date; } - $result = match ($repeatFreq) { + $result = match ($repeatFreq) { 'last7' => $date->subDays(7)->startOfDay(), 'last30' => $date->subDays(30)->startOfDay(), 'last90' => $date->subDays(90)->startOfDay(), @@ -687,7 +705,7 @@ class Navigation public function subtractPeriod(Carbon $theDate, string $repeatFreq, ?int $subtract = null): Carbon { $subtract ??= 1; - $date = clone $theDate; + $date = clone $theDate; // 1D 1W 1M 3M 6M 1Y $functionMap = [ '1D' => 'subDays', @@ -726,7 +744,7 @@ class Navigation // this is then subtracted from $theDate (* $subtract). if ('custom' === $repeatFreq) { /** @var Carbon $tStart */ - $tStart = session('start', today(config('app.timezone'))->startOfMonth()); + $tStart = session('start', today(config('app.timezone'))->startOfMonth()); /** @var Carbon $tEnd */ $tEnd = session('end', today(config('app.timezone'))->endOfMonth()); @@ -820,7 +838,7 @@ class Navigation return $fiscalHelper->endOfFiscalYear($end); } - $list = [ + $list = [ 'last7', 'last30', 'last90', From ff3a935e9d1c6d3b3e3996329b7ef77928f18a6c Mon Sep 17 00:00:00 2001 From: JC5 Date: Sun, 28 Dec 2025 06:59:39 +0100 Subject: [PATCH 29/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-28?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Commands/Correction/CorrectsAmounts.php | 3 +- app/Http/Controllers/HomeController.php | 1 - .../Models/AccountBalanceCalculator.php | 1 + app/Support/Navigation.php | 59 +++++++++------- composer.lock | 70 +++++++++---------- config/firefly.php | 4 +- package-lock.json | 6 +- 7 files changed, 74 insertions(+), 70 deletions(-) diff --git a/app/Console/Commands/Correction/CorrectsAmounts.php b/app/Console/Commands/Correction/CorrectsAmounts.php index 522794c082..74f3826dcf 100644 --- a/app/Console/Commands/Correction/CorrectsAmounts.php +++ b/app/Console/Commands/Correction/CorrectsAmounts.php @@ -84,8 +84,7 @@ class CorrectsAmounts extends Command /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $type = TransactionType::where('type', TransactionTypeEnum::TRANSFER->value)->first(); - $journals = TransactionJournal:: - leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')->whereNotNull('transactions.foreign_amount')->where('transaction_journals.transaction_type_id', $type->id)->distinct()->get(['transaction_journals.*']); + $journals = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')->whereNotNull('transactions.foreign_amount')->where('transaction_journals.transaction_type_id', $type->id)->distinct()->get(['transaction_journals.*']); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f96f0e501d..67118821c6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; -use FireflyIII\Support\Facades\Navigation; use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index 93d8b32b74..ddb91a412b 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -79,6 +79,7 @@ class AccountBalanceCalculator { if (!$notBefore instanceof Carbon) { Log::debug(sprintf('Start balance for account #%d and currency #%d is 0.', $accountId, $currencyId)); + return '0'; } Log::debug(sprintf('getLatestBalance: notBefore date is "%s", calculating', $notBefore->format('Y-m-d'))); diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index b62da66414..88b53c03e7 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -79,10 +79,10 @@ class Navigation if (!array_key_exists($repeatFreq, $functionMap)) { Log::error(sprintf( - 'The periodicity %s is unknown. Choose one of available periodicity: %s', - $repeatFreq, - implode(', ', array_keys($functionMap)) - )); + 'The periodicity %s is unknown. Choose one of available periodicity: %s', + $repeatFreq, + implode(', ', array_keys($functionMap)) + )); return $theDate; } @@ -95,7 +95,7 @@ class Navigation if ($end < $start) { [$start, $end] = [$end, $start]; } - $periods = []; + $periods = []; // first, 13 periods of [range] $loopCount = 0; $loopDate = clone $end; @@ -153,7 +153,7 @@ class Navigation public function diffInPeriods(string $period, int $skip, Carbon $beginning, Carbon $end): int { Log::debug(sprintf('diffInPeriods: %s (skip: %d), between %s and %s.', $period, $skip, $beginning->format('Y-m-d'), $end->format('Y-m-d'))); - $map = [ + $map = [ 'daily' => 'diffInDays', 'weekly' => 'diffInWeeks', 'monthly' => 'diffInMonths', @@ -166,7 +166,7 @@ class Navigation return 1; } - $func = $map[$period]; + $func = $map[$period]; // first do the diff $floatDiff = $beginning->{$func}($end, true); // @phpstan-ignore-line @@ -181,7 +181,7 @@ class Navigation } // then do ceil() - $diff = ceil($floatDiff); + $diff = ceil($floatDiff); Log::debug(sprintf('Diff is %f periods (%d rounded up)', $floatDiff, $diff)); @@ -189,11 +189,11 @@ class Navigation $parameter = $skip + 1; $diff = ceil($diff / $parameter) * $parameter; Log::debug(sprintf( - 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d', - $skip, - $parameter, - $diff - )); + 'diffInPeriods: skip is %d, so param is %d, and diff becomes %d', + $skip, + $parameter, + $diff + )); } return (int)$diff; @@ -201,7 +201,7 @@ class Navigation public function endOfPeriod(Carbon $end, string $repeatFreq): Carbon { - $currentEnd = clone $end; + $currentEnd = clone $end; // Log::debug(sprintf('Now in endOfPeriod("%s", "%s").', $currentEnd->toIso8601String(), $repeatFreq)); if ('MTD' === $repeatFreq && $end->isFuture()) { @@ -251,7 +251,7 @@ class Navigation Log::debug('Session data available.'); /** @var Carbon $tStart */ - $tStart = session('start', today(config('app.timezone'))->startOfMonth()); + $tStart = session('start', today(config('app.timezone'))->startOfMonth()); /** @var Carbon $tEnd */ $tEnd = session('end', today(config('app.timezone'))->endOfMonth()); @@ -287,7 +287,7 @@ class Navigation return $end->endOfMonth(); } - $result = match ($repeatFreq) { + $result = match ($repeatFreq) { 'last7' => $currentEnd->addDays(7)->startOfDay(), 'last30' => $currentEnd->addDays(30)->startOfDay(), 'last90' => $currentEnd->addDays(90)->startOfDay(), @@ -303,12 +303,17 @@ class Navigation switch ($repeatFreq) { case 'QTD': $currentEnd->endOfQuarter()->setMilli(0); + break; + case 'MTD': $currentEnd->endOfMonth()->setMilli(0); + break; + case 'YTD': $currentEnd->endOfYear()->setMilli(0); + break; } if ($currentEnd->lt($end)) { @@ -330,7 +335,7 @@ class Navigation return $end; } - $function = $functionMap[$repeatFreq]; + $function = $functionMap[$repeatFreq]; if (array_key_exists($repeatFreq, $modifierMap)) { $currentEnd->{$function}($modifierMap[$repeatFreq])->milli(0); // @phpstan-ignore-line @@ -380,7 +385,7 @@ class Navigation 'yearly' => 'endOfYear', ]; - $currentEnd = clone $theCurrentEnd; + $currentEnd = clone $theCurrentEnd; if (array_key_exists($repeatFreq, $functionMap)) { $function = $functionMap[$repeatFreq]; @@ -423,7 +428,7 @@ class Navigation */ public function listOfPeriods(Carbon $start, Carbon $end): array { - $locale = Steam::getLocale(); + $locale = Steam::getLocale(); // define period to increment $increment = 'addDay'; $format = $this->preferredCarbonFormat($start, $end); @@ -440,8 +445,8 @@ class Navigation $increment = 'addYear'; $displayFormat = (string)trans('config.year_js'); } - $begin = clone $start; - $entries = []; + $begin = clone $start; + $entries = []; while ($begin < $end) { $formatted = $begin->format($format); $displayed = $begin->isoFormat($displayFormat); @@ -624,9 +629,9 @@ class Navigation public function startOfPeriod(Carbon $theDate, string $repeatFreq): Carbon { - $date = clone $theDate; + $date = clone $theDate; // Log::debug(sprintf('Now in startOfPeriod("%s", "%s")', $date->toIso8601String(), $repeatFreq)); - $functionMap = [ + $functionMap = [ '1D' => 'startOfDay', 'daily' => 'startOfDay', '1W' => 'startOfWeek', @@ -673,7 +678,7 @@ class Navigation return $date; } - $result = match ($repeatFreq) { + $result = match ($repeatFreq) { 'last7' => $date->subDays(7)->startOfDay(), 'last30' => $date->subDays(30)->startOfDay(), 'last90' => $date->subDays(90)->startOfDay(), @@ -705,7 +710,7 @@ class Navigation public function subtractPeriod(Carbon $theDate, string $repeatFreq, ?int $subtract = null): Carbon { $subtract ??= 1; - $date = clone $theDate; + $date = clone $theDate; // 1D 1W 1M 3M 6M 1Y $functionMap = [ '1D' => 'subDays', @@ -744,7 +749,7 @@ class Navigation // this is then subtracted from $theDate (* $subtract). if ('custom' === $repeatFreq) { /** @var Carbon $tStart */ - $tStart = session('start', today(config('app.timezone'))->startOfMonth()); + $tStart = session('start', today(config('app.timezone'))->startOfMonth()); /** @var Carbon $tEnd */ $tEnd = session('end', today(config('app.timezone'))->endOfMonth()); @@ -838,7 +843,7 @@ class Navigation return $fiscalHelper->endOfFiscalYear($end); } - $list = [ + $list = [ 'last7', 'last30', 'last90', diff --git a/composer.lock b/composer.lock index 961b646e9a..d6dc3ad826 100644 --- a/composer.lock +++ b/composer.lock @@ -1182,24 +1182,24 @@ }, { "name": "graham-campbell/result-type", - "version": "v1.1.3", + "version": "v1.1.4", "source": { "type": "git", "url": "https://github.com/GrahamCampbell/Result-Type.git", - "reference": "3ba905c11371512af9d9bdd27d99b782216b6945" + "reference": "e01f4a821471308ba86aa202fed6698b6b695e3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/3ba905c11371512af9d9bdd27d99b782216b6945", - "reference": "3ba905c11371512af9d9bdd27d99b782216b6945", + "url": "https://api.github.com/repos/GrahamCampbell/Result-Type/zipball/e01f4a821471308ba86aa202fed6698b6b695e3b", + "reference": "e01f4a821471308ba86aa202fed6698b6b695e3b", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.3" + "phpoption/phpoption": "^1.9.5" }, "require-dev": { - "phpunit/phpunit": "^8.5.39 || ^9.6.20 || ^10.5.28" + "phpunit/phpunit": "^8.5.41 || ^9.6.22 || ^10.5.45 || ^11.5.7" }, "type": "library", "autoload": { @@ -1228,7 +1228,7 @@ ], "support": { "issues": "https://github.com/GrahamCampbell/Result-Type/issues", - "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.3" + "source": "https://github.com/GrahamCampbell/Result-Type/tree/v1.1.4" }, "funding": [ { @@ -1240,7 +1240,7 @@ "type": "tidelift" } ], - "time": "2024-07-20T21:45:45+00:00" + "time": "2025-12-27T19:43:20+00:00" }, { "name": "guzzlehttp/guzzle", @@ -2813,16 +2813,16 @@ }, { "name": "league/csv", - "version": "9.27.1", + "version": "9.28.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "26de738b8fccf785397d05ee2fc07b6cd8749797" + "reference": "6582ace29ae09ba5b07049d40ea13eb19c8b5073" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/26de738b8fccf785397d05ee2fc07b6cd8749797", - "reference": "26de738b8fccf785397d05ee2fc07b6cd8749797", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/6582ace29ae09ba5b07049d40ea13eb19c8b5073", + "reference": "6582ace29ae09ba5b07049d40ea13eb19c8b5073", "shasum": "" }, "require": { @@ -2832,14 +2832,14 @@ "require-dev": { "ext-dom": "*", "ext-xdebug": "*", - "friendsofphp/php-cs-fixer": "^3.75.0", - "phpbench/phpbench": "^1.4.1", - "phpstan/phpstan": "^1.12.27", + "friendsofphp/php-cs-fixer": "^3.92.3", + "phpbench/phpbench": "^1.4.3", + "phpstan/phpstan": "^1.12.32", "phpstan/phpstan-deprecation-rules": "^1.2.1", "phpstan/phpstan-phpunit": "^1.4.2", "phpstan/phpstan-strict-rules": "^1.6.2", - "phpunit/phpunit": "^10.5.16 || ^11.5.22 || ^12.3.6", - "symfony/var-dumper": "^6.4.8 || ^7.3.0" + "phpunit/phpunit": "^10.5.16 || ^11.5.22 || ^12.5.4", + "symfony/var-dumper": "^6.4.8 || ^7.4.0 || ^8.0" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", @@ -2900,7 +2900,7 @@ "type": "github" } ], - "time": "2025-10-25T08:35:20+00:00" + "time": "2025-12-27T15:18:42+00:00" }, { "name": "league/event", @@ -4749,16 +4749,16 @@ }, { "name": "phpoption/phpoption", - "version": "1.9.4", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/schmittjoh/php-option.git", - "reference": "638a154f8d4ee6a5cfa96d6a34dfbe0cffa9566d" + "reference": "75365b91986c2405cf5e1e012c5595cd487a98be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/638a154f8d4ee6a5cfa96d6a34dfbe0cffa9566d", - "reference": "638a154f8d4ee6a5cfa96d6a34dfbe0cffa9566d", + "url": "https://api.github.com/repos/schmittjoh/php-option/zipball/75365b91986c2405cf5e1e012c5595cd487a98be", + "reference": "75365b91986c2405cf5e1e012c5595cd487a98be", "shasum": "" }, "require": { @@ -4808,7 +4808,7 @@ ], "support": { "issues": "https://github.com/schmittjoh/php-option/issues", - "source": "https://github.com/schmittjoh/php-option/tree/1.9.4" + "source": "https://github.com/schmittjoh/php-option/tree/1.9.5" }, "funding": [ { @@ -4820,7 +4820,7 @@ "type": "tidelift" } ], - "time": "2025-08-21T11:53:16+00:00" + "time": "2025-12-27T19:41:33+00:00" }, { "name": "phpseclib/phpseclib", @@ -9918,26 +9918,26 @@ }, { "name": "vlucas/phpdotenv", - "version": "v5.6.2", + "version": "v5.6.3", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af" + "reference": "955e7815d677a3eaa7075231212f2110983adecc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/24ac4c74f91ee2c193fa1aaa5c249cb0822809af", - "reference": "24ac4c74f91ee2c193fa1aaa5c249cb0822809af", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/955e7815d677a3eaa7075231212f2110983adecc", + "reference": "955e7815d677a3eaa7075231212f2110983adecc", "shasum": "" }, "require": { "ext-pcre": "*", - "graham-campbell/result-type": "^1.1.3", + "graham-campbell/result-type": "^1.1.4", "php": "^7.2.5 || ^8.0", - "phpoption/phpoption": "^1.9.3", - "symfony/polyfill-ctype": "^1.24", - "symfony/polyfill-mbstring": "^1.24", - "symfony/polyfill-php80": "^1.24" + "phpoption/phpoption": "^1.9.5", + "symfony/polyfill-ctype": "^1.26", + "symfony/polyfill-mbstring": "^1.26", + "symfony/polyfill-php80": "^1.26" }, "require-dev": { "bamarni/composer-bin-plugin": "^1.8.2", @@ -9986,7 +9986,7 @@ ], "support": { "issues": "https://github.com/vlucas/phpdotenv/issues", - "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.2" + "source": "https://github.com/vlucas/phpdotenv/tree/v5.6.3" }, "funding": [ { @@ -9998,7 +9998,7 @@ "type": "tidelift" } ], - "time": "2025-04-30T23:37:27+00:00" + "time": "2025-12-27T19:49:13+00:00" }, { "name": "voku/portable-ascii", diff --git a/config/firefly.php b/config/firefly.php index 55b44c07b0..07d57ec4e2 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-27', - 'build_time' => 1766836093, + 'version' => 'develop/2025-12-28', + 'build_time' => 1766901480, '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 a32d405071..b3582a9dd1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7082,9 +7082,9 @@ } }, "node_modules/i18next-chained-backend": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/i18next-chained-backend/-/i18next-chained-backend-4.6.2.tgz", - "integrity": "sha512-2P092fR+nAPQlGzPUoIIxbwo7PTBqQYgLxwv1XhSTQUAUoelLo5LkX+FqRxxSDg9WEAsrc8+2WL6mJtMGIa6WQ==", + "version": "4.6.3", + "resolved": "https://registry.npmjs.org/i18next-chained-backend/-/i18next-chained-backend-4.6.3.tgz", + "integrity": "sha512-Yg4hAKg/98zRAMQs87vJSNevTzaPPrYF3Eb7Kpx+UEaaXLd3p69g7dulAL+hpmZQHeMQ/5gFqHVtdwva53mB0Q==", "license": "MIT", "dependencies": { "@babel/runtime": "^7.23.2" From 07c6dac766f5b213c38033b3db2e45721d6648f1 Mon Sep 17 00:00:00 2001 From: Diego Algorta Date: Sun, 28 Dec 2025 11:55:11 -0300 Subject: [PATCH 30/58] Add Uruguayan Peso to currency seeder --- database/seeders/TransactionCurrencySeeder.php | 1 + 1 file changed, 1 insertion(+) diff --git a/database/seeders/TransactionCurrencySeeder.php b/database/seeders/TransactionCurrencySeeder.php index da378388c1..12e86c9f3d 100644 --- a/database/seeders/TransactionCurrencySeeder.php +++ b/database/seeders/TransactionCurrencySeeder.php @@ -57,6 +57,7 @@ class TransactionCurrencySeeder extends Seeder $currencies[] = ['code' => 'ARS', 'name' => 'Argentinian Peso', 'symbol' => '$', 'decimal_places' => 2]; $currencies[] = ['code' => 'COP', 'name' => 'Colombian Peso', 'symbol' => '$', 'decimal_places' => 2]; $currencies[] = ['code' => 'CLP', 'name' => 'Chilean Peso', 'symbol' => '$', 'decimal_places' => 2]; + $currencies[] = ['code' => 'UYU', 'name' => 'Uruguayan Peso', 'symbol' => '$', 'decimal_places' => 2]; // oceanian currencies $currencies[] = ['code' => 'IDR', 'name' => 'Indonesian rupiah', 'symbol' => 'Rp', 'decimal_places' => 2]; From 1c8eaf93a6877be1e21fbe228a76b93f125bb27a Mon Sep 17 00:00:00 2001 From: JC5 Date: Mon, 29 Dec 2025 09:12:30 +0100 Subject: [PATCH 31/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/firefly.php b/config/firefly.php index 07d57ec4e2..25b010d494 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-28', - 'build_time' => 1766901480, + 'version' => 'develop/2025-12-29', + 'build_time' => 1766995845, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From 73a9be06051eca29af9ef826f9883f63c5e959be Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 29 Dec 2025 11:05:48 +0100 Subject: [PATCH 32/58] Fix #11410 --- public/v1/js/ff/transactions/mass/edit-bulk.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/public/v1/js/ff/transactions/mass/edit-bulk.js b/public/v1/js/ff/transactions/mass/edit-bulk.js index c1cfa67142..137cead5e9 100644 --- a/public/v1/js/ff/transactions/mass/edit-bulk.js +++ b/public/v1/js/ff/transactions/mass/edit-bulk.js @@ -34,12 +34,14 @@ $(document).ready(function () { $('input[name="ignore_budget"]').attr('checked', false); }); + $('input[name="tags"]').on('itemAdded', function (event) { + var isChecked = $('#tags_action_do_nothing').is(':checked'); + if (true === isChecked) { + $('#tags_action_do_nothing').attr('checked', false); + $('#tags_action_do_replace').attr('checked', true); + } - $('input[name="tags"]').on('itemAdded', function(event) { - $('#tags_action_do_nothing').attr('checked', false); - $('#tags_action_do_replace').attr('checked', true); }); - -}); \ No newline at end of file +}); From e0542f1270c56ca082213cb3936c68bbc812b18f Mon Sep 17 00:00:00 2001 From: James Cole Date: Mon, 29 Dec 2025 11:10:28 +0100 Subject: [PATCH 33/58] Fix end of quarter issue. --- app/Support/Navigation.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Support/Navigation.php b/app/Support/Navigation.php index 88b53c03e7..fad31a7f0e 100644 --- a/app/Support/Navigation.php +++ b/app/Support/Navigation.php @@ -302,17 +302,17 @@ class Navigation if ($currentEnd->lt($end)) { switch ($repeatFreq) { case 'QTD': - $currentEnd->endOfQuarter()->setMilli(0); + $currentEnd = $end->clone()->endOfQuarter()->setMilli(0); break; case 'MTD': - $currentEnd->endOfMonth()->setMilli(0); + $currentEnd = $end->clone()->endOfMonth()->setMilli(0); break; case 'YTD': - $currentEnd->endOfYear()->setMilli(0); + $currentEnd = $end->clone()->endOfYear()->setMilli(0); break; } From 7d374b22f94371de7fb3d1af7e4b259b2205f721 Mon Sep 17 00:00:00 2001 From: JC5 Date: Mon, 29 Dec 2025 15:54:09 +0100 Subject: [PATCH 34/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-29?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- THANKS.md | 1 + composer.lock | 12 ++++++------ config/firefly.php | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/THANKS.md b/THANKS.md index f046b17eb6..2c2bdfd8d3 100755 --- a/THANKS.md +++ b/THANKS.md @@ -4,6 +4,7 @@ Over time, many people have contributed to Firefly III. Their efforts are not al Please find below all the people who contributed to the Firefly III code. Their names are mentioned in the year of their first contribution. ## 2025 +- Diego Algorta - Jihad - jreyesr - codearena-bot diff --git a/composer.lock b/composer.lock index d6dc3ad826..72625d90f7 100644 --- a/composer.lock +++ b/composer.lock @@ -10367,16 +10367,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.7.0", + "version": "1.7.1", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "2373419b7709815ed323ebf18c3c72d03ff4a8a6" + "reference": "8f5fa3cc214230e71f54924bd0197a3bcc705eb1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/2373419b7709815ed323ebf18c3c72d03ff4a8a6", - "reference": "2373419b7709815ed323ebf18c3c72d03ff4a8a6", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/8f5fa3cc214230e71f54924bd0197a3bcc705eb1", + "reference": "8f5fa3cc214230e71f54924bd0197a3bcc705eb1", "shasum": "" }, "require": { @@ -10420,7 +10420,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.7.0" + "source": "https://github.com/composer/class-map-generator/tree/1.7.1" }, "funding": [ { @@ -10432,7 +10432,7 @@ "type": "github" } ], - "time": "2025-11-19T10:41:15+00:00" + "time": "2025-12-29T13:15:25+00:00" }, { "name": "composer/pcre", diff --git a/config/firefly.php b/config/firefly.php index 25b010d494..a2dfd0783c 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -79,7 +79,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-29', - 'build_time' => 1766995845, + 'build_time' => 1767019946, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From dc3c3bb0925355982bea5b3a537adf85589ea538 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 30 Dec 2025 07:24:14 +0100 Subject: [PATCH 35/58] Add setting for anonymous amounts in preferences. --- app/Http/Controllers/HomeController.php | 1 + .../Controllers/PreferencesController.php | 121 +++++++++--------- resources/lang/en_US/firefly.php | 3 + resources/views/preferences/index.twig | 8 ++ 4 files changed, 75 insertions(+), 58 deletions(-) diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 67118821c6..f96f0e501d 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; +use FireflyIII\Support\Facades\Navigation; use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index 4c526e553d..aca67a7c5e 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; -use FireflyIII\Support\Facades\Navigation; use Carbon\Carbon; use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Events\Preferences\UserGroupChangedPrimaryCurrency; @@ -33,7 +32,9 @@ use FireflyIII\Http\Requests\PreferencesRequest; use FireflyIII\Models\Account; use FireflyIII\Models\Preference; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Support\Facades\Navigation; use FireflyIII\Support\Facades\Preferences; +use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Singleton\PreferencesSingleton; use FireflyIII\User; use Illuminate\Contracts\View\Factory; @@ -44,8 +45,6 @@ use Illuminate\Support\Facades\Log; use Illuminate\View\View; use JsonException; use Safe\Exceptions\FilesystemException; -use FireflyIII\Support\Facades\Steam; - use function Safe\file_get_contents; use function Safe\json_decode; @@ -63,7 +62,7 @@ class PreferencesController extends Controller $this->middleware( static function ($request, $next) { - app('view')->share('title', (string) trans('firefly.preferences')); + app('view')->share('title', (string)trans('firefly.preferences')); app('view')->share('mainTitleIcon', 'fa-gear'); return $next($request); @@ -79,16 +78,16 @@ class PreferencesController extends Controller * @throws FireflyException * @throws FilesystemException */ - public function index(AccountRepositoryInterface $repository): Factory|\Illuminate\Contracts\View\View + public function index(AccountRepositoryInterface $repository): Factory | \Illuminate\Contracts\View\View { - $accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]); - $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line - $groupedAccounts = []; + $accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]); + $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line + $groupedAccounts = []; /** @var Account $account */ foreach ($accounts as $account) { - $type = $account->accountType->type; - $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role')); + $type = $account->accountType->type; + $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role')); if (in_array($type, [AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value], true)) { $role = sprintf('opt_group_l_%s', $type); @@ -97,54 +96,55 @@ class PreferencesController extends Controller if ('opt_group_' === $role) { $role = 'opt_group_defaultAsset'; } - $groupedAccounts[(string) trans(sprintf('firefly.%s', $role))][$account->id] = $account->name; + $groupedAccounts[(string)trans(sprintf('firefly.%s', $role))][$account->id] = $account->name; } ksort($groupedAccounts); /** @var array $accountIds */ - $accountIds = $accounts->pluck('id')->toArray(); - $viewRange = Navigation::getViewRange(false); - $frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds); - $frontpageAccounts = $frontpageAccountsPref->data; + $accountIds = $accounts->pluck('id')->toArray(); + $viewRange = Navigation::getViewRange(false); + $frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds); + $frontpageAccounts = $frontpageAccountsPref->data; if (!is_array($frontpageAccounts)) { $frontpageAccounts = $accountIds; } - $language = Steam::getLanguage(); - $languages = config('firefly.languages'); - $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; - $listPageSize = Preferences::get('listPageSize', 50)->data; - $darkMode = Preferences::get('darkMode', 'browser')->data; - $customFiscalYear = Preferences::get('customFiscalYear', 0)->data; - $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data; - $convertToPrimary = $this->convertToPrimary; + $language = Steam::getLanguage(); + $languages = config('firefly.languages'); + $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; + $listPageSize = Preferences::get('listPageSize', 50)->data; + $darkMode = Preferences::get('darkMode', 'browser')->data; + $customFiscalYear = Preferences::get('customFiscalYear', 0)->data; + $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data; + $convertToPrimary = $this->convertToPrimary; if (is_array($fiscalYearStartStr)) { $fiscalYearStartStr = '01-01'; } - $fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string) $fiscalYearStartStr); - $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; - $availableDarkModes = config('firefly.available_dark_modes'); + $fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string)$fiscalYearStartStr); + $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; + $availableDarkModes = config('firefly.available_dark_modes'); // notifications settings - $slackUrl = Preferences::getEncrypted('slack_webhook_url', '')->data; - $pushoverAppToken = (string) Preferences::getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = (string) Preferences::getEncrypted('pushover_user_token', '')->data; - $ntfyServer = Preferences::getEncrypted('ntfy_server', 'https://ntfy.sh')->data; - $ntfyTopic = (string) Preferences::getEncrypted('ntfy_topic', '')->data; - $ntfyAuth = '1' === Preferences::get('ntfy_auth', false)->data; - $ntfyUser = Preferences::getEncrypted('ntfy_user', '')->data; - $ntfyPass = (string) Preferences::getEncrypted('ntfy_pass', '')->data; - $channels = config('notifications.channels'); - $forcedAvailability = []; + $slackUrl = Preferences::getEncrypted('slack_webhook_url', '')->data; + $pushoverAppToken = (string)Preferences::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = (string)Preferences::getEncrypted('pushover_user_token', '')->data; + $ntfyServer = Preferences::getEncrypted('ntfy_server', 'https://ntfy.sh')->data; + $ntfyTopic = (string)Preferences::getEncrypted('ntfy_topic', '')->data; + $ntfyAuth = '1' === Preferences::get('ntfy_auth', false)->data; + $ntfyUser = Preferences::getEncrypted('ntfy_user', '')->data; + $ntfyPass = (string)Preferences::getEncrypted('ntfy_pass', '')->data; + $channels = config('notifications.channels'); + $forcedAvailability = []; + $anonymous = Steam::anonymous(); // notification preferences - $notifications = []; + $notifications = []; foreach (config('notifications.notifications.user') as $key => $info) { if (true === $info['enabled']) { $notifications[$key] = [ - 'enabled' => true === Preferences::get(sprintf('notification_%s', $key), true)->data, - 'configurable' => $info['configurable'], - ]; + 'enabled' => true === Preferences::get(sprintf('notification_%s', $key), true)->data, + 'configurable' => $info['configurable'], + ]; } } // loop all channels to see if they are available. @@ -164,7 +164,7 @@ class PreferencesController extends Controller Log::error($e->getMessage()); $locales = []; } - $locales = ['equal' => (string) trans('firefly.equal_to_language')] + $locales; + $locales = ['equal' => (string)trans('firefly.equal_to_language')] + $locales; // an important fallback is that the frontPageAccount array gets refilled automatically // when it turns up empty. if (0 === count($frontpageAccounts)) { @@ -184,7 +184,7 @@ class PreferencesController extends Controller $ntfyPass = ''; } - return view('preferences.index', ['language' => $language, 'pushoverAppToken' => $pushoverAppToken, 'pushoverUserToken' => $pushoverUserToken, 'ntfyServer' => $ntfyServer, 'ntfyTopic' => $ntfyTopic, 'ntfyAuth' => $ntfyAuth, 'channels' => $channels, 'ntfyUser' => $ntfyUser, 'forcedAvailability' => $forcedAvailability, 'ntfyPass' => $ntfyPass, 'groupedAccounts' => $groupedAccounts, 'isDocker' => $isDocker, 'frontpageAccounts' => $frontpageAccounts, 'languages' => $languages, 'darkMode' => $darkMode, 'availableDarkModes' => $availableDarkModes, 'notifications' => $notifications, 'convertToPrimary' => $convertToPrimary, 'slackUrl' => $slackUrl, 'locales' => $locales, 'locale' => $locale, 'tjOptionalFields' => $tjOptionalFields, 'viewRange' => $viewRange, 'customFiscalYear' => $customFiscalYear, 'listPageSize' => $listPageSize, 'fiscalYearStart' => $fiscalYearStart]); + return view('preferences.index', ['anonymous' => $anonymous, 'language' => $language, 'pushoverAppToken' => $pushoverAppToken, 'pushoverUserToken' => $pushoverUserToken, 'ntfyServer' => $ntfyServer, 'ntfyTopic' => $ntfyTopic, 'ntfyAuth' => $ntfyAuth, 'channels' => $channels, 'ntfyUser' => $ntfyUser, 'forcedAvailability' => $forcedAvailability, 'ntfyPass' => $ntfyPass, 'groupedAccounts' => $groupedAccounts, 'isDocker' => $isDocker, 'frontpageAccounts' => $frontpageAccounts, 'languages' => $languages, 'darkMode' => $darkMode, 'availableDarkModes' => $availableDarkModes, 'notifications' => $notifications, 'convertToPrimary' => $convertToPrimary, 'slackUrl' => $slackUrl, 'locales' => $locales, 'locale' => $locale, 'tjOptionalFields' => $tjOptionalFields, 'viewRange' => $viewRange, 'customFiscalYear' => $customFiscalYear, 'listPageSize' => $listPageSize, 'fiscalYearStart' => $fiscalYearStart]); } /** @@ -195,19 +195,19 @@ class PreferencesController extends Controller * @SuppressWarnings("PHPMD.ExcessiveMethodLength") * @SuppressWarnings("PHPMD.NPathComplexity") */ - public function postIndex(PreferencesRequest $request): Redirector|RedirectResponse + public function postIndex(PreferencesRequest $request): Redirector | RedirectResponse { // front page accounts $frontpageAccounts = []; if (is_array($request->get('frontpageAccounts')) && count($request->get('frontpageAccounts')) > 0) { foreach ($request->get('frontpageAccounts') as $id) { - $frontpageAccounts[] = (int) $id; + $frontpageAccounts[] = (int)$id; } Preferences::set('frontpageAccounts', $frontpageAccounts); } // extract notifications: - $all = $request->all(); + $all = $request->all(); foreach (config('notifications.notifications.user') as $key => $info) { $key = sprintf('notification_%s', $key); if (array_key_exists($key, $all)) { @@ -241,7 +241,7 @@ class PreferencesController extends Controller } // convert primary - $convertToPrimary = 1 === (int) $request->get('convertToPrimary'); + $convertToPrimary = 1 === (int)$request->get('convertToPrimary'); if ($convertToPrimary && !$this->convertToPrimary) { // set to true! Log::debug('User sets convertToPrimary to true.'); @@ -253,9 +253,9 @@ class PreferencesController extends Controller Preferences::set('convert_to_primary', $convertToPrimary); // custom fiscal year - $customFiscalYear = 1 === (int) $request->get('customFiscalYear'); + $customFiscalYear = 1 === (int)$request->get('customFiscalYear'); Preferences::set('customFiscalYear', $customFiscalYear); - $fiscalYearString = (string) $request->get('fiscalYearStart'); + $fiscalYearString = (string)$request->get('fiscalYearStart'); if ('' !== $fiscalYearString) { $fiscalYearStart = Carbon::parse($fiscalYearString, config('app.timezone'))->format('m-d'); Preferences::set('fiscalYearStart', $fiscalYearStart); @@ -263,15 +263,15 @@ class PreferencesController extends Controller // save page size: Preferences::set('listPageSize', 50); - $listPageSize = (int) $request->get('listPageSize'); + $listPageSize = (int)$request->get('listPageSize'); if ($listPageSize > 0 && $listPageSize < 1337) { Preferences::set('listPageSize', $listPageSize); } // language: /** @var Preference $currentLang */ - $currentLang = Preferences::get('language', 'en_US'); - $lang = $request->get('language'); + $currentLang = Preferences::get('language', 'en_US'); + $lang = $request->get('language'); if (array_key_exists($lang, config('firefly.languages'))) { Preferences::set('language', $lang); } @@ -282,14 +282,14 @@ class PreferencesController extends Controller // same for locale: if (!auth()->user()->hasRole('demo')) { - $locale = (string) $request->get('locale'); + $locale = (string)$request->get('locale'); $locale = '' === $locale ? null : $locale; Preferences::set('locale', $locale); } // optional fields for transactions: - $setOptions = $request->get('tj') ?? []; - $optionalTj = [ + $setOptions = $request->get('tj') ?? []; + $optionalTj = [ 'interest_date' => array_key_exists('interest_date', $setOptions), 'book_date' => array_key_exists('book_date', $setOptions), 'process_date' => array_key_exists('process_date', $setOptions), @@ -306,12 +306,17 @@ class PreferencesController extends Controller Preferences::set('transaction_journal_optional_fields', $optionalTj); // dark mode - $darkMode = $request->get('darkMode') ?? 'browser'; + $darkMode = $request->get('darkMode') ?? 'browser'; if (in_array($darkMode, config('firefly.available_dark_modes'), true)) { Preferences::set('darkMode', $darkMode); } - session()->flash('success', (string) trans('firefly.saved_preferences')); + // anonymous amounts? + $anonymous = '1' === $request->get('anonymous'); + Preferences::set('anonymous', $anonymous); + + // save and continue + session()->flash('success', (string)trans('firefly.saved_preferences')); Preferences::mark(); return redirect(route('preferences.index')); @@ -325,7 +330,7 @@ class PreferencesController extends Controller switch ($channel) { default: - session()->flash('error', (string) trans('firefly.notification_test_failed', ['channel' => $channel])); + session()->flash('error', (string)trans('firefly.notification_test_failed', ['channel' => $channel])); break; @@ -337,7 +342,7 @@ class PreferencesController extends Controller $user = auth()->user(); Log::debug(sprintf('Now in testNotification("%s") controller.', $channel)); event(new UserTestNotificationChannel($channel, $user)); - session()->flash('success', (string) trans('firefly.notification_test_executed', ['channel' => $channel])); + session()->flash('success', (string)trans('firefly.notification_test_executed', ['channel' => $channel])); } return ''; diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index a26b76a875..fd9fd32d9a 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -149,6 +149,9 @@ return [ 'left_in_budget_limit' => 'Left to spend according to budgeting', 'current_period' => 'Current period', 'show_the_current_period_and_overview' => 'Show the current period and overview', + 'pref_anonymous' => 'Hidden amounts', + 'pref_anonymous_help' => 'For privacy and anonymity, you can make Firefly III hide all amounts. This will not hide amounts in edit boxes, but the rest are hidden. You can also toggle this with the little "eye"-icon in the top bar.', + 'pref_anonymous_label' => 'Hide amounts', 'pref_languages_locale' => 'For a language other than English to work properly, your operating system must be equipped with the correct locale-information. If these are not present, currency data, dates and amounts may be formatted wrong.', 'budget_in_period' => 'All transactions for budget ":name" between :start and :end in :currency', 'chart_budget_in_period' => 'Chart for all transactions for budget ":name" between :start and :end in :currency', diff --git a/resources/views/preferences/index.twig b/resources/views/preferences/index.twig index 4316a7c390..f35aad6987 100644 --- a/resources/views/preferences/index.twig +++ b/resources/views/preferences/index.twig @@ -110,6 +110,14 @@ {{ ExpandedForm.checkbox('convertToPrimary','1',convertToPrimary,{ 'label' : 'pref_convert_primary_help'|_ }) }}

    {% endif %} + {# conversion back to primary currency #} +
    +

    {{ 'pref_anonymous'|_ }}

    +

    + {{ 'pref_anonymous_help'|_ }} +

    + {{ ExpandedForm.checkbox('anonymous','1',anonymous,{ 'label' : 'pref_anonymous_label'|_ }) }} +
    {# general settings column B #} From 27586a7ec26a55643bb7cb99190282054b3c88be Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 30 Dec 2025 16:13:28 +0100 Subject: [PATCH 36/58] Allow transactions to be moved to the future and still have the running balance calculated correctly. --- app/Factory/TransactionJournalMetaFactory.php | 8 +-- app/Handlers/Observer/TransactionObserver.php | 17 ++++-- .../AttachmentRepositoryInterface.php | 1 - .../Internal/Update/JournalUpdateService.php | 35 ++++++----- .../Models/AccountBalanceCalculator.php | 59 +++++++++++-------- .../TransactionGroupTransformer.php | 2 +- 6 files changed, 72 insertions(+), 50 deletions(-) diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php index 31e9fe4888..9d2c1f1a80 100644 --- a/app/Factory/TransactionJournalMetaFactory.php +++ b/app/Factory/TransactionJournalMetaFactory.php @@ -36,10 +36,10 @@ class TransactionJournalMetaFactory public function updateOrCreate(array $data): ?TransactionJournalMeta { // Log::debug('In updateOrCreate()'); - $value = $data['data']; + $value = $data['data']; /** @var null|TransactionJournalMeta $entry */ - $entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first(); + $entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first(); if (null === $value && null !== $entry) { // Log::debug('Value is empty, delete meta value.'); $entry->delete(); @@ -51,7 +51,7 @@ class TransactionJournalMetaFactory Log::debug('Is a carbon object.'); $value = $data['data']->toW3cString(); } - if ('' === (string) $value) { + if ('' === (string)$value) { // Log::debug('Is an empty string.'); // don't store blank strings. if (null !== $entry) { @@ -65,7 +65,7 @@ class TransactionJournalMetaFactory if (null === $entry) { // Log::debug('Will create new object.'); Log::debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name'])); - $entry = new TransactionJournalMeta(); + $entry = new TransactionJournalMeta(); $entry->transactionJournal()->associate($data['journal']); $entry->name = $data['name']; } diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index 1ab0953d6c..b44c56c124 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -24,11 +24,12 @@ declare(strict_types=1); namespace FireflyIII\Handlers\Observer; use FireflyIII\Models\Transaction; +use FireflyIII\Models\TransactionJournal; use FireflyIII\Support\Facades\Amount; +use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Models\AccountBalanceCalculator; use Illuminate\Support\Facades\Log; -use FireflyIII\Support\Facades\FireflyConfig; /** * Class TransactionObserver @@ -42,7 +43,10 @@ class TransactionObserver Log::debug('Observe "created" of a transaction.'); if (true === FireflyConfig::get('use_running_balance', config('firefly.feature_flags.running_balance_column'))->data && (1 === bccomp($transaction->amount, '0') && self::$recalculate)) { Log::debug('Trigger recalculateForJournal'); - AccountBalanceCalculator::recalculateForJournal($transaction->transactionJournal); + $journal = $transaction->transactionJournal; + if ($journal instanceof TransactionJournal) { + AccountBalanceCalculator::recalculateForJournal($journal); + } } $this->updatePrimaryCurrencyAmount($transaction); } @@ -56,15 +60,18 @@ class TransactionObserver $transaction->native_amount = null; $transaction->native_foreign_amount = null; // first normal amount - if ($transaction->transactionCurrency->id !== $userCurrency->id && (null === $transaction->foreign_currency_id || (null !== $transaction->foreign_currency_id && $transaction->foreign_currency_id !== $userCurrency->id))) { - $converter = new ExchangeRateConverter(); + if ($transaction->transactionCurrency->id !== $userCurrency->id && + (null === $transaction->foreign_currency_id || + (null !== $transaction->foreign_currency_id && + $transaction->foreign_currency_id !== $userCurrency->id))) { + $converter = new ExchangeRateConverter(); $converter->setUserGroup($transaction->transactionJournal->user->userGroup); $converter->setIgnoreSettings(true); $transaction->native_amount = $converter->convert($transaction->transactionCurrency, $userCurrency, $transaction->transactionJournal->date, $transaction->amount); } // then foreign amount if ($transaction->foreignCurrency?->id !== $userCurrency->id && null !== $transaction->foreign_amount && null !== $transaction->foreignCurrency) { - $converter = new ExchangeRateConverter(); + $converter = new ExchangeRateConverter(); $converter->setUserGroup($transaction->transactionJournal->user->userGroup); $converter->setIgnoreSettings(true); $transaction->native_foreign_amount = $converter->convert($transaction->foreignCurrency, $userCurrency, $transaction->transactionJournal->date, $transaction->foreign_amount); diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index 01f43cdb3b..756219f108 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -38,7 +38,6 @@ use Illuminate\Support\Collection; * @method getUserGroup() * @method getUser() * @method checkUserGroupAccess(UserRoleEnum $role) - * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) */ interface AttachmentRepositoryInterface diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index c528cd2e40..0e7b19ba34 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -68,8 +68,7 @@ class JournalUpdateService private ?Account $destinationAccount = null; private ?Transaction $destinationTransaction = null; private array $metaDate - = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', - 'invoice_date', ]; + = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', '_internal_previous_date']; private array $metaString = [ 'sepa_cc', @@ -205,11 +204,9 @@ class JournalUpdateService $validator->setUser($this->transactionJournal->user); $result = $validator->validateSource(['id' => $sourceId, 'name' => $sourceName]); - Log::debug( - sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true)) - ); + Log::debug(sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true))); - // TODO typeoverrule the account validator may have a different opinion on the transaction type. + // TODO type overrule the account validator may have a different opinion on the transaction type. // validate submitted info: return $result; @@ -283,14 +280,7 @@ class JournalUpdateService $validator->setUser($this->transactionJournal->user); $validator->source = $this->getValidSourceAccount(); $result = $validator->validateDestination(['id' => $destId, 'name' => $destName]); - Log::debug( - sprintf( - 'hasValidDestinationAccount(%d, "%s") will return %s', - $destId, - $destName, - var_export($result, true) - ) - ); + Log::debug(sprintf('hasValidDestinationAccount(%d, "%s") will return %s', $destId, $destName, var_export($result, true))); // TODO typeOverrule: the account validator may have another opinion on the transaction type. @@ -494,6 +484,23 @@ class JournalUpdateService // do some parsing. Log::debug(sprintf('Create date value from string "%s".', $value)); $this->transactionJournal->date_tz = $value->format('e'); + $res = $value->gt($this->transactionJournal->date); + Log::debug(sprintf('Old date: %s, new date: %s', $this->transactionJournal->date->toW3cString(), $value->toW3cString())); + /** @var TransactionJournalMetaFactory $factory */ + $factory = app(TransactionJournalMetaFactory::class); + $set = [ + 'journal' => $this->transactionJournal, + 'name' => '_internal_previous_date', + 'data' => null, + ]; + if($res) { + Log::debug('Transaction is set to be AFTER its current date. Save also the "_internal_previous_date"-field.'); + $set['data'] = clone $this->transactionJournal->date; + } + if(!$res) { + Log::debug('Transaction is NOT set to be AFTER its current date. Remove the "_internal_previous_date"-field.'); + } + $factory->updateOrCreate($set); } event(new TriggeredAuditLog($this->transactionJournal->user, $this->transactionJournal, sprintf('update_%s', $fieldName), $this->transactionJournal->{$fieldName}, $value)); diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index ddb91a412b..b77496a7eb 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -65,14 +65,25 @@ class AccountBalanceCalculator public static function recalculateForJournal(TransactionJournal $transactionJournal): void { Log::debug(__METHOD__); - $object = new self(); + $object = new self(); - $set = []; + $set = []; foreach ($transactionJournal->transactions as $transaction) { $set[$transaction->account_id] = $transaction->account; } $accounts = new Collection()->push(...$set); - $object->optimizedCalculation($accounts, $transactionJournal->date); + + // find meta value: + $date = $transactionJournal->date; + $meta = $transactionJournal->transactionJournalMeta()->where('name', '_internal_previous_date')->where('data', '!=', '')->first(); + Log::debug(sprintf('Date used is "%s"', $date->toW3cString())); + if (null !== $meta) { + $date = Carbon::parse($meta->data); + Log::debug(sprintf('Date is overruled with "%s"', $date->toW3cString())); + } + + + $object->optimizedCalculation($accounts, $date); } private function getLatestBalance(int $accountId, int $currencyId, ?Carbon $notBefore): string @@ -83,18 +94,17 @@ class AccountBalanceCalculator return '0'; } Log::debug(sprintf('getLatestBalance: notBefore date is "%s", calculating', $notBefore->format('Y-m-d'))); - $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->whereNull('transactions.deleted_at') - ->where('transaction_journals.transaction_currency_id', $currencyId) - ->whereNull('transaction_journals.deleted_at') + $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->whereNull('transactions.deleted_at') + ->where('transaction_journals.transaction_currency_id', $currencyId) + ->whereNull('transaction_journals.deleted_at') // this order is the same as GroupCollector - ->orderBy('transaction_journals.date', 'DESC') - ->orderBy('transaction_journals.order', 'ASC') - ->orderBy('transaction_journals.id', 'DESC') - ->orderBy('transaction_journals.description', 'DESC') - ->orderBy('transactions.amount', 'DESC') - ->where('transactions.account_id', $accountId) - ; + ->orderBy('transaction_journals.date', 'DESC') + ->orderBy('transaction_journals.order', 'ASC') + ->orderBy('transaction_journals.id', 'DESC') + ->orderBy('transaction_journals.description', 'DESC') + ->orderBy('transactions.amount', 'DESC') + ->where('transactions.account_id', $accountId); $notBefore->startOfDay(); $query->where('transaction_journals.date', '<', $notBefore); @@ -115,15 +125,14 @@ class AccountBalanceCalculator $balances = []; $count = 0; $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->whereNull('transactions.deleted_at') - ->whereNull('transaction_journals.deleted_at') + ->whereNull('transactions.deleted_at') + ->whereNull('transaction_journals.deleted_at') // this order is the same as GroupCollector, but in the exact reverse. - ->orderBy('transaction_journals.date', 'asc') - ->orderBy('transaction_journals.order', 'desc') - ->orderBy('transaction_journals.id', 'asc') - ->orderBy('transaction_journals.description', 'asc') - ->orderBy('transactions.amount', 'asc') - ; + ->orderBy('transaction_journals.date', 'asc') + ->orderBy('transaction_journals.order', 'desc') + ->orderBy('transaction_journals.id', 'asc') + ->orderBy('transaction_journals.description', 'asc') + ->orderBy('transactions.amount', 'asc'); if ($accounts->count() > 0) { $query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray()); } @@ -132,7 +141,7 @@ class AccountBalanceCalculator $query->where('transaction_journals.date', '>=', $notBefore); } - $set = $query->get(['transactions.id', 'transactions.balance_dirty', 'transactions.transaction_currency_id', 'transaction_journals.date', 'transactions.account_id', 'transactions.amount']); + $set = $query->get(['transactions.id', 'transactions.balance_dirty', 'transactions.transaction_currency_id', 'transaction_journals.date', 'transactions.account_id', 'transactions.amount']); Log::debug(sprintf('Counted %d transaction(s)', $set->count())); // the balance value is an array. @@ -145,8 +154,8 @@ class AccountBalanceCalculator $balances[$entry->account_id][$entry->transaction_currency_id] ??= [$this->getLatestBalance($entry->account_id, $entry->transaction_currency_id, $notBefore), null]; // before and after are easy: - $before = $balances[$entry->account_id][$entry->transaction_currency_id][0]; - $after = bcadd($before, (string)$entry->amount); + $before = $balances[$entry->account_id][$entry->transaction_currency_id][0]; + $after = bcadd($before, (string)$entry->amount); if (true === $entry->balance_dirty || $accounts->count() > 0) { // update the transaction: $entry->balance_before = $before; diff --git a/app/Transformers/TransactionGroupTransformer.php b/app/Transformers/TransactionGroupTransformer.php index 8f2152f973..2d420a6f9d 100644 --- a/app/Transformers/TransactionGroupTransformer.php +++ b/app/Transformers/TransactionGroupTransformer.php @@ -75,7 +75,7 @@ class TransactionGroupTransformer extends AbstractTransformer 'recurrence_count', 'recurrence_total', ]; - $this->metaDateFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date']; + $this->metaDateFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', '_internal_previous_date']; } public function transform(array $group): array From 7ca96a766f9067dba8e53bce56f1c4f4a0628e66 Mon Sep 17 00:00:00 2001 From: JC5 Date: Tue, 30 Dec 2025 16:19:05 +0100 Subject: [PATCH 37/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Factory/TransactionJournalMetaFactory.php | 6 +- app/Handlers/Observer/TransactionObserver.php | 12 +-- app/Http/Controllers/HomeController.php | 1 - .../Controllers/PreferencesController.php | 99 ++++++++++--------- .../AttachmentRepositoryInterface.php | 2 - .../Internal/Update/JournalUpdateService.php | 11 ++- .../Models/AccountBalanceCalculator.php | 50 +++++----- config/firefly.php | 4 +- package-lock.json | 12 +-- 9 files changed, 99 insertions(+), 98 deletions(-) diff --git a/app/Factory/TransactionJournalMetaFactory.php b/app/Factory/TransactionJournalMetaFactory.php index 9d2c1f1a80..bef9804fc3 100644 --- a/app/Factory/TransactionJournalMetaFactory.php +++ b/app/Factory/TransactionJournalMetaFactory.php @@ -36,10 +36,10 @@ class TransactionJournalMetaFactory public function updateOrCreate(array $data): ?TransactionJournalMeta { // Log::debug('In updateOrCreate()'); - $value = $data['data']; + $value = $data['data']; /** @var null|TransactionJournalMeta $entry */ - $entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first(); + $entry = $data['journal']->transactionJournalMeta()->where('name', $data['name'])->first(); if (null === $value && null !== $entry) { // Log::debug('Value is empty, delete meta value.'); $entry->delete(); @@ -65,7 +65,7 @@ class TransactionJournalMetaFactory if (null === $entry) { // Log::debug('Will create new object.'); Log::debug(sprintf('Going to create new meta-data entry to store "%s".', $data['name'])); - $entry = new TransactionJournalMeta(); + $entry = new TransactionJournalMeta(); $entry->transactionJournal()->associate($data['journal']); $entry->name = $data['name']; } diff --git a/app/Handlers/Observer/TransactionObserver.php b/app/Handlers/Observer/TransactionObserver.php index b44c56c124..2f542a67c8 100644 --- a/app/Handlers/Observer/TransactionObserver.php +++ b/app/Handlers/Observer/TransactionObserver.php @@ -60,18 +60,18 @@ class TransactionObserver $transaction->native_amount = null; $transaction->native_foreign_amount = null; // first normal amount - if ($transaction->transactionCurrency->id !== $userCurrency->id && - (null === $transaction->foreign_currency_id || - (null !== $transaction->foreign_currency_id && - $transaction->foreign_currency_id !== $userCurrency->id))) { - $converter = new ExchangeRateConverter(); + if ($transaction->transactionCurrency->id !== $userCurrency->id + && (null === $transaction->foreign_currency_id + || (null !== $transaction->foreign_currency_id + && $transaction->foreign_currency_id !== $userCurrency->id))) { + $converter = new ExchangeRateConverter(); $converter->setUserGroup($transaction->transactionJournal->user->userGroup); $converter->setIgnoreSettings(true); $transaction->native_amount = $converter->convert($transaction->transactionCurrency, $userCurrency, $transaction->transactionJournal->date, $transaction->amount); } // then foreign amount if ($transaction->foreignCurrency?->id !== $userCurrency->id && null !== $transaction->foreign_amount && null !== $transaction->foreignCurrency) { - $converter = new ExchangeRateConverter(); + $converter = new ExchangeRateConverter(); $converter->setUserGroup($transaction->transactionJournal->user->userGroup); $converter->setIgnoreSettings(true); $transaction->native_foreign_amount = $converter->convert($transaction->foreignCurrency, $userCurrency, $transaction->transactionJournal->date, $transaction->foreign_amount); diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index f96f0e501d..67118821c6 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Http\Controllers; -use FireflyIII\Support\Facades\Navigation; use FireflyIII\Support\Facades\Preferences; use Carbon\Carbon; use Carbon\Exceptions\InvalidFormatException; diff --git a/app/Http/Controllers/PreferencesController.php b/app/Http/Controllers/PreferencesController.php index aca67a7c5e..5f2a3b03a6 100644 --- a/app/Http/Controllers/PreferencesController.php +++ b/app/Http/Controllers/PreferencesController.php @@ -45,6 +45,7 @@ use Illuminate\Support\Facades\Log; use Illuminate\View\View; use JsonException; use Safe\Exceptions\FilesystemException; + use function Safe\file_get_contents; use function Safe\json_decode; @@ -78,16 +79,16 @@ class PreferencesController extends Controller * @throws FireflyException * @throws FilesystemException */ - public function index(AccountRepositoryInterface $repository): Factory | \Illuminate\Contracts\View\View + public function index(AccountRepositoryInterface $repository): Factory|\Illuminate\Contracts\View\View { - $accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]); - $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line - $groupedAccounts = []; + $accounts = $repository->getAccountsByType([AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value]); + $isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line + $groupedAccounts = []; /** @var Account $account */ foreach ($accounts as $account) { - $type = $account->accountType->type; - $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role')); + $type = $account->accountType->type; + $role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role')); if (in_array($type, [AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value], true)) { $role = sprintf('opt_group_l_%s', $type); @@ -101,50 +102,50 @@ class PreferencesController extends Controller ksort($groupedAccounts); /** @var array $accountIds */ - $accountIds = $accounts->pluck('id')->toArray(); - $viewRange = Navigation::getViewRange(false); - $frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds); - $frontpageAccounts = $frontpageAccountsPref->data; + $accountIds = $accounts->pluck('id')->toArray(); + $viewRange = Navigation::getViewRange(false); + $frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds); + $frontpageAccounts = $frontpageAccountsPref->data; if (!is_array($frontpageAccounts)) { $frontpageAccounts = $accountIds; } - $language = Steam::getLanguage(); - $languages = config('firefly.languages'); - $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; - $listPageSize = Preferences::get('listPageSize', 50)->data; - $darkMode = Preferences::get('darkMode', 'browser')->data; - $customFiscalYear = Preferences::get('customFiscalYear', 0)->data; - $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data; - $convertToPrimary = $this->convertToPrimary; + $language = Steam::getLanguage(); + $languages = config('firefly.languages'); + $locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data; + $listPageSize = Preferences::get('listPageSize', 50)->data; + $darkMode = Preferences::get('darkMode', 'browser')->data; + $customFiscalYear = Preferences::get('customFiscalYear', 0)->data; + $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data; + $convertToPrimary = $this->convertToPrimary; if (is_array($fiscalYearStartStr)) { $fiscalYearStartStr = '01-01'; } - $fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string)$fiscalYearStartStr); - $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; - $availableDarkModes = config('firefly.available_dark_modes'); + $fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string)$fiscalYearStartStr); + $tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; + $availableDarkModes = config('firefly.available_dark_modes'); // notifications settings - $slackUrl = Preferences::getEncrypted('slack_webhook_url', '')->data; - $pushoverAppToken = (string)Preferences::getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = (string)Preferences::getEncrypted('pushover_user_token', '')->data; - $ntfyServer = Preferences::getEncrypted('ntfy_server', 'https://ntfy.sh')->data; - $ntfyTopic = (string)Preferences::getEncrypted('ntfy_topic', '')->data; - $ntfyAuth = '1' === Preferences::get('ntfy_auth', false)->data; - $ntfyUser = Preferences::getEncrypted('ntfy_user', '')->data; - $ntfyPass = (string)Preferences::getEncrypted('ntfy_pass', '')->data; - $channels = config('notifications.channels'); - $forcedAvailability = []; - $anonymous = Steam::anonymous(); + $slackUrl = Preferences::getEncrypted('slack_webhook_url', '')->data; + $pushoverAppToken = (string)Preferences::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = (string)Preferences::getEncrypted('pushover_user_token', '')->data; + $ntfyServer = Preferences::getEncrypted('ntfy_server', 'https://ntfy.sh')->data; + $ntfyTopic = (string)Preferences::getEncrypted('ntfy_topic', '')->data; + $ntfyAuth = '1' === Preferences::get('ntfy_auth', false)->data; + $ntfyUser = Preferences::getEncrypted('ntfy_user', '')->data; + $ntfyPass = (string)Preferences::getEncrypted('ntfy_pass', '')->data; + $channels = config('notifications.channels'); + $forcedAvailability = []; + $anonymous = Steam::anonymous(); // notification preferences - $notifications = []; + $notifications = []; foreach (config('notifications.notifications.user') as $key => $info) { if (true === $info['enabled']) { $notifications[$key] = [ - 'enabled' => true === Preferences::get(sprintf('notification_%s', $key), true)->data, - 'configurable' => $info['configurable'], - ]; + 'enabled' => true === Preferences::get(sprintf('notification_%s', $key), true)->data, + 'configurable' => $info['configurable'], + ]; } } // loop all channels to see if they are available. @@ -164,7 +165,7 @@ class PreferencesController extends Controller Log::error($e->getMessage()); $locales = []; } - $locales = ['equal' => (string)trans('firefly.equal_to_language')] + $locales; + $locales = ['equal' => (string)trans('firefly.equal_to_language')] + $locales; // an important fallback is that the frontPageAccount array gets refilled automatically // when it turns up empty. if (0 === count($frontpageAccounts)) { @@ -195,7 +196,7 @@ class PreferencesController extends Controller * @SuppressWarnings("PHPMD.ExcessiveMethodLength") * @SuppressWarnings("PHPMD.NPathComplexity") */ - public function postIndex(PreferencesRequest $request): Redirector | RedirectResponse + public function postIndex(PreferencesRequest $request): Redirector|RedirectResponse { // front page accounts $frontpageAccounts = []; @@ -207,7 +208,7 @@ class PreferencesController extends Controller } // extract notifications: - $all = $request->all(); + $all = $request->all(); foreach (config('notifications.notifications.user') as $key => $info) { $key = sprintf('notification_%s', $key); if (array_key_exists($key, $all)) { @@ -241,7 +242,7 @@ class PreferencesController extends Controller } // convert primary - $convertToPrimary = 1 === (int)$request->get('convertToPrimary'); + $convertToPrimary = 1 === (int)$request->get('convertToPrimary'); if ($convertToPrimary && !$this->convertToPrimary) { // set to true! Log::debug('User sets convertToPrimary to true.'); @@ -253,9 +254,9 @@ class PreferencesController extends Controller Preferences::set('convert_to_primary', $convertToPrimary); // custom fiscal year - $customFiscalYear = 1 === (int)$request->get('customFiscalYear'); + $customFiscalYear = 1 === (int)$request->get('customFiscalYear'); Preferences::set('customFiscalYear', $customFiscalYear); - $fiscalYearString = (string)$request->get('fiscalYearStart'); + $fiscalYearString = (string)$request->get('fiscalYearStart'); if ('' !== $fiscalYearString) { $fiscalYearStart = Carbon::parse($fiscalYearString, config('app.timezone'))->format('m-d'); Preferences::set('fiscalYearStart', $fiscalYearStart); @@ -263,15 +264,15 @@ class PreferencesController extends Controller // save page size: Preferences::set('listPageSize', 50); - $listPageSize = (int)$request->get('listPageSize'); + $listPageSize = (int)$request->get('listPageSize'); if ($listPageSize > 0 && $listPageSize < 1337) { Preferences::set('listPageSize', $listPageSize); } // language: /** @var Preference $currentLang */ - $currentLang = Preferences::get('language', 'en_US'); - $lang = $request->get('language'); + $currentLang = Preferences::get('language', 'en_US'); + $lang = $request->get('language'); if (array_key_exists($lang, config('firefly.languages'))) { Preferences::set('language', $lang); } @@ -288,8 +289,8 @@ class PreferencesController extends Controller } // optional fields for transactions: - $setOptions = $request->get('tj') ?? []; - $optionalTj = [ + $setOptions = $request->get('tj') ?? []; + $optionalTj = [ 'interest_date' => array_key_exists('interest_date', $setOptions), 'book_date' => array_key_exists('book_date', $setOptions), 'process_date' => array_key_exists('process_date', $setOptions), @@ -306,13 +307,13 @@ class PreferencesController extends Controller Preferences::set('transaction_journal_optional_fields', $optionalTj); // dark mode - $darkMode = $request->get('darkMode') ?? 'browser'; + $darkMode = $request->get('darkMode') ?? 'browser'; if (in_array($darkMode, config('firefly.available_dark_modes'), true)) { Preferences::set('darkMode', $darkMode); } // anonymous amounts? - $anonymous = '1' === $request->get('anonymous'); + $anonymous = '1' === $request->get('anonymous'); Preferences::set('anonymous', $anonymous); // save and continue diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index 756219f108..56078984e2 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -27,8 +27,6 @@ use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Attachment; use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index 0e7b19ba34..17d0a0da4b 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -484,20 +484,21 @@ class JournalUpdateService // do some parsing. Log::debug(sprintf('Create date value from string "%s".', $value)); $this->transactionJournal->date_tz = $value->format('e'); - $res = $value->gt($this->transactionJournal->date); + $res = $value->gt($this->transactionJournal->date); Log::debug(sprintf('Old date: %s, new date: %s', $this->transactionJournal->date->toW3cString(), $value->toW3cString())); + /** @var TransactionJournalMetaFactory $factory */ - $factory = app(TransactionJournalMetaFactory::class); - $set = [ + $factory = app(TransactionJournalMetaFactory::class); + $set = [ 'journal' => $this->transactionJournal, 'name' => '_internal_previous_date', 'data' => null, ]; - if($res) { + if ($res) { Log::debug('Transaction is set to be AFTER its current date. Save also the "_internal_previous_date"-field.'); $set['data'] = clone $this->transactionJournal->date; } - if(!$res) { + if (!$res) { Log::debug('Transaction is NOT set to be AFTER its current date. Remove the "_internal_previous_date"-field.'); } $factory->updateOrCreate($set); diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index b77496a7eb..3298c7ed39 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -65,17 +65,17 @@ class AccountBalanceCalculator public static function recalculateForJournal(TransactionJournal $transactionJournal): void { Log::debug(__METHOD__); - $object = new self(); + $object = new self(); - $set = []; + $set = []; foreach ($transactionJournal->transactions as $transaction) { $set[$transaction->account_id] = $transaction->account; } $accounts = new Collection()->push(...$set); // find meta value: - $date = $transactionJournal->date; - $meta = $transactionJournal->transactionJournalMeta()->where('name', '_internal_previous_date')->where('data', '!=', '')->first(); + $date = $transactionJournal->date; + $meta = $transactionJournal->transactionJournalMeta()->where('name', '_internal_previous_date')->where('data', '!=', '')->first(); Log::debug(sprintf('Date used is "%s"', $date->toW3cString())); if (null !== $meta) { $date = Carbon::parse($meta->data); @@ -94,17 +94,18 @@ class AccountBalanceCalculator return '0'; } Log::debug(sprintf('getLatestBalance: notBefore date is "%s", calculating', $notBefore->format('Y-m-d'))); - $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->whereNull('transactions.deleted_at') - ->where('transaction_journals.transaction_currency_id', $currencyId) - ->whereNull('transaction_journals.deleted_at') + $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->whereNull('transactions.deleted_at') + ->where('transaction_journals.transaction_currency_id', $currencyId) + ->whereNull('transaction_journals.deleted_at') // this order is the same as GroupCollector - ->orderBy('transaction_journals.date', 'DESC') - ->orderBy('transaction_journals.order', 'ASC') - ->orderBy('transaction_journals.id', 'DESC') - ->orderBy('transaction_journals.description', 'DESC') - ->orderBy('transactions.amount', 'DESC') - ->where('transactions.account_id', $accountId); + ->orderBy('transaction_journals.date', 'DESC') + ->orderBy('transaction_journals.order', 'ASC') + ->orderBy('transaction_journals.id', 'DESC') + ->orderBy('transaction_journals.description', 'DESC') + ->orderBy('transactions.amount', 'DESC') + ->where('transactions.account_id', $accountId) + ; $notBefore->startOfDay(); $query->where('transaction_journals.date', '<', $notBefore); @@ -125,14 +126,15 @@ class AccountBalanceCalculator $balances = []; $count = 0; $query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->whereNull('transactions.deleted_at') - ->whereNull('transaction_journals.deleted_at') + ->whereNull('transactions.deleted_at') + ->whereNull('transaction_journals.deleted_at') // this order is the same as GroupCollector, but in the exact reverse. - ->orderBy('transaction_journals.date', 'asc') - ->orderBy('transaction_journals.order', 'desc') - ->orderBy('transaction_journals.id', 'asc') - ->orderBy('transaction_journals.description', 'asc') - ->orderBy('transactions.amount', 'asc'); + ->orderBy('transaction_journals.date', 'asc') + ->orderBy('transaction_journals.order', 'desc') + ->orderBy('transaction_journals.id', 'asc') + ->orderBy('transaction_journals.description', 'asc') + ->orderBy('transactions.amount', 'asc') + ; if ($accounts->count() > 0) { $query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray()); } @@ -141,7 +143,7 @@ class AccountBalanceCalculator $query->where('transaction_journals.date', '>=', $notBefore); } - $set = $query->get(['transactions.id', 'transactions.balance_dirty', 'transactions.transaction_currency_id', 'transaction_journals.date', 'transactions.account_id', 'transactions.amount']); + $set = $query->get(['transactions.id', 'transactions.balance_dirty', 'transactions.transaction_currency_id', 'transaction_journals.date', 'transactions.account_id', 'transactions.amount']); Log::debug(sprintf('Counted %d transaction(s)', $set->count())); // the balance value is an array. @@ -154,8 +156,8 @@ class AccountBalanceCalculator $balances[$entry->account_id][$entry->transaction_currency_id] ??= [$this->getLatestBalance($entry->account_id, $entry->transaction_currency_id, $notBefore), null]; // before and after are easy: - $before = $balances[$entry->account_id][$entry->transaction_currency_id][0]; - $after = bcadd($before, (string)$entry->amount); + $before = $balances[$entry->account_id][$entry->transaction_currency_id][0]; + $after = bcadd($before, (string)$entry->amount); if (true === $entry->balance_dirty || $accounts->count() > 0) { // update the transaction: $entry->balance_before = $before; diff --git a/config/firefly.php b/config/firefly.php index a2dfd0783c..7bf86de769 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-29', - 'build_time' => 1767019946, + 'version' => 'develop/2025-12-30', + 'build_time' => 1767107843, '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 b3582a9dd1..30f337f330 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4508,9 +4508,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001761", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001761.tgz", - "integrity": "sha512-JF9ptu1vP2coz98+5051jZ4PwQgd2ni8A+gYSN7EA7dPKIMf0pDlSUxhdmVOaV3/fYK5uWBkgSXJaRLr4+3A6g==", + "version": "1.0.30001762", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001762.tgz", + "integrity": "sha512-PxZwGNvH7Ak8WX5iXzoK1KPZttBXNPuaOvI2ZYU7NrlM+d9Ov+TUvlLOBNGzVXAntMSMMlJPd+jY6ovrVjSmUw==", "dev": true, "funding": [ { @@ -9650,9 +9650,9 @@ "license": "MIT" }, "node_modules/qs": { - "version": "6.14.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", - "integrity": "sha512-YWWTjgABSKcvs/nWBi9PycY/JiPJqOD4JA6o9Sej2AtvSGarXxKC3OQSk4pAarbdQlKAh5D4FCQkJNkW+GAn3w==", + "version": "6.14.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.1.tgz", + "integrity": "sha512-4EK3+xJl8Ts67nLYNwqw/dsFVnCf+qR7RgXSK9jEEm9unao3njwMDdmsdvoKBKHzxd7tCYz5e5M+SnMjdtXGQQ==", "dev": true, "license": "BSD-3-Clause", "dependencies": { From 61444e96600b111ae0370573fd33190503a431b2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 30 Dec 2025 16:39:46 +0100 Subject: [PATCH 38/58] New variables for updates. --- app/Support/Binder/DynamicConfigKey.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Support/Binder/DynamicConfigKey.php b/app/Support/Binder/DynamicConfigKey.php index e2524c81ec..aed8a9d06a 100644 --- a/app/Support/Binder/DynamicConfigKey.php +++ b/app/Support/Binder/DynamicConfigKey.php @@ -34,10 +34,16 @@ class DynamicConfigKey { public static array $accepted = [ - 'configuration.is_demo_site', - 'configuration.permission_update_check', - 'configuration.single_user_mode', - 'configuration.last_update_check', + 'configuration.is_demo_site', // boolean + 'configuration.permission_update_check', // -1, 0 or 1 (never asked, no permission, permission) + 'configuration.single_user_mode', // boolean + 'configuration.last_update_check', // timestamp + 'configuration.enable_exchange_rates', // boolean + 'configuration.use_running_balance', // boolean + 'configuration.enable_external_map', // boolean + 'configuration.enable_external_rates', // boolean + 'configuration.allow_webhooks', // boolean + 'configuration.valid_url_protocols' // string ("http,https") ]; /** From 523ec7c0a15e0cfeeea85438a536e478e7c46e83 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 30 Dec 2025 20:51:56 +0100 Subject: [PATCH 39/58] Expand settings, make accounts not mandatory. --- .../V1/Requests/Models/PiggyBank/UpdateRequest.php | 2 +- app/Api/V1/Requests/System/UpdateRequest.php | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php index c6c23c72ca..f04d5217c4 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php @@ -80,7 +80,7 @@ class UpdateRequest extends FormRequest 'target_date' => 'date|nullable|after:start_date', 'notes' => 'max:65000', 'accounts' => 'required', - 'accounts.*' => 'array|required', + 'accounts.*' => 'array', 'accounts.*.account_id' => ['required', 'numeric', 'belongsToUser:accounts,id'], 'accounts.*.current_amount' => ['numeric', 'nullable', new IsValidZeroOrMoreAmount(true)], 'object_group_id' => 'numeric|belongsToUser:object_groups,id', diff --git a/app/Api/V1/Requests/System/UpdateRequest.php b/app/Api/V1/Requests/System/UpdateRequest.php index 2f9c39af0e..00da8d03bd 100644 --- a/app/Api/V1/Requests/System/UpdateRequest.php +++ b/app/Api/V1/Requests/System/UpdateRequest.php @@ -37,17 +37,18 @@ class UpdateRequest extends FormRequest use ChecksLogin; use ConvertsDataTypes; + private array $booleans = ['configuration.is_demo_site', 'configuration.single_user_mode', 'configuration.enable_exchange_rates', 'configuration.use_running_balance', 'configuration.enable_external_map', 'configuration.enable_external_rates', 'configuration.allow_webhooks',]; + private array $integers = ['configuration.permission_update_check', 'configuration.last_update_check']; /** * Get all data from the request. */ public function getAll(): array { $name = $this->route()->parameter('dynamicConfigKey'); - - if ('configuration.is_demo_site' === $name || 'configuration.single_user_mode' === $name) { + if (in_array($name, $this->booleans, true)) { return ['value' => $this->boolean('value')]; } - if ('configuration.permission_update_check' === $name || 'configuration.last_update_check' === $name) { + if (in_array($name, $this->integers, true)) { return ['value' => $this->convertInteger('value')]; } @@ -61,13 +62,13 @@ class UpdateRequest extends FormRequest { $name = $this->route()->parameter('configName'); - if ('configuration.is_demo_site' === $name || 'configuration.single_user_mode' === $name) { + if (in_array($name, $this->booleans, true)) { return ['value' => ['required', new IsBoolean()]]; } if ('configuration.permission_update_check' === $name) { return ['value' => 'required|numeric|min:-1|max:1']; } - if ('configuration.last_update_check' === $name) { + if (in_array($name, $this->integers, true)) { return ['value' => 'required|numeric|min:464272080']; } From c96ada053fc9c24b6ee8e1a47e27f5cf21029fc1 Mon Sep 17 00:00:00 2001 From: JC5 Date: Tue, 30 Dec 2025 20:56:17 +0100 Subject: [PATCH 40/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Api/V1/Requests/System/UpdateRequest.php | 3 ++- app/Support/Binder/DynamicConfigKey.php | 2 +- config/firefly.php | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Api/V1/Requests/System/UpdateRequest.php b/app/Api/V1/Requests/System/UpdateRequest.php index 00da8d03bd..ae91a4fe33 100644 --- a/app/Api/V1/Requests/System/UpdateRequest.php +++ b/app/Api/V1/Requests/System/UpdateRequest.php @@ -37,8 +37,9 @@ class UpdateRequest extends FormRequest use ChecksLogin; use ConvertsDataTypes; - private array $booleans = ['configuration.is_demo_site', 'configuration.single_user_mode', 'configuration.enable_exchange_rates', 'configuration.use_running_balance', 'configuration.enable_external_map', 'configuration.enable_external_rates', 'configuration.allow_webhooks',]; + private array $booleans = ['configuration.is_demo_site', 'configuration.single_user_mode', 'configuration.enable_exchange_rates', 'configuration.use_running_balance', 'configuration.enable_external_map', 'configuration.enable_external_rates', 'configuration.allow_webhooks']; private array $integers = ['configuration.permission_update_check', 'configuration.last_update_check']; + /** * Get all data from the request. */ diff --git a/app/Support/Binder/DynamicConfigKey.php b/app/Support/Binder/DynamicConfigKey.php index aed8a9d06a..42b4db8c9b 100644 --- a/app/Support/Binder/DynamicConfigKey.php +++ b/app/Support/Binder/DynamicConfigKey.php @@ -43,7 +43,7 @@ class DynamicConfigKey 'configuration.enable_external_map', // boolean 'configuration.enable_external_rates', // boolean 'configuration.allow_webhooks', // boolean - 'configuration.valid_url_protocols' // string ("http,https") + 'configuration.valid_url_protocols', // string ("http,https") ]; /** diff --git a/config/firefly.php b/config/firefly.php index 7bf86de769..d8fda62010 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -79,7 +79,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-30', - 'build_time' => 1767107843, + 'build_time' => 1767124470, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From df03899588aeef6279e52383b3e813cb45390e82 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 30 Dec 2025 21:05:50 +0100 Subject: [PATCH 41/58] Fix whoopsie. --- app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php index f04d5217c4..0a6b4debf8 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php @@ -79,7 +79,7 @@ class UpdateRequest extends FormRequest 'start_date' => 'date|nullable', 'target_date' => 'date|nullable|after:start_date', 'notes' => 'max:65000', - 'accounts' => 'required', + 'accounts' => 'array', 'accounts.*' => 'array', 'accounts.*.account_id' => ['required', 'numeric', 'belongsToUser:accounts,id'], 'accounts.*.current_amount' => ['numeric', 'nullable', new IsValidZeroOrMoreAmount(true)], From 22074568ae2182de28e2e577fc1cebf4851607cb Mon Sep 17 00:00:00 2001 From: JC5 Date: Tue, 30 Dec 2025 21:09:43 +0100 Subject: [PATCH 42/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-12-30?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/firefly.php b/config/firefly.php index d8fda62010..fa1034975f 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -79,7 +79,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2025-12-30', - 'build_time' => 1767124470, + 'build_time' => 1767125279, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From 8220d491f9b1801db3f2ad6d33f4857434bc1f7b Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 1 Jan 2026 13:39:16 +0100 Subject: [PATCH 43/58] Fix popup in report helper --- app/Helpers/Report/PopupReport.php | 71 +++++++++---------- .../Http/Controllers/RenderPartialViews.php | 1 - 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index 414cd57d78..674d72c10a 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -46,11 +46,10 @@ class PopupReport implements PopupReportInterface /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setAccounts(new Collection()->push($account)) - ->withAccountInformation() - ->withBudgetInformation() - ->withCategoryInformation() - ->setRange($attributes['startDate'], $attributes['endDate'])->setBudget($budget) - ; + ->withAccountInformation() + ->withBudgetInformation() + ->withCategoryInformation() + ->setRange($attributes['startDate'], $attributes['endDate'])->setBudget($budget); return $collector->getExtractedJournals(); } @@ -66,19 +65,18 @@ class PopupReport implements PopupReportInterface if (null !== $currencyId) { /** @var CurrencyRepositoryInterface $repos */ $repos = app(CurrencyRepositoryInterface::class); - $currency = $repos->find((int) $currencyId); + $currency = $repos->find((int)$currencyId); } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setAccounts(new Collection()->push($account)) ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) ->withAccountInformation() ->withCategoryInformation() ->setRange($attributes['startDate'], $attributes['endDate']) - ->withoutBudget() - ; + ->withoutBudget(); if (null !== $currency) { $collector->setCurrency($currency); @@ -98,18 +96,17 @@ class PopupReport implements PopupReportInterface if (null !== $currencyId) { /** @var CurrencyRepositoryInterface $repos */ $repos = app(CurrencyRepositoryInterface::class); - $currency = $repos->find((int) $currencyId); + $currency = $repos->find((int)$currencyId); } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setAccounts($attributes['accounts']) ->withAccountInformation() ->withBudgetInformation() ->withCategoryInformation() - ->setRange($attributes['startDate'], $attributes['endDate']) - ; + ->setRange($attributes['startDate'], $attributes['endDate']); if (null !== $currency) { $collector->setCurrency($currency); @@ -135,19 +132,18 @@ class PopupReport implements PopupReportInterface if (null !== $currencyId) { /** @var CurrencyRepositoryInterface $repos */ $repos = app(CurrencyRepositoryInterface::class); - $currency = $repos->find((int) $currencyId); + $currency = $repos->find((int)$currencyId); } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts($attributes['accounts']) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::DEPOSIT->value]) - ->withAccountInformation() - ->withBudgetInformation() - ->withCategoryInformation() - ->setRange($attributes['startDate'], $attributes['endDate'])->withAccountInformation() - ; + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::DEPOSIT->value]) + ->withAccountInformation() + ->withBudgetInformation() + ->withCategoryInformation() + ->setRange($attributes['startDate'], $attributes['endDate'])->withAccountInformation(); if ($category instanceof Category) { $collector->setCategory($category); @@ -169,35 +165,35 @@ class PopupReport implements PopupReportInterface public function byExpenses(Account $account, array $attributes): array { // filter by currency, if set. - $currencyId = $attributes['currencyId'] ?? null; - $currency = null; + $currencyId = $attributes['currencyId'] ?? null; + $currency = null; if (null !== $currencyId) { /** @var CurrencyRepositoryInterface $repos */ $repos = app(CurrencyRepositoryInterface::class); - $currency = $repos->find((int) $currencyId); + $currency = $repos->find((int)$currencyId); } + /** @var JournalRepositoryInterface $repository */ - $repository = app(JournalRepositoryInterface::class); + $repository = app(JournalRepositoryInterface::class); $repository->setUser($account->user); $accountRepository = app(AccountRepositoryInterface::class); $accountRepository->setUser($account->user); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); - // set report accounts + the request accounts: - // $set = $attributes['accounts'] ?? new Collection; - // $set->push($account); + // the source account must be in the set. + $set = $attributes['accounts'] ?? new Collection; $collector->setDestinationAccounts(new Collection()->push($account)) - ->setRange($attributes['startDate'], $attributes['endDate']) - ->withAccountInformation() - ->withBudgetInformation() - ->withCategoryInformation() - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value]) - ; + ->setSourceAccounts($set) + ->setRange($attributes['startDate'], $attributes['endDate']) + ->withAccountInformation() + ->withBudgetInformation() + ->withCategoryInformation() + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value]); if (null !== $currency) { $collector->setCurrency($currency); @@ -216,7 +212,7 @@ class PopupReport implements PopupReportInterface $repository->setUser($account->user); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setSourceAccounts(new Collection()->push($account)) ->setDestinationAccounts($attributes['accounts']) @@ -225,8 +221,7 @@ class PopupReport implements PopupReportInterface ->withAccountInformation() ->withBudgetInformation() ->withCategoryInformation() - ->withAccountInformation() - ; + ->withAccountInformation(); return $collector->getExtractedJournals(); } diff --git a/app/Support/Http/Controllers/RenderPartialViews.php b/app/Support/Http/Controllers/RenderPartialViews.php index 962e9d5155..b831727b81 100644 --- a/app/Support/Http/Controllers/RenderPartialViews.php +++ b/app/Support/Http/Controllers/RenderPartialViews.php @@ -245,7 +245,6 @@ trait RenderPartialViews if (null === $account) { return 'This is an unknown account. Apologies.'; } - $journals = $popupHelper->byExpenses($account, $attributes); try { From 775deb21420678eaae4a25fda5bfec8fc1b220d3 Mon Sep 17 00:00:00 2001 From: JC5 Date: Thu, 1 Jan 2026 13:43:08 +0100 Subject: [PATCH 44/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202026-01-01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/php-cs-fixer/composer.lock | 36 ++++---- app/Helpers/Report/PopupReport.php | 58 +++++++------ composer.lock | 132 ++++++++++++++--------------- config/firefly.php | 4 +- package-lock.json | 2 +- 5 files changed, 119 insertions(+), 113 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index fbdfac4a68..cca0ee2946 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -1252,16 +1252,16 @@ }, { "name": "symfony/console", - "version": "v8.0.1", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "fcb73f69d655b48fcb894a262f074218df08bd58" + "reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/fcb73f69d655b48fcb894a262f074218df08bd58", - "reference": "fcb73f69d655b48fcb894a262f074218df08bd58", + "url": "https://api.github.com/repos/symfony/console/zipball/6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", + "reference": "6145b304a5c1ea0bdbd0b04d297a5864f9a7d587", "shasum": "" }, "require": { @@ -1318,7 +1318,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v8.0.1" + "source": "https://github.com/symfony/console/tree/v8.0.3" }, "funding": [ { @@ -1338,7 +1338,7 @@ "type": "tidelift" } ], - "time": "2025-12-05T15:25:33+00:00" + "time": "2025-12-23T14:52:06+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1640,16 +1640,16 @@ }, { "name": "symfony/finder", - "version": "v8.0.0", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291" + "reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/7598dd5770580fa3517ec83e8da0c9b9e01f4291", - "reference": "7598dd5770580fa3517ec83e8da0c9b9e01f4291", + "url": "https://api.github.com/repos/symfony/finder/zipball/dd3a2953570a283a2ba4e17063bb98c734cf5b12", + "reference": "dd3a2953570a283a2ba4e17063bb98c734cf5b12", "shasum": "" }, "require": { @@ -1684,7 +1684,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v8.0.0" + "source": "https://github.com/symfony/finder/tree/v8.0.3" }, "funding": [ { @@ -1704,7 +1704,7 @@ "type": "tidelift" } ], - "time": "2025-11-05T14:36:47+00:00" + "time": "2025-12-23T14:52:06+00:00" }, { "name": "symfony/options-resolver", @@ -2358,16 +2358,16 @@ }, { "name": "symfony/process", - "version": "v8.0.0", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149" + "reference": "0cbbd88ec836f8757641c651bb995335846abb78" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a0a750500c4ce900d69ba4e9faf16f82c10ee149", - "reference": "a0a750500c4ce900d69ba4e9faf16f82c10ee149", + "url": "https://api.github.com/repos/symfony/process/zipball/0cbbd88ec836f8757641c651bb995335846abb78", + "reference": "0cbbd88ec836f8757641c651bb995335846abb78", "shasum": "" }, "require": { @@ -2399,7 +2399,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v8.0.0" + "source": "https://github.com/symfony/process/tree/v8.0.3" }, "funding": [ { @@ -2419,7 +2419,7 @@ "type": "tidelift" } ], - "time": "2025-10-16T16:25:44+00:00" + "time": "2025-12-19T10:01:18+00:00" }, { "name": "symfony/service-contracts", diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index 674d72c10a..d07ce12aa6 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -46,10 +46,11 @@ class PopupReport implements PopupReportInterface /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setAccounts(new Collection()->push($account)) - ->withAccountInformation() - ->withBudgetInformation() - ->withCategoryInformation() - ->setRange($attributes['startDate'], $attributes['endDate'])->setBudget($budget); + ->withAccountInformation() + ->withBudgetInformation() + ->withCategoryInformation() + ->setRange($attributes['startDate'], $attributes['endDate'])->setBudget($budget) + ; return $collector->getExtractedJournals(); } @@ -69,14 +70,15 @@ class PopupReport implements PopupReportInterface } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setAccounts(new Collection()->push($account)) ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) ->withAccountInformation() ->withCategoryInformation() ->setRange($attributes['startDate'], $attributes['endDate']) - ->withoutBudget(); + ->withoutBudget() + ; if (null !== $currency) { $collector->setCurrency($currency); @@ -100,13 +102,14 @@ class PopupReport implements PopupReportInterface } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setAccounts($attributes['accounts']) ->withAccountInformation() ->withBudgetInformation() ->withCategoryInformation() - ->setRange($attributes['startDate'], $attributes['endDate']); + ->setRange($attributes['startDate'], $attributes['endDate']) + ; if (null !== $currency) { $collector->setCurrency($currency); @@ -136,14 +139,15 @@ class PopupReport implements PopupReportInterface } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts($attributes['accounts']) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::DEPOSIT->value]) - ->withAccountInformation() - ->withBudgetInformation() - ->withCategoryInformation() - ->setRange($attributes['startDate'], $attributes['endDate'])->withAccountInformation(); + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::DEPOSIT->value]) + ->withAccountInformation() + ->withBudgetInformation() + ->withCategoryInformation() + ->setRange($attributes['startDate'], $attributes['endDate'])->withAccountInformation() + ; if ($category instanceof Category) { $collector->setCategory($category); @@ -165,8 +169,8 @@ class PopupReport implements PopupReportInterface public function byExpenses(Account $account, array $attributes): array { // filter by currency, if set. - $currencyId = $attributes['currencyId'] ?? null; - $currency = null; + $currencyId = $attributes['currencyId'] ?? null; + $currency = null; if (null !== $currencyId) { /** @var CurrencyRepositoryInterface $repos */ $repos = app(CurrencyRepositoryInterface::class); @@ -175,25 +179,26 @@ class PopupReport implements PopupReportInterface /** @var JournalRepositoryInterface $repository */ - $repository = app(JournalRepositoryInterface::class); + $repository = app(JournalRepositoryInterface::class); $repository->setUser($account->user); $accountRepository = app(AccountRepositoryInterface::class); $accountRepository->setUser($account->user); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); // the source account must be in the set. - $set = $attributes['accounts'] ?? new Collection; + $set = $attributes['accounts'] ?? new Collection(); $collector->setDestinationAccounts(new Collection()->push($account)) ->setSourceAccounts($set) - ->setRange($attributes['startDate'], $attributes['endDate']) - ->withAccountInformation() - ->withBudgetInformation() - ->withCategoryInformation() - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value]); + ->setRange($attributes['startDate'], $attributes['endDate']) + ->withAccountInformation() + ->withBudgetInformation() + ->withCategoryInformation() + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value]) + ; if (null !== $currency) { $collector->setCurrency($currency); @@ -212,7 +217,7 @@ class PopupReport implements PopupReportInterface $repository->setUser($account->user); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setSourceAccounts(new Collection()->push($account)) ->setDestinationAccounts($attributes['accounts']) @@ -221,7 +226,8 @@ class PopupReport implements PopupReportInterface ->withAccountInformation() ->withBudgetInformation() ->withCategoryInformation() - ->withAccountInformation(); + ->withAccountInformation() + ; return $collector->getExtractedJournals(); } diff --git a/composer.lock b/composer.lock index 72625d90f7..94546cebc4 100644 --- a/composer.lock +++ b/composer.lock @@ -6427,16 +6427,16 @@ }, { "name": "symfony/cache", - "version": "v8.0.1", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "0e67dc8145810d4e1c0d13c0e1d29ceb930b1c8e" + "reference": "ef8c7dbfe613d2773d0b5e68b2ef2db72c8b025f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/0e67dc8145810d4e1c0d13c0e1d29ceb930b1c8e", - "reference": "0e67dc8145810d4e1c0d13c0e1d29ceb930b1c8e", + "url": "https://api.github.com/repos/symfony/cache/zipball/ef8c7dbfe613d2773d0b5e68b2ef2db72c8b025f", + "reference": "ef8c7dbfe613d2773d0b5e68b2ef2db72c8b025f", "shasum": "" }, "require": { @@ -6503,7 +6503,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v8.0.1" + "source": "https://github.com/symfony/cache/tree/v8.0.3" }, "funding": [ { @@ -6523,7 +6523,7 @@ "type": "tidelift" } ], - "time": "2025-12-04T18:17:06+00:00" + "time": "2025-12-28T10:45:32+00:00" }, { "name": "symfony/cache-contracts", @@ -6680,16 +6680,16 @@ }, { "name": "symfony/console", - "version": "v7.4.1", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6d9f0fbf2ec2e9785880096e3abd0ca0c88b506e" + "reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6d9f0fbf2ec2e9785880096e3abd0ca0c88b506e", - "reference": "6d9f0fbf2ec2e9785880096e3abd0ca0c88b506e", + "url": "https://api.github.com/repos/symfony/console/zipball/732a9ca6cd9dfd940c639062d5edbde2f6727fb6", + "reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6", "shasum": "" }, "require": { @@ -6754,7 +6754,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v7.4.1" + "source": "https://github.com/symfony/console/tree/v7.4.3" }, "funding": [ { @@ -6774,7 +6774,7 @@ "type": "tidelift" } ], - "time": "2025-12-05T15:23:39+00:00" + "time": "2025-12-23T14:50:43+00:00" }, { "name": "symfony/css-selector", @@ -7224,16 +7224,16 @@ }, { "name": "symfony/finder", - "version": "v7.4.0", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "340b9ed7320570f319028a2cbec46d40535e94bd" + "reference": "fffe05569336549b20a1be64250b40516d6e8d06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/340b9ed7320570f319028a2cbec46d40535e94bd", - "reference": "340b9ed7320570f319028a2cbec46d40535e94bd", + "url": "https://api.github.com/repos/symfony/finder/zipball/fffe05569336549b20a1be64250b40516d6e8d06", + "reference": "fffe05569336549b20a1be64250b40516d6e8d06", "shasum": "" }, "require": { @@ -7268,7 +7268,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v7.4.0" + "source": "https://github.com/symfony/finder/tree/v7.4.3" }, "funding": [ { @@ -7288,20 +7288,20 @@ "type": "tidelift" } ], - "time": "2025-11-05T05:42:40+00:00" + "time": "2025-12-23T14:50:43+00:00" }, { "name": "symfony/http-client", - "version": "v8.0.1", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "727fda60d0aebfdfcc4c8bc4661f0cb8f44153c0" + "reference": "ea062691009cc2b7bb87734fef20e02671cbd50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/727fda60d0aebfdfcc4c8bc4661f0cb8f44153c0", - "reference": "727fda60d0aebfdfcc4c8bc4661f0cb8f44153c0", + "url": "https://api.github.com/repos/symfony/http-client/zipball/ea062691009cc2b7bb87734fef20e02671cbd50b", + "reference": "ea062691009cc2b7bb87734fef20e02671cbd50b", "shasum": "" }, "require": { @@ -7364,7 +7364,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v8.0.1" + "source": "https://github.com/symfony/http-client/tree/v8.0.3" }, "funding": [ { @@ -7384,7 +7384,7 @@ "type": "tidelift" } ], - "time": "2025-12-05T14:08:45+00:00" + "time": "2025-12-23T14:52:06+00:00" }, { "name": "symfony/http-client-contracts", @@ -7466,16 +7466,16 @@ }, { "name": "symfony/http-foundation", - "version": "v7.4.1", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "bd1af1e425811d6f077db240c3a588bdb405cd27" + "reference": "a70c745d4cea48dbd609f4075e5f5cbce453bd52" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/bd1af1e425811d6f077db240c3a588bdb405cd27", - "reference": "bd1af1e425811d6f077db240c3a588bdb405cd27", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/a70c745d4cea48dbd609f4075e5f5cbce453bd52", + "reference": "a70c745d4cea48dbd609f4075e5f5cbce453bd52", "shasum": "" }, "require": { @@ -7524,7 +7524,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v7.4.1" + "source": "https://github.com/symfony/http-foundation/tree/v7.4.3" }, "funding": [ { @@ -7544,20 +7544,20 @@ "type": "tidelift" } ], - "time": "2025-12-07T11:13:10+00:00" + "time": "2025-12-23T14:23:49+00:00" }, { "name": "symfony/http-kernel", - "version": "v7.4.2", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "f6e6f0a5fa8763f75a504b930163785fb6dd055f" + "reference": "885211d4bed3f857b8c964011923528a55702aa5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/f6e6f0a5fa8763f75a504b930163785fb6dd055f", - "reference": "f6e6f0a5fa8763f75a504b930163785fb6dd055f", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/885211d4bed3f857b8c964011923528a55702aa5", + "reference": "885211d4bed3f857b8c964011923528a55702aa5", "shasum": "" }, "require": { @@ -7643,7 +7643,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v7.4.2" + "source": "https://github.com/symfony/http-kernel/tree/v7.4.3" }, "funding": [ { @@ -7663,20 +7663,20 @@ "type": "tidelift" } ], - "time": "2025-12-08T07:43:37+00:00" + "time": "2025-12-31T08:43:57+00:00" }, { "name": "symfony/mailer", - "version": "v7.4.0", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "a3d9eea8cfa467ece41f0f54ba28185d74bd53fd" + "reference": "e472d35e230108231ccb7f51eb6b2100cac02ee4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/a3d9eea8cfa467ece41f0f54ba28185d74bd53fd", - "reference": "a3d9eea8cfa467ece41f0f54ba28185d74bd53fd", + "url": "https://api.github.com/repos/symfony/mailer/zipball/e472d35e230108231ccb7f51eb6b2100cac02ee4", + "reference": "e472d35e230108231ccb7f51eb6b2100cac02ee4", "shasum": "" }, "require": { @@ -7727,7 +7727,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v7.4.0" + "source": "https://github.com/symfony/mailer/tree/v7.4.3" }, "funding": [ { @@ -7747,7 +7747,7 @@ "type": "tidelift" } ], - "time": "2025-11-21T15:26:00+00:00" + "time": "2025-12-16T08:02:06+00:00" }, { "name": "symfony/mailgun-mailer", @@ -8810,16 +8810,16 @@ }, { "name": "symfony/process", - "version": "v7.4.0", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "7ca8dc2d0dcf4882658313aba8be5d9fd01026c8" + "reference": "2f8e1a6cdf590ca63715da4d3a7a3327404a523f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/7ca8dc2d0dcf4882658313aba8be5d9fd01026c8", - "reference": "7ca8dc2d0dcf4882658313aba8be5d9fd01026c8", + "url": "https://api.github.com/repos/symfony/process/zipball/2f8e1a6cdf590ca63715da4d3a7a3327404a523f", + "reference": "2f8e1a6cdf590ca63715da4d3a7a3327404a523f", "shasum": "" }, "require": { @@ -8851,7 +8851,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.4.0" + "source": "https://github.com/symfony/process/tree/v7.4.3" }, "funding": [ { @@ -8871,7 +8871,7 @@ "type": "tidelift" } ], - "time": "2025-10-16T11:21:06+00:00" + "time": "2025-12-19T10:00:43+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -8963,16 +8963,16 @@ }, { "name": "symfony/routing", - "version": "v7.4.0", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "4720254cb2644a0b876233d258a32bf017330db7" + "reference": "5d3fd7adf8896c2fdb54e2f0f35b1bcbd9e45090" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/4720254cb2644a0b876233d258a32bf017330db7", - "reference": "4720254cb2644a0b876233d258a32bf017330db7", + "url": "https://api.github.com/repos/symfony/routing/zipball/5d3fd7adf8896c2fdb54e2f0f35b1bcbd9e45090", + "reference": "5d3fd7adf8896c2fdb54e2f0f35b1bcbd9e45090", "shasum": "" }, "require": { @@ -9024,7 +9024,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v7.4.0" + "source": "https://github.com/symfony/routing/tree/v7.4.3" }, "funding": [ { @@ -9044,7 +9044,7 @@ "type": "tidelift" } ], - "time": "2025-11-27T13:27:24+00:00" + "time": "2025-12-19T10:00:43+00:00" }, { "name": "symfony/service-contracts", @@ -9225,16 +9225,16 @@ }, { "name": "symfony/translation", - "version": "v8.0.1", + "version": "v8.0.3", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "770e3b8b0ba8360958abedcabacd4203467333ca" + "reference": "60a8f11f0e15c48f2cc47c4da53873bb5b62135d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/770e3b8b0ba8360958abedcabacd4203467333ca", - "reference": "770e3b8b0ba8360958abedcabacd4203467333ca", + "url": "https://api.github.com/repos/symfony/translation/zipball/60a8f11f0e15c48f2cc47c4da53873bb5b62135d", + "reference": "60a8f11f0e15c48f2cc47c4da53873bb5b62135d", "shasum": "" }, "require": { @@ -9294,7 +9294,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v8.0.1" + "source": "https://github.com/symfony/translation/tree/v8.0.3" }, "funding": [ { @@ -9314,7 +9314,7 @@ "type": "tidelift" } ], - "time": "2025-12-01T09:13:36+00:00" + "time": "2025-12-21T10:59:45+00:00" }, { "name": "symfony/translation-contracts", @@ -9478,16 +9478,16 @@ }, { "name": "symfony/var-dumper", - "version": "v7.4.0", + "version": "v7.4.3", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "41fd6c4ae28c38b294b42af6db61446594a0dece" + "reference": "7e99bebcb3f90d8721890f2963463280848cba92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/41fd6c4ae28c38b294b42af6db61446594a0dece", - "reference": "41fd6c4ae28c38b294b42af6db61446594a0dece", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7e99bebcb3f90d8721890f2963463280848cba92", + "reference": "7e99bebcb3f90d8721890f2963463280848cba92", "shasum": "" }, "require": { @@ -9541,7 +9541,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v7.4.0" + "source": "https://github.com/symfony/var-dumper/tree/v7.4.3" }, "funding": [ { @@ -9561,7 +9561,7 @@ "type": "tidelift" } ], - "time": "2025-10-27T20:36:44+00:00" + "time": "2025-12-18T07:04:31+00:00" }, { "name": "symfony/var-exporter", diff --git a/config/firefly.php b/config/firefly.php index fa1034975f..3c45c93fcc 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-12-30', - 'build_time' => 1767125279, + 'version' => 'develop/2026-01-01', + 'build_time' => 1767271288, '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 30f337f330..dd6b0b6ca4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11577,7 +11577,7 @@ "version": "8.28.2", "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-8.28.2.tgz", "integrity": "sha512-C5GZjs1tYlAqjwymaaCPDjCyGo10ajUphiwA922jKt9n7KPpqR7oM1PCwYzhB/E7+nT3wfdG3oRre5raIT1rKA==", - "deprecated": "Vue I18n v8.x has reached EOL and is no longer actively maintained. About maintenance status, see https://vue-i18n.intlify.dev/guide/maintenance.html", + "deprecated": "v9 and v10 no longer supported. please migrate to v11. about maintenance status, see https://vue-i18n.intlify.dev/guide/maintenance.html", "dev": true, "license": "MIT" }, From 5a3edbe68f23e5b4c33b162405ddf3f5ed404aa4 Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 1 Jan 2026 15:37:09 +0100 Subject: [PATCH 45/58] Be less strict about bills. --- app/Jobs/WarnAboutBills.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Jobs/WarnAboutBills.php b/app/Jobs/WarnAboutBills.php index bf217497ee..8a6d2f9631 100644 --- a/app/Jobs/WarnAboutBills.php +++ b/app/Jobs/WarnAboutBills.php @@ -191,7 +191,7 @@ class WarnAboutBills implements ShouldQueue $diff = $earliest->diffInDays($this->date); Log::debug(sprintf('Difference in days is %s', $diff)); - return $diff >= 2; + return $diff >= 6; // FIXME hard coded value. } private function sendOverdueAlerts(User $user, array $overdue): void From 13bb0647344320a5cf765158a3d81e243958bb22 Mon Sep 17 00:00:00 2001 From: JC5 Date: Thu, 1 Jan 2026 15:40:52 +0100 Subject: [PATCH 46/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202026-01-01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/firefly.php b/config/firefly.php index 3c45c93fcc..f2931db2ae 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -79,7 +79,7 @@ return [ // see cer.php for exchange rates feature flag. ], 'version' => 'develop/2026-01-01', - 'build_time' => 1767271288, + 'build_time' => 1767278351, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From 2209087b948669bbe617dab88e859ff72c1dbc98 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2026 07:59:29 +0100 Subject: [PATCH 47/58] Previous year, fixes #11433 --- app/Support/Http/Controllers/GetConfigurationData.php | 5 +++++ resources/lang/en_US/firefly.php | 1 + 2 files changed, 6 insertions(+) diff --git a/app/Support/Http/Controllers/GetConfigurationData.php b/app/Support/Http/Controllers/GetConfigurationData.php index 2ea8527419..ea6733cf1e 100644 --- a/app/Support/Http/Controllers/GetConfigurationData.php +++ b/app/Support/Http/Controllers/GetConfigurationData.php @@ -157,6 +157,11 @@ trait GetConfigurationData $index = (string)trans('firefly.year_to_date'); $ranges[$index] = [$yearBegin, new Carbon()]; + // previous year: + $yearBegin = today(config('app.timezone'))->subYear()->startOfYear(); + $index = (string)trans('firefly.previous_year', ['year' => $yearBegin->year]); + $ranges[$index] = [$yearBegin, $yearBegin->clone()->endOfYear()]; + // everything $index = (string)trans('firefly.everything'); $ranges[$index] = [$first, new Carbon()]; diff --git a/resources/lang/en_US/firefly.php b/resources/lang/en_US/firefly.php index fd9fd32d9a..b4973b4bdf 100644 --- a/resources/lang/en_US/firefly.php +++ b/resources/lang/en_US/firefly.php @@ -43,6 +43,7 @@ return [ 'last_180_days' => 'Last 180 days', 'month_to_date' => 'Month to date', 'year_to_date' => 'Year to date', + 'previous_year' => 'Previous year (:year)', 'YTD' => 'YTD', 'welcome_back' => 'What\'s playing?', 'main_dashboard_page_title' => 'Home', From 4ccd65b4d7eb0ae48ae6f9c7b5cfdb6bf31a4705 Mon Sep 17 00:00:00 2001 From: JC5 Date: Fri, 2 Jan 2026 08:13:01 +0100 Subject: [PATCH 48/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202026-01-02?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/firefly.php b/config/firefly.php index f2931db2ae..c8d6662cda 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2026-01-01', - 'build_time' => 1767278351, + 'version' => 'develop/2026-01-02', + 'build_time' => 1767337875, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From 54676715c02e4ae93110c943a6ed4dd951095945 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 2 Jan 2026 16:38:46 +0100 Subject: [PATCH 49/58] Create new request for search. --- .../Search/TransactionController.php | 9 ++-- .../V1/Requests/Search/SearchQueryRequest.php | 50 +++++++++++++++++++ .../Search/TransactionSearchRequest.php | 40 +++++++++++++++ 3 files changed, 95 insertions(+), 4 deletions(-) create mode 100644 app/Api/V1/Requests/Search/SearchQueryRequest.php create mode 100644 app/Api/V1/Requests/Search/TransactionSearchRequest.php diff --git a/app/Api/V1/Controllers/Search/TransactionController.php b/app/Api/V1/Controllers/Search/TransactionController.php index d95daf8c37..ac04fb2bb5 100644 --- a/app/Api/V1/Controllers/Search/TransactionController.php +++ b/app/Api/V1/Controllers/Search/TransactionController.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Search; use FireflyIII\Api\V1\Controllers\Controller; +use FireflyIII\Api\V1\Requests\Search\TransactionSearchRequest; use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment; use FireflyIII\Support\Search\SearchInterface; use FireflyIII\Transformers\TransactionGroupTransformer; @@ -42,12 +43,12 @@ class TransactionController extends Controller * This endpoint is documented at: * https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/search/searchTransactions */ - public function search(Request $request, SearchInterface $searcher): JsonResponse + public function search(TransactionSearchRequest $request, SearchInterface $searcher): JsonResponse { $manager = $this->getManager(); - $fullQuery = (string) $request->get('query'); - $page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page'); - $pageSize = $this->parameters->get('limit'); + $fullQuery = (string) $request->attributes->get('query'); + $page = $request->attributes->get('page'); + $pageSize = $request->attributes->get('limit'); $searcher->parseQuery($fullQuery); $searcher->setPage($page); $searcher->setLimit($pageSize); diff --git a/app/Api/V1/Requests/Search/SearchQueryRequest.php b/app/Api/V1/Requests/Search/SearchQueryRequest.php new file mode 100644 index 0000000000..73640dc8ee --- /dev/null +++ b/app/Api/V1/Requests/Search/SearchQueryRequest.php @@ -0,0 +1,50 @@ +. + */ + +namespace FireflyIII\Api\V1\Requests\Search; + +use FireflyIII\Api\V1\Requests\ApiRequest; +use Illuminate\Contracts\Validation\Validator; + +class SearchQueryRequest extends ApiRequest +{ + public function rules(): array + { + return [ + 'query' => sprintf('min:0|max:500|%s', $this->required), + ]; + } + + + public function withValidator(Validator $validator): void + { + $validator->after( + function (Validator $validator): void { + if ($validator->failed()) { + return; + } + $query = $this->convertString('query'); + $this->attributes->set('query', $query); + } + ); + } + +} diff --git a/app/Api/V1/Requests/Search/TransactionSearchRequest.php b/app/Api/V1/Requests/Search/TransactionSearchRequest.php new file mode 100644 index 0000000000..f1bed30e15 --- /dev/null +++ b/app/Api/V1/Requests/Search/TransactionSearchRequest.php @@ -0,0 +1,40 @@ +. + */ + +namespace FireflyIII\Api\V1\Requests\Search; + +use FireflyIII\Api\V1\Requests\AggregateFormRequest; +use FireflyIII\Api\V1\Requests\PaginationRequest; +use FireflyIII\Models\TransactionJournal; + +class TransactionSearchRequest extends AggregateFormRequest +{ + + #[\Override] + protected function getRequests(): array + { + return [ + [PaginationRequest::class, 'sort_class' => TransactionJournal::class], + SearchQueryRequest::class, + // [ObjectTypeApiRequest::class, 'object_type' => Account::class], + ]; + } +} From 04553f6fc5d80335cfd53edd547cfee242197d8c Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 3 Jan 2026 14:46:39 +0100 Subject: [PATCH 50/58] Fix #11443 --- app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php index 4a97d262a6..60bf82b7c4 100644 --- a/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php +++ b/app/Support/JsonApi/Enrichments/SubscriptionEnrichment.php @@ -321,7 +321,7 @@ class SubscriptionEnrichment implements EnrichmentInterface $array['foreign_currency_code'] = $entry->foreign_currency_code; $array['foreign_currency_symbol'] = $entry->foreign_currency_symbol; $array['foreign_currency_decimal_places'] = $entry->foreign_currency_decimal_places; - $array['foreign_amount'] = Steam::bcround($entry->foreign_amount, $entry->foreign_currency_decimal_places); + $array['foreign_amount'] = Steam::bcround((string) $entry->foreign_amount, $entry->foreign_currency_decimal_places); } // convert to primary, but is already primary. if ($this->convertToPrimary && (int)$entry->transaction_currency_id === $this->primaryCurrency->id) { @@ -329,7 +329,7 @@ class SubscriptionEnrichment implements EnrichmentInterface } // convert to primary, but is NOT already primary. if ($this->convertToPrimary && (int)$entry->transaction_currency_id !== $this->primaryCurrency->id) { - $array['pc_amount'] = $converter->convert($entry->transactionCurrency, $this->primaryCurrency, $entry->date, $entry->amount); + $array['pc_amount'] = $converter->convert($entry->transactionCurrency, $this->primaryCurrency, $entry->date, (string) $entry->amount); } // convert to primary, but foreign is already primary. if ($this->convertToPrimary && (int)$entry->foreign_currency_id === $this->primaryCurrency->id) { @@ -340,7 +340,7 @@ class SubscriptionEnrichment implements EnrichmentInterface // TODO this is very database intensive. /** @var TransactionCurrency $foreignCurrency */ $foreignCurrency = Amount::getTransactionCurrencyById($entry->foreign_currency_id); - $array['pc_foreign_amount'] = $converter->convert($foreignCurrency, $this->primaryCurrency, $entry->date, $entry->amount); + $array['pc_foreign_amount'] = $converter->convert($foreignCurrency, $this->primaryCurrency, $entry->date, (string) $entry->amount); } $result[] = $array; } From 4d7f63273ebf7a216a0c3e555c5ae40a65835e46 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 4 Jan 2026 20:21:41 +0100 Subject: [PATCH 51/58] Fix #11449 --- .../TriggeredStoredTransactionGroup.php | 6 +++- .../Events/StoredGroupEventHandler.php | 34 ++++++++++++------- .../RuleGroup/ExecutionController.php | 14 ++++++-- composer.json | 3 ++ composer.lock | 17 ++++++---- 5 files changed, 50 insertions(+), 24 deletions(-) diff --git a/app/Events/Model/TransactionGroup/TriggeredStoredTransactionGroup.php b/app/Events/Model/TransactionGroup/TriggeredStoredTransactionGroup.php index 769208971f..b0826f1144 100644 --- a/app/Events/Model/TransactionGroup/TriggeredStoredTransactionGroup.php +++ b/app/Events/Model/TransactionGroup/TriggeredStoredTransactionGroup.php @@ -24,15 +24,19 @@ declare(strict_types=1); namespace FireflyIII\Events\Model\TransactionGroup; use FireflyIII\Events\Event; +use FireflyIII\Models\RuleGroup; use FireflyIII\Models\TransactionGroup; use Illuminate\Queue\SerializesModels; class TriggeredStoredTransactionGroup extends Event { use SerializesModels; + public ?RuleGroup $ruleGroup = null; /** * Create a new event instance. */ - public function __construct(public TransactionGroup $transactionGroup) {} + public function __construct(public TransactionGroup $transactionGroup, ?RuleGroup $ruleGroup = null) { + $this->ruleGroup = $ruleGroup; + } } diff --git a/app/Handlers/Events/StoredGroupEventHandler.php b/app/Handlers/Events/StoredGroupEventHandler.php index a77296ceed..d9facddc15 100644 --- a/app/Handlers/Events/StoredGroupEventHandler.php +++ b/app/Handlers/Events/StoredGroupEventHandler.php @@ -28,6 +28,7 @@ use FireflyIII\Events\Model\TransactionGroup\TriggeredStoredTransactionGroup; use FireflyIII\Events\RequestedSendWebhookMessages; use FireflyIII\Events\StoredTransactionGroup; use FireflyIII\Generator\Webhook\MessageGeneratorInterface; +use FireflyIII\Models\RuleGroup; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\PeriodStatistic\PeriodStatisticRepositoryInterface; @@ -46,7 +47,7 @@ class StoredGroupEventHandler { public function runAllHandlers(StoredTransactionGroup $event): void { - $this->processRules($event); + $this->processRules($event, null); $this->recalculateCredit($event); $this->triggerWebhooks($event); $this->removePeriodStatistics($event); @@ -55,13 +56,13 @@ class StoredGroupEventHandler public function triggerRulesManually(TriggeredStoredTransactionGroup $event): void { $newEvent = new StoredTransactionGroup($event->transactionGroup, true, false); - $this->processRules($newEvent); + $this->processRules($newEvent, $event->ruleGroup); } /** * This method grabs all the users rules and processes them. */ - private function processRules(StoredTransactionGroup $storedGroupEvent): void + private function processRules(StoredTransactionGroup $storedGroupEvent, ?RuleGroup $ruleGroup): void { if (false === $storedGroupEvent->applyRules) { Log::info(sprintf('Will not run rules on group #%d', $storedGroupEvent->transactionGroup->id)); @@ -70,14 +71,14 @@ class StoredGroupEventHandler } Log::debug('Now in StoredGroupEventHandler::processRules()'); - $journals = $storedGroupEvent->transactionGroup->transactionJournals; - $array = []; + $journals = $storedGroupEvent->transactionGroup->transactionJournals; + $array = []; /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $array[] = $journal->id; } - $journalIds = implode(',', $array); + $journalIds = implode(',', $array); Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds)); // collect rules: @@ -86,10 +87,17 @@ class StoredGroupEventHandler // add the groups to the rule engine. // it should run the rules in the group and cancel the group if necessary. - $groups = $ruleGroupRepository->getRuleGroupsWithRules('store-journal'); + if (null === $ruleGroup) { + Log::debug('Fire processRules with ALL store-journal rule groups.'); + $groups = $ruleGroupRepository->getRuleGroupsWithRules('store-journal'); + } + if (null !== $ruleGroup) { + Log::debug(sprintf('Fire processRules with rule group #%d.', $ruleGroup->id)); + $groups = new Collection([$ruleGroup]); + } // create and fire rule engine. - $newRuleEngine = app(RuleEngineInterface::class); + $newRuleEngine = app(RuleEngineInterface::class); $newRuleEngine->setUser($storedGroupEvent->transactionGroup->user); $newRuleEngine->addOperator(['type' => 'journal_id', 'value' => $journalIds]); $newRuleEngine->setRuleGroups($groups); @@ -98,7 +106,7 @@ class StoredGroupEventHandler private function recalculateCredit(StoredTransactionGroup $event): void { - $group = $event->transactionGroup; + $group = $event->transactionGroup; /** @var CreditRecalculateService $object */ $object = app(CreditRecalculateService::class); @@ -114,10 +122,10 @@ class StoredGroupEventHandler /** @var TransactionJournal $journal */ foreach ($event->transactionGroup->transactionJournals as $journal) { /** @var null|Transaction $source */ - $source = $journal->transactions()->where('amount', '<', '0')->first(); + $source = $journal->transactions()->where('amount', '<', '0')->first(); /** @var null|Transaction $dest */ - $dest = $journal->transactions()->where('amount', '>', '0')->first(); + $dest = $journal->transactions()->where('amount', '>', '0')->first(); if (null !== $source) { $repository->deleteStatisticsForModel($source->account, $journal->date); @@ -152,14 +160,14 @@ class StoredGroupEventHandler private function triggerWebhooks(StoredTransactionGroup $storedGroupEvent): void { Log::debug(__METHOD__); - $group = $storedGroupEvent->transactionGroup; + $group = $storedGroupEvent->transactionGroup; if (false === $storedGroupEvent->fireWebhooks) { Log::info(sprintf('Will not fire webhooks for transaction group #%d', $group->id)); return; } - $user = $group->user; + $user = $group->user; /** @var MessageGeneratorInterface $engine */ $engine = app(MessageGeneratorInterface::class); diff --git a/app/Http/Controllers/RuleGroup/ExecutionController.php b/app/Http/Controllers/RuleGroup/ExecutionController.php index 80628fd116..332c9c6f3f 100644 --- a/app/Http/Controllers/RuleGroup/ExecutionController.php +++ b/app/Http/Controllers/RuleGroup/ExecutionController.php @@ -35,6 +35,7 @@ use FireflyIII\Models\TransactionGroup; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; +use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Illuminate\View\View; @@ -70,13 +71,20 @@ class ExecutionController extends Controller */ public function execute(SelectTransactionsRequest $request, RuleGroup $ruleGroup): RedirectResponse { + Log::debug(sprintf('You have selected rule group #%d', $ruleGroup->id)); // Get parameters specified by the user $accounts = $request->get('accounts'); - $set = $this->repository->getAccountsById($accounts); + $set = new Collection(); + if(is_array($accounts)) { + $set = $this->repository->getAccountsById($accounts); + } /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); - $collector->setAccounts($set); + if(count($set) > 0) { + $collector->setAccounts($set); + } + // add date operators. if (null !== $request->get('start')) { $startDate = new Carbon($request->get('start')); @@ -96,7 +104,7 @@ class ExecutionController extends Controller /** @var TransactionGroup $group */ foreach ($groups as $group) { Log::debug(sprintf('Processing group #%d.', $group->id)); - event(new TriggeredStoredTransactionGroup($group)); + event(new TriggeredStoredTransactionGroup($group, $ruleGroup)); } } diff --git a/composer.json b/composer.json index 78faaa43d8..e846cb8566 100644 --- a/composer.json +++ b/composer.json @@ -34,6 +34,9 @@ "transfers", "management" ], + "platform": { + "php": "8.4" + }, "license": "AGPL-3.0-or-later", "homepage": "https://github.com/firefly-iii/firefly-iii", "type": "project", diff --git a/composer.lock b/composer.lock index 94546cebc4..b6b4b6c1ce 100644 --- a/composer.lock +++ b/composer.lock @@ -3621,16 +3621,16 @@ }, { "name": "monolog/monolog", - "version": "3.9.0", + "version": "3.10.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6" + "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/10d85740180ecba7896c87e06a166e0c95a0e3b6", - "reference": "10d85740180ecba7896c87e06a166e0c95a0e3b6", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/b321dd6749f0bf7189444158a3ce785cc16d69b0", + "reference": "b321dd6749f0bf7189444158a3ce785cc16d69b0", "shasum": "" }, "require": { @@ -3648,7 +3648,7 @@ "graylog2/gelf-php": "^1.4.2 || ^2.0", "guzzlehttp/guzzle": "^7.4.5", "guzzlehttp/psr7": "^2.2", - "mongodb/mongodb": "^1.8", + "mongodb/mongodb": "^1.8 || ^2.0", "php-amqplib/php-amqplib": "~2.4 || ^3", "php-console/php-console": "^3.1.8", "phpstan/phpstan": "^2", @@ -3708,7 +3708,7 @@ ], "support": { "issues": "https://github.com/Seldaek/monolog/issues", - "source": "https://github.com/Seldaek/monolog/tree/3.9.0" + "source": "https://github.com/Seldaek/monolog/tree/3.10.0" }, "funding": [ { @@ -3720,7 +3720,7 @@ "type": "tidelift" } ], - "time": "2025-03-24T10:02:05+00:00" + "time": "2026-01-02T08:56:05+00:00" }, { "name": "nesbot/carbon", @@ -13087,5 +13087,8 @@ "ext-xmlwriter": "*" }, "platform-dev": {}, + "platform-overrides": { + "php": "8.4" + }, "plugin-api-version": "2.9.0" } From e5b3c3e6bd2cf20a8ef3d7dabde545c86a3bd818 Mon Sep 17 00:00:00 2001 From: JC5 Date: Mon, 5 Jan 2026 08:31:53 +0100 Subject: [PATCH 52/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202026-01-05?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/php-cs-fixer/composer.lock | 24 +++++++++---------- .../Search/TransactionController.php | 1 - .../V1/Requests/Search/SearchQueryRequest.php | 4 ++-- .../Search/TransactionSearchRequest.php | 6 +++-- .../TriggeredStoredTransactionGroup.php | 3 ++- .../Events/StoredGroupEventHandler.php | 18 +++++++------- .../RuleGroup/ExecutionController.php | 8 +++---- composer.lock | 3 --- config/firefly.php | 4 ++-- 9 files changed, 35 insertions(+), 36 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index cca0ee2946..f686a86fb2 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -402,16 +402,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.92.3", + "version": "v3.92.4", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8" + "reference": "9e7488b19403423e02e8403cc1eb596baf4673b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8", - "reference": "2ba8f5a60f6f42fb65758cfb3768434fa2d1c7e8", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/9e7488b19403423e02e8403cc1eb596baf4673b0", + "reference": "9e7488b19403423e02e8403cc1eb596baf4673b0", "shasum": "" }, "require": { @@ -443,17 +443,17 @@ }, "require-dev": { "facile-it/paraunit": "^1.3.1 || ^2.7", - "infection/infection": "^0.31.0", - "justinrainbow/json-schema": "^6.5", - "keradus/cli-executor": "^2.2", + "infection/infection": "^0.31", + "justinrainbow/json-schema": "^6.6", + "keradus/cli-executor": "^2.3", "mikey179/vfsstream": "^1.6.12", "php-coveralls/php-coveralls": "^2.9", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", - "phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34", + "phpunit/phpunit": "^9.6.31 || ^10.5.60 || ^11.5.46", "symfony/polyfill-php85": "^1.33", - "symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2 || ^8.0", - "symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2 || ^8.0" + "symfony/var-dumper": "^5.4.48 || ^6.4.26 || ^7.4.0 || ^8.0", + "symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -494,7 +494,7 @@ ], "support": { "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", - "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.3" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.4" }, "funding": [ { @@ -502,7 +502,7 @@ "type": "github" } ], - "time": "2025-12-18T10:45:02+00:00" + "time": "2026-01-04T00:38:52+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Controllers/Search/TransactionController.php b/app/Api/V1/Controllers/Search/TransactionController.php index ac04fb2bb5..cc5768fce1 100644 --- a/app/Api/V1/Controllers/Search/TransactionController.php +++ b/app/Api/V1/Controllers/Search/TransactionController.php @@ -30,7 +30,6 @@ use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment; use FireflyIII\Support\Search\SearchInterface; use FireflyIII\Transformers\TransactionGroupTransformer; use Illuminate\Http\JsonResponse; -use Illuminate\Http\Request; use League\Fractal\Pagination\IlluminatePaginatorAdapter; use League\Fractal\Resource\Collection; diff --git a/app/Api/V1/Requests/Search/SearchQueryRequest.php b/app/Api/V1/Requests/Search/SearchQueryRequest.php index 73640dc8ee..f3c4d9a0f3 100644 --- a/app/Api/V1/Requests/Search/SearchQueryRequest.php +++ b/app/Api/V1/Requests/Search/SearchQueryRequest.php @@ -1,4 +1,6 @@ after( @@ -46,5 +47,4 @@ class SearchQueryRequest extends ApiRequest } ); } - } diff --git a/app/Api/V1/Requests/Search/TransactionSearchRequest.php b/app/Api/V1/Requests/Search/TransactionSearchRequest.php index f1bed30e15..fa6df367b1 100644 --- a/app/Api/V1/Requests/Search/TransactionSearchRequest.php +++ b/app/Api/V1/Requests/Search/TransactionSearchRequest.php @@ -1,4 +1,6 @@ ruleGroup = $ruleGroup; } } diff --git a/app/Handlers/Events/StoredGroupEventHandler.php b/app/Handlers/Events/StoredGroupEventHandler.php index d9facddc15..30e0973a49 100644 --- a/app/Handlers/Events/StoredGroupEventHandler.php +++ b/app/Handlers/Events/StoredGroupEventHandler.php @@ -71,14 +71,14 @@ class StoredGroupEventHandler } Log::debug('Now in StoredGroupEventHandler::processRules()'); - $journals = $storedGroupEvent->transactionGroup->transactionJournals; - $array = []; + $journals = $storedGroupEvent->transactionGroup->transactionJournals; + $array = []; /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $array[] = $journal->id; } - $journalIds = implode(',', $array); + $journalIds = implode(',', $array); Log::debug(sprintf('Add local operator for journal(s): %s', $journalIds)); // collect rules: @@ -97,7 +97,7 @@ class StoredGroupEventHandler } // create and fire rule engine. - $newRuleEngine = app(RuleEngineInterface::class); + $newRuleEngine = app(RuleEngineInterface::class); $newRuleEngine->setUser($storedGroupEvent->transactionGroup->user); $newRuleEngine->addOperator(['type' => 'journal_id', 'value' => $journalIds]); $newRuleEngine->setRuleGroups($groups); @@ -106,7 +106,7 @@ class StoredGroupEventHandler private function recalculateCredit(StoredTransactionGroup $event): void { - $group = $event->transactionGroup; + $group = $event->transactionGroup; /** @var CreditRecalculateService $object */ $object = app(CreditRecalculateService::class); @@ -122,10 +122,10 @@ class StoredGroupEventHandler /** @var TransactionJournal $journal */ foreach ($event->transactionGroup->transactionJournals as $journal) { /** @var null|Transaction $source */ - $source = $journal->transactions()->where('amount', '<', '0')->first(); + $source = $journal->transactions()->where('amount', '<', '0')->first(); /** @var null|Transaction $dest */ - $dest = $journal->transactions()->where('amount', '>', '0')->first(); + $dest = $journal->transactions()->where('amount', '>', '0')->first(); if (null !== $source) { $repository->deleteStatisticsForModel($source->account, $journal->date); @@ -160,14 +160,14 @@ class StoredGroupEventHandler private function triggerWebhooks(StoredTransactionGroup $storedGroupEvent): void { Log::debug(__METHOD__); - $group = $storedGroupEvent->transactionGroup; + $group = $storedGroupEvent->transactionGroup; if (false === $storedGroupEvent->fireWebhooks) { Log::info(sprintf('Will not fire webhooks for transaction group #%d', $group->id)); return; } - $user = $group->user; + $user = $group->user; /** @var MessageGeneratorInterface $engine */ $engine = app(MessageGeneratorInterface::class); diff --git a/app/Http/Controllers/RuleGroup/ExecutionController.php b/app/Http/Controllers/RuleGroup/ExecutionController.php index 332c9c6f3f..ecf02825a1 100644 --- a/app/Http/Controllers/RuleGroup/ExecutionController.php +++ b/app/Http/Controllers/RuleGroup/ExecutionController.php @@ -74,14 +74,14 @@ class ExecutionController extends Controller Log::debug(sprintf('You have selected rule group #%d', $ruleGroup->id)); // Get parameters specified by the user $accounts = $request->get('accounts'); - $set = new Collection(); - if(is_array($accounts)) { - $set = $this->repository->getAccountsById($accounts); + $set = new Collection(); + if (is_array($accounts)) { + $set = $this->repository->getAccountsById($accounts); } /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); - if(count($set) > 0) { + if (count($set) > 0) { $collector->setAccounts($set); } diff --git a/composer.lock b/composer.lock index b6b4b6c1ce..eafa2a21be 100644 --- a/composer.lock +++ b/composer.lock @@ -13087,8 +13087,5 @@ "ext-xmlwriter": "*" }, "platform-dev": {}, - "platform-overrides": { - "php": "8.4" - }, "plugin-api-version": "2.9.0" } diff --git a/config/firefly.php b/config/firefly.php index c8d6662cda..dfb9528c2e 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2026-01-02', - 'build_time' => 1767337875, + 'version' => 'develop/2026-01-05', + 'build_time' => 1767598210, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used. From 581d67a92cb3ac0653837e022a2b00c9eacc11c5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 6 Jan 2026 20:38:41 +0100 Subject: [PATCH 53/58] Fix #11399 --- public/v1/js/.gitkeep | 0 .../transactions/ForeignAmountSelect.vue | 17 ++++++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) mode change 100644 => 100755 public/v1/js/.gitkeep diff --git a/public/v1/js/.gitkeep b/public/v1/js/.gitkeep old mode 100644 new mode 100755 diff --git a/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue b/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue index fdcc48f80b..53fd2c26c5 100644 --- a/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue +++ b/resources/assets/v1/src/components/transactions/ForeignAmountSelect.vue @@ -68,8 +68,8 @@ export default { props: ['source', 'destination', 'transactionType', 'value', 'error', 'no_currency', 'title',], mounted() { this.liability = false; - // console.log('I am mounted with a ' + this.transactionType + ' transaction type and currency id!'); - // console.log(this.value); + console.log('ForeignAmountSelect is mounted with a ' + this.transactionType + ' transaction type and currency id!'); + console.log(this.value); this.loadCurrencies(); }, data() { @@ -124,23 +124,25 @@ export default { let sourceIsLiability = liabilities.indexOf(srcType) !== -1; let destIsLiability = liabilities.indexOf(destType) !== -1; + // console.log(srcType + ' (source) is a liability: ' + sourceIsLiability); // console.log(destType + ' (dest) is a liability: ' + destIsLiability); // console.log('tType: ' + tType); if (tType === 'transfer' || destIsLiability || sourceIsLiability) { - // console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.'); + console.log('Source or dest is a liability.') + console.log('Source is liability OR dest is liability, OR transfer. Lock list on currency of destination.'); // console.log('Length of currencies is ' + this.currencies.length); // console.log(this.currencies); this.liability = true; - // lock dropdown list on currencyID of destination. + // lock dropdown list on currencyID of destination UNLESS dest is not liab for (const key in this.currencies) { if (this.currencies.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) { if ( - parseInt(this.currencies[key].id) === parseInt(this.destination.currency_id) + parseInt(this.currencies[key].id) === parseInt(this.destination.currency_id) || !destIsLiability ) { - // console.log('Enable currency!!'); + console.log('Enable currency!!'); + console.log(this.currencies[key]); // console.log(this.destination); - // console.log(this.currencies[key]); this.enabledCurrencies.push(this.currencies[key]); } } @@ -151,6 +153,7 @@ export default { // if type is withdrawal, list all but skip the source account ID. if (tType === 'withdrawal' && this.source && false === sourceIsLiability) { + console.log('Type is withdrawal, there is a source, it is not a liability.') for (const key in this.currencies) { if (this.currencies.hasOwnProperty(key) && /^0$|^[1-9]\d*$/.test(key) && key <= 4294967294) { if (this.source.currency_id !== this.currencies[key].id) { From 280e531a76e456cea1e2a28341f18688143af0f2 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 6 Jan 2026 20:43:11 +0100 Subject: [PATCH 54/58] Fix #11396 --- app/Http/Controllers/Json/ReconcileController.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index 561cbd48a2..4068545e7f 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -212,6 +212,13 @@ class ReconcileController extends Controller $startBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $startDate)[$account->id]; $endBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $end)[$account->id]; + // round balances. + foreach($startBalance as $key => $value) { + $startBalance[$key] = Steam::bcround($value, $currency->decimal_places); + } + foreach($endBalance as $key => $value) { + $endBalance[$key] = Steam::bcround($value, $currency->decimal_places); + } // get the transactions From ffa618101d99775e7b6338280b992a96167104eb Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 6 Jan 2026 20:55:08 +0100 Subject: [PATCH 55/58] Update changelog. --- changelog.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/changelog.md b/changelog.md index 1567e3b4ba..4c8969b83b 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,50 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## v6.4.15 - 2026-01-07 + +### Added + +- #11264 +- #11410 +- #11433 + +### Changed + +- Moved some settings to your system settings + +### Removed + +- The following environment variables are removed and will no longer work. They are now in your settings. + - `ENABLE_EXTERNAL_MAP` + - `ENABLE_EXCHANGE_RATES` + - `ENABLE_EXTERNAL_RATES` + - `VALID_URL_PROTOCOLS` + - `ALLOW_WEBHOOKS` + - `USE_RUNNING_BALANCE` +- Removed sentry.io code + +### Fixed + +- #11378 +- #11383 +- #11388 +- #11396 +- #11399 +- #11403 +- #11410 +- #11443 +- #11445 +- #11449 + +### Security + +- Initial release. + +### API + +- Initial release. + ## v6.4.14 - 2025-12-17 ### Fixed From 9ebafe64f1a9373e7a691b9e8f14ae9ace3a0733 Mon Sep 17 00:00:00 2001 From: JC5 Date: Tue, 6 Jan 2026 20:59:11 +0100 Subject: [PATCH 56/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202026-01-06?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/Json/ReconcileController.php | 4 +- changelog.md | 26 +- composer.lock | 10 +- config/firefly.php | 4 +- package-lock.json | 239 +++++++++++------- public/v1/js/.gitkeep | 0 6 files changed, 164 insertions(+), 119 deletions(-) mode change 100755 => 100644 public/v1/js/.gitkeep diff --git a/app/Http/Controllers/Json/ReconcileController.php b/app/Http/Controllers/Json/ReconcileController.php index 4068545e7f..f68569b6d8 100644 --- a/app/Http/Controllers/Json/ReconcileController.php +++ b/app/Http/Controllers/Json/ReconcileController.php @@ -213,10 +213,10 @@ class ReconcileController extends Controller $startBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $startDate)[$account->id]; $endBalance = Steam::accountsBalancesOptimized(new Collection()->push($account), $end)[$account->id]; // round balances. - foreach($startBalance as $key => $value) { + foreach ($startBalance as $key => $value) { $startBalance[$key] = Steam::bcround($value, $currency->decimal_places); } - foreach($endBalance as $key => $value) { + foreach ($endBalance as $key => $value) { $endBalance[$key] = Steam::bcround($value, $currency->decimal_places); } diff --git a/changelog.md b/changelog.md index 4c8969b83b..37e258a39a 100644 --- a/changelog.md +++ b/changelog.md @@ -7,9 +7,9 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added -- #11264 -- #11410 -- #11433 +- [Issue 11264](https://github.com/firefly-iii/firefly-iii/issues/11264) (Add GUI for some settings, replacing environment variables) reported by @jacobburrell +- [Issue 11410](https://github.com/firefly-iii/firefly-iii/issues/11410) (nitpick: Bulk edit tags should keep the option chosen instead of always changing back to "replace") reported by @jxtxzzw +- [Discussion 11433](https://github.com/orgs/firefly-iii/discussions/11433) ([Suggestion] Updates to Date Range selection) started by @fett327 ### Changed @@ -28,16 +28,16 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- #11378 -- #11383 -- #11388 -- #11396 -- #11399 -- #11403 -- #11410 -- #11443 -- #11445 -- #11449 +- [Issue 11378](https://github.com/firefly-iii/firefly-iii/issues/11378) (Wrong account balance with initial transfer from different currency) reported by @bozho +- [Issue 11383](https://github.com/firefly-iii/firefly-iii/issues/11383) (Login flow could redirect to javascript path) reported by @stefvonb +- [Issue 11388](https://github.com/firefly-iii/firefly-iii/issues/11388) (TypeError bugs during upgrade to 6.4.14 + account_balances corruption) reported by @jaconde2 +- [Issue 11396](https://github.com/firefly-iii/firefly-iii/issues/11396) (Reconciliation adds extra digits) reported by @niklas2810 +- [Issue 11399](https://github.com/firefly-iii/firefly-iii/issues/11399) (Unusual behavior in audit logs (multi-currency)) reported by @jgmm81 +- [Issue 11403](https://github.com/firefly-iii/firefly-iii/issues/11403) (Error 404 when trying to view the details (Piggy banks section)) reported by @jgmm81 +- [Issue 11410](https://github.com/firefly-iii/firefly-iii/issues/11410) (nitpick: Bulk edit tags should keep the option chosen instead of always changing back to "replace") reported by @jxtxzzw +- [Issue 11443](https://github.com/firefly-iii/firefly-iii/issues/11443) (Exception thrown, when subscription is in foreign currency) reported by @ajgon +- [Issue 11445](https://github.com/firefly-iii/firefly-iii/issues/11445) (“Reconcile” screen breaks when Preferences → Layout is set to “Year to date”) reported by @semonsir +- [Issue 11449](https://github.com/firefly-iii/firefly-iii/issues/11449) (Non-strict rules break with "Apply rule" and "Apply rule group") reported by @Bytenka ### Security diff --git a/composer.lock b/composer.lock index eafa2a21be..8b28675e06 100644 --- a/composer.lock +++ b/composer.lock @@ -1878,16 +1878,16 @@ }, { "name": "laravel/framework", - "version": "v12.44.0", + "version": "v12.45.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "592bbf1c036042958332eb98e3e8131b29102f33" + "reference": "9dfd2afc48f2519bfdbe6862dfb9849491c673ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/592bbf1c036042958332eb98e3e8131b29102f33", - "reference": "592bbf1c036042958332eb98e3e8131b29102f33", + "url": "https://api.github.com/repos/laravel/framework/zipball/9dfd2afc48f2519bfdbe6862dfb9849491c673ad", + "reference": "9dfd2afc48f2519bfdbe6862dfb9849491c673ad", "shasum": "" }, "require": { @@ -2096,7 +2096,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-12-23T15:29:43+00:00" + "time": "2026-01-06T15:24:52+00:00" }, { "name": "laravel/passport", diff --git a/config/firefly.php b/config/firefly.php index dfb9528c2e..a7519b847f 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2026-01-05', - 'build_time' => 1767598210, + 'version' => 'develop/2026-01-06', + 'build_time' => 1767729449, '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 dd6b0b6ca4..6a81fd44a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2592,9 +2592,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.55.1.tgz", + "integrity": "sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==", "cpu": [ "arm" ], @@ -2606,9 +2606,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.55.1.tgz", + "integrity": "sha512-eFZCb1YUqhTysgW3sj/55du5cG57S7UTNtdMjCW7LwVcj3dTTcowCsC8p7uBdzKsZYa8J7IDE8lhMI+HX1vQvg==", "cpu": [ "arm64" ], @@ -2620,9 +2620,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.55.1.tgz", + "integrity": "sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==", "cpu": [ "arm64" ], @@ -2634,9 +2634,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.55.1.tgz", + "integrity": "sha512-rDUjG25C9qoTm+e02Esi+aqTKSBYwVTaoS1wxcN47/Luqef57Vgp96xNANwt5npq9GDxsH7kXxNkJVEsWEOEaQ==", "cpu": [ "x64" ], @@ -2648,9 +2648,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.55.1.tgz", + "integrity": "sha512-+JiU7Jbp5cdxekIgdte0jfcu5oqw4GCKr6i3PJTlXTCU5H5Fvtkpbs4XJHRmWNXF+hKmn4v7ogI5OQPaupJgOg==", "cpu": [ "arm64" ], @@ -2662,9 +2662,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.55.1.tgz", + "integrity": "sha512-V5xC1tOVWtLLmr3YUk2f6EJK4qksksOYiz/TCsFHu/R+woubcLWdC9nZQmwjOAbmExBIVKsm1/wKmEy4z4u4Bw==", "cpu": [ "x64" ], @@ -2676,9 +2676,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.55.1.tgz", + "integrity": "sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==", "cpu": [ "arm" ], @@ -2690,9 +2690,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.55.1.tgz", + "integrity": "sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==", "cpu": [ "arm" ], @@ -2704,9 +2704,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.55.1.tgz", + "integrity": "sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==", "cpu": [ "arm64" ], @@ -2718,9 +2718,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.55.1.tgz", + "integrity": "sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==", "cpu": [ "arm64" ], @@ -2732,9 +2732,23 @@ ] }, "node_modules/@rollup/rollup-linux-loong64-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.55.1.tgz", + "integrity": "sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.55.1.tgz", + "integrity": "sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==", "cpu": [ "loong64" ], @@ -2746,9 +2760,23 @@ ] }, "node_modules/@rollup/rollup-linux-ppc64-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.55.1.tgz", + "integrity": "sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.55.1.tgz", + "integrity": "sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==", "cpu": [ "ppc64" ], @@ -2760,9 +2788,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.55.1.tgz", + "integrity": "sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==", "cpu": [ "riscv64" ], @@ -2774,9 +2802,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-musl": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.55.1.tgz", + "integrity": "sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==", "cpu": [ "riscv64" ], @@ -2788,9 +2816,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.55.1.tgz", + "integrity": "sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==", "cpu": [ "s390x" ], @@ -2802,9 +2830,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.55.1.tgz", + "integrity": "sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==", "cpu": [ "x64" ], @@ -2816,9 +2844,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.55.1.tgz", + "integrity": "sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==", "cpu": [ "x64" ], @@ -2829,10 +2857,24 @@ "linux" ] }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.55.1.tgz", + "integrity": "sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, "node_modules/@rollup/rollup-openharmony-arm64": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.55.1.tgz", + "integrity": "sha512-xzm44KgEP11te3S2HCSyYf5zIzWmx3n8HDCc7EE59+lTcswEWNpvMLfd9uJvVX8LCg9QWG67Xt75AuHn4vgsXw==", "cpu": [ "arm64" ], @@ -2844,9 +2886,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.55.1.tgz", + "integrity": "sha512-yR6Bl3tMC/gBok5cz/Qi0xYnVbIxGx5Fcf/ca0eB6/6JwOY+SRUcJfI0OpeTpPls7f194as62thCt/2BjxYN8g==", "cpu": [ "arm64" ], @@ -2858,9 +2900,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.55.1.tgz", + "integrity": "sha512-3fZBidchE0eY0oFZBnekYCfg+5wAB0mbpCBuofh5mZuzIU/4jIVkbESmd2dOsFNS78b53CYv3OAtwqkZZmU5nA==", "cpu": [ "ia32" ], @@ -2872,9 +2914,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-gnu": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.55.1.tgz", + "integrity": "sha512-xGGY5pXj69IxKb4yv/POoocPy/qmEGhimy/FoTpTSVju3FYXUQQMFCaZZXJVidsmGxRioZAwpThl/4zX41gRKg==", "cpu": [ "x64" ], @@ -2886,9 +2928,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "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==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.55.1.tgz", + "integrity": "sha512-SPEpaL6DX4rmcXtnhdrQYgzQ5W2uW3SCJch88lB2zImhJRhIIK44fkUrgIV/Q8yUNfw5oyZ5vkeQsZLhCb06lw==", "cpu": [ "x64" ], @@ -10036,9 +10078,9 @@ } }, "node_modules/rollup": { - "version": "4.54.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.54.0.tgz", - "integrity": "sha512-3nk8Y3a9Ea8szgKhinMlGMhGMw89mqule3KWczxhIzqudyHdCIOHw8WJlj/r329fACjKLEh13ZSk7oE22kyeIw==", + "version": "4.55.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.55.1.tgz", + "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==", "dev": true, "license": "MIT", "dependencies": { @@ -10052,28 +10094,31 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@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", + "@rollup/rollup-android-arm-eabi": "4.55.1", + "@rollup/rollup-android-arm64": "4.55.1", + "@rollup/rollup-darwin-arm64": "4.55.1", + "@rollup/rollup-darwin-x64": "4.55.1", + "@rollup/rollup-freebsd-arm64": "4.55.1", + "@rollup/rollup-freebsd-x64": "4.55.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.55.1", + "@rollup/rollup-linux-arm-musleabihf": "4.55.1", + "@rollup/rollup-linux-arm64-gnu": "4.55.1", + "@rollup/rollup-linux-arm64-musl": "4.55.1", + "@rollup/rollup-linux-loong64-gnu": "4.55.1", + "@rollup/rollup-linux-loong64-musl": "4.55.1", + "@rollup/rollup-linux-ppc64-gnu": "4.55.1", + "@rollup/rollup-linux-ppc64-musl": "4.55.1", + "@rollup/rollup-linux-riscv64-gnu": "4.55.1", + "@rollup/rollup-linux-riscv64-musl": "4.55.1", + "@rollup/rollup-linux-s390x-gnu": "4.55.1", + "@rollup/rollup-linux-x64-gnu": "4.55.1", + "@rollup/rollup-linux-x64-musl": "4.55.1", + "@rollup/rollup-openbsd-x64": "4.55.1", + "@rollup/rollup-openharmony-arm64": "4.55.1", + "@rollup/rollup-win32-arm64-msvc": "4.55.1", + "@rollup/rollup-win32-ia32-msvc": "4.55.1", + "@rollup/rollup-win32-x64-gnu": "4.55.1", + "@rollup/rollup-win32-x64-msvc": "4.55.1", "fsevents": "~2.3.2" } }, @@ -10129,9 +10174,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.97.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.97.1.tgz", - "integrity": "sha512-uf6HoO8fy6ClsrShvMgaKUn14f2EHQLQRtpsZZLeU/Mv0Q1K5P0+x2uvH6Cub39TVVbWNSrraUhDAoFph6vh0A==", + "version": "1.97.2", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.97.2.tgz", + "integrity": "sha512-y5LWb0IlbO4e97Zr7c3mlpabcbBtS+ieiZ9iwDooShpFKWXf62zz5pEPdwrLYm+Bxn1fnbwFGzHuCLSA9tBmrw==", "dev": true, "license": "MIT", "dependencies": { @@ -12288,9 +12333,9 @@ "license": "ISC" }, "node_modules/ws": { - "version": "8.18.3", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.3.tgz", - "integrity": "sha512-PEIGCY5tSlUt50cqyMXfCzX+oOPqN0vuGqWzbcJ2xvnkzkq46oOpz7dQaTDBdfICb4N14+GARUDw2XV2N4tvzg==", + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.19.0.tgz", + "integrity": "sha512-blAT2mjOEIi0ZzruJfIhb3nps74PRWTCz1IjglWEEpQl5XS/UNama6u2/rjFkDDouqr4L67ry+1aGIALViWjDg==", "dev": true, "license": "MIT", "engines": { diff --git a/public/v1/js/.gitkeep b/public/v1/js/.gitkeep old mode 100755 new mode 100644 From 5260b770bbabda97db82064beeac54d5e18c3366 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 6 Jan 2026 21:01:07 +0100 Subject: [PATCH 57/58] Clean up changelog. --- changelog.md | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/changelog.md b/changelog.md index 37e258a39a..76467d68a5 100644 --- a/changelog.md +++ b/changelog.md @@ -8,8 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Added - [Issue 11264](https://github.com/firefly-iii/firefly-iii/issues/11264) (Add GUI for some settings, replacing environment variables) reported by @jacobburrell -- [Issue 11410](https://github.com/firefly-iii/firefly-iii/issues/11410) (nitpick: Bulk edit tags should keep the option chosen instead of always changing back to "replace") reported by @jxtxzzw -- [Discussion 11433](https://github.com/orgs/firefly-iii/discussions/11433) ([Suggestion] Updates to Date Range selection) started by @fett327 +- [Discussion 11433](https://github.com/orgs/firefly-iii/discussions/11433) (Updates to Date Range selection) started by @fett327 ### Changed @@ -39,14 +38,6 @@ This project adheres to [Semantic Versioning](http://semver.org/). - [Issue 11445](https://github.com/firefly-iii/firefly-iii/issues/11445) (“Reconcile” screen breaks when Preferences → Layout is set to “Year to date”) reported by @semonsir - [Issue 11449](https://github.com/firefly-iii/firefly-iii/issues/11449) (Non-strict rules break with "Apply rule" and "Apply rule group") reported by @Bytenka -### Security - -- Initial release. - -### API - -- Initial release. - ## v6.4.14 - 2025-12-17 ### Fixed From 52b14b46a221131c403a073e812e3641a9dfbd5a Mon Sep 17 00:00:00 2001 From: JC5 Date: Tue, 6 Jan 2026 21:05:27 +0100 Subject: [PATCH 58/58] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'v6.4.15'=20on=202026-01-06?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/firefly.php b/config/firefly.php index a7519b847f..ea32253719 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -78,8 +78,8 @@ return [ 'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used. // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2026-01-06', - 'build_time' => 1767729449, + 'version' => '6.4.15', + 'build_time' => 1767729818, 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 28, // field is no longer used.