From b93cfc5de29e4749cde9dc0396821ed0e130e40f Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 22 Feb 2025 17:26:08 +0100 Subject: [PATCH 01/52] Auto commit for release 'develop' on 2025-02-22 --- config/firefly.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/firefly.php b/config/firefly.php index 7c4e0bf3c3..7728e8a78e 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => '6.2.9', + 'version' => 'develop/2025-02-22', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, From 8d464962a8615a58ddc25dd9ee32aea6aa4851fb Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:27:07 +0100 Subject: [PATCH 02/52] Remove methods, point to interface. --- .../Account/AccountRepositoryInterface.php | 7 --- .../Account/AccountTaskerInterface.php | 4 -- .../Account/OperationsRepositoryInterface.php | 4 -- .../AttachmentRepositoryInterface.php | 4 -- .../Bill/BillRepositoryInterface.php | 7 --- .../AvailableBudgetRepositoryInterface.php | 4 -- .../Budget/BudgetLimitRepositoryInterface.php | 4 -- .../Budget/BudgetRepositoryInterface.php | 7 --- .../Budget/NoBudgetRepositoryInterface.php | 4 -- .../Budget/OperationsRepositoryInterface.php | 4 -- .../Category/CategoryRepositoryInterface.php | 7 --- .../NoCategoryRepositoryInterface.php | 4 -- .../OperationsRepositoryInterface.php | 4 -- .../Currency/CurrencyRepositoryInterface.php | 7 --- .../Journal/JournalAPIRepositoryInterface.php | 4 -- .../Journal/JournalCLIRepositoryInterface.php | 4 -- .../Journal/JournalRepositoryInterface.php | 4 -- .../LinkType/LinkTypeRepositoryInterface.php | 4 -- .../ObjectGroupRepositoryInterface.php | 4 -- .../PiggyBankRepositoryInterface.php | 11 +---- .../RecurringRepositoryInterface.php | 4 -- .../Rule/RuleRepositoryInterface.php | 4 -- .../RuleGroupRepositoryInterface.php | 4 -- .../Tag/OperationsRepositoryInterface.php | 4 -- .../Tag/TagRepositoryInterface.php | 4 -- .../TransactionGroupRepositoryInterface.php | 7 --- .../UserGroupRepositoryInterface.php | 4 -- .../Webhook/WebhookRepositoryInterface.php | 4 -- .../UserGroup/UserGroupInterface.php | 45 +++++++++++++++++++ .../Repositories/UserGroup/UserGroupTrait.php | 7 ++- 30 files changed, 53 insertions(+), 136 deletions(-) create mode 100644 app/Support/Repositories/UserGroup/UserGroupInterface.php diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 3878423227..9079921991 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -30,9 +30,6 @@ use FireflyIII\Models\Location; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -148,10 +145,6 @@ interface AccountRepositoryInterface public function searchAccountNr(string $query, array $types, int $limit): Collection; - public function setUser(null|Authenticatable|User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; - public function store(array $data): Account; public function update(Account $account, array $data): Account; diff --git a/app/Repositories/Account/AccountTaskerInterface.php b/app/Repositories/Account/AccountTaskerInterface.php index 74438f7882..cb05d48a32 100644 --- a/app/Repositories/Account/AccountTaskerInterface.php +++ b/app/Repositories/Account/AccountTaskerInterface.php @@ -24,8 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Account; use Carbon\Carbon; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -38,6 +36,4 @@ interface AccountTaskerInterface public function getExpenseReport(Carbon $start, Carbon $end, Collection $accounts): array; public function getIncomeReport(Carbon $start, Carbon $end, Collection $accounts): array; - - public function setUser(null|Authenticatable|User $user): void; } diff --git a/app/Repositories/Account/OperationsRepositoryInterface.php b/app/Repositories/Account/OperationsRepositoryInterface.php index aea8031c7c..3a0dc10db5 100644 --- a/app/Repositories/Account/OperationsRepositoryInterface.php +++ b/app/Repositories/Account/OperationsRepositoryInterface.php @@ -26,8 +26,6 @@ namespace FireflyIII\Repositories\Account; use Carbon\Carbon; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -49,8 +47,6 @@ interface OperationsRepositoryInterface */ public function listIncome(Carbon $start, Carbon $end, ?Collection $accounts = null): array; - public function setUser(null|Authenticatable|User $user): void; - /** * Sum of withdrawal journals in period for a set of accounts, grouped per currency. Amounts are always negative. * diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index e48a8df323..831a72c456 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -25,8 +25,6 @@ namespace FireflyIII\Repositories\Attachment; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Attachment; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -47,8 +45,6 @@ interface AttachmentRepositoryInterface */ public function getNoteText(Attachment $attachment): ?string; - public function setUser(null|Authenticatable|User $user): void; - /** * @throws FireflyException */ diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index 25553941d0..08cc1e4e4c 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -26,9 +26,6 @@ namespace FireflyIII\Repositories\Bill; use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Bill; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -41,8 +38,6 @@ interface BillRepositoryInterface public function billStartsWith(string $query, int $limit): Collection; - public function setUserGroup(UserGroup $userGroup): void; - /** * Add correct order to bills. */ @@ -141,8 +136,6 @@ interface BillRepositoryInterface */ public function setOrder(Bill $bill, int $order): void; - public function setUser(null|Authenticatable|User $user): void; - /** * @throws FireflyException */ diff --git a/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php b/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php index 410f5990ed..a76b1b8d73 100644 --- a/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php +++ b/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php @@ -27,8 +27,6 @@ namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; use FireflyIII\Models\AvailableBudget; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -86,8 +84,6 @@ interface AvailableBudgetRepositoryInterface */ public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): AvailableBudget; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): ?AvailableBudget; public function update(AvailableBudget $availableBudget, array $data): AvailableBudget; diff --git a/app/Repositories/Budget/BudgetLimitRepositoryInterface.php b/app/Repositories/Budget/BudgetLimitRepositoryInterface.php index bb101e2068..0c752c213f 100644 --- a/app/Repositories/Budget/BudgetLimitRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetLimitRepositoryInterface.php @@ -28,8 +28,6 @@ use Carbon\Carbon; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -68,8 +66,6 @@ interface BudgetLimitRepositoryInterface public function setNoteText(BudgetLimit $budgetLimit, string $text): void; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): BudgetLimit; public function update(BudgetLimit $budgetLimit, array $data): BudgetLimit; diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 89e0c44ed3..dcdf30581d 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -27,9 +27,6 @@ use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\AutoBudget; use FireflyIII\Models\Budget; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -41,8 +38,6 @@ interface BudgetRepositoryInterface public function budgetStartsWith(string $query, int $limit): Collection; - public function setUserGroup(UserGroup $userGroup): void; - /** * Returns the amount that is budgeted in a period. */ @@ -102,8 +97,6 @@ interface BudgetRepositoryInterface public function setBudgetOrder(Budget $budget, int $order): void; - public function setUser(null|Authenticatable|User $user): void; - /** * Used in the v2 API to calculate the amount of money spent in all active budgets. */ diff --git a/app/Repositories/Budget/NoBudgetRepositoryInterface.php b/app/Repositories/Budget/NoBudgetRepositoryInterface.php index 01b4d6d1f1..00ad60b41d 100644 --- a/app/Repositories/Budget/NoBudgetRepositoryInterface.php +++ b/app/Repositories/Budget/NoBudgetRepositoryInterface.php @@ -26,8 +26,6 @@ namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -40,7 +38,5 @@ interface NoBudgetRepositoryInterface */ public function getNoBudgetPeriodReport(Collection $accounts, Carbon $start, Carbon $end): array; - public function setUser(null|Authenticatable|User $user): void; - public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?TransactionCurrency $currency = null): array; } diff --git a/app/Repositories/Budget/OperationsRepositoryInterface.php b/app/Repositories/Budget/OperationsRepositoryInterface.php index f35973432e..d4685070af 100644 --- a/app/Repositories/Budget/OperationsRepositoryInterface.php +++ b/app/Repositories/Budget/OperationsRepositoryInterface.php @@ -27,8 +27,6 @@ namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; use FireflyIII\Models\Budget; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -54,8 +52,6 @@ interface OperationsRepositoryInterface */ public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null): array; - public function setUser(null|Authenticatable|User $user): void; - /** * @SuppressWarnings("PHPMD.ExcessiveParameterList") */ diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 5f59f1ce5e..e181475879 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -26,9 +26,6 @@ namespace FireflyIII\Repositories\Category; use Carbon\Carbon; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Category; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -87,10 +84,6 @@ interface CategoryRepositoryInterface public function searchCategory(string $query, int $limit): Collection; - public function setUser(null|Authenticatable|User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; - /** * @throws FireflyException */ diff --git a/app/Repositories/Category/NoCategoryRepositoryInterface.php b/app/Repositories/Category/NoCategoryRepositoryInterface.php index 6dd36fbc64..41b5f2a3e5 100644 --- a/app/Repositories/Category/NoCategoryRepositoryInterface.php +++ b/app/Repositories/Category/NoCategoryRepositoryInterface.php @@ -25,8 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -48,8 +46,6 @@ interface NoCategoryRepositoryInterface */ public function listIncome(Carbon $start, Carbon $end, ?Collection $accounts = null): array; - public function setUser(null|Authenticatable|User $user): void; - /** * Sum of withdrawal journals in period without a category, grouped per currency. Amounts are always negative. */ diff --git a/app/Repositories/Category/OperationsRepositoryInterface.php b/app/Repositories/Category/OperationsRepositoryInterface.php index 522dd80a55..12531923df 100644 --- a/app/Repositories/Category/OperationsRepositoryInterface.php +++ b/app/Repositories/Category/OperationsRepositoryInterface.php @@ -25,8 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -64,8 +62,6 @@ interface OperationsRepositoryInterface */ public function listTransferredOut(Carbon $start, Carbon $end, Collection $accounts, ?Collection $categories = null): array; - public function setUser(null|Authenticatable|User $user): void; - /** * Sum of withdrawal journals in period for a set of categories, grouped per currency. Amounts are always negative. */ diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 30b889d299..bd6e9f49f4 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -26,9 +26,6 @@ namespace FireflyIII\Repositories\Currency; use Carbon\Carbon; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -66,8 +63,4 @@ interface CurrencyRepositoryInterface * Used in download exchange rate cron job. Needs the user object! */ public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate; - - public function setUser(null|Authenticatable|User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; } diff --git a/app/Repositories/Journal/JournalAPIRepositoryInterface.php b/app/Repositories/Journal/JournalAPIRepositoryInterface.php index e5e9b9ec6a..03c84a6eba 100644 --- a/app/Repositories/Journal/JournalAPIRepositoryInterface.php +++ b/app/Repositories/Journal/JournalAPIRepositoryInterface.php @@ -26,8 +26,6 @@ namespace FireflyIII\Repositories\Journal; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -54,6 +52,4 @@ interface JournalAPIRepositoryInterface * Get all piggy bank events for a journal. */ public function getPiggyBankEvents(TransactionJournal $journal): Collection; - - public function setUser(null|Authenticatable|User $user): void; } diff --git a/app/Repositories/Journal/JournalCLIRepositoryInterface.php b/app/Repositories/Journal/JournalCLIRepositoryInterface.php index 588e9e1d55..80d582c547 100644 --- a/app/Repositories/Journal/JournalCLIRepositoryInterface.php +++ b/app/Repositories/Journal/JournalCLIRepositoryInterface.php @@ -26,8 +26,6 @@ namespace FireflyIII\Repositories\Journal; use Carbon\Carbon; use FireflyIII\Models\TransactionJournal; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -80,6 +78,4 @@ interface JournalCLIRepositoryInterface * Return all tags as strings in an array. */ public function getTags(TransactionJournal $journal): array; - - public function setUser(null|Authenticatable|User $user): void; } diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 055af9b5f5..f9187b4dbb 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -29,8 +29,6 @@ use FireflyIII\Models\Account; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalLink; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -98,8 +96,6 @@ interface JournalRepositoryInterface */ public function searchJournalDescriptions(string $search, int $limit): Collection; - public function setUser(null|Authenticatable|User $user): void; - /** * TODO Maybe to account repository? Do this wen reconcile is API only. */ diff --git a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php index 7ebae5caa7..7586243925 100644 --- a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php +++ b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php @@ -26,8 +26,6 @@ namespace FireflyIII\Repositories\LinkType; use FireflyIII\Models\LinkType; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalLink; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -72,8 +70,6 @@ interface LinkTypeRepositoryInterface */ public function getLinks(TransactionJournal $journal): Collection; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): LinkType; /** diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php index 0232de5ef6..7c83b41bce 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php @@ -25,8 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\ObjectGroup; use FireflyIII\Models\ObjectGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -61,7 +59,5 @@ interface ObjectGroupRepositoryInterface public function setOrder(ObjectGroup $objectGroup, int $newOrder): ObjectGroup; - public function setUser(null|Authenticatable|User $user): void; - public function update(ObjectGroup $objectGroup, array $data): ObjectGroup; } diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php index ac8509d6e1..215e1514d7 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php @@ -29,9 +29,6 @@ use FireflyIII\Models\Account; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBankRepetition; use FireflyIII\Models\TransactionJournal; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -41,8 +38,6 @@ interface PiggyBankRepositoryInterface { public function addAmount(PiggyBank $piggyBank, Account $account, string $amount, ?TransactionJournal $journal = null): bool; - public function getCurrentNativeAmount(PiggyBank $piggyBank, ?Account $account = null): string; - public function addAmountToPiggyBank(PiggyBank $piggyBank, string $amount, TransactionJournal $journal): void; public function canAddAmount(PiggyBank $piggyBank, Account $account, string $amount): bool; @@ -72,6 +67,8 @@ interface PiggyBankRepositoryInterface */ public function getCurrentAmount(PiggyBank $piggyBank, ?Account $account = null): string; + public function getCurrentNativeAmount(PiggyBank $piggyBank, ?Account $account = null): string; + /** * Get all events. */ @@ -136,10 +133,6 @@ interface PiggyBankRepositoryInterface */ public function setOrder(PiggyBank $piggyBank, int $newOrder): bool; - public function setUser(null|Authenticatable|User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; - /** * Store new piggy bank. * diff --git a/app/Repositories/Recurring/RecurringRepositoryInterface.php b/app/Repositories/Recurring/RecurringRepositoryInterface.php index 3842a5b2be..caa8debe4d 100644 --- a/app/Repositories/Recurring/RecurringRepositoryInterface.php +++ b/app/Repositories/Recurring/RecurringRepositoryInterface.php @@ -29,8 +29,6 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceRepetition; use FireflyIII\Models\RecurrenceTransaction; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -137,8 +135,6 @@ interface RecurringRepositoryInterface public function searchRecurrence(string $query, int $limit): Collection; - public function setUser(null|Authenticatable|User $user): void; - /** * Store a new recurring transaction. * diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php index 96cb48c06d..24e060f64b 100644 --- a/app/Repositories/Rule/RuleRepositoryInterface.php +++ b/app/Repositories/Rule/RuleRepositoryInterface.php @@ -27,8 +27,6 @@ use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; use FireflyIII\Models\RuleTrigger; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -84,8 +82,6 @@ interface RuleRepositoryInterface public function setOrder(Rule $rule, int $newOrder): void; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): Rule; public function storeAction(Rule $rule, array $values): RuleAction; diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php index d334fbb473..d924a588ca 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php +++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php @@ -24,8 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\RuleGroup; use FireflyIII\Models\RuleGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -88,8 +86,6 @@ interface RuleGroupRepositoryInterface public function setOrder(RuleGroup $ruleGroup, int $newOrder): void; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): RuleGroup; public function update(RuleGroup $ruleGroup, array $data): RuleGroup; diff --git a/app/Repositories/Tag/OperationsRepositoryInterface.php b/app/Repositories/Tag/OperationsRepositoryInterface.php index 3bab517c0c..61f6f46429 100644 --- a/app/Repositories/Tag/OperationsRepositoryInterface.php +++ b/app/Repositories/Tag/OperationsRepositoryInterface.php @@ -25,8 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -48,8 +46,6 @@ interface OperationsRepositoryInterface */ public function listIncome(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array; - public function setUser(null|Authenticatable|User $user): void; - /** * Sum of withdrawal journals in period for a set of tags, grouped per currency. Amounts are always negative. */ diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php index d81efa1cf4..6937f42bcb 100644 --- a/app/Repositories/Tag/TagRepositoryInterface.php +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -26,8 +26,6 @@ namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; use FireflyIII\Models\Location; use FireflyIII\Models\Tag; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -93,8 +91,6 @@ interface TagRepositoryInterface */ public function searchTags(string $query, int $limit): Collection; - public function setUser(null|Authenticatable|User $user): void; - /** * This method stores a tag. */ diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php index 10da55ec14..a2f50a9b0d 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php @@ -28,10 +28,7 @@ use FireflyIII\Exceptions\DuplicateTransactionException; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Location; use FireflyIII\Models\TransactionGroup; -use FireflyIII\Models\UserGroup; use FireflyIII\Support\NullArrayObject; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -98,10 +95,6 @@ interface TransactionGroupRepositoryInterface */ public function getTags(int $journalId): array; - public function setUser(null|Authenticatable|User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; - /** * Create a new transaction group. * diff --git a/app/Repositories/UserGroup/UserGroupRepositoryInterface.php b/app/Repositories/UserGroup/UserGroupRepositoryInterface.php index 0bbeddf828..7db436290f 100644 --- a/app/Repositories/UserGroup/UserGroupRepositoryInterface.php +++ b/app/Repositories/UserGroup/UserGroupRepositoryInterface.php @@ -25,8 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroup; use FireflyIII\Models\UserGroup; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -44,8 +42,6 @@ interface UserGroupRepositoryInterface public function getMembershipsFromGroupId(int $groupId): Collection; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): UserGroup; public function update(UserGroup $userGroup, array $data): UserGroup; diff --git a/app/Repositories/Webhook/WebhookRepositoryInterface.php b/app/Repositories/Webhook/WebhookRepositoryInterface.php index 6425192893..928889f3c9 100644 --- a/app/Repositories/Webhook/WebhookRepositoryInterface.php +++ b/app/Repositories/Webhook/WebhookRepositoryInterface.php @@ -27,8 +27,6 @@ namespace FireflyIII\Repositories\Webhook; use FireflyIII\Models\Webhook; use FireflyIII\Models\WebhookAttempt; use FireflyIII\Models\WebhookMessage; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** @@ -53,8 +51,6 @@ interface WebhookRepositoryInterface public function getReadyMessages(Webhook $webhook): Collection; - public function setUser(null|Authenticatable|User $user): void; - public function store(array $data): Webhook; public function update(Webhook $webhook, array $data): Webhook; diff --git a/app/Support/Repositories/UserGroup/UserGroupInterface.php b/app/Support/Repositories/UserGroup/UserGroupInterface.php new file mode 100644 index 0000000000..0c86120c1d --- /dev/null +++ b/app/Support/Repositories/UserGroup/UserGroupInterface.php @@ -0,0 +1,45 @@ +userGroup; } + public function getUser(): ?User + { + return $this->user; + } + public function checkUserGroupAccess(UserRoleEnum $role): bool { $result = $this->user->hasRoleInGroupOrOwner($this->userGroup, $role); From 60aef0de1a34dcff268ca52df7a106c7c3a4a3a7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:27:34 +0100 Subject: [PATCH 03/52] Mark as deprecated. --- .../UserGroups/Account/AccountRepository.php | 2 + .../Account/AccountRepositoryInterface.php | 7 +-- .../UserGroups/Bill/BillRepository.php | 2 + .../Bill/BillRepositoryInterface.php | 5 +-- .../Budget/AvailableBudgetRepository.php | 2 + .../AvailableBudgetRepositoryInterface.php | 5 +-- .../UserGroups/Budget/BudgetRepository.php | 2 + .../Budget/BudgetRepositoryInterface.php | 8 +--- .../Budget/OperationsRepository.php | 2 + .../Budget/OperationsRepositoryInterface.php | 5 +-- .../Category/CategoryRepository.php | 5 +++ .../Category/CategoryRepositoryInterface.php | 5 +++ .../Currency/CurrencyRepository.php | 2 + .../Currency/CurrencyRepositoryInterface.php | 12 ++--- .../ExchangeRate/ExchangeRateRepository.php | 45 ++++++++++--------- .../ExchangeRateRepositoryInterface.php | 13 ++++-- .../UserGroups/Journal/JournalRepository.php | 2 + .../Journal/JournalRepositoryInterface.php | 5 +-- .../PiggyBank/PiggyBankRepository.php | 2 + .../PiggyBankRepositoryInterface.php | 2 + .../UserGroups/Tag/TagRepository.php | 2 + .../UserGroups/Tag/TagRepositoryInterface.php | 5 +++ 22 files changed, 88 insertions(+), 52 deletions(-) diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index 912a4d0e0e..97877aeb3e 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -40,6 +40,8 @@ use Illuminate\Support\Facades\DB; /** * Class AccountRepository + * + * @deprecated */ class AccountRepository implements AccountRepositoryInterface { diff --git a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php index 17b3fad59b..3af1e70aa3 100644 --- a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php +++ b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php @@ -27,11 +27,12 @@ namespace FireflyIII\Repositories\UserGroups\Account; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\UserGroup; -use FireflyIII\User; use Illuminate\Support\Collection; /** * Interface AccountRepositoryInterface + * + * @deprecated */ interface AccountRepositoryInterface { @@ -82,9 +83,5 @@ interface AccountRepositoryInterface public function searchAccount(string $query, array $types, int $page, int $limit): Collection; - public function setUser(User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; - public function update(Account $account, array $data): Account; } diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php index ffeb688792..ad2558a70f 100644 --- a/app/Repositories/UserGroups/Bill/BillRepository.php +++ b/app/Repositories/UserGroups/Bill/BillRepository.php @@ -36,6 +36,8 @@ use Illuminate\Support\Facades\Log; /** * Class BillRepository + * + * @deprecated */ class BillRepository implements BillRepositoryInterface { diff --git a/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php b/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php index 6bf9d979a5..7c2819022e 100644 --- a/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php +++ b/app/Repositories/UserGroups/Bill/BillRepositoryInterface.php @@ -26,11 +26,12 @@ namespace FireflyIII\Repositories\UserGroups\Bill; use Carbon\Carbon; use FireflyIII\Models\Bill; -use FireflyIII\User; use Illuminate\Support\Collection; /** * Interface BillRepositoryInterface + * + * @deprecated */ interface BillRepositoryInterface { @@ -59,8 +60,6 @@ interface BillRepositoryInterface */ public function nextDateMatch(Bill $bill, Carbon $date): Carbon; - public function setUser(User $user): void; - /** * Collect multi-currency of sum of bills already paid. */ diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php index f1b9fa96f8..e6118cb938 100644 --- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php @@ -32,6 +32,8 @@ use Illuminate\Support\Facades\Log; /** * Class AvailableBudgetRepository + * + * @deprecated */ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface { diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php index 6d1015f348..33a2c7b203 100644 --- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php +++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepositoryInterface.php @@ -25,14 +25,13 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroups\Budget; use Carbon\Carbon; -use FireflyIII\User; /** * Interface AvailableBudgetRepositoryInterface + * + * @deprecated */ interface AvailableBudgetRepositoryInterface { public function getAvailableBudgetWithCurrency(Carbon $start, Carbon $end): array; - - public function setUser(User $user): void; } diff --git a/app/Repositories/UserGroups/Budget/BudgetRepository.php b/app/Repositories/UserGroups/Budget/BudgetRepository.php index f86e58e601..cb43479b71 100644 --- a/app/Repositories/UserGroups/Budget/BudgetRepository.php +++ b/app/Repositories/UserGroups/Budget/BudgetRepository.php @@ -29,6 +29,8 @@ use Illuminate\Support\Collection; /** * Class BudgetRepository + * + * @deprecated */ class BudgetRepository implements BudgetRepositoryInterface { diff --git a/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php b/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php index c6929275b5..021736f595 100644 --- a/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/UserGroups/Budget/BudgetRepositoryInterface.php @@ -24,20 +24,16 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroups\Budget; -use FireflyIII\Models\UserGroup; -use FireflyIII\User; use Illuminate\Support\Collection; /** * Interface BudgetRepositoryInterface + * + * @deprecated */ interface BudgetRepositoryInterface { public function getActiveBudgets(): Collection; public function getBudgets(): Collection; - - public function setUser(User $user): void; - - public function setUserGroup(UserGroup $userGroup): void; } diff --git a/app/Repositories/UserGroups/Budget/OperationsRepository.php b/app/Repositories/UserGroups/Budget/OperationsRepository.php index 349daf0a71..63a0b22644 100644 --- a/app/Repositories/UserGroups/Budget/OperationsRepository.php +++ b/app/Repositories/UserGroups/Budget/OperationsRepository.php @@ -33,6 +33,8 @@ use Illuminate\Support\Collection; /** * Class OperationsRepository + * + * @deprecated */ class OperationsRepository implements OperationsRepositoryInterface { diff --git a/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php b/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php index e1eb8762a1..a96b94f658 100644 --- a/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php +++ b/app/Repositories/UserGroups/Budget/OperationsRepositoryInterface.php @@ -25,11 +25,12 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroups\Budget; use Carbon\Carbon; -use FireflyIII\User; use Illuminate\Support\Collection; /** * Interface OperationsRepositoryInterface + * + * @deprecated */ interface OperationsRepositoryInterface { @@ -39,6 +40,4 @@ interface OperationsRepositoryInterface * as possible. Amounts are always negative. */ public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null): array; - - public function setUser(User $user): void; } diff --git a/app/Repositories/UserGroups/Category/CategoryRepository.php b/app/Repositories/UserGroups/Category/CategoryRepository.php index dd489d1bcd..2b93a540cf 100644 --- a/app/Repositories/UserGroups/Category/CategoryRepository.php +++ b/app/Repositories/UserGroups/Category/CategoryRepository.php @@ -28,6 +28,11 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Support\Collection; +/** + * Class CategoryRepository + * + * @deprecated + */ class CategoryRepository implements CategoryRepositoryInterface { use UserGroupTrait; diff --git a/app/Repositories/UserGroups/Category/CategoryRepositoryInterface.php b/app/Repositories/UserGroups/Category/CategoryRepositoryInterface.php index 5c5c1242f6..1a8cc54a4c 100644 --- a/app/Repositories/UserGroups/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/UserGroups/Category/CategoryRepositoryInterface.php @@ -26,6 +26,11 @@ namespace FireflyIII\Repositories\UserGroups\Category; use Illuminate\Support\Collection; +/** + * Interface CategoryRepositoryInterface + * + * @deprecated + */ interface CategoryRepositoryInterface { /** diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php index 428ddf0da3..73bce5a06b 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php @@ -43,6 +43,8 @@ use Illuminate\Support\Facades\Log; /** * Class CurrencyRepository + * + * @deprecated */ class CurrencyRepository implements CurrencyRepositoryInterface { diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php index 8982498eb4..c49b3b4fb8 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php @@ -27,15 +27,17 @@ namespace FireflyIII\Repositories\UserGroups\Currency; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\UserGroup; -use FireflyIII\User; use Illuminate\Support\Collection; +/** + * Interface CurrencyRepositoryInterface + * + * @deprecated + */ interface CurrencyRepositoryInterface { public function currencyInUse(TransactionCurrency $currency): bool; - public function getUserGroup(): UserGroup; - /** * Currency is in use where exactly. */ @@ -86,14 +88,14 @@ interface CurrencyRepositoryInterface public function getByIds(array $ids): Collection; + public function getUserGroup(): UserGroup; + public function isFallbackCurrency(TransactionCurrency $currency): bool; public function makeDefault(TransactionCurrency $currency): void; public function searchCurrency(string $search, int $limit): Collection; - public function setUser(User $user): void; - /** * @throws FireflyException */ diff --git a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php index 3384fc1f41..2460d7d572 100644 --- a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php @@ -31,10 +31,27 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +/** + * Class ExchangeRateRepository + * + * @deprecated + */ class ExchangeRateRepository implements ExchangeRateRepositoryInterface { use UserGroupTrait; + #[\Override] + public function deleteRate(CurrencyExchangeRate $rate): void + { + $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); + } + + #[\Override] + public function getAll(): Collection + { + return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); + } + #[\Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { @@ -71,24 +88,6 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface ; } - #[\Override] - public function deleteRate(CurrencyExchangeRate $rate): void - { - $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); - } - - #[\Override] - public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate - { - $object->rate = $rate; - if (null !== $date) { - $object->date = $date; - } - $object->save(); - - return $object; - } - #[\Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { @@ -106,8 +105,14 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface } #[\Override] - public function getAll(): Collection + public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { - return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); + $object->rate = $rate; + if (null !== $date) { + $object->date = $date; + } + $object->save(); + + return $object; } } diff --git a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepositoryInterface.php b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepositoryInterface.php index ba2c83d9aa..00e164d15e 100644 --- a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepositoryInterface.php +++ b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepositoryInterface.php @@ -29,17 +29,22 @@ use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; use Illuminate\Support\Collection; +/** + * Interface ExchangeRateRepositoryInterface + * + * @deprecated + */ interface ExchangeRateRepositoryInterface { - public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection; + public function deleteRate(CurrencyExchangeRate $rate): void; public function getAll(): Collection; + public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection; + public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate; - public function deleteRate(CurrencyExchangeRate $rate): void; + public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate; public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate; - - public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate; } diff --git a/app/Repositories/UserGroups/Journal/JournalRepository.php b/app/Repositories/UserGroups/Journal/JournalRepository.php index 6b141c5b09..8926573acd 100644 --- a/app/Repositories/UserGroups/Journal/JournalRepository.php +++ b/app/Repositories/UserGroups/Journal/JournalRepository.php @@ -30,6 +30,8 @@ use Illuminate\Support\Collection; /** * Class JournalRepository + * + * @deprecated */ class JournalRepository implements JournalRepositoryInterface { diff --git a/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php b/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php index 71bfd8f518..c8321fcd7c 100644 --- a/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/UserGroups/Journal/JournalRepositoryInterface.php @@ -24,11 +24,12 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroups\Journal; -use FireflyIII\User; use Illuminate\Support\Collection; /** * Interface JournalRepositoryInterface + * + * @deprecated */ interface JournalRepositoryInterface { @@ -36,6 +37,4 @@ interface JournalRepositoryInterface * Search in journal descriptions. */ public function searchJournalDescriptions(array $query, int $limit): Collection; - - public function setUser(User $user): void; } diff --git a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php index e45d568990..c1312306f7 100644 --- a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php @@ -30,6 +30,8 @@ use Illuminate\Support\Collection; /** * Class PiggyBankRepository + * + * @deprecated */ class PiggyBankRepository implements PiggyBankRepositoryInterface { diff --git a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepositoryInterface.php index 32a98d5423..cf39595a4b 100644 --- a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepositoryInterface.php @@ -28,6 +28,8 @@ use Illuminate\Support\Collection; /** * Interface PiggyBankRepositoryInterface + * + * @deprecated */ interface PiggyBankRepositoryInterface { diff --git a/app/Repositories/UserGroups/Tag/TagRepository.php b/app/Repositories/UserGroups/Tag/TagRepository.php index 7ec5dc4926..49f9c2e044 100644 --- a/app/Repositories/UserGroups/Tag/TagRepository.php +++ b/app/Repositories/UserGroups/Tag/TagRepository.php @@ -30,6 +30,8 @@ use Illuminate\Support\Collection; /** * Class TagRepository + * + * @deprecated */ class TagRepository implements TagRepositoryInterface { diff --git a/app/Repositories/UserGroups/Tag/TagRepositoryInterface.php b/app/Repositories/UserGroups/Tag/TagRepositoryInterface.php index 1d65350890..f5aa677560 100644 --- a/app/Repositories/UserGroups/Tag/TagRepositoryInterface.php +++ b/app/Repositories/UserGroups/Tag/TagRepositoryInterface.php @@ -26,6 +26,11 @@ namespace FireflyIII\Repositories\UserGroups\Tag; use Illuminate\Support\Collection; +/** + * Interface TagRepositoryInterface + * + * @deprecated + */ interface TagRepositoryInterface { /** From 79ae1103680f74cd9f433f673637e2c2e84a59c4 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:27:49 +0100 Subject: [PATCH 04/52] Update php cs fixer --- .ci/php-cs-fixer/composer.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 6ec2d09671..610267380d 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -406,16 +406,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.69.1", + "version": "v3.70.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "13b0c0eede38c11cd674b080f2b485d0f14ffa9f" + "reference": "2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/13b0c0eede38c11cd674b080f2b485d0f14ffa9f", - "reference": "13b0c0eede38c11cd674b080f2b485d0f14ffa9f", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e", + "reference": "2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e", "shasum": "" }, "require": { @@ -497,7 +497,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.69.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.70.0" }, "funding": [ { @@ -505,7 +505,7 @@ "type": "github" } ], - "time": "2025-02-18T23:57:43+00:00" + "time": "2025-02-22T23:30:51+00:00" }, { "name": "psr/container", From de8149137afd4f75d033834ae0e02162556edcf7 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:28:27 +0100 Subject: [PATCH 05/52] Use trait and interface. --- .../Account/AccountRepository.php | 18 ++--- app/Repositories/Account/AccountTasker.php | 17 ++-- .../Account/OperationsRepository.php | 15 +--- .../Attachment/AttachmentRepository.php | 16 +--- app/Repositories/Bill/BillRepository.php | 3 +- .../Budget/AvailableBudgetRepository.php | 15 +--- .../Budget/BudgetLimitRepository.php | 14 +--- app/Repositories/Budget/BudgetRepository.php | 3 +- .../Budget/NoBudgetRepository.php | 16 +--- .../Budget/OperationsRepository.php | 16 +--- .../Category/CategoryRepository.php | 12 +-- .../Category/NoCategoryRepository.php | 27 +++---- .../Category/OperationsRepository.php | 14 +--- .../Currency/CurrencyRepository.php | 23 +----- .../Journal/JournalAPIRepository.php | 15 +--- .../Journal/JournalCLIRepository.php | 13 ++-- .../Journal/JournalRepository.php | 15 +--- .../LinkType/LinkTypeRepository.php | 15 +--- .../ObjectGroup/ObjectGroupRepository.php | 15 +--- .../PiggyBank/PiggyBankRepository.php | 78 +++++++++---------- .../Recurring/RecurringRepository.php | 14 +--- app/Repositories/Rule/RuleRepository.php | 16 +--- .../RuleGroup/RuleGroupRepository.php | 15 +--- app/Repositories/Tag/OperationsRepository.php | 15 +--- app/Repositories/Tag/TagRepository.php | 15 +--- .../TransactionGroupRepository.php | 3 +- app/Repositories/User/UserRepository.php | 5 +- .../UserGroup/UserGroupRepository.php | 15 +--- .../Webhook/WebhookRepository.php | 20 ++--- .../Internal/Update/BillUpdateService.php | 4 +- .../Internal/Update/JournalUpdateService.php | 4 +- .../Support/Models/BillDateCalculatorTest.php | 22 +++--- 32 files changed, 165 insertions(+), 343 deletions(-) diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 02e06bb0f4..0309b66f95 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -33,24 +33,23 @@ use FireflyIII\Models\AccountMeta; use FireflyIII\Models\AccountType; use FireflyIII\Models\Attachment; use FireflyIII\Models\Location; -use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Services\Internal\Destroy\AccountDestroyService; use FireflyIII\Services\Internal\Update\AccountUpdateService; use FireflyIII\Support\Facades\Steam; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Storage; /** * Class AccountRepository. */ -class AccountRepository implements AccountRepositoryInterface +class AccountRepository implements AccountRepositoryInterface, UserGroupInterface { use UserGroupTrait; @@ -210,8 +209,8 @@ class AccountRepository implements AccountRepositoryInterface { $set = $account->attachments()->get(); - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + /** @var Storage $disk */ + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line @@ -239,13 +238,6 @@ class AccountRepository implements AccountRepositoryInterface return $factory->findOrCreate('Cash account', $type->type); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function getCreditTransactionGroup(Account $account): ?TransactionGroup { $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 2f6133978b..eae312bd36 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -30,17 +30,17 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Account; use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Facades\Steam; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; /** * Class AccountTasker. */ -class AccountTasker implements AccountTaskerInterface +class AccountTasker implements AccountTaskerInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * @throws FireflyException @@ -49,7 +49,7 @@ class AccountTasker implements AccountTaskerInterface { $yesterday = clone $start; $yesterday->subDay()->endOfDay(); // exactly up until $start but NOT including. - $end->endOfDay(); // needs to be end of day to be correct. + $end->endOfDay(); // needs to be end of day to be correct. Log::debug(sprintf('getAccountReport: finalAccountsBalance("%s")', $yesterday->format('Y-m-d H:i:s'))); Log::debug(sprintf('getAccountReport: finalAccountsBalance("%s")', $end->format('Y-m-d H:i:s'))); $startSet = Steam::finalAccountsBalance($accounts, $yesterday); @@ -289,11 +289,4 @@ class AccountTasker implements AccountTaskerInterface return $report; } - - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } } diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php index ab37ea4b87..fb71bb7235 100644 --- a/app/Repositories/Account/OperationsRepository.php +++ b/app/Repositories/Account/OperationsRepository.php @@ -29,16 +29,16 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class OperationsRepository */ -class OperationsRepository implements OperationsRepositoryInterface +class OperationsRepository implements OperationsRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * This method returns a list of all the withdrawal transaction journals (as arrays) set in that period @@ -66,13 +66,6 @@ class OperationsRepository implements OperationsRepositoryInterface return $collector->getExtractedJournals(); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - private function sortByCurrency(array $journals, string $direction): array { $array = []; diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index a1744a3dac..2c9bed54b7 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -28,8 +28,8 @@ use FireflyIII\Factory\AttachmentFactory; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; use FireflyIII\Models\Attachment; use FireflyIII\Models\Note; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Storage; @@ -38,10 +38,9 @@ use League\Flysystem\UnableToDeleteFile; /** * Class AttachmentRepository. */ -class AttachmentRepository implements AttachmentRepositoryInterface +class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupInterface { - /** @var User */ - private $user; + use UserGroupTrait; /** * @throws \Exception @@ -126,13 +125,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface return $result; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function update(Attachment $attachment, array $data): Attachment { if (array_key_exists('title', $data)) { diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 248b3ac2dd..7c1426c929 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -38,6 +38,7 @@ use FireflyIII\Services\Internal\Destroy\BillDestroyService; use FireflyIII\Services\Internal\Update\BillUpdateService; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Facades\Amount; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Query\JoinClause; use Illuminate\Pagination\LengthAwarePaginator; @@ -48,7 +49,7 @@ use Illuminate\Support\Facades\Log; /** * Class BillRepository. */ -class BillRepository implements BillRepositoryInterface +class BillRepository implements BillRepositoryInterface, UserGroupInterface { use CreatesObjectGroups; use UserGroupTrait; diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index f991ed0d99..fddb77e0ec 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -28,8 +28,8 @@ use Carbon\Carbon; use FireflyIII\Models\AvailableBudget; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Facades\Amount; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; @@ -37,9 +37,9 @@ use Illuminate\Support\Facades\Log; /** * Class AvailableBudgetRepository */ -class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface +class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function cleanup(): void { @@ -230,13 +230,6 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface return $availableBudget; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function store(array $data): ?AvailableBudget { $start = $data['start']; diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index c7ffe4b45d..17bf27e34c 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -31,8 +31,9 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\Note; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; @@ -40,9 +41,9 @@ use Illuminate\Support\Facades\Log; /** * Class BudgetLimitRepository */ -class BudgetLimitRepository implements BudgetLimitRepositoryInterface +class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * Tells you which amount has been budgeted (for the given budgets) @@ -262,13 +263,6 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface return (string) $budgetLimit->notes()->first()?->text; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - /** * @throws FireflyException */ diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 3e7426ec0a..03363c925f 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -41,6 +41,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; use FireflyIII\Services\Internal\Destroy\BudgetDestroyService; use FireflyIII\Support\Http\Api\ExchangeRateConverter; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; @@ -49,7 +50,7 @@ use Illuminate\Support\Facades\Log; /** * Class BudgetRepository. */ -class BudgetRepository implements BudgetRepositoryInterface +class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { use UserGroupTrait; diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php index decae30ffc..fa9d367d8a 100644 --- a/app/Repositories/Budget/NoBudgetRepository.php +++ b/app/Repositories/Budget/NoBudgetRepository.php @@ -29,17 +29,16 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class NoBudgetRepository */ -class NoBudgetRepository implements NoBudgetRepositoryInterface +class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterface { - /** @var User */ - private $user; + use UserGroupTrait; public function getNoBudgetPeriodReport(Collection $accounts, Carbon $start, Carbon $end): array { @@ -80,13 +79,6 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface return $data; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?TransactionCurrency $currency = null): array { /** @var GroupCollectorInterface $collector */ diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index 077e89a16c..eb6c70a52d 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -31,19 +31,18 @@ use FireflyIII\Models\Account; use FireflyIII\Models\Budget; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; /** * Class OperationsRepository */ -class OperationsRepository implements OperationsRepositoryInterface +class OperationsRepository implements OperationsRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * A method that returns the amount of money budgeted per day for this budget, @@ -186,13 +185,6 @@ class OperationsRepository implements OperationsRepositoryInterface return $array; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - private function getBudgets(): Collection { /** @var BudgetRepositoryInterface $repos */ diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 53d25b6686..c168a7a98c 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -33,16 +33,15 @@ use FireflyIII\Models\RecurrenceTransactionMeta; use FireflyIII\Models\RuleAction; use FireflyIII\Services\Internal\Destroy\CategoryDestroyService; use FireflyIII\Services\Internal\Update\CategoryUpdateService; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; /** * Class CategoryRepository. */ -class CategoryRepository implements CategoryRepositoryInterface +class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterface { use UserGroupTrait; @@ -168,13 +167,6 @@ class CategoryRepository implements CategoryRepositoryInterface return $category; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function removeNotes(Category $category): void { $category->notes()->delete(); diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index 9fdeae0978..d8ea7ce007 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -28,16 +28,16 @@ use Carbon\Carbon; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class NoCategoryRepository */ -class NoCategoryRepository implements NoCategoryRepositoryInterface +class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * This method returns a list of all the withdrawal transaction journals (as arrays) set in that period @@ -77,21 +77,14 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->negative($journal['amount']), - 'date' => $journal['date'], - ]; + 'amount' => app('steam')->negative($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - /** * This method returns a list of all the deposit transaction journals (as arrays) set in that period * which have no category set to them. It's grouped per currency, with as few details in the array @@ -130,9 +123,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->positive($journal['amount']), - 'date' => $journal['date'], - ]; + 'amount' => app('steam')->positive($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php index 0845ddfa10..a0f5b168a7 100644 --- a/app/Repositories/Category/OperationsRepository.php +++ b/app/Repositories/Category/OperationsRepository.php @@ -29,17 +29,18 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; /** * Class OperationsRepository */ -class OperationsRepository implements OperationsRepositoryInterface +class OperationsRepository implements OperationsRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * This method returns a list of all the withdrawal transaction journals (as arrays) set in that period @@ -112,13 +113,6 @@ class OperationsRepository implements OperationsRepositoryInterface return $array; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - /** * Returns a list of all the categories belonging to a user. */ diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index ca3c15e64c..e908216f2a 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -26,18 +26,17 @@ namespace FireflyIII\Repositories\Currency; use Carbon\Carbon; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Models\UserGroup; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Class CurrencyRepository. */ -class CurrencyRepository implements CurrencyRepositoryInterface +class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterface { - private User $user; - private UserGroup $userGroup; + use UserGroupTrait; #[\Override] public function find(int $currencyId): ?TransactionCurrency @@ -107,18 +106,4 @@ class CurrencyRepository implements CurrencyRepositoryInterface ] ); } - - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - $this->userGroup = $user->userGroup; - } - } - - #[\Override] - public function setUserGroup(UserGroup $userGroup): void - { - $this->userGroup = $userGroup; - } } diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php index 71ba154860..35590f1d5c 100644 --- a/app/Repositories/Journal/JournalAPIRepository.php +++ b/app/Repositories/Journal/JournalAPIRepository.php @@ -29,16 +29,16 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBankEvent; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class JournalAPIRepository */ -class JournalAPIRepository implements JournalAPIRepositoryInterface +class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * Returns transaction by ID. Used to validate attachments. @@ -96,11 +96,4 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface return $events; } - - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } } diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php index a605f60331..5384b22eea 100644 --- a/app/Repositories/Journal/JournalCLIRepository.php +++ b/app/Repositories/Journal/JournalCLIRepository.php @@ -28,15 +28,17 @@ use Carbon\Carbon; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Support\CacheProperties; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class JournalCLIRepository */ -class JournalCLIRepository implements JournalCLIRepositoryInterface +class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupInterface { + use UserGroupTrait; + /** * Get all transaction journals with a specific type, regardless of user. */ @@ -201,9 +203,4 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface { return $journal->tags()->get()->pluck('tag')->toArray(); } - - public function setUser(null|Authenticatable|User $user): void - { - // empty - } } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 0a07d7d166..7ef358d137 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -36,16 +36,16 @@ use FireflyIII\Services\Internal\Destroy\JournalDestroyService; use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService; use FireflyIII\Services\Internal\Update\JournalUpdateService; use FireflyIII\Support\CacheProperties; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class JournalRepository. */ -class JournalRepository implements JournalRepositoryInterface +class JournalRepository implements JournalRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function destroyGroup(TransactionGroup $transactionGroup): void { @@ -204,13 +204,6 @@ class JournalRepository implements JournalRepositoryInterface return $query->take($limit)->get(); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function unreconcileById(int $journalId): void { /** @var null|TransactionJournal $journal */ diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index f42ece55ca..024e097959 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -28,16 +28,16 @@ use FireflyIII\Models\LinkType; use FireflyIII\Models\Note; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalLink; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class LinkTypeRepository. */ -class LinkTypeRepository implements LinkTypeRepositoryInterface +class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function countJournals(LinkType $linkType): int { @@ -157,13 +157,6 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface ); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function store(array $data): LinkType { $linkType = new LinkType(); diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php index e9d880d56a..90e96cb1e0 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php @@ -26,16 +26,16 @@ namespace FireflyIII\Repositories\ObjectGroup; use FireflyIII\Models\ObjectGroup; use FireflyIII\Models\PiggyBank; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class ObjectGroupRepository */ -class ObjectGroupRepository implements ObjectGroupRepositoryInterface +class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function deleteAll(): void { @@ -127,13 +127,6 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface return $dbQuery->take($limit)->get(['object_groups.*']); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function update(ObjectGroup $objectGroup, array $data): ObjectGroup { if (array_key_exists('title', $data)) { diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 9291cbdd05..5f96219b1b 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -36,16 +36,15 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\Facades\Steam; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; /** * Class PiggyBankRepository. */ -class PiggyBankRepository implements PiggyBankRepositoryInterface +class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInterface { use ModifiesPiggyBanks; @@ -126,6 +125,24 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface ); } + /** + * Get current amount saved in piggy bank. + */ + public function getCurrentNativeAmount(PiggyBank $piggyBank, ?Account $account = null): string + { + $sum = '0'; + foreach ($piggyBank->accounts as $current) { + if (null !== $account && $account->id !== $current->id) { + continue; + } + $amount = (string) $current->pivot->native_current_amount; + $amount = '' === $amount ? '0' : $amount; + $sum = bcadd($sum, $amount); + } + + return $sum; + } + public function getEvents(PiggyBank $piggyBank): Collection { return $piggyBank->piggyBankEvents()->orderBy('date', 'DESC')->orderBy('id', 'DESC')->get(); @@ -242,11 +259,23 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface return (string) $amount; } - public function setUser(null|Authenticatable|User $user): void + /** + * Get current amount saved in piggy bank. + */ + public function getCurrentAmount(PiggyBank $piggyBank, ?Account $account = null): string { - if ($user instanceof User) { - $this->user = $user; + $sum = '0'; + foreach ($piggyBank->accounts as $current) { + if (null !== $account && $account->id !== $current->id) { + continue; + } + $amount = (string) $current->pivot->current_amount; + $amount = '' === $amount ? '0' : $amount; + $sum = bcadd($sum, $amount); } + // Log::debug(sprintf('Current amount in piggy bank #%d ("%s") is %s', $piggyBank->id, $piggyBank->name, $sum)); + + return $sum; } /** @@ -290,43 +319,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface ; } - /** - * Get current amount saved in piggy bank. - */ - public function getCurrentAmount(PiggyBank $piggyBank, ?Account $account = null): string - { - $sum = '0'; - foreach ($piggyBank->accounts as $current) { - if (null !== $account && $account->id !== $current->id) { - continue; - } - $amount = (string) $current->pivot->current_amount; - $amount = '' === $amount ? '0' : $amount; - $sum = bcadd($sum, $amount); - } - // Log::debug(sprintf('Current amount in piggy bank #%d ("%s") is %s', $piggyBank->id, $piggyBank->name, $sum)); - - return $sum; - } - - /** - * Get current amount saved in piggy bank. - */ - public function getCurrentNativeAmount(PiggyBank $piggyBank, ?Account $account = null): string - { - $sum = '0'; - foreach ($piggyBank->accounts as $current) { - if (null !== $account && $account->id !== $current->id) { - continue; - } - $amount = (string) $current->pivot->native_current_amount; - $amount = '' === $amount ? '0' : $amount; - $sum = bcadd($sum, $amount); - } - - return $sum; - } - public function getRepetition(PiggyBank $piggyBank, bool $overrule = false): ?PiggyBankRepetition { if (false === $overrule) { diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index b24aa9be82..1d6c47c5ac 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -43,8 +43,9 @@ use FireflyIII\Support\Repositories\Recurring\CalculateRangeOccurrences; use FireflyIII\Support\Repositories\Recurring\CalculateXOccurrences; use FireflyIII\Support\Repositories\Recurring\CalculateXOccurrencesSince; use FireflyIII\Support\Repositories\Recurring\FiltersWeekends; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\Eloquent\Builder; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -53,14 +54,14 @@ use Illuminate\Support\Facades\Log; /** * Class RecurringRepository */ -class RecurringRepository implements RecurringRepositoryInterface +class RecurringRepository implements RecurringRepositoryInterface, UserGroupInterface { use CalculateRangeOccurrences; use CalculateXOccurrences; use CalculateXOccurrencesSince; use FiltersWeekends; - private User $user; + use UserGroupTrait; public function createdPreviously(Recurrence $recurrence, Carbon $date): bool { @@ -305,13 +306,6 @@ class RecurringRepository implements RecurringRepositoryInterface return $collector->getPaginatedGroups(); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function getTransactions(Recurrence $recurrence): Collection { $journalMeta = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 0c43cdc0db..ca214c6edd 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -29,18 +29,17 @@ use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; use FireflyIII\Models\RuleTrigger; use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\Support\Search\OperatorQuerySearch; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Class RuleRepository. */ -class RuleRepository implements RuleRepositoryInterface +class RuleRepository implements RuleRepositoryInterface, UserGroupInterface { - /** @var User */ - private $user; + use UserGroupTrait; /** * @throws \Exception @@ -312,13 +311,6 @@ class RuleRepository implements RuleRepositoryInterface return true; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function setOrder(Rule $rule, int $newOrder): void { $oldOrder = $rule->order; diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 447151dbad..8615e346ec 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -27,8 +27,8 @@ use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; use FireflyIII\Models\RuleTrigger; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; @@ -36,9 +36,9 @@ use Illuminate\Support\Facades\Log; /** * Class RuleGroupRepository. */ -class RuleGroupRepository implements RuleGroupRepositoryInterface +class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function correctRuleGroupOrder(): void { @@ -382,13 +382,6 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface return $search->take($limit)->get(['id', 'title', 'description']); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function store(array $data): RuleGroup { $newRuleGroup = new RuleGroup( diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php index 20ee0ad654..9fe781fd00 100644 --- a/app/Repositories/Tag/OperationsRepository.php +++ b/app/Repositories/Tag/OperationsRepository.php @@ -28,16 +28,16 @@ use Carbon\Carbon; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; /** * Class OperationsRepository */ -class OperationsRepository implements OperationsRepositoryInterface +class OperationsRepository implements OperationsRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; /** * This method returns a list of all the withdrawal transaction journals (as arrays) set in that period @@ -114,13 +114,6 @@ class OperationsRepository implements OperationsRepositoryInterface return $array; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - private function getTags(): Collection { /** @var TagRepositoryInterface $repository */ diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 3b1427af38..eb0f2c3649 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -31,17 +31,17 @@ use FireflyIII\Models\Attachment; use FireflyIII\Models\Location; use FireflyIII\Models\Note; use FireflyIII\Models\Tag; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; /** * Class TagRepository. */ -class TagRepository implements TagRepositoryInterface +class TagRepository implements TagRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function count(): int { @@ -91,13 +91,6 @@ class TagRepository implements TagRepositoryInterface return $collector->getExtractedJournals(); } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function find(int $tagId): ?Tag { /** @var null|Tag */ diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index b533d19296..cc5b68565b 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -43,6 +43,7 @@ use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService; use FireflyIII\Services\Internal\Update\GroupUpdateService; use FireflyIII\Support\NullArrayObject; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; @@ -50,7 +51,7 @@ use Illuminate\Support\Collection; /** * Class TransactionGroupRepository */ -class TransactionGroupRepository implements TransactionGroupRepositoryInterface +class TransactionGroupRepository implements TransactionGroupRepositoryInterface, UserGroupInterface { use UserGroupTrait; diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index a811edd134..9abc8554a3 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -33,6 +33,7 @@ use FireflyIII\User; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; +use Illuminate\Support\Str; /** * Class UserRepository. @@ -275,7 +276,7 @@ class UserRepository implements UserRepositoryInterface $now->addDays(2); $invitee = new InvitedUser(); $invitee->user()->associate($user); - $invitee->invite_code = \Str::random(64); + $invitee->invite_code = Str::random(64); $invitee->email = $email; $invitee->redeemed = false; $invitee->expires = $now; @@ -310,7 +311,7 @@ class UserRepository implements UserRepositoryInterface 'blocked' => $data['blocked'] ?? false, 'blocked_code' => $data['blocked_code'] ?? null, 'email' => $data['email'], - 'password' => \Str::random(24), + 'password' => Str::random(24), ] ); $role = $data['role'] ?? ''; diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index 1d283c3fd3..863e9a5d4a 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -31,16 +31,17 @@ use FireflyIII\Models\GroupMembership; use FireflyIII\Models\UserGroup; use FireflyIII\Models\UserRole; use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Class UserGroupRepository */ -class UserGroupRepository implements UserGroupRepositoryInterface +class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function destroy(UserGroup $userGroup): void { @@ -187,14 +188,6 @@ class UserGroupRepository implements UserGroupRepositoryInterface return $this->user->groupMemberships()->where('user_group_id', $groupId)->get(); } - public function setUser(null|Authenticatable|User $user): void - { - app('log')->debug(sprintf('Now in %s', __METHOD__)); - if ($user instanceof User) { - $this->user = $user; - } - } - public function update(UserGroup $userGroup, array $data): UserGroup { $userGroup->title = $data['title']; diff --git a/app/Repositories/Webhook/WebhookRepository.php b/app/Repositories/Webhook/WebhookRepository.php index 4c9fd15ca9..0cc7dee0e2 100644 --- a/app/Repositories/Webhook/WebhookRepository.php +++ b/app/Repositories/Webhook/WebhookRepository.php @@ -27,16 +27,17 @@ namespace FireflyIII\Repositories\Webhook; use FireflyIII\Models\Webhook; use FireflyIII\Models\WebhookAttempt; use FireflyIII\Models\WebhookMessage; -use FireflyIII\User; -use Illuminate\Contracts\Auth\Authenticatable; +use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; +use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Str; /** * Class WebhookRepository */ -class WebhookRepository implements WebhookRepositoryInterface +class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterface { - private User $user; + use UserGroupTrait; public function all(): Collection { @@ -85,16 +86,9 @@ class WebhookRepository implements WebhookRepositoryInterface ; } - public function setUser(null|Authenticatable|User $user): void - { - if ($user instanceof User) { - $this->user = $user; - } - } - public function store(array $data): Webhook { - $secret = \Str::random(24); + $secret = Str::random(24); $fullData = [ 'user_id' => $this->user->id, 'user_group_id' => $this->user->user_group_id, @@ -120,7 +114,7 @@ class WebhookRepository implements WebhookRepositoryInterface $webhook->url = $data['url'] ?? $webhook->url; if (true === $data['secret']) { - $secret = \Str::random(24); + $secret = Str::random(24); $webhook->secret = $secret; } diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index 3905b21d62..d56bb2cc8c 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -54,8 +54,8 @@ 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')->getNativeCurrencyByUserGroup($bill->user->userGroup); + $currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) + ?? app('amount')->getNativeCurrencyByUserGroup($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 b156b2705f..e596d4363b 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -703,8 +703,8 @@ class JournalUpdateService // find currency in data array $newForeignId = $this->data['foreign_currency_id'] ?? null; $newForeignCode = $this->data['foreign_currency_code'] ?? null; - $foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode) ?? - $foreignCurrency; + $foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode) + ?? $foreignCurrency; // not the same as normal currency if (null !== $foreignCurrency && $foreignCurrency->id === $this->transactionJournal->transaction_currency_id) { diff --git a/tests/integration/Support/Models/BillDateCalculatorTest.php b/tests/integration/Support/Models/BillDateCalculatorTest.php index b4962ad6fb..bb65b1d0ac 100644 --- a/tests/integration/Support/Models/BillDateCalculatorTest.php +++ b/tests/integration/Support/Models/BillDateCalculatorTest.php @@ -45,6 +45,17 @@ final class BillDateCalculatorTest extends TestCase $this->calculator = new BillDateCalculator(); } + /** + * Stupid long method names I'm not going to do that. + * + * @dataProvider provideDates + */ + public function testGivenSomeDataItWorks(Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid, array $expected): void + { + $result = $this->calculator->getPayDates($earliest, $latest, $billStart, $period, $skip, $lastPaid); + self::assertSame($expected, $result); + } + public static function provideDates(): iterable { // Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid @@ -66,15 +77,4 @@ final class BillDateCalculatorTest extends TestCase '1Ya' => ['earliest' => Carbon::parse('2023-11-01'), 'latest' => Carbon::parse('2023-11-30'), 'billStart' => Carbon::parse('2021-05-01'), 'period' => 'yearly', 'skip' => 0, 'lastPaid' => Carbon::parse('2023-05-02'), 'expected' => ['2024-05-01']], ]; } - - /** - * Stupid long method names I'm not going to do that. - * - * @dataProvider provideDates - */ - public function testGivenSomeDataItWorks(Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid, array $expected): void - { - $result = $this->calculator->getPayDates($earliest, $latest, $billStart, $period, $skip, $lastPaid); - self::assertSame($expected, $result); - } } From 25ebfd6978cf1f5a94f6ba117bed5b809b562485 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:28:43 +0100 Subject: [PATCH 06/52] php cs cleanup --- .../Controllers/Summary/BasicController.php | 4 +- app/Api/V1/Requests/Data/DestroyRequest.php | 6 +- app/Factory/BillFactory.php | 4 +- .../Transaction/MassController.php | 4 +- app/Http/Middleware/TrustProxies.php | 10 +- .../unit/Support/Calendar/CalculatorTest.php | 62 +++---- .../Calendar/Periodicity/IntervalTestCase.php | 20 +-- .../unit/Support/NavigationAddPeriodTest.php | 152 +++++++++--------- .../Support/NavigationEndOfPeriodTest.php | 36 ++--- ...ationPreferredCarbonFormatByPeriodTest.php | 18 +-- .../NavigationPreferredCarbonFormatTest.php | 18 +-- .../NavigationPreferredEndOfPeriodTest.php | 18 +-- .../NavigationPreferredRangeFormatTest.php | 18 +-- .../NavigationPreferredSqlFormatTest.php | 18 +-- .../Support/NavigationStartOfPeriodTest.php | 36 ++--- ...ctQueryParserInterfaceParseQueryTester.php | 28 ++-- 16 files changed, 226 insertions(+), 226 deletions(-) diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index addd31b8eb..cb0a7bbb96 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -185,8 +185,8 @@ class BasicController extends Controller 'currency_decimal_places' => $currency->decimal_places, 'value_parsed' => app('amount')->formatAnything($currency, $sums[$currencyId] ?? '0', false), 'local_icon' => 'balance-scale', - 'sub_title' => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false). - ' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false), + 'sub_title' => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false) + .' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false), ]; $return[] = [ 'key' => sprintf('spent-in-%s', $currency->code), diff --git a/app/Api/V1/Requests/Data/DestroyRequest.php b/app/Api/V1/Requests/Data/DestroyRequest.php index 2f564567d9..082fb00adb 100644 --- a/app/Api/V1/Requests/Data/DestroyRequest.php +++ b/app/Api/V1/Requests/Data/DestroyRequest.php @@ -49,9 +49,9 @@ class DestroyRequest extends FormRequest */ public function rules(): array { - $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'. - ',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'. - ',not_assets_liabilities'; + $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups' + .',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers' + .',not_assets_liabilities'; return [ 'objects' => sprintf('required|max:255|min:1|string|in:%s', $valid), diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php index 62d1e79805..24aa6a7e7e 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -48,8 +48,8 @@ class BillFactory { app('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')->getNativeCurrencyByUserGroup($this->user->userGroup); + $currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) + ?? app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); try { $skip = array_key_exists('skip', $data) ? $data['skip'] : 0; diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index f5d46ec514..67a2fc6add 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -141,8 +141,8 @@ 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]['foreign_amount'] = null === $journal['foreign_amount'] ? - null : app('steam')->positive($journal['foreign_amount']); + $journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] + ? null : app('steam')->positive($journal['foreign_amount']); } $this->rememberPreviousUrl('transactions.mass-edit.url'); diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index d68f3054be..986bb2e5b8 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -33,11 +33,11 @@ class TrustProxies extends Middleware { // After... protected $headers - = Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; + = Request::HEADER_X_FORWARDED_FOR + | Request::HEADER_X_FORWARDED_HOST + | Request::HEADER_X_FORWARDED_PORT + | Request::HEADER_X_FORWARDED_PROTO + | Request::HEADER_X_FORWARDED_AWS_ELB; /** * TrustProxies constructor. diff --git a/tests/unit/Support/Calendar/CalculatorTest.php b/tests/unit/Support/Calendar/CalculatorTest.php index 3830390c3b..4f127bf767 100644 --- a/tests/unit/Support/Calendar/CalculatorTest.php +++ b/tests/unit/Support/Calendar/CalculatorTest.php @@ -50,6 +50,32 @@ use Tests\unit\Support\Calendar\Periodicity\YearlyTest; */ final class CalculatorTest extends TestCase { + private static function convert(Periodicity $periodicity, array $intervals): array + { + $periodicityIntervals = []; + + /** @var IntervalProvider $interval */ + foreach ($intervals as $index => $interval) { + $calculator = CalculatorProvider::from($periodicity, $interval); + + $periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator]; + } + + return $periodicityIntervals; + } + + /** + * @dataProvider provideAllPeriodicity + * + * @throws IntervalException + */ + public function testGivenADailyPeriodicityWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(CalculatorProvider $provider): void + { + $calculator = new Calculator(); + $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity); + self::assertSame($provider->expected()->toDateString(), $period->toDateString()); + } + public static function provideAllPeriodicity(): iterable { $intervals = []; @@ -68,37 +94,6 @@ final class CalculatorTest extends TestCase } } - private static function convert(Periodicity $periodicity, array $intervals): array - { - $periodicityIntervals = []; - - /** @var IntervalProvider $interval */ - foreach ($intervals as $index => $interval) { - $calculator = CalculatorProvider::from($periodicity, $interval); - - $periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator]; - } - - return $periodicityIntervals; - } - - public static function provideSkippedIntervals(): iterable - { - return CalculatorProvider::providePeriodicityWithSkippedIntervals(); - } - - /** - * @dataProvider provideAllPeriodicity - * - * @throws IntervalException - */ - public function testGivenADailyPeriodicityWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(CalculatorProvider $provider): void - { - $calculator = new Calculator(); - $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity); - self::assertSame($provider->expected()->toDateString(), $period->toDateString()); - } - /** * @dataProvider provideSkippedIntervals * @@ -110,4 +105,9 @@ final class CalculatorTest extends TestCase $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity, $provider->skip); self::assertSame($provider->expected()->toDateString(), $period->toDateString()); } + + public static function provideSkippedIntervals(): iterable + { + return CalculatorProvider::providePeriodicityWithSkippedIntervals(); + } } diff --git a/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php b/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php index 2153f1b9a0..7e4cc812bc 100644 --- a/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php +++ b/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php @@ -29,16 +29,6 @@ use Tests\integration\TestCase; abstract class IntervalTestCase extends TestCase { - public static function provider(): iterable - { - $intervals = static::provideIntervals(); - - /** @var IntervalProvider $interval */ - foreach ($intervals as $interval) { - yield "{$interval->label}" => [$interval]; - } - } - abstract public static function provideIntervals(): array; /** @@ -50,5 +40,15 @@ abstract class IntervalTestCase extends TestCase self::assertSame($provider->expected->toDateString(), $period->toDateString()); } + public static function provider(): iterable + { + $intervals = static::provideIntervals(); + + /** @var IntervalProvider $interval */ + foreach ($intervals as $interval) { + yield "{$interval->label}" => [$interval]; + } + } + abstract public static function factory(): Interval; } diff --git a/tests/unit/Support/NavigationAddPeriodTest.php b/tests/unit/Support/NavigationAddPeriodTest.php index cb0cedc1f0..018258d2bf 100644 --- a/tests/unit/Support/NavigationAddPeriodTest.php +++ b/tests/unit/Support/NavigationAddPeriodTest.php @@ -48,74 +48,13 @@ final class NavigationAddPeriodTest extends TestCase $this->navigation = new Navigation(); } - public static function provideFrequencies(): iterable + /** + * @dataProvider providePeriodsWithSkippingParam + */ + public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected): void { - return [ - Periodicity::Daily->name => ['periodicity' => Periodicity::Daily, 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], - Periodicity::Weekly->name => ['periodicity' => Periodicity::Weekly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - Periodicity::Fortnightly->name => ['periodicity' => Periodicity::Fortnightly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(2)], - Periodicity::Monthly->name => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], - '2019-01-01 to 2019-02-01' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-01'), 'expected' => Carbon::parse('2019-02-01')], - '2019-01-29 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-30 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-31 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], - '2023-03-31 to 2023-04-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], - '2023-05-31 to 2023-06-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], - '2023-08-31 to 2023-09-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], - '2023-10-31 to 2023-11-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], - Periodicity::Quarterly->name => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - '2019-01-29 to 2020-04-29' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-04-29')], - '2019-01-30 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-04-30')], - '2019-01-31 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-04-30')], - Periodicity::HalfYearly->name => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], - '2019-01-31 to 2020-07-29' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-07-29')], - '2019-01-31 to 2020-07-30' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-07-30')], - '2019-01-31 to 2020-07-31' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-07-31')], - Periodicity::Yearly->name => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - '2020-02-29 to 2021-02-28' => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::parse('2020-02-29'), 'expected' => Carbon::parse('2021-02-28')], - ]; - } - - public static function provideMonthPeriods(): iterable - { - return [ - '1M' => ['frequency' => '1M', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], - 'month' => ['frequency' => 'month', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], - 'monthly' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], - '2019-01-29 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-30 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-31 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], - '2023-03-31 to 2023-04-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], - '2023-05-31 to 2023-06-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], - '2023-08-31 to 2023-09-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], - '2023-10-31 to 2023-11-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], - ]; - } - - public static function providePeriods(): iterable - { - return [ - '1D' => ['frequency' => '1D', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], - 'daily' => ['frequency' => 'daily', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], - '1W' => ['frequency' => '1W', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - 'weekly' => ['frequency' => 'weekly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - 'week' => ['frequency' => 'week', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - '3M' => ['frequency' => '3M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'quarter' => ['frequency' => 'quarter', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'quarterly' => ['frequency' => 'quarterly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - '6M' => ['frequency' => '6M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], - 'half-year' => ['frequency' => 'half-year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], - 'year' => ['frequency' => 'year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - 'yearly' => ['frequency' => 'yearly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - '1Y' => ['frequency' => '1Y', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - 'last7' => ['frequency' => 'last7', 'from' => Carbon::now(), 'expected' => Carbon::now()->addDays(7)], - 'last30' => ['frequency' => 'last30', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], - 'last90' => ['frequency' => 'last90', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'last365' => ['frequency' => 'last365', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - 'MTD' => ['frequency' => 'MTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], - 'QTD' => ['frequency' => 'QTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'YTD' => ['frequency' => 'YTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - ]; + $period = $this->navigation->addPeriod($from, $frequency, $skip); + self::assertSame($expected->toDateString(), $period->toDateString()); } public static function providePeriodsWithSkippingParam(): iterable @@ -163,15 +102,6 @@ final class NavigationAddPeriodTest extends TestCase } } - /** - * @dataProvider providePeriodsWithSkippingParam - */ - public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected): void - { - $period = $this->navigation->addPeriod($from, $frequency, $skip); - self::assertSame($expected->toDateString(), $period->toDateString()); - } - /** * @dataProvider providePeriods */ @@ -181,6 +111,32 @@ final class NavigationAddPeriodTest extends TestCase self::assertSame($expected->toDateString(), $period->toDateString()); } + public static function providePeriods(): iterable + { + return [ + '1D' => ['frequency' => '1D', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], + 'daily' => ['frequency' => 'daily', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], + '1W' => ['frequency' => '1W', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + 'weekly' => ['frequency' => 'weekly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + 'week' => ['frequency' => 'week', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + '3M' => ['frequency' => '3M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'quarter' => ['frequency' => 'quarter', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'quarterly' => ['frequency' => 'quarterly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + '6M' => ['frequency' => '6M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], + 'half-year' => ['frequency' => 'half-year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], + 'year' => ['frequency' => 'year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + 'yearly' => ['frequency' => 'yearly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + '1Y' => ['frequency' => '1Y', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + 'last7' => ['frequency' => 'last7', 'from' => Carbon::now(), 'expected' => Carbon::now()->addDays(7)], + 'last30' => ['frequency' => 'last30', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], + 'last90' => ['frequency' => 'last90', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'last365' => ['frequency' => 'last365', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + 'MTD' => ['frequency' => 'MTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], + 'QTD' => ['frequency' => 'QTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'YTD' => ['frequency' => 'YTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + ]; + } + /** * @dataProvider provideFrequencies */ @@ -190,6 +146,34 @@ final class NavigationAddPeriodTest extends TestCase self::assertSame($expected->toDateString(), $period->toDateString()); } + public static function provideFrequencies(): iterable + { + return [ + Periodicity::Daily->name => ['periodicity' => Periodicity::Daily, 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], + Periodicity::Weekly->name => ['periodicity' => Periodicity::Weekly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + Periodicity::Fortnightly->name => ['periodicity' => Periodicity::Fortnightly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(2)], + Periodicity::Monthly->name => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], + '2019-01-01 to 2019-02-01' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-01'), 'expected' => Carbon::parse('2019-02-01')], + '2019-01-29 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-30 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-31 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], + '2023-03-31 to 2023-04-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], + '2023-05-31 to 2023-06-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], + '2023-08-31 to 2023-09-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], + '2023-10-31 to 2023-11-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], + Periodicity::Quarterly->name => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + '2019-01-29 to 2020-04-29' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-04-29')], + '2019-01-30 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-04-30')], + '2019-01-31 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-04-30')], + Periodicity::HalfYearly->name => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], + '2019-01-31 to 2020-07-29' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-07-29')], + '2019-01-31 to 2020-07-30' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-07-30')], + '2019-01-31 to 2020-07-31' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-07-31')], + Periodicity::Yearly->name => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + '2020-02-29 to 2021-02-28' => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::parse('2020-02-29'), 'expected' => Carbon::parse('2021-02-28')], + ]; + } + /** * @dataProvider provideMonthPeriods */ @@ -198,4 +182,20 @@ final class NavigationAddPeriodTest extends TestCase $period = $this->navigation->addPeriod($from, $frequency, 0); self::assertSame($expected->toDateString(), $period->toDateString()); } + + public static function provideMonthPeriods(): iterable + { + return [ + '1M' => ['frequency' => '1M', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], + 'month' => ['frequency' => 'month', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], + 'monthly' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], + '2019-01-29 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-30 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-31 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], + '2023-03-31 to 2023-04-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], + '2023-05-31 to 2023-06-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], + '2023-08-31 to 2023-09-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], + '2023-10-31 to 2023-11-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], + ]; + } } diff --git a/tests/unit/Support/NavigationEndOfPeriodTest.php b/tests/unit/Support/NavigationEndOfPeriodTest.php index f9a3b22e8e..278b2e7897 100644 --- a/tests/unit/Support/NavigationEndOfPeriodTest.php +++ b/tests/unit/Support/NavigationEndOfPeriodTest.php @@ -47,6 +47,15 @@ final class NavigationEndOfPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider provideDates + */ + public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void + { + $period = clone $this->navigation->endOfPeriod($from, $frequency); + self::assertSame($expected->toDateString(), $period->toDateString()); + } + public static function provideDates(): iterable { return [ @@ -78,24 +87,6 @@ final class NavigationEndOfPeriodTest extends TestCase ]; } - public static function provideUnknownFrequencies(): iterable - { - return [ - '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], - 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - ]; - } - - /** - * @dataProvider provideDates - */ - public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void - { - $period = clone $this->navigation->endOfPeriod($from, $frequency); - self::assertSame($expected->toDateString(), $period->toDateString()); - } - /** * @dataProvider provideUnknownFrequencies */ @@ -109,4 +100,13 @@ final class NavigationEndOfPeriodTest extends TestCase Log::shouldHaveReceived('error', [$expectedMessage]); } + + public static function provideUnknownFrequencies(): iterable + { + return [ + '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], + 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + ]; + } } diff --git a/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php b/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php index fcb0165476..1a6007870d 100644 --- a/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php +++ b/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php @@ -46,6 +46,15 @@ final class NavigationPreferredCarbonFormatByPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenAPeriodWhenCallPreferredCarbonFormatByPeriodThenReturnsExpectedFormat(string $period, string $expected): void + { + $formatPeriod = $this->navigation->preferredCarbonFormatByPeriod($period); + self::assertSame($expected, $formatPeriod); + } + public static function providePeriods(): iterable { return [ @@ -57,13 +66,4 @@ final class NavigationPreferredCarbonFormatByPeriodTest extends TestCase 'yearly' => ['period' => '1Y', 'expected' => 'Y'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenAPeriodWhenCallPreferredCarbonFormatByPeriodThenReturnsExpectedFormat(string $period, string $expected): void - { - $formatPeriod = $this->navigation->preferredCarbonFormatByPeriod($period); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationPreferredCarbonFormatTest.php b/tests/unit/Support/NavigationPreferredCarbonFormatTest.php index 667cd77333..2cb4e0d074 100644 --- a/tests/unit/Support/NavigationPreferredCarbonFormatTest.php +++ b/tests/unit/Support/NavigationPreferredCarbonFormatTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredCarbonFormatTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenStartAndEndDatesWhenCallPreferredCarbonFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $carbonFormat = $this->navigation->preferredCarbonFormat($start, $end); + self::assertSame($expected, $carbonFormat); + } + public static function providePeriods(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredCarbonFormatTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => 'Y'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenStartAndEndDatesWhenCallPreferredCarbonFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $carbonFormat = $this->navigation->preferredCarbonFormat($start, $end); - self::assertSame($expected, $carbonFormat); - } } diff --git a/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php b/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php index d5f56ff678..f951a9a6a2 100644 --- a/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php +++ b/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredEndOfPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenStartAndEndDatesWhenCallPreferredEndOfPeriodThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $formatPeriod = $this->navigation->preferredEndOfPeriod($start, $end); + self::assertSame($expected, $formatPeriod); + } + public static function providePeriods(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredEndOfPeriodTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => 'endOfYear'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenStartAndEndDatesWhenCallPreferredEndOfPeriodThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $formatPeriod = $this->navigation->preferredEndOfPeriod($start, $end); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationPreferredRangeFormatTest.php b/tests/unit/Support/NavigationPreferredRangeFormatTest.php index fede42ff47..21c2dea91d 100644 --- a/tests/unit/Support/NavigationPreferredRangeFormatTest.php +++ b/tests/unit/Support/NavigationPreferredRangeFormatTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredRangeFormatTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenStartAndEndDatesWhenCallPreferredRangeFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $formatPeriod = $this->navigation->preferredRangeFormat($start, $end); + self::assertSame($expected, $formatPeriod); + } + public static function providePeriods(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredRangeFormatTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => '1Y'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenStartAndEndDatesWhenCallPreferredRangeFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $formatPeriod = $this->navigation->preferredRangeFormat($start, $end); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationPreferredSqlFormatTest.php b/tests/unit/Support/NavigationPreferredSqlFormatTest.php index 24a9c174fa..9dce8d5d33 100644 --- a/tests/unit/Support/NavigationPreferredSqlFormatTest.php +++ b/tests/unit/Support/NavigationPreferredSqlFormatTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredSqlFormatTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider provideDates + */ + public function testGivenStartAndEndDatesWhenCallPreferredSqlFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $formatPeriod = $this->navigation->preferredSqlFormat($start, $end); + self::assertSame($expected, $formatPeriod); + } + public static function provideDates(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredSqlFormatTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => '%Y'], ]; } - - /** - * @dataProvider provideDates - */ - public function testGivenStartAndEndDatesWhenCallPreferredSqlFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $formatPeriod = $this->navigation->preferredSqlFormat($start, $end); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationStartOfPeriodTest.php b/tests/unit/Support/NavigationStartOfPeriodTest.php index 315cb1695c..fe9f5117b0 100644 --- a/tests/unit/Support/NavigationStartOfPeriodTest.php +++ b/tests/unit/Support/NavigationStartOfPeriodTest.php @@ -48,6 +48,15 @@ final class NavigationStartOfPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider provideDates + */ + public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void + { + $period = $this->navigation->startOfPeriod($from, $frequency); + self::assertSame($expected->toDateString(), $period->toDateString()); + } + public static function provideDates(): iterable { return [ @@ -78,24 +87,6 @@ final class NavigationStartOfPeriodTest extends TestCase ]; } - public static function provideUnknownFrequencies(): iterable - { - return [ - '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], - 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - ]; - } - - /** - * @dataProvider provideDates - */ - public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void - { - $period = $this->navigation->startOfPeriod($from, $frequency); - self::assertSame($expected->toDateString(), $period->toDateString()); - } - /** * @dataProvider provideUnknownFrequencies */ @@ -111,4 +102,13 @@ final class NavigationStartOfPeriodTest extends TestCase $period = $this->navigation->startOfPeriod($from, $frequency); self::assertSame($expected->toDateString(), $period->toDateString()); } + + public static function provideUnknownFrequencies(): iterable + { + return [ + '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], + 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + ]; + } } diff --git a/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php b/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php index c2abc6aeb2..0081ac0b19 100644 --- a/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php +++ b/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php @@ -15,6 +15,20 @@ abstract class AbstractQueryParserInterfaceParseQueryTester extends TestCase { abstract protected function createParser(): QueryParserInterface; + /** + * @dataProvider queryDataProvider + * + * @param string $query The query string to parse + * @param Node $expected The expected parse result + */ + public function testQueryParsing(string $query, Node $expected): void + { + $actual = $this->createParser()->parse($query); + + self::assertObjectEquals($expected, $actual); + + } + public static function queryDataProvider(): iterable { return [ @@ -181,18 +195,4 @@ abstract class AbstractQueryParserInterfaceParseQueryTester extends TestCase ], ]; } - - /** - * @dataProvider queryDataProvider - * - * @param string $query The query string to parse - * @param Node $expected The expected parse result - */ - public function testQueryParsing(string $query, Node $expected): void - { - $actual = $this->createParser()->parse($query); - - self::assertObjectEquals($expected, $actual); - - } } From 0086a0ddc84b1bc0e5a860798dcb714ac98240ac Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:35:13 +0100 Subject: [PATCH 07/52] Fix namespace. --- .../Controllers/Autocomplete/CurrencyController.php | 2 +- .../TransactionCurrency/DestroyController.php | 2 +- .../Models/TransactionCurrency/ShowController.php | 2 +- .../Models/TransactionCurrency/StoreController.php | 2 +- .../Models/TransactionCurrency/UpdateController.php | 2 +- app/Api/V1/Controllers/Summary/BasicController.php | 2 +- app/Api/V2/Controllers/Chart/CategoryController.php | 2 +- .../Controllers/Model/Currency/IndexController.php | 2 +- .../Model/TransactionCurrency/IndexController.php | 2 +- .../Model/TransactionCurrency/ShowController.php | 2 +- app/Api/V2/Controllers/Summary/BasicController.php | 2 +- .../Commands/Correction/CorrectsCurrencies.php | 2 +- app/Factory/TransactionJournalFactory.php | 2 +- app/Helpers/Report/NetWorth.php | 2 +- app/Helpers/Report/PopupReport.php | 2 +- .../Controllers/Budget/BudgetLimitController.php | 2 +- app/Http/Controllers/Budget/IndexController.php | 2 +- app/Http/Controllers/Chart/AccountController.php | 2 +- app/Http/Controllers/JavascriptController.php | 2 +- app/Http/Controllers/Json/BoxController.php | 2 +- app/Http/Controllers/NewUserController.php | 2 +- .../TransactionCurrency/CreateController.php | 2 +- .../TransactionCurrency/DeleteController.php | 2 +- .../TransactionCurrency/EditController.php | 2 +- .../TransactionCurrency/IndexController.php | 2 +- app/Providers/CurrencyServiceProvider.php | 4 ++-- app/Repositories/Account/AccountTasker.php | 2 +- app/Repositories/Budget/BudgetRepository.php | 2 +- app/Repositories/Currency/CurrencyRepository.php | 13 +++++++++++++ .../Currency/CurrencyRepositoryInterface.php | 8 ++++++++ app/Repositories/UserGroup/UserGroupRepository.php | 2 +- .../Internal/Update/JournalUpdateService.php | 2 +- app/Support/Form/CurrencyForm.php | 2 +- app/Support/Http/Api/SummaryBalanceGrouped.php | 2 +- app/Support/Search/OperatorQuerySearch.php | 2 +- app/Transformers/V2/AccountTransformer.php | 2 +- 36 files changed, 56 insertions(+), 35 deletions(-) diff --git a/app/Api/V1/Controllers/Autocomplete/CurrencyController.php b/app/Api/V1/Controllers/Autocomplete/CurrencyController.php index adf4e3b223..3db9b03095 100644 --- a/app/Api/V1/Controllers/Autocomplete/CurrencyController.php +++ b/app/Api/V1/Controllers/Autocomplete/CurrencyController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Autocomplete; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php index e2512cf47c..2ce47e432e 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/DestroyController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\User\UserRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php index 24cc0f2dec..2283b5da50 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ShowController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php index fd041a704e..d3ef22fb29 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/StoreController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency; use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\StoreRequest; use FireflyIII\Exceptions\FireflyException; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php index 77ae70c5c9..16c6ba78cf 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/UpdateController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\UpdateRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Transformers\CurrencyTransformer; diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index cb0a7bbb96..ef535f241f 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -37,7 +37,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Facades\Amount; use FireflyIII\User; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Chart/CategoryController.php b/app/Api/V2/Controllers/Chart/CategoryController.php index 893e718445..20ca5fc27f 100644 --- a/app/Api/V2/Controllers/Chart/CategoryController.php +++ b/app/Api/V2/Controllers/Chart/CategoryController.php @@ -32,7 +32,7 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\CleansChartData; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; diff --git a/app/Api/V2/Controllers/Model/Currency/IndexController.php b/app/Api/V2/Controllers/Model/Currency/IndexController.php index bcaaae0d7d..aa0418e43d 100644 --- a/app/Api/V2/Controllers/Model/Currency/IndexController.php +++ b/app/Api/V2/Controllers/Model/Currency/IndexController.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V2\Controllers\Model\Currency; use FireflyIII\Api\V2\Controllers\Controller; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Transformers\V2\CurrencyTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php b/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php index a19fc67edf..e0c4d7db58 100644 --- a/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php +++ b/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\TransactionCurrency; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\TransactionCurrency\IndexRequest; use FireflyIII\Enums\UserRoleEnum; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Transformers\V2\CurrencyTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php b/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php index 29f8fb4bb1..c27ce06389 100644 --- a/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php +++ b/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\TransactionCurrency; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\UserGroup; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Transformers\V2\CurrencyTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Summary/BasicController.php b/app/Api/V2/Controllers/Summary/BasicController.php index 3f14113f43..41c45d4e98 100644 --- a/app/Api/V2/Controllers/Summary/BasicController.php +++ b/app/Api/V2/Controllers/Summary/BasicController.php @@ -39,7 +39,7 @@ use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface; use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepositoryInterface; use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Http\Api\SummaryBalanceGrouped; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; diff --git a/app/Console/Commands/Correction/CorrectsCurrencies.php b/app/Console/Commands/Correction/CorrectsCurrencies.php index ada3f40a1b..0f621fe5be 100644 --- a/app/Console/Commands/Correction/CorrectsCurrencies.php +++ b/app/Console/Commands/Correction/CorrectsCurrencies.php @@ -31,7 +31,7 @@ use FireflyIII\Models\GroupMembership; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\UserGroup; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; diff --git a/app/Factory/TransactionJournalFactory.php b/app/Factory/TransactionJournalFactory.php index f8d3cc363a..67428dbc50 100644 --- a/app/Factory/TransactionJournalFactory.php +++ b/app/Factory/TransactionJournalFactory.php @@ -41,7 +41,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Repositories\TransactionType\TransactionTypeRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Services\Internal\Destroy\JournalDestroyService; use FireflyIII\Services\Internal\Support\JournalServiceTrait; use FireflyIII\Support\Facades\FireflyConfig; diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index 5760466334..898c7d984f 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -31,7 +31,7 @@ use FireflyIII\Models\Account; use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Facades\Steam; diff --git a/app/Helpers/Report/PopupReport.php b/app/Helpers/Report/PopupReport.php index 586b4a0897..f5e0b13757 100644 --- a/app/Helpers/Report/PopupReport.php +++ b/app/Helpers/Report/PopupReport.php @@ -30,7 +30,7 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\Category; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; /** diff --git a/app/Http/Controllers/Budget/BudgetLimitController.php b/app/Http/Controllers/Budget/BudgetLimitController.php index 4adc1a76ab..f75a7a4c16 100644 --- a/app/Http/Controllers/Budget/BudgetLimitController.php +++ b/app/Http/Controllers/Budget/BudgetLimitController.php @@ -33,7 +33,7 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Controllers\DateCalculation; use Illuminate\Contracts\View\Factory; use Illuminate\Http\JsonResponse; diff --git a/app/Http/Controllers/Budget/IndexController.php b/app/Http/Controllers/Budget/IndexController.php index 8c67680cba..6e04f56134 100644 --- a/app/Http/Controllers/Budget/IndexController.php +++ b/app/Http/Controllers/Budget/IndexController.php @@ -35,7 +35,7 @@ use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Http\Controllers\DateCalculation; use Illuminate\Contracts\View\Factory; diff --git a/app/Http/Controllers/Chart/AccountController.php b/app/Http/Controllers/Chart/AccountController.php index 3f46253fac..e0b54071b3 100644 --- a/app/Http/Controllers/Chart/AccountController.php +++ b/app/Http/Controllers/Chart/AccountController.php @@ -33,7 +33,7 @@ use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Facades\Steam; diff --git a/app/Http/Controllers/JavascriptController.php b/app/Http/Controllers/JavascriptController.php index 2111caa5d2..2fcc5b3aed 100644 --- a/app/Http/Controllers/JavascriptController.php +++ b/app/Http/Controllers/JavascriptController.php @@ -29,7 +29,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Controllers\GetConfigurationData; use Illuminate\Http\Request; use Illuminate\Http\Response; diff --git a/app/Http/Controllers/Json/BoxController.php b/app/Http/Controllers/Json/BoxController.php index 66d78230a9..42aeaca80b 100644 --- a/app/Http/Controllers/Json/BoxController.php +++ b/app/Http/Controllers/Json/BoxController.php @@ -31,7 +31,7 @@ use FireflyIII\Helpers\Report\NetWorthInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Http\Controllers\DateCalculation; diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php index 64b6956ca0..e5d2dcb68b 100644 --- a/app/Http/Controllers/NewUserController.php +++ b/app/Http/Controllers/NewUserController.php @@ -27,7 +27,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Requests\NewUserFormRequest; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Controllers\CreateStuff; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; diff --git a/app/Http/Controllers/TransactionCurrency/CreateController.php b/app/Http/Controllers/TransactionCurrency/CreateController.php index 11dd895971..84e30328db 100644 --- a/app/Http/Controllers/TransactionCurrency/CreateController.php +++ b/app/Http/Controllers/TransactionCurrency/CreateController.php @@ -28,7 +28,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\CurrencyFormRequest; use FireflyIII\Repositories\User\UserRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; diff --git a/app/Http/Controllers/TransactionCurrency/DeleteController.php b/app/Http/Controllers/TransactionCurrency/DeleteController.php index c2785f2696..aa68b1d34e 100644 --- a/app/Http/Controllers/TransactionCurrency/DeleteController.php +++ b/app/Http/Controllers/TransactionCurrency/DeleteController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\User\UserRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; diff --git a/app/Http/Controllers/TransactionCurrency/EditController.php b/app/Http/Controllers/TransactionCurrency/EditController.php index 56ef93ae77..80789ac1d7 100644 --- a/app/Http/Controllers/TransactionCurrency/EditController.php +++ b/app/Http/Controllers/TransactionCurrency/EditController.php @@ -28,7 +28,7 @@ use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\CurrencyFormRequest; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\User\UserRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; diff --git a/app/Http/Controllers/TransactionCurrency/IndexController.php b/app/Http/Controllers/TransactionCurrency/IndexController.php index 5234ee308c..f0ae6910b4 100644 --- a/app/Http/Controllers/TransactionCurrency/IndexController.php +++ b/app/Http/Controllers/TransactionCurrency/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Http\Controllers\TransactionCurrency; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\User\UserRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\User; use Illuminate\Contracts\View\Factory; use Illuminate\Http\Request; diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 545dfef856..8e562d7c58 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -25,8 +25,8 @@ namespace FireflyIII\Providers; use FireflyIII\Repositories\Currency\CurrencyRepository; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepository as GroupCurrencyRepository; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepository as GroupCurrencyRepository; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface; use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepository; use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; use Illuminate\Foundation\Application; diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index eae312bd36..2447de9f43 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -28,7 +28,7 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Account; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 03363c925f..f4d54963e6 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -38,7 +38,7 @@ use FireflyIII\Models\RecurrenceTransactionMeta; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleTrigger; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Services\Internal\Destroy\BudgetDestroyService; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index e908216f2a..66ba81d933 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -60,6 +60,19 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf { return TransactionCurrency::where('enabled', true)->orderBy('code', 'ASC')->get(); } + public function get(): Collection + { + $all = $this->userGroup->currencies()->orderBy('code', 'ASC')->withPivot(['group_default'])->get(); + $all->map(static function (TransactionCurrency $current) { // @phpstan-ignore-line + $current->userGroupEnabled = true; + $current->userGroupNative = 1 === (int) $current->pivot->group_default; + + return $current; + }); + + /** @var Collection */ + return $all; + } /** * Get currency exchange rate. diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index bd6e9f49f4..79e7ffe0c1 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -50,6 +50,14 @@ interface CurrencyRepositoryInterface */ public function getCompleteSet(): Collection; + /** + * Get the user group's currencies. + * + * @return Collection + */ + public function get(): Collection; + + /** * Get currency exchange rate. * diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index 863e9a5d4a..e75221c4e3 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -30,7 +30,7 @@ use FireflyIII\Factory\UserGroupFactory; use FireflyIII\Models\GroupMembership; use FireflyIII\Models\UserGroup; use FireflyIII\Models\UserRole; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; diff --git a/app/Services/Internal/Update/JournalUpdateService.php b/app/Services/Internal/Update/JournalUpdateService.php index e596d4363b..4acf1d9242 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -41,7 +41,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Services\Internal\Support\JournalServiceTrait; use FireflyIII\Support\Facades\FireflyConfig; use FireflyIII\Support\NullArrayObject; diff --git a/app/Support/Form/CurrencyForm.php b/app/Support/Form/CurrencyForm.php index aedff307a4..ad0997025a 100644 --- a/app/Support/Form/CurrencyForm.php +++ b/app/Support/Form/CurrencyForm.php @@ -26,7 +26,7 @@ namespace FireflyIII\Support\Form; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; /** diff --git a/app/Support/Http/Api/SummaryBalanceGrouped.php b/app/Support/Http/Api/SummaryBalanceGrouped.php index f415075e73..1f03ed2e5d 100644 --- a/app/Support/Http/Api/SummaryBalanceGrouped.php +++ b/app/Support/Http/Api/SummaryBalanceGrouped.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Support\Http\Api; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Facades\Log; class SummaryBalanceGrouped diff --git a/app/Support/Search/OperatorQuerySearch.php b/app/Support/Search/OperatorQuerySearch.php index 908a394c2a..96cfbcd422 100644 --- a/app/Support/Search/OperatorQuerySearch.php +++ b/app/Support/Search/OperatorQuerySearch.php @@ -38,7 +38,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Search\QueryParser\QueryParserInterface; use FireflyIII\Support\Search\QueryParser\Node; use FireflyIII\Support\Search\QueryParser\FieldNode; diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php index 7ca1114793..03d36f372c 100644 --- a/app/Transformers/V2/AccountTransformer.php +++ b/app/Transformers/V2/AccountTransformer.php @@ -30,7 +30,7 @@ use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface; +use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; From f7ad9c56c854914ab5a3a49fccea2162174dea65 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Feb 2025 12:47:04 +0100 Subject: [PATCH 08/52] Add imports for facades --- app/Console/Commands/System/CreatesFirstUser.php | 5 +++-- app/Console/Commands/System/ScansAttachments.php | 6 ++++-- app/Console/Commands/System/VerifySecurityAlerts.php | 3 ++- .../Commands/Upgrade/RemovesDatabaseDecryption.php | 3 ++- app/Helpers/Attachments/AttachmentHelper.php | 3 ++- app/Repositories/Attachment/AttachmentRepository.php | 3 ++- app/Repositories/Bill/BillRepository.php | 5 ++--- app/Repositories/Budget/BudgetRepository.php | 9 +++++---- app/Repositories/Category/CategoryRepository.php | 9 +++++---- app/Repositories/Journal/JournalAPIRepository.php | 4 ++-- app/Repositories/Journal/JournalCLIRepository.php | 3 ++- .../ObjectGroup/ObjectGroupRepository.php | 3 ++- app/Repositories/PiggyBank/PiggyBankRepository.php | 4 ++-- app/Repositories/Tag/TagRepository.php | 10 +++++----- .../TransactionGroup/TransactionGroupRepository.php | 7 ++++--- .../Internal/Destroy/AccountDestroyService.php | 4 ++-- .../Internal/Destroy/BudgetDestroyService.php | 5 +++-- .../Internal/Destroy/CategoryDestroyService.php | 7 ++++--- .../Internal/Destroy/JournalDestroyService.php | 7 ++++--- app/Support/Authentication/RemoteUserProvider.php | 3 ++- app/Support/Steam.php | 5 +++-- app/Support/System/OAuthKeys.php | 9 +++++---- app/Support/Twig/TransactionGroupTwig.php | 7 ++++--- app/TransactionRules/Actions/AddTag.php | 5 +++-- app/TransactionRules/Actions/AppendDescription.php | 3 ++- app/TransactionRules/Actions/ClearBudget.php | 3 ++- app/TransactionRules/Actions/ClearCategory.php | 3 ++- app/TransactionRules/Actions/ClearNotes.php | 3 ++- app/TransactionRules/Actions/ConvertToDeposit.php | 11 ++++++----- app/TransactionRules/Actions/ConvertToTransfer.php | 9 +++++---- app/TransactionRules/Actions/ConvertToWithdrawal.php | 11 ++++++----- app/TransactionRules/Actions/LinkToBill.php | 5 +++-- app/TransactionRules/Actions/PrependDescription.php | 3 ++- app/TransactionRules/Actions/RemoveAllTags.php | 5 +++-- app/TransactionRules/Actions/RemoveTag.php | 5 +++-- app/TransactionRules/Actions/SetBudget.php | 5 +++-- app/TransactionRules/Actions/SetCategory.php | 5 +++-- app/TransactionRules/Actions/SetDescription.php | 3 ++- .../Actions/SetDestinationAccount.php | 3 ++- .../Actions/SetDestinationToCashAccount.php | 3 ++- app/TransactionRules/Actions/SetSourceAccount.php | 3 ++- .../Actions/SetSourceToCashAccount.php | 3 ++- app/Validation/FireflyValidator.php | 11 ++++++----- 43 files changed, 132 insertions(+), 94 deletions(-) diff --git a/app/Console/Commands/System/CreatesFirstUser.php b/app/Console/Commands/System/CreatesFirstUser.php index 98a7cac5b2..18fa530bb8 100644 --- a/app/Console/Commands/System/CreatesFirstUser.php +++ b/app/Console/Commands/System/CreatesFirstUser.php @@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Repositories\User\UserRepositoryInterface; use Illuminate\Console\Command; use Illuminate\Support\Facades\Hash; +use Illuminate\Support\Str; class CreatesFirstUser extends Command { @@ -61,11 +62,11 @@ class CreatesFirstUser extends Command 'email' => $this->argument('email'), 'role' => 'owner', ]; - $password = \Str::random(24); + $password = Str::random(24); $user = $this->repository->store($data); $user->password = Hash::make($password); $user->save(); - $user->setRememberToken(\Str::random(60)); + $user->setRememberToken(Str::random(60)); $this->friendlyInfo(sprintf('Created new admin user (ID #%d) with email address "%s" and password "%s".', $user->id, $user->email, $password)); $this->friendlyWarning('Change this password.'); diff --git a/app/Console/Commands/System/ScansAttachments.php b/app/Console/Commands/System/ScansAttachments.php index eac9f9b774..b5fad33afa 100644 --- a/app/Console/Commands/System/ScansAttachments.php +++ b/app/Console/Commands/System/ScansAttachments.php @@ -28,6 +28,8 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages; use FireflyIII\Models\Attachment; use Illuminate\Console\Command; use Illuminate\Contracts\Encryption\DecryptException; +use Illuminate\Support\Facades\Crypt; +use Illuminate\Support\Facades\Storage; class ScansAttachments extends Command { @@ -43,7 +45,7 @@ class ScansAttachments extends Command public function handle(): int { $attachments = Attachment::get(); - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); /** @var Attachment $attachment */ foreach ($attachments as $attachment) { @@ -56,7 +58,7 @@ class ScansAttachments extends Command } try { - $decryptedContent = \Crypt::decrypt($encryptedContent); // verified + $decryptedContent = Crypt::decrypt($encryptedContent); // verified } catch (DecryptException $e) { app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage())); $decryptedContent = $encryptedContent; diff --git a/app/Console/Commands/System/VerifySecurityAlerts.php b/app/Console/Commands/System/VerifySecurityAlerts.php index ce05afa16b..894c73daa2 100644 --- a/app/Console/Commands/System/VerifySecurityAlerts.php +++ b/app/Console/Commands/System/VerifySecurityAlerts.php @@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\System; use FireflyIII\Console\Commands\ShowsFriendlyMessages; use Illuminate\Console\Command; use Illuminate\Database\QueryException; +use Illuminate\Support\Facades\Storage; use League\Flysystem\FilesystemException; class VerifySecurityAlerts extends Command @@ -48,7 +49,7 @@ class VerifySecurityAlerts extends Command // check for security advisories. $version = config('firefly.version'); - $disk = \Storage::disk('resources'); + $disk = Storage::disk('resources'); // Next line is ignored because it's a Laravel Facade. if (!$disk->has('alerts.json')) { // @phpstan-ignore-line app('log')->debug('No alerts.json file present.'); diff --git a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php index 83cfb4da5d..89a961925c 100644 --- a/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php +++ b/app/Console/Commands/Upgrade/RemovesDatabaseDecryption.php @@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Preference; use Illuminate\Console\Command; use Illuminate\Contracts\Encryption\DecryptException; +use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\DB; class RemovesDatabaseDecryption extends Command @@ -152,7 +153,7 @@ class RemovesDatabaseDecryption extends Command private function tryDecrypt($value) { try { - $value = \Crypt::decrypt($value); + $value = Crypt::decrypt($value); } catch (DecryptException $e) { if ('The MAC is invalid.' === $e->getMessage()) { throw new FireflyException($e->getMessage(), 0, $e); diff --git a/app/Helpers/Attachments/AttachmentHelper.php b/app/Helpers/Attachments/AttachmentHelper.php index 42b53f8c56..a4cbc352ba 100644 --- a/app/Helpers/Attachments/AttachmentHelper.php +++ b/app/Helpers/Attachments/AttachmentHelper.php @@ -31,6 +31,7 @@ use Illuminate\Contracts\Encryption\EncryptException; use Illuminate\Contracts\Filesystem\Filesystem; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; use Illuminate\Support\MessageBag; @@ -70,7 +71,7 @@ class AttachmentHelper implements AttachmentHelperInterface $encryptedData = (string) $this->uploadDisk->get(sprintf('at-%d.data', $attachment->id)); try { - $unencryptedData = \Crypt::decrypt($encryptedData); // verified + $unencryptedData = Crypt::decrypt($encryptedData); // verified } catch (DecryptException $e) { Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage())); $unencryptedData = $encryptedData; diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 2c9bed54b7..17ec138917 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -32,6 +32,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Contracts\Encryption\DecryptException; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Storage; use League\Flysystem\UnableToDeleteFile; @@ -73,7 +74,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn $encryptedContent = (string) $disk->get($file); try { - $unencryptedContent = \Crypt::decrypt($encryptedContent); // verified + $unencryptedContent = Crypt::decrypt($encryptedContent); // verified } catch (DecryptException $e) { app('log')->debug(sprintf('Could not decrypt attachment #%d but this is fine: %s', $attachment->id, $e->getMessage())); $unencryptedContent = $encryptedContent; diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 7c1426c929..9d067a5c3a 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -45,6 +45,7 @@ use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; /** * Class BillRepository. @@ -161,9 +162,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getAttachments(Bill $bill): Collection { $set = $bill->attachments()->get(); - - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index f4d54963e6..858f48f417 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -45,7 +45,9 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; /** * Class BudgetRepository. @@ -457,8 +459,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface /** @var Budget $budget */ foreach ($budgets as $budget) { - \DB::table('budget_transaction')->where('budget_id', $budget->id)->delete(); - \DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete(); + DB::table('budget_transaction')->where('budget_id', $budget->id)->delete(); + DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete(); RecurrenceTransactionMeta::where('name', 'budget_id')->where('value', (string) $budget->id)->delete(); RuleAction::where('action_type', 'set_budget')->where('action_value', (string) $budget->id)->delete(); $budget->delete(); @@ -530,8 +532,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { $set = $budget->attachments()->get(); - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index c168a7a98c..19d1447857 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -36,7 +36,9 @@ use FireflyIII\Services\Internal\Update\CategoryUpdateService; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; /** * Class CategoryRepository. @@ -83,8 +85,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf /** @var Category $category */ foreach ($categories as $category) { - \DB::table('category_transaction')->where('category_id', $category->id)->delete(); - \DB::table('category_transaction_journal')->where('category_id', $category->id)->delete(); + DB::table('category_transaction')->where('category_id', $category->id)->delete(); + DB::table('category_transaction_journal')->where('category_id', $category->id)->delete(); RecurrenceTransactionMeta::where('name', 'category_id')->where('value', $category->id)->delete(); RuleAction::where('action_type', 'set_category')->where('action_value', $category->name)->delete(); $category->delete(); @@ -237,8 +239,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf { $set = $category->attachments()->get(); - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php index 35590f1d5c..97efb75814 100644 --- a/app/Repositories/Journal/JournalAPIRepository.php +++ b/app/Repositories/Journal/JournalAPIRepository.php @@ -32,6 +32,7 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Storage; /** * Class JournalAPIRepository @@ -61,8 +62,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn { $set = $journal->attachments; - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk) { diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php index 5384b22eea..c3b51cd860 100644 --- a/app/Repositories/Journal/JournalCLIRepository.php +++ b/app/Repositories/Journal/JournalCLIRepository.php @@ -31,6 +31,7 @@ use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; /** * Class JournalCLIRepository @@ -180,7 +181,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') ->groupBy('transaction_journals.id') ; - $result = $query->get(['transaction_journals.id as id', \DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line + $result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line $journalIds = []; /** @var \stdClass $row */ diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php index 90e96cb1e0..4299155670 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php @@ -29,6 +29,7 @@ use FireflyIII\Models\PiggyBank; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; /** * Class ObjectGroupRepository @@ -64,7 +65,7 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup /** @var ObjectGroup $group */ foreach ($all as $group) { - $count = \DB::table('object_groupables')->where('object_groupables.object_group_id', $group->id)->count(); + $count = DB::table('object_groupables')->where('object_groupables.object_group_id', $group->id)->count(); if (0 === $count) { $group->delete(); } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 5f96219b1b..4616fd1415 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -40,6 +40,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; /** * Class PiggyBankRepository. @@ -111,8 +112,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte { $set = $piggyBank->attachments()->get(); - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index eb0f2c3649..3e74489477 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -34,7 +34,9 @@ use FireflyIII\Models\Tag; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Facades\Storage; /** * Class TagRepository. @@ -53,7 +55,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface */ public function destroy(Tag $tag): bool { - \DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); + DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); $tag->transactionJournals()->sync([]); $tag->delete(); @@ -70,7 +72,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface /** @var Tag $tag */ foreach ($tags as $tag) { - \DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); + DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); $tag->delete(); } } @@ -112,9 +114,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface public function getAttachments(Tag $tag): Collection { $set = $tag->attachments()->get(); - - /** @var \Storage $disk */ - $disk = \Storage::disk('upload'); + $disk = Storage::disk('upload'); return $set->each( static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index cc5b68565b..97a5b7f48c 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -47,6 +47,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\DB; /** * Class TransactionGroupRepository @@ -294,7 +295,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, */ public function getMetaDateFields(int $journalId, array $fields): NullArrayObject { - $query = \DB::table('journal_meta') + $query = DB::table('journal_meta') ->where('transaction_journal_id', $journalId) ->whereIn('name', $fields) ->whereNull('deleted_at') @@ -314,7 +315,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, */ public function getMetaFields(int $journalId, array $fields): NullArrayObject { - $query = \DB::table('journal_meta') + $query = DB::table('journal_meta') ->where('transaction_journal_id', $journalId) ->whereIn('name', $fields) ->whereNull('deleted_at') @@ -383,7 +384,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, */ public function getTags(int $journalId): array { - $result = \DB::table('tag_transaction_journal') + $result = DB::table('tag_transaction_journal') ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') ->where('tag_transaction_journal.transaction_journal_id', $journalId) ->orderBy('tags.tag', 'ASC') diff --git a/app/Services/Internal/Destroy/AccountDestroyService.php b/app/Services/Internal/Destroy/AccountDestroyService.php index dc6ad02892..44fbaea069 100644 --- a/app/Services/Internal/Destroy/AccountDestroyService.php +++ b/app/Services/Internal/Destroy/AccountDestroyService.php @@ -105,11 +105,11 @@ class AccountDestroyService public function moveTransactions(Account $account, Account $moveTo): void { app('log')->debug(sprintf('Move from account #%d to #%d', $account->id, $moveTo->id)); - \DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]); + DB::table('transactions')->where('account_id', $account->id)->update(['account_id' => $moveTo->id]); $collection = Transaction::groupBy('transaction_journal_id', 'account_id') ->where('account_id', $moveTo->id) - ->get(['transaction_journal_id', 'account_id', \DB::raw('count(*) as the_count')]) // @phpstan-ignore-line + ->get(['transaction_journal_id', 'account_id', DB::raw('count(*) as the_count')]) // @phpstan-ignore-line ; if (0 === $collection->count()) { return; diff --git a/app/Services/Internal/Destroy/BudgetDestroyService.php b/app/Services/Internal/Destroy/BudgetDestroyService.php index 97424db35b..0391ce924a 100644 --- a/app/Services/Internal/Destroy/BudgetDestroyService.php +++ b/app/Services/Internal/Destroy/BudgetDestroyService.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Destroy; use FireflyIII\Models\Budget; +use Illuminate\Support\Facades\DB; /** * Class BudgetDestroyService @@ -41,10 +42,10 @@ class BudgetDestroyService } // also delete all relations between categories and transaction journals: - \DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete(); + DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete(); // also delete all relations between categories and transactions: - \DB::table('budget_transaction')->where('budget_id', $budget->id)->delete(); + DB::table('budget_transaction')->where('budget_id', $budget->id)->delete(); // also delete all budget limits foreach ($budget->budgetlimits()->get() as $limit) { diff --git a/app/Services/Internal/Destroy/CategoryDestroyService.php b/app/Services/Internal/Destroy/CategoryDestroyService.php index f2d5107fdc..04b6fb3873 100644 --- a/app/Services/Internal/Destroy/CategoryDestroyService.php +++ b/app/Services/Internal/Destroy/CategoryDestroyService.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Services\Internal\Destroy; use FireflyIII\Models\Category; +use Illuminate\Support\Facades\DB; /** * Class CategoryDestroyService @@ -36,12 +37,12 @@ class CategoryDestroyService $category->delete(); // also delete all relations between categories and transaction journals: - \DB::table('category_transaction_journal')->where('category_id', $category->id)->delete(); + DB::table('category_transaction_journal')->where('category_id', $category->id)->delete(); // also delete all relations between categories and transactions: - \DB::table('category_transaction')->where('category_id', $category->id)->delete(); + DB::table('category_transaction')->where('category_id', $category->id)->delete(); // delete references to category from recurring transactions. - \DB::table('rt_meta')->where('name', 'category_id')->where('value', $category->id)->delete(); + DB::table('rt_meta')->where('name', 'category_id')->where('value', $category->id)->delete(); } } diff --git a/app/Services/Internal/Destroy/JournalDestroyService.php b/app/Services/Internal/Destroy/JournalDestroyService.php index ddbd419d87..77f63fa3ff 100644 --- a/app/Services/Internal/Destroy/JournalDestroyService.php +++ b/app/Services/Internal/Destroy/JournalDestroyService.php @@ -29,6 +29,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalLink; use FireflyIII\Models\TransactionJournalMeta; +use Illuminate\Support\Facades\DB; /** * Class JournalDestroyService @@ -59,17 +60,17 @@ class JournalDestroyService } // delete all from 'budget_transaction_journal' - \DB::table('budget_transaction_journal') + DB::table('budget_transaction_journal') ->where('transaction_journal_id', $journal->id)->delete() ; // delete all from 'category_transaction_journal' - \DB::table('category_transaction_journal') + DB::table('category_transaction_journal') ->where('transaction_journal_id', $journal->id)->delete() ; // delete all from 'tag_transaction_journal' - \DB::table('tag_transaction_journal') + DB::table('tag_transaction_journal') ->where('transaction_journal_id', $journal->id)->delete() ; diff --git a/app/Support/Authentication/RemoteUserProvider.php b/app/Support/Authentication/RemoteUserProvider.php index 1249e62c65..2fc06cd450 100644 --- a/app/Support/Authentication/RemoteUserProvider.php +++ b/app/Support/Authentication/RemoteUserProvider.php @@ -30,6 +30,7 @@ use FireflyIII\Models\Role; use FireflyIII\User; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\UserProvider; +use Illuminate\Support\Str; /** * Class RemoteUserProvider @@ -72,7 +73,7 @@ class RemoteUserProvider implements UserProvider 'blocked' => false, 'blocked_code' => null, 'email' => $identifier, - 'password' => bcrypt(\Str::random(64)), + 'password' => bcrypt(Str::random(64)), ] ); // if this is the first user, give them admin as well. diff --git a/app/Support/Steam.php b/app/Support/Steam.php index 5aa6a8c917..5d53d36515 100644 --- a/app/Support/Steam.php +++ b/app/Support/Steam.php @@ -33,6 +33,7 @@ use FireflyIII\Support\Http\Api\ExchangeRateConverter; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; +use Illuminate\Support\Str; /** * Class Steam. @@ -467,7 +468,7 @@ class Steam $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 + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) AS max_date')]) // @phpstan-ignore-line ; /** @var Transaction $entry */ @@ -557,7 +558,7 @@ class Steam // URL must not lead to weird pages $forbiddenWords = ['jscript', 'json', 'debug', 'serviceworker', 'offline', 'delete', '/login', '/attachments/view']; - if (\Str::contains($returnUrl, $forbiddenWords)) { + if (Str::contains($returnUrl, $forbiddenWords)) { $returnUrl = $safeUrl; } diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.php index 641a561f7a..cda0721846 100644 --- a/app/Support/System/OAuthKeys.php +++ b/app/Support/System/OAuthKeys.php @@ -26,6 +26,7 @@ namespace FireflyIII\Support\System; use FireflyIII\Exceptions\FireflyException; use Illuminate\Contracts\Encryption\DecryptException; +use Illuminate\Support\Facades\Crypt; use Laravel\Passport\Console\KeysCommand; use Psr\Container\ContainerExceptionInterface; use Psr\Container\NotFoundExceptionInterface; @@ -95,8 +96,8 @@ class OAuthKeys { $private = storage_path('oauth-private.key'); $public = storage_path('oauth-public.key'); - app('fireflyconfig')->set(self::PRIVATE_KEY, \Crypt::encrypt(file_get_contents($private))); - app('fireflyconfig')->set(self::PUBLIC_KEY, \Crypt::encrypt(file_get_contents($public))); + app('fireflyconfig')->set(self::PRIVATE_KEY, Crypt::encrypt(file_get_contents($private))); + app('fireflyconfig')->set(self::PUBLIC_KEY, Crypt::encrypt(file_get_contents($public))); } /** @@ -108,8 +109,8 @@ class OAuthKeys $publicKey = (string) app('fireflyconfig')->get(self::PUBLIC_KEY)?->data; try { - $privateContent = \Crypt::decrypt($privateKey); - $publicContent = \Crypt::decrypt($publicKey); + $privateContent = Crypt::decrypt($privateKey); + $publicContent = Crypt::decrypt($publicKey); } catch (DecryptException $e) { app('log')->error('Could not decrypt pub/private keypair.'); app('log')->error($e->getMessage()); diff --git a/app/Support/Twig/TransactionGroupTwig.php b/app/Support/Twig/TransactionGroupTwig.php index 8579025abc..73d1542a26 100644 --- a/app/Support/Twig/TransactionGroupTwig.php +++ b/app/Support/Twig/TransactionGroupTwig.php @@ -30,6 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalMeta; +use Illuminate\Support\Facades\DB; use Twig\Extension\AbstractExtension; use Twig\TwigFunction; @@ -225,7 +226,7 @@ class TransactionGroupTwig extends AbstractExtension return new TwigFunction( 'journalHasMeta', static function (int $journalId, string $metaField) { - $count = \DB::table('journal_meta') + $count = DB::table('journal_meta') ->where('name', $metaField) ->where('transaction_journal_id', $journalId) ->whereNull('deleted_at') @@ -243,7 +244,7 @@ class TransactionGroupTwig extends AbstractExtension 'journalGetMetaDate', static function (int $journalId, string $metaField) { /** @var null|TransactionJournalMeta $entry */ - $entry = \DB::table('journal_meta') + $entry = DB::table('journal_meta') ->where('name', $metaField) ->where('transaction_journal_id', $journalId) ->whereNull('deleted_at') @@ -264,7 +265,7 @@ class TransactionGroupTwig extends AbstractExtension 'journalGetMetaField', static function (int $journalId, string $metaField) { /** @var null|TransactionJournalMeta $entry */ - $entry = \DB::table('journal_meta') + $entry = DB::table('journal_meta') ->where('name', $metaField) ->where('transaction_journal_id', $journalId) ->whereNull('deleted_at') diff --git a/app/TransactionRules/Actions/AddTag.php b/app/TransactionRules/Actions/AddTag.php index 3381c86277..42330e2655 100644 --- a/app/TransactionRules/Actions/AddTag.php +++ b/app/TransactionRules/Actions/AddTag.php @@ -29,6 +29,7 @@ use FireflyIII\Factory\TagFactory; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class AddTag. @@ -64,14 +65,14 @@ class AddTag implements ActionInterface return false; } - $count = \DB::table('tag_transaction_journal') + $count = DB::table('tag_transaction_journal') ->where('tag_id', $tag->id) ->where('transaction_journal_id', $journal['transaction_journal_id']) ->count() ; if (0 === $count) { // add to journal: - \DB::table('tag_transaction_journal')->insert(['tag_id' => $tag->id, 'transaction_journal_id' => $journal['transaction_journal_id']]); + DB::table('tag_transaction_journal')->insert(['tag_id' => $tag->id, 'transaction_journal_id' => $journal['transaction_journal_id']]); app('log')->debug(sprintf('RuleAction AddTag. Added tag #%d ("%s") to journal %d.', $tag->id, $tag->tag, $journal['transaction_journal_id'])); /** @var TransactionJournal $object */ diff --git a/app/TransactionRules/Actions/AppendDescription.php b/app/TransactionRules/Actions/AppendDescription.php index b0c1c2a274..fba8df1a58 100644 --- a/app/TransactionRules/Actions/AppendDescription.php +++ b/app/TransactionRules/Actions/AppendDescription.php @@ -27,6 +27,7 @@ use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\TransactionRules\Traits\RefreshNotesTrait; +use Illuminate\Support\Facades\DB; /** * Class AppendDescription. @@ -51,7 +52,7 @@ class AppendDescription implements ActionInterface $this->refreshNotes($journal); $append = $this->action->getValue($journal); $description = sprintf('%s %s', $journal['description'], $append); - \DB::table('transaction_journals')->where('id', $journal['transaction_journal_id'])->limit(1)->update(['description' => $description]); + DB::table('transaction_journals')->where('id', $journal['transaction_journal_id'])->limit(1)->update(['description' => $description]); // event for audit log entry /** @var TransactionJournal $object */ diff --git a/app/TransactionRules/Actions/ClearBudget.php b/app/TransactionRules/Actions/ClearBudget.php index b6ca1af2e0..06275d4bc8 100644 --- a/app/TransactionRules/Actions/ClearBudget.php +++ b/app/TransactionRules/Actions/ClearBudget.php @@ -27,6 +27,7 @@ use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray; use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; +use Illuminate\Support\Facades\DB; /** * Class ClearBudget. @@ -55,7 +56,7 @@ class ClearBudget implements ActionInterface return false; } - \DB::table('budget_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); + DB::table('budget_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); event(new TriggeredAuditLog($this->action->rule, $object, 'clear_budget', $budget->name, null)); diff --git a/app/TransactionRules/Actions/ClearCategory.php b/app/TransactionRules/Actions/ClearCategory.php index fe87dd3c3f..4831064c9b 100644 --- a/app/TransactionRules/Actions/ClearCategory.php +++ b/app/TransactionRules/Actions/ClearCategory.php @@ -27,6 +27,7 @@ use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray; use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; +use Illuminate\Support\Facades\DB; /** * Class ClearCategory. @@ -55,7 +56,7 @@ class ClearCategory implements ActionInterface return false; } - \DB::table('category_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); + DB::table('category_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); event(new TriggeredAuditLog($this->action->rule, $object, 'clear_category', $category->name, null)); diff --git a/app/TransactionRules/Actions/ClearNotes.php b/app/TransactionRules/Actions/ClearNotes.php index 61d588d542..0aa0d693df 100644 --- a/app/TransactionRules/Actions/ClearNotes.php +++ b/app/TransactionRules/Actions/ClearNotes.php @@ -28,6 +28,7 @@ use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\Note; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; +use Illuminate\Support\Facades\DB; /** * Class ClearNotes. @@ -59,7 +60,7 @@ class ClearNotes implements ActionInterface } $before = $notes->text; - \DB::table('notes') + DB::table('notes') ->where('noteable_id', $journal['transaction_journal_id']) ->where('noteable_type', TransactionJournal::class) ->delete() diff --git a/app/TransactionRules/Actions/ConvertToDeposit.php b/app/TransactionRules/Actions/ConvertToDeposit.php index 3dd9e68621..d7aa0dfeb0 100644 --- a/app/TransactionRules/Actions/ConvertToDeposit.php +++ b/app/TransactionRules/Actions/ConvertToDeposit.php @@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use Illuminate\Support\Facades\DB; /** * Class ConvertToDeposit @@ -154,14 +155,14 @@ class ConvertToDeposit implements ActionInterface app('log')->debug(sprintf('ConvertToDeposit. Action value is "%s", new opposing name is "%s"', $actionValue, $opposingAccount->name)); // update the source transaction and put in the new revenue ID. - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '<', 0) ->update(['account_id' => $opposingAccount->id]) ; // update the destination transaction and put in the original source account ID. - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '>', 0) ->update(['account_id' => $sourceAccount->id]) @@ -170,7 +171,7 @@ class ConvertToDeposit implements ActionInterface // change transaction type of journal: $newType = TransactionType::whereType(TransactionTypeEnum::DEPOSIT->value)->first(); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal->id) ->update(['transaction_type_id' => $newType->id, 'bill_id' => null]) ; @@ -242,7 +243,7 @@ class ConvertToDeposit implements ActionInterface app('log')->debug(sprintf('ConvertToDeposit. Action value is "%s", revenue name is "%s"', $actionValue, $opposingAccount->name)); // update source transaction(s) to be revenue account - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '<', 0) ->update(['account_id' => $opposingAccount->id]) @@ -251,7 +252,7 @@ class ConvertToDeposit implements ActionInterface // change transaction type of journal: $newType = TransactionType::whereType(TransactionTypeEnum::DEPOSIT->value)->first(); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal->id) ->update(['transaction_type_id' => $newType->id, 'bill_id' => null]) ; diff --git a/app/TransactionRules/Actions/ConvertToTransfer.php b/app/TransactionRules/Actions/ConvertToTransfer.php index 3a88c9bf39..a2f6e69317 100644 --- a/app/TransactionRules/Actions/ConvertToTransfer.php +++ b/app/TransactionRules/Actions/ConvertToTransfer.php @@ -35,6 +35,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use Illuminate\Support\Facades\DB; /** * Class ConvertToTransfer @@ -209,7 +210,7 @@ class ConvertToTransfer implements ActionInterface } // update destination transaction: - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '>', 0) ->update(['account_id' => $opposing->id]) @@ -218,7 +219,7 @@ class ConvertToTransfer implements ActionInterface // change transaction type of journal: $newType = TransactionType::whereType(TransactionTypeEnum::TRANSFER->value)->first(); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal->id) ->update(['transaction_type_id' => $newType->id, 'bill_id' => null]) ; @@ -264,7 +265,7 @@ class ConvertToTransfer implements ActionInterface } // update source transaction: - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '<', 0) ->update(['account_id' => $opposing->id]) @@ -273,7 +274,7 @@ class ConvertToTransfer implements ActionInterface // change transaction type of journal: $newType = TransactionType::whereType(TransactionTypeEnum::TRANSFER->value)->first(); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal->id) ->update(['transaction_type_id' => $newType->id, 'bill_id' => null]) ; diff --git a/app/TransactionRules/Actions/ConvertToWithdrawal.php b/app/TransactionRules/Actions/ConvertToWithdrawal.php index 3c6547bcdd..05ded624b6 100644 --- a/app/TransactionRules/Actions/ConvertToWithdrawal.php +++ b/app/TransactionRules/Actions/ConvertToWithdrawal.php @@ -36,6 +36,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use Illuminate\Support\Facades\DB; /** * Class ConvertToWithdrawal @@ -148,14 +149,14 @@ class ConvertToWithdrawal implements ActionInterface app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", expense name is "%s"', $actionValue, $opposingName)); // update source transaction(s) to be the original destination account - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '<', 0) ->update(['account_id' => $destAccount->id]) ; // update destination transaction(s) to be new expense account. - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '>', 0) ->update(['account_id' => $opposingAccount->id]) @@ -163,7 +164,7 @@ class ConvertToWithdrawal implements ActionInterface // change transaction type of journal: $newType = TransactionType::whereType(TransactionTypeEnum::WITHDRAWAL->value)->first(); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal->id) ->update(['transaction_type_id' => $newType->id]) ; @@ -234,7 +235,7 @@ class ConvertToWithdrawal implements ActionInterface app('log')->debug(sprintf('ConvertToWithdrawal. Action value is "%s", destination name is "%s"', $actionValue, $opposingName)); // update destination transaction(s) to be new expense account. - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $journal->id) ->where('amount', '>', 0) ->update(['account_id' => $opposingAccount->id]) @@ -242,7 +243,7 @@ class ConvertToWithdrawal implements ActionInterface // change transaction type of journal: $newType = TransactionType::whereType(TransactionTypeEnum::WITHDRAWAL->value)->first(); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal->id) ->update(['transaction_type_id' => $newType->id]) ; diff --git a/app/TransactionRules/Actions/LinkToBill.php b/app/TransactionRules/Actions/LinkToBill.php index 65189801cc..3e114846ac 100644 --- a/app/TransactionRules/Actions/LinkToBill.php +++ b/app/TransactionRules/Actions/LinkToBill.php @@ -30,6 +30,7 @@ use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class LinkToBill. @@ -58,7 +59,7 @@ class LinkToBill implements ActionInterface $bill = $repository->findByName($billName); if (null !== $bill && TransactionTypeEnum::WITHDRAWAL->value === $journal['transaction_type_type']) { - $count = \DB::table('transaction_journals')->where('id', '=', $journal['transaction_journal_id']) + $count = DB::table('transaction_journals')->where('id', '=', $journal['transaction_journal_id']) ->where('bill_id', $bill->id)->count() ; if (0 !== $count) { @@ -74,7 +75,7 @@ class LinkToBill implements ActionInterface return false; } - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal['transaction_journal_id']) ->update(['bill_id' => $bill->id]) ; diff --git a/app/TransactionRules/Actions/PrependDescription.php b/app/TransactionRules/Actions/PrependDescription.php index 72cef11b45..8e409b0ee3 100644 --- a/app/TransactionRules/Actions/PrependDescription.php +++ b/app/TransactionRules/Actions/PrependDescription.php @@ -26,6 +26,7 @@ namespace FireflyIII\TransactionRules\Actions; use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; +use Illuminate\Support\Facades\DB; /** * Class PrependDescription. @@ -47,7 +48,7 @@ class PrependDescription implements ActionInterface { $before = $journal['description']; $after = sprintf('%s%s', $this->action->getValue($journal), $journal['description']); - \DB::table('transaction_journals')->where('id', $journal['transaction_journal_id'])->limit(1)->update(['description' => $after]); + DB::table('transaction_journals')->where('id', $journal['transaction_journal_id'])->limit(1)->update(['description' => $after]); // journal /** @var TransactionJournal $object */ diff --git a/app/TransactionRules/Actions/RemoveAllTags.php b/app/TransactionRules/Actions/RemoveAllTags.php index 8952d9532d..e53a11404f 100644 --- a/app/TransactionRules/Actions/RemoveAllTags.php +++ b/app/TransactionRules/Actions/RemoveAllTags.php @@ -27,6 +27,7 @@ use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray; use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; +use Illuminate\Support\Facades\DB; /** * Class RemoveAllTags. @@ -45,8 +46,8 @@ class RemoveAllTags implements ActionInterface public function actOnArray(array $journal): bool { - \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->delete(); - $count = \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->count(); + DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->delete(); + $count = DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->count(); if (0 === $count) { app('log')->debug(sprintf('RuleAction RemoveAllTags, journal #%d has no tags.', $journal['transaction_journal_id'])); event(new RuleActionFailedOnArray($this->action, $journal, trans('rules.no_tags_to_remove'))); diff --git a/app/TransactionRules/Actions/RemoveTag.php b/app/TransactionRules/Actions/RemoveTag.php index a717043ce2..451ed252d0 100644 --- a/app/TransactionRules/Actions/RemoveTag.php +++ b/app/TransactionRules/Actions/RemoveTag.php @@ -28,6 +28,7 @@ use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class RemoveTag. @@ -61,7 +62,7 @@ class RemoveTag implements ActionInterface return false; } - $count = \DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count(); + $count = DB::table('tag_transaction_journal')->where('transaction_journal_id', $journal['transaction_journal_id'])->where('tag_id', $tag->id)->count(); if (0 === $count) { app('log')->debug( sprintf('RuleAction RemoveTag tried to remove tag "%s" from journal #%d but no such tag is linked.', $name, $journal['transaction_journal_id']) @@ -72,7 +73,7 @@ class RemoveTag implements ActionInterface } app('log')->debug(sprintf('RuleAction RemoveTag removed tag #%d ("%s") from journal #%d.', $tag->id, $tag->tag, $journal['transaction_journal_id'])); - \DB::table('tag_transaction_journal') + DB::table('tag_transaction_journal') ->where('transaction_journal_id', $journal['transaction_journal_id']) ->where('tag_id', $tag->id) ->delete() diff --git a/app/TransactionRules/Actions/SetBudget.php b/app/TransactionRules/Actions/SetBudget.php index c5a7bf9c10..cd80f7872b 100644 --- a/app/TransactionRules/Actions/SetBudget.php +++ b/app/TransactionRules/Actions/SetBudget.php @@ -29,6 +29,7 @@ use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class SetBudget. @@ -94,8 +95,8 @@ class SetBudget implements ActionInterface sprintf('RuleAction SetBudget set the budget of journal #%d to budget #%d ("%s").', $journal['transaction_journal_id'], $budget->id, $budget->name) ); - \DB::table('budget_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); - \DB::table('budget_transaction_journal')->insert(['transaction_journal_id' => $journal['transaction_journal_id'], 'budget_id' => $budget->id]); + DB::table('budget_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); + DB::table('budget_transaction_journal')->insert(['transaction_journal_id' => $journal['transaction_journal_id'], 'budget_id' => $budget->id]); /** @var TransactionJournal $object */ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); diff --git a/app/TransactionRules/Actions/SetCategory.php b/app/TransactionRules/Actions/SetCategory.php index edf0176cd0..9f9321a928 100644 --- a/app/TransactionRules/Actions/SetCategory.php +++ b/app/TransactionRules/Actions/SetCategory.php @@ -29,6 +29,7 @@ use FireflyIII\Factory\CategoryFactory; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class SetCategory. @@ -94,8 +95,8 @@ class SetCategory implements ActionInterface return false; } - \DB::table('category_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); - \DB::table('category_transaction_journal')->insert(['transaction_journal_id' => $journal['transaction_journal_id'], 'category_id' => $category->id]); + DB::table('category_transaction_journal')->where('transaction_journal_id', '=', $journal['transaction_journal_id'])->delete(); + DB::table('category_transaction_journal')->insert(['transaction_journal_id' => $journal['transaction_journal_id'], 'category_id' => $category->id]); /** @var TransactionJournal $object */ $object = TransactionJournal::where('user_id', $journal['user_id'])->find($journal['transaction_journal_id']); diff --git a/app/TransactionRules/Actions/SetDescription.php b/app/TransactionRules/Actions/SetDescription.php index 599e5e5673..805dcd96f0 100644 --- a/app/TransactionRules/Actions/SetDescription.php +++ b/app/TransactionRules/Actions/SetDescription.php @@ -27,6 +27,7 @@ use FireflyIII\Events\TriggeredAuditLog; use FireflyIII\Models\RuleAction; use FireflyIII\Models\TransactionJournal; use FireflyIII\TransactionRules\Traits\RefreshNotesTrait; +use Illuminate\Support\Facades\DB; /** * Class SetDescription. @@ -57,7 +58,7 @@ class SetDescription implements ActionInterface // replace newlines. $after = str_replace(["\r", "\n", "\t", "\036", "\025"], '', $after); - \DB::table('transaction_journals') + DB::table('transaction_journals') ->where('id', '=', $journal['transaction_journal_id']) ->update(['description' => $after]) ; diff --git a/app/TransactionRules/Actions/SetDestinationAccount.php b/app/TransactionRules/Actions/SetDestinationAccount.php index 494636802d..810dcbaa3b 100644 --- a/app/TransactionRules/Actions/SetDestinationAccount.php +++ b/app/TransactionRules/Actions/SetDestinationAccount.php @@ -32,6 +32,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class SetDestinationAccount. @@ -125,7 +126,7 @@ class SetDestinationAccount implements ActionInterface event(new TriggeredAuditLog($this->action->rule, $object, 'set_destination', null, $newAccount->name)); // update destination transaction with new destination account: - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $object->id) ->where('amount', '>', 0) ->update(['account_id' => $newAccount->id]) diff --git a/app/TransactionRules/Actions/SetDestinationToCashAccount.php b/app/TransactionRules/Actions/SetDestinationToCashAccount.php index 366d4a9171..fe88ddc06e 100644 --- a/app/TransactionRules/Actions/SetDestinationToCashAccount.php +++ b/app/TransactionRules/Actions/SetDestinationToCashAccount.php @@ -32,6 +32,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class SetDestinationToCashAccount @@ -108,7 +109,7 @@ class SetDestinationToCashAccount implements ActionInterface event(new TriggeredAuditLog($this->action->rule, $object, 'set_destination', null, $cashAccount->name)); // update destination transaction with new destination account: - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $object->id) ->where('amount', '>', 0) ->update(['account_id' => $cashAccount->id]) diff --git a/app/TransactionRules/Actions/SetSourceAccount.php b/app/TransactionRules/Actions/SetSourceAccount.php index 09dbeca8ab..2c656a815b 100644 --- a/app/TransactionRules/Actions/SetSourceAccount.php +++ b/app/TransactionRules/Actions/SetSourceAccount.php @@ -32,6 +32,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class SetSourceAccount. @@ -117,7 +118,7 @@ class SetSourceAccount implements ActionInterface app('log')->debug(sprintf('New source account is #%d ("%s").', $newAccount->id, $newAccount->name)); // update source transaction with new source account: - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $object->id) ->where('amount', '<', 0) ->update(['account_id' => $newAccount->id]) diff --git a/app/TransactionRules/Actions/SetSourceToCashAccount.php b/app/TransactionRules/Actions/SetSourceToCashAccount.php index 0f4bb5bcf5..af618b44a8 100644 --- a/app/TransactionRules/Actions/SetSourceToCashAccount.php +++ b/app/TransactionRules/Actions/SetSourceToCashAccount.php @@ -32,6 +32,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\User; +use Illuminate\Support\Facades\DB; /** * Class SetSourceToCashAccount @@ -108,7 +109,7 @@ class SetSourceToCashAccount implements ActionInterface event(new TriggeredAuditLog($this->action->rule, $object, 'set_source', null, $cashAccount->name)); // update destination transaction with new destination account: - \DB::table('transactions') + DB::table('transactions') ->where('transaction_journal_id', '=', $object->id) ->where('amount', '<', 0) ->update(['account_id' => $cashAccount->id]) diff --git a/app/Validation/FireflyValidator.php b/app/Validation/FireflyValidator.php index aec54ca692..213bfab7a6 100644 --- a/app/Validation/FireflyValidator.php +++ b/app/Validation/FireflyValidator.php @@ -38,6 +38,7 @@ use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Services\Password\Verifier; use FireflyIII\Support\ParseDateString; use FireflyIII\User; +use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Validation\Validator; use PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException; @@ -95,7 +96,7 @@ class FireflyValidator extends Validator if (0 === (int) $value) { return true; } - $count = \DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count(); + $count = DB::table($parameters[0])->where('user_id', auth()->user()->id)->where($field, $value)->count(); return 1 === $count; } @@ -269,7 +270,7 @@ class FireflyValidator extends Validator if (0 === (int) $value) { return true; } - $count = \DB::table($parameters[0])->where($field, $value)->count(); + $count = DB::table($parameters[0])->where($field, $value)->count(); return 1 === $count; } @@ -686,7 +687,7 @@ class FireflyValidator extends Validator */ public function validateUniqueCurrency(string $field, string $attribute, string $value): bool { - return 0 === \DB::table('transaction_currencies')->where($field, $value)->whereNull('deleted_at')->count(); + return 0 === DB::table('transaction_currencies')->where($field, $value)->whereNull('deleted_at')->count(); } public function validateUniqueCurrencyName(?string $attribute, ?string $value): bool @@ -775,7 +776,7 @@ class FireflyValidator extends Validator $exclude = (int) $data['id']; } // get entries from table - $result = \DB::table($table)->where('user_id', auth()->user()->id)->whereNull('deleted_at') + $result = DB::table($table)->where('user_id', auth()->user()->id)->whereNull('deleted_at') ->where('id', '!=', $exclude) ->where($field, $value) ->first([$field]) @@ -798,7 +799,7 @@ class FireflyValidator extends Validator public function validateUniqueObjectGroup($attribute, $value, $parameters): bool { $exclude = $parameters[0] ?? null; - $query = \DB::table('object_groups') + $query = DB::table('object_groups') ->whereNull('object_groups.deleted_at') ->where('object_groups.user_id', auth()->user()->id) ->where('object_groups.title', $value) From 56bac9fc97e7bd038f74804e0c2e0f4caecedece Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 24 Feb 2025 04:13:39 +0100 Subject: [PATCH 09/52] Auto commit for release 'develop' on 2025-02-24 --- .ci/php-cs-fixer/composer.lock | 12 +- .../Controllers/Summary/BasicController.php | 4 +- app/Api/V1/Requests/Data/DestroyRequest.php | 6 +- app/Factory/BillFactory.php | 4 +- .../Transaction/MassController.php | 4 +- app/Http/Middleware/TrustProxies.php | 10 +- .../Internal/Update/BillUpdateService.php | 4 +- .../Internal/Update/JournalUpdateService.php | 4 +- composer.lock | 18 ++- config/firefly.php | 2 +- package-lock.json | 12 +- resources/assets/v1/src/locales/zh-cn.json | 16 +- .../Support/Models/BillDateCalculatorTest.php | 22 +-- .../unit/Support/Calendar/CalculatorTest.php | 62 +++---- .../Calendar/Periodicity/IntervalTestCase.php | 20 +-- .../unit/Support/NavigationAddPeriodTest.php | 152 +++++++++--------- .../Support/NavigationEndOfPeriodTest.php | 36 ++--- ...ationPreferredCarbonFormatByPeriodTest.php | 18 +-- .../NavigationPreferredCarbonFormatTest.php | 18 +-- .../NavigationPreferredEndOfPeriodTest.php | 18 +-- .../NavigationPreferredRangeFormatTest.php | 18 +-- .../NavigationPreferredSqlFormatTest.php | 18 +-- .../Support/NavigationStartOfPeriodTest.php | 36 ++--- ...ctQueryParserInterfaceParseQueryTester.php | 28 ++-- 24 files changed, 272 insertions(+), 270 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 6ec2d09671..610267380d 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -406,16 +406,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.69.1", + "version": "v3.70.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "13b0c0eede38c11cd674b080f2b485d0f14ffa9f" + "reference": "2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/13b0c0eede38c11cd674b080f2b485d0f14ffa9f", - "reference": "13b0c0eede38c11cd674b080f2b485d0f14ffa9f", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e", + "reference": "2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e", "shasum": "" }, "require": { @@ -497,7 +497,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.69.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.70.0" }, "funding": [ { @@ -505,7 +505,7 @@ "type": "github" } ], - "time": "2025-02-18T23:57:43+00:00" + "time": "2025-02-22T23:30:51+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index addd31b8eb..cb0a7bbb96 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -185,8 +185,8 @@ class BasicController extends Controller 'currency_decimal_places' => $currency->decimal_places, 'value_parsed' => app('amount')->formatAnything($currency, $sums[$currencyId] ?? '0', false), 'local_icon' => 'balance-scale', - 'sub_title' => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false). - ' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false), + 'sub_title' => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false) + .' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false), ]; $return[] = [ 'key' => sprintf('spent-in-%s', $currency->code), diff --git a/app/Api/V1/Requests/Data/DestroyRequest.php b/app/Api/V1/Requests/Data/DestroyRequest.php index 2f564567d9..082fb00adb 100644 --- a/app/Api/V1/Requests/Data/DestroyRequest.php +++ b/app/Api/V1/Requests/Data/DestroyRequest.php @@ -49,9 +49,9 @@ class DestroyRequest extends FormRequest */ public function rules(): array { - $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'. - ',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'. - ',not_assets_liabilities'; + $valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups' + .',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers' + .',not_assets_liabilities'; return [ 'objects' => sprintf('required|max:255|min:1|string|in:%s', $valid), diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php index 62d1e79805..24aa6a7e7e 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -48,8 +48,8 @@ class BillFactory { app('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')->getNativeCurrencyByUserGroup($this->user->userGroup); + $currency = $factory->find((int) ($data['currency_id'] ?? null), (string) ($data['currency_code'] ?? null)) + ?? app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); try { $skip = array_key_exists('skip', $data) ? $data['skip'] : 0; diff --git a/app/Http/Controllers/Transaction/MassController.php b/app/Http/Controllers/Transaction/MassController.php index f5d46ec514..67a2fc6add 100644 --- a/app/Http/Controllers/Transaction/MassController.php +++ b/app/Http/Controllers/Transaction/MassController.php @@ -141,8 +141,8 @@ 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]['foreign_amount'] = null === $journal['foreign_amount'] ? - null : app('steam')->positive($journal['foreign_amount']); + $journals[$index]['foreign_amount'] = null === $journal['foreign_amount'] + ? null : app('steam')->positive($journal['foreign_amount']); } $this->rememberPreviousUrl('transactions.mass-edit.url'); diff --git a/app/Http/Middleware/TrustProxies.php b/app/Http/Middleware/TrustProxies.php index d68f3054be..986bb2e5b8 100644 --- a/app/Http/Middleware/TrustProxies.php +++ b/app/Http/Middleware/TrustProxies.php @@ -33,11 +33,11 @@ class TrustProxies extends Middleware { // After... protected $headers - = Request::HEADER_X_FORWARDED_FOR | - Request::HEADER_X_FORWARDED_HOST | - Request::HEADER_X_FORWARDED_PORT | - Request::HEADER_X_FORWARDED_PROTO | - Request::HEADER_X_FORWARDED_AWS_ELB; + = Request::HEADER_X_FORWARDED_FOR + | Request::HEADER_X_FORWARDED_HOST + | Request::HEADER_X_FORWARDED_PORT + | Request::HEADER_X_FORWARDED_PROTO + | Request::HEADER_X_FORWARDED_AWS_ELB; /** * TrustProxies constructor. diff --git a/app/Services/Internal/Update/BillUpdateService.php b/app/Services/Internal/Update/BillUpdateService.php index 3905b21d62..d56bb2cc8c 100644 --- a/app/Services/Internal/Update/BillUpdateService.php +++ b/app/Services/Internal/Update/BillUpdateService.php @@ -54,8 +54,8 @@ 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')->getNativeCurrencyByUserGroup($bill->user->userGroup); + $currency = $factory->find((int) ($data['currency_id'] ?? null), $data['currency_code'] ?? null) + ?? app('amount')->getNativeCurrencyByUserGroup($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 b156b2705f..e596d4363b 100644 --- a/app/Services/Internal/Update/JournalUpdateService.php +++ b/app/Services/Internal/Update/JournalUpdateService.php @@ -703,8 +703,8 @@ class JournalUpdateService // find currency in data array $newForeignId = $this->data['foreign_currency_id'] ?? null; $newForeignCode = $this->data['foreign_currency_code'] ?? null; - $foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode) ?? - $foreignCurrency; + $foreignCurrency = $this->currencyRepository->findCurrencyNull($newForeignId, $newForeignCode) + ?? $foreignCurrency; // not the same as normal currency if (null !== $foreignCurrency && $foreignCurrency->id === $this->transactionJournal->transaction_currency_id) { diff --git a/composer.lock b/composer.lock index fe4310b3f3..13150084d1 100644 --- a/composer.lock +++ b/composer.lock @@ -11135,16 +11135,16 @@ }, { "name": "phpmyadmin/sql-parser", - "version": "5.10.3", + "version": "5.11.0", "source": { "type": "git", "url": "https://github.com/phpmyadmin/sql-parser.git", - "reference": "5346664973d10cf1abff20837fb1183f3c11a055" + "reference": "07044bc8c13abd542756c3fd34dc66a5d6dee8e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/5346664973d10cf1abff20837fb1183f3c11a055", - "reference": "5346664973d10cf1abff20837fb1183f3c11a055", + "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/07044bc8c13abd542756c3fd34dc66a5d6dee8e4", + "reference": "07044bc8c13abd542756c3fd34dc66a5d6dee8e4", "shasum": "" }, "require": { @@ -11159,9 +11159,11 @@ "phpbench/phpbench": "^1.1", "phpmyadmin/coding-standard": "^3.0", "phpmyadmin/motranslator": "^4.0 || ^5.0", - "phpstan/extension-installer": "^1.1", - "phpstan/phpstan": "^1.9.12", - "phpstan/phpstan-phpunit": "^1.3.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^1.12", + "phpstan/phpstan-deprecation-rules": "^1.2", + "phpstan/phpstan-phpunit": "^1.4", + "phpstan/phpstan-strict-rules": "^1.6", "phpunit/phpunit": "^8.5 || ^9.6", "psalm/plugin-phpunit": "^0.16.1", "vimeo/psalm": "^4.11", @@ -11218,7 +11220,7 @@ "type": "other" } ], - "time": "2025-01-19T04:14:02+00:00" + "time": "2025-02-22T20:00:59+00:00" }, { "name": "phpstan/extension-installer", diff --git a/config/firefly.php b/config/firefly.php index 7728e8a78e..ef64d73fc4 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-02-22', + 'version' => 'develop/2025-02-24', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/package-lock.json b/package-lock.json index 33805cec08..4eb7c8af94 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6491,18 +6491,18 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", - "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", + "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "get-proto": "^1.0.0", + "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", diff --git a/resources/assets/v1/src/locales/zh-cn.json b/resources/assets/v1/src/locales/zh-cn.json index faff2d7ae9..2d98265295 100644 --- a/resources/assets/v1/src/locales/zh-cn.json +++ b/resources/assets/v1/src/locales/zh-cn.json @@ -1,8 +1,8 @@ { "firefly": { - "administrations_page_title": "Financial administrations", - "administrations_index_menu": "Financial administrations", - "temp_administrations_introduction": "Firefly III will soon get the ability to manage multiple financial administrations. Right now, you only have the one. You can set the title of this administration and its native currency. This replaces the previous setting where you would set your \"default currency\". This setting is now tied to the financial administration and can be different per administration.", + "administrations_page_title": "\u8d22\u52a1\u7ba1\u7406", + "administrations_index_menu": "\u8d22\u52a1\u7ba1\u7406", + "temp_administrations_introduction": "Firefly III \u4e0d\u4e45\u5c06\u80fd\u591f\u7ba1\u7406\u591a\u4e2a\u8d22\u52a1\u7ba1\u7406\u3002 \u73b0\u5728\uff0c\u4f60\u53ea\u80fd\u6709\u4e00\u4e2a\u8d22\u52a1\u7ba1\u7406\u3002\u4f60\u53ef\u4ee5\u8bbe\u7f6e\u8fd9\u4e2a\u8d22\u52a1\u7ba1\u7406\u7684\u6807\u9898\u53ca\u5176\u5f53\u5730\u8d27\u5e01\u3002 \u8fd9\u5c06\u53d6\u4ee3\u60a8\u5148\u524d\u8bbe\u7f6e\u7684\u201c\u9ed8\u8ba4\u8d27\u5e01\u201d\u3002 \u8fd9\u79cd\u8bbe\u7f6e\u73b0\u5728\u4e0e\u8d22\u52a1\u7ba1\u7406\u6302\u94a9\uff0c\u6bcf\u4e2a\u7ba1\u7406\u53ef\u4ee5\u6709\u4e0d\u540c\u7684\u8bbe\u7f6e\u3002", "administration_currency_form_help": "It may take a long time for the page to load if you change the native currency because transaction may need to be converted to your (new) native currency.", "administrations_page_edit_sub_title_js": "Edit financial administration \"{title}\"", "table": "\u8868\u683c", @@ -19,7 +19,7 @@ "split": "\u62c6\u5206", "single_split": "\u62c6\u5206", "not_enough_currencies": "Not enough currencies", - "not_enough_currencies_enabled": "If you have just one currency enabled, there is no need to add exchange rates.", + "not_enough_currencies_enabled": "\u5982\u679c\u60a8\u53ea\u542f\u7528\u4e86\u4e00\u79cd\u8d27\u5e01\uff0c\u5c31\u4e0d\u9700\u8981\u6dfb\u52a0\u6c47\u7387\u3002", "transaction_stored_link": "\u4ea4\u6613 #{ID} (\u201c{title}\u201d)<\/a> \u5df2\u4fdd\u5b58\u3002", "webhook_stored_link": "\u63a8\u9001 #{ID} (\"{title}\")<\/a> \u5df2\u4fdd\u5b58.", "webhook_updated_link": "\u63a8\u9001 #{ID}<\/a> (\"{title}\") \u5df2\u66f4\u65b0.", @@ -45,7 +45,7 @@ "is_reconciled_fields_dropped": "Because this transaction is reconciled, you will not be able to update the accounts, nor the amount(s) unless you remove the reconciliation flag.", "tags": "\u6807\u7b7e", "no_budget": "(\u65e0\u9884\u7b97)", - "no_bill": "(no subscription)", + "no_bill": "(\u65e0\u8ba2\u9605)", "category": "\u5206\u7c7b", "attachments": "\u9644\u4ef6", "notes": "\u5907\u6ce8", @@ -146,8 +146,8 @@ "header_exchange_rates_rates": "\u6c47\u7387", "header_exchange_rates_table": "Table with exchange rates", "help_rate_form": "On this day, how many {to} will you get for one {from}?", - "add_new_rate": "Add a new exchange rate", - "save_new_rate": "Save new rate" + "add_new_rate": "\u6dfb\u52a0\u65b0\u6c47\u7387", + "save_new_rate": "\u4fdd\u5b58\u65b0\u6c47\u7387" }, "form": { "url": "\u7f51\u5740", @@ -182,6 +182,6 @@ }, "config": { "html_language": "zh-cn", - "date_time_fns": "YYYY\u5e74M\u6708D\u65e5 HH:mm:ss" + "date_time_fns": "yyyy\u5e74M\u6708d\u65e5 HH:mm:ss" } } \ No newline at end of file diff --git a/tests/integration/Support/Models/BillDateCalculatorTest.php b/tests/integration/Support/Models/BillDateCalculatorTest.php index b4962ad6fb..bb65b1d0ac 100644 --- a/tests/integration/Support/Models/BillDateCalculatorTest.php +++ b/tests/integration/Support/Models/BillDateCalculatorTest.php @@ -45,6 +45,17 @@ final class BillDateCalculatorTest extends TestCase $this->calculator = new BillDateCalculator(); } + /** + * Stupid long method names I'm not going to do that. + * + * @dataProvider provideDates + */ + public function testGivenSomeDataItWorks(Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid, array $expected): void + { + $result = $this->calculator->getPayDates($earliest, $latest, $billStart, $period, $skip, $lastPaid); + self::assertSame($expected, $result); + } + public static function provideDates(): iterable { // Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid @@ -66,15 +77,4 @@ final class BillDateCalculatorTest extends TestCase '1Ya' => ['earliest' => Carbon::parse('2023-11-01'), 'latest' => Carbon::parse('2023-11-30'), 'billStart' => Carbon::parse('2021-05-01'), 'period' => 'yearly', 'skip' => 0, 'lastPaid' => Carbon::parse('2023-05-02'), 'expected' => ['2024-05-01']], ]; } - - /** - * Stupid long method names I'm not going to do that. - * - * @dataProvider provideDates - */ - public function testGivenSomeDataItWorks(Carbon $earliest, Carbon $latest, Carbon $billStart, string $period, int $skip, ?Carbon $lastPaid, array $expected): void - { - $result = $this->calculator->getPayDates($earliest, $latest, $billStart, $period, $skip, $lastPaid); - self::assertSame($expected, $result); - } } diff --git a/tests/unit/Support/Calendar/CalculatorTest.php b/tests/unit/Support/Calendar/CalculatorTest.php index 3830390c3b..4f127bf767 100644 --- a/tests/unit/Support/Calendar/CalculatorTest.php +++ b/tests/unit/Support/Calendar/CalculatorTest.php @@ -50,6 +50,32 @@ use Tests\unit\Support\Calendar\Periodicity\YearlyTest; */ final class CalculatorTest extends TestCase { + private static function convert(Periodicity $periodicity, array $intervals): array + { + $periodicityIntervals = []; + + /** @var IntervalProvider $interval */ + foreach ($intervals as $index => $interval) { + $calculator = CalculatorProvider::from($periodicity, $interval); + + $periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator]; + } + + return $periodicityIntervals; + } + + /** + * @dataProvider provideAllPeriodicity + * + * @throws IntervalException + */ + public function testGivenADailyPeriodicityWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(CalculatorProvider $provider): void + { + $calculator = new Calculator(); + $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity); + self::assertSame($provider->expected()->toDateString(), $period->toDateString()); + } + public static function provideAllPeriodicity(): iterable { $intervals = []; @@ -68,37 +94,6 @@ final class CalculatorTest extends TestCase } } - private static function convert(Periodicity $periodicity, array $intervals): array - { - $periodicityIntervals = []; - - /** @var IntervalProvider $interval */ - foreach ($intervals as $index => $interval) { - $calculator = CalculatorProvider::from($periodicity, $interval); - - $periodicityIntervals["#{$index} {$calculator->label}"] = [$calculator]; - } - - return $periodicityIntervals; - } - - public static function provideSkippedIntervals(): iterable - { - return CalculatorProvider::providePeriodicityWithSkippedIntervals(); - } - - /** - * @dataProvider provideAllPeriodicity - * - * @throws IntervalException - */ - public function testGivenADailyPeriodicityWhenCallTheNextDateByIntervalMethodThenReturnsTheExpectedDateSuccessful(CalculatorProvider $provider): void - { - $calculator = new Calculator(); - $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity); - self::assertSame($provider->expected()->toDateString(), $period->toDateString()); - } - /** * @dataProvider provideSkippedIntervals * @@ -110,4 +105,9 @@ final class CalculatorTest extends TestCase $period = $calculator->nextDateByInterval($provider->epoch(), $provider->periodicity, $provider->skip); self::assertSame($provider->expected()->toDateString(), $period->toDateString()); } + + public static function provideSkippedIntervals(): iterable + { + return CalculatorProvider::providePeriodicityWithSkippedIntervals(); + } } diff --git a/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php b/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php index 2153f1b9a0..7e4cc812bc 100644 --- a/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php +++ b/tests/unit/Support/Calendar/Periodicity/IntervalTestCase.php @@ -29,16 +29,6 @@ use Tests\integration\TestCase; abstract class IntervalTestCase extends TestCase { - public static function provider(): iterable - { - $intervals = static::provideIntervals(); - - /** @var IntervalProvider $interval */ - foreach ($intervals as $interval) { - yield "{$interval->label}" => [$interval]; - } - } - abstract public static function provideIntervals(): array; /** @@ -50,5 +40,15 @@ abstract class IntervalTestCase extends TestCase self::assertSame($provider->expected->toDateString(), $period->toDateString()); } + public static function provider(): iterable + { + $intervals = static::provideIntervals(); + + /** @var IntervalProvider $interval */ + foreach ($intervals as $interval) { + yield "{$interval->label}" => [$interval]; + } + } + abstract public static function factory(): Interval; } diff --git a/tests/unit/Support/NavigationAddPeriodTest.php b/tests/unit/Support/NavigationAddPeriodTest.php index cb0cedc1f0..018258d2bf 100644 --- a/tests/unit/Support/NavigationAddPeriodTest.php +++ b/tests/unit/Support/NavigationAddPeriodTest.php @@ -48,74 +48,13 @@ final class NavigationAddPeriodTest extends TestCase $this->navigation = new Navigation(); } - public static function provideFrequencies(): iterable + /** + * @dataProvider providePeriodsWithSkippingParam + */ + public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected): void { - return [ - Periodicity::Daily->name => ['periodicity' => Periodicity::Daily, 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], - Periodicity::Weekly->name => ['periodicity' => Periodicity::Weekly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - Periodicity::Fortnightly->name => ['periodicity' => Periodicity::Fortnightly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(2)], - Periodicity::Monthly->name => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], - '2019-01-01 to 2019-02-01' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-01'), 'expected' => Carbon::parse('2019-02-01')], - '2019-01-29 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-30 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-31 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], - '2023-03-31 to 2023-04-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], - '2023-05-31 to 2023-06-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], - '2023-08-31 to 2023-09-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], - '2023-10-31 to 2023-11-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], - Periodicity::Quarterly->name => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - '2019-01-29 to 2020-04-29' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-04-29')], - '2019-01-30 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-04-30')], - '2019-01-31 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-04-30')], - Periodicity::HalfYearly->name => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], - '2019-01-31 to 2020-07-29' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-07-29')], - '2019-01-31 to 2020-07-30' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-07-30')], - '2019-01-31 to 2020-07-31' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-07-31')], - Periodicity::Yearly->name => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - '2020-02-29 to 2021-02-28' => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::parse('2020-02-29'), 'expected' => Carbon::parse('2021-02-28')], - ]; - } - - public static function provideMonthPeriods(): iterable - { - return [ - '1M' => ['frequency' => '1M', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], - 'month' => ['frequency' => 'month', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], - 'monthly' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], - '2019-01-29 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-30 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], - '2019-01-31 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], - '2023-03-31 to 2023-04-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], - '2023-05-31 to 2023-06-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], - '2023-08-31 to 2023-09-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], - '2023-10-31 to 2023-11-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], - ]; - } - - public static function providePeriods(): iterable - { - return [ - '1D' => ['frequency' => '1D', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], - 'daily' => ['frequency' => 'daily', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], - '1W' => ['frequency' => '1W', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - 'weekly' => ['frequency' => 'weekly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - 'week' => ['frequency' => 'week', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], - '3M' => ['frequency' => '3M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'quarter' => ['frequency' => 'quarter', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'quarterly' => ['frequency' => 'quarterly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - '6M' => ['frequency' => '6M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], - 'half-year' => ['frequency' => 'half-year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], - 'year' => ['frequency' => 'year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - 'yearly' => ['frequency' => 'yearly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - '1Y' => ['frequency' => '1Y', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - 'last7' => ['frequency' => 'last7', 'from' => Carbon::now(), 'expected' => Carbon::now()->addDays(7)], - 'last30' => ['frequency' => 'last30', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], - 'last90' => ['frequency' => 'last90', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'last365' => ['frequency' => 'last365', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - 'MTD' => ['frequency' => 'MTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], - 'QTD' => ['frequency' => 'QTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], - 'YTD' => ['frequency' => 'YTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], - ]; + $period = $this->navigation->addPeriod($from, $frequency, $skip); + self::assertSame($expected->toDateString(), $period->toDateString()); } public static function providePeriodsWithSkippingParam(): iterable @@ -163,15 +102,6 @@ final class NavigationAddPeriodTest extends TestCase } } - /** - * @dataProvider providePeriodsWithSkippingParam - */ - public function testGivenAFrequencyAndSkipIntervalWhenCalculateTheDateThenReturnsTheSkippedDateSuccessful(int $skip, string $frequency, Carbon $from, Carbon $expected): void - { - $period = $this->navigation->addPeriod($from, $frequency, $skip); - self::assertSame($expected->toDateString(), $period->toDateString()); - } - /** * @dataProvider providePeriods */ @@ -181,6 +111,32 @@ final class NavigationAddPeriodTest extends TestCase self::assertSame($expected->toDateString(), $period->toDateString()); } + public static function providePeriods(): iterable + { + return [ + '1D' => ['frequency' => '1D', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], + 'daily' => ['frequency' => 'daily', 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], + '1W' => ['frequency' => '1W', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + 'weekly' => ['frequency' => 'weekly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + 'week' => ['frequency' => 'week', 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + '3M' => ['frequency' => '3M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'quarter' => ['frequency' => 'quarter', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'quarterly' => ['frequency' => 'quarterly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + '6M' => ['frequency' => '6M', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], + 'half-year' => ['frequency' => 'half-year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], + 'year' => ['frequency' => 'year', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + 'yearly' => ['frequency' => 'yearly', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + '1Y' => ['frequency' => '1Y', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + 'last7' => ['frequency' => 'last7', 'from' => Carbon::now(), 'expected' => Carbon::now()->addDays(7)], + 'last30' => ['frequency' => 'last30', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], + 'last90' => ['frequency' => 'last90', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'last365' => ['frequency' => 'last365', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + 'MTD' => ['frequency' => 'MTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], + 'QTD' => ['frequency' => 'QTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + 'YTD' => ['frequency' => 'YTD', 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + ]; + } + /** * @dataProvider provideFrequencies */ @@ -190,6 +146,34 @@ final class NavigationAddPeriodTest extends TestCase self::assertSame($expected->toDateString(), $period->toDateString()); } + public static function provideFrequencies(): iterable + { + return [ + Periodicity::Daily->name => ['periodicity' => Periodicity::Daily, 'from' => Carbon::now(), 'expected' => Carbon::tomorrow()], + Periodicity::Weekly->name => ['periodicity' => Periodicity::Weekly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(1)], + Periodicity::Fortnightly->name => ['periodicity' => Periodicity::Fortnightly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addWeeks(2)], + Periodicity::Monthly->name => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(1)], + '2019-01-01 to 2019-02-01' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-01'), 'expected' => Carbon::parse('2019-02-01')], + '2019-01-29 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-30 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-31 to 2019-02-28' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], + '2023-03-31 to 2023-04-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], + '2023-05-31 to 2023-06-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], + '2023-08-31 to 2023-09-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], + '2023-10-31 to 2023-11-30' => ['periodicity' => Periodicity::Monthly, 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], + Periodicity::Quarterly->name => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(3)], + '2019-01-29 to 2020-04-29' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-04-29')], + '2019-01-30 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-04-30')], + '2019-01-31 to 2020-04-30' => ['periodicity' => Periodicity::Quarterly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-04-30')], + Periodicity::HalfYearly->name => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addMonthsNoOverflow(6)], + '2019-01-31 to 2020-07-29' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-07-29')], + '2019-01-31 to 2020-07-30' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-07-30')], + '2019-01-31 to 2020-07-31' => ['periodicity' => Periodicity::HalfYearly, 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-07-31')], + Periodicity::Yearly->name => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::now(), 'expected' => Carbon::now()->addYears(1)], + '2020-02-29 to 2021-02-28' => ['periodicity' => Periodicity::Yearly, 'from' => Carbon::parse('2020-02-29'), 'expected' => Carbon::parse('2021-02-28')], + ]; + } + /** * @dataProvider provideMonthPeriods */ @@ -198,4 +182,20 @@ final class NavigationAddPeriodTest extends TestCase $period = $this->navigation->addPeriod($from, $frequency, 0); self::assertSame($expected->toDateString(), $period->toDateString()); } + + public static function provideMonthPeriods(): iterable + { + return [ + '1M' => ['frequency' => '1M', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], + 'month' => ['frequency' => 'month', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], + 'monthly' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-06-25'), 'expected' => Carbon::parse('2023-06-25')->addMonthsNoOverflow(1)], + '2019-01-29 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-29'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-30 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-30'), 'expected' => Carbon::parse('2019-02-28')], + '2019-01-31 to 2019-02-28' => ['frequency' => 'monthly', 'from' => Carbon::parse('2019-01-31'), 'expected' => Carbon::parse('2019-02-28')], + '2023-03-31 to 2023-04-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-03-31'), 'expected' => Carbon::parse('2023-04-30')], + '2023-05-31 to 2023-06-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-05-31'), 'expected' => Carbon::parse('2023-06-30')], + '2023-08-31 to 2023-09-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-08-31'), 'expected' => Carbon::parse('2023-09-30')], + '2023-10-31 to 2023-11-30' => ['frequency' => 'monthly', 'from' => Carbon::parse('2023-10-31'), 'expected' => Carbon::parse('2023-11-30')], + ]; + } } diff --git a/tests/unit/Support/NavigationEndOfPeriodTest.php b/tests/unit/Support/NavigationEndOfPeriodTest.php index f9a3b22e8e..278b2e7897 100644 --- a/tests/unit/Support/NavigationEndOfPeriodTest.php +++ b/tests/unit/Support/NavigationEndOfPeriodTest.php @@ -47,6 +47,15 @@ final class NavigationEndOfPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider provideDates + */ + public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void + { + $period = clone $this->navigation->endOfPeriod($from, $frequency); + self::assertSame($expected->toDateString(), $period->toDateString()); + } + public static function provideDates(): iterable { return [ @@ -78,24 +87,6 @@ final class NavigationEndOfPeriodTest extends TestCase ]; } - public static function provideUnknownFrequencies(): iterable - { - return [ - '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], - 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - ]; - } - - /** - * @dataProvider provideDates - */ - public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void - { - $period = clone $this->navigation->endOfPeriod($from, $frequency); - self::assertSame($expected->toDateString(), $period->toDateString()); - } - /** * @dataProvider provideUnknownFrequencies */ @@ -109,4 +100,13 @@ final class NavigationEndOfPeriodTest extends TestCase Log::shouldHaveReceived('error', [$expectedMessage]); } + + public static function provideUnknownFrequencies(): iterable + { + return [ + '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], + 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + ]; + } } diff --git a/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php b/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php index fcb0165476..1a6007870d 100644 --- a/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php +++ b/tests/unit/Support/NavigationPreferredCarbonFormatByPeriodTest.php @@ -46,6 +46,15 @@ final class NavigationPreferredCarbonFormatByPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenAPeriodWhenCallPreferredCarbonFormatByPeriodThenReturnsExpectedFormat(string $period, string $expected): void + { + $formatPeriod = $this->navigation->preferredCarbonFormatByPeriod($period); + self::assertSame($expected, $formatPeriod); + } + public static function providePeriods(): iterable { return [ @@ -57,13 +66,4 @@ final class NavigationPreferredCarbonFormatByPeriodTest extends TestCase 'yearly' => ['period' => '1Y', 'expected' => 'Y'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenAPeriodWhenCallPreferredCarbonFormatByPeriodThenReturnsExpectedFormat(string $period, string $expected): void - { - $formatPeriod = $this->navigation->preferredCarbonFormatByPeriod($period); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationPreferredCarbonFormatTest.php b/tests/unit/Support/NavigationPreferredCarbonFormatTest.php index 667cd77333..2cb4e0d074 100644 --- a/tests/unit/Support/NavigationPreferredCarbonFormatTest.php +++ b/tests/unit/Support/NavigationPreferredCarbonFormatTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredCarbonFormatTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenStartAndEndDatesWhenCallPreferredCarbonFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $carbonFormat = $this->navigation->preferredCarbonFormat($start, $end); + self::assertSame($expected, $carbonFormat); + } + public static function providePeriods(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredCarbonFormatTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => 'Y'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenStartAndEndDatesWhenCallPreferredCarbonFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $carbonFormat = $this->navigation->preferredCarbonFormat($start, $end); - self::assertSame($expected, $carbonFormat); - } } diff --git a/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php b/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php index d5f56ff678..f951a9a6a2 100644 --- a/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php +++ b/tests/unit/Support/NavigationPreferredEndOfPeriodTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredEndOfPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenStartAndEndDatesWhenCallPreferredEndOfPeriodThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $formatPeriod = $this->navigation->preferredEndOfPeriod($start, $end); + self::assertSame($expected, $formatPeriod); + } + public static function providePeriods(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredEndOfPeriodTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => 'endOfYear'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenStartAndEndDatesWhenCallPreferredEndOfPeriodThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $formatPeriod = $this->navigation->preferredEndOfPeriod($start, $end); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationPreferredRangeFormatTest.php b/tests/unit/Support/NavigationPreferredRangeFormatTest.php index fede42ff47..21c2dea91d 100644 --- a/tests/unit/Support/NavigationPreferredRangeFormatTest.php +++ b/tests/unit/Support/NavigationPreferredRangeFormatTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredRangeFormatTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider providePeriods + */ + public function testGivenStartAndEndDatesWhenCallPreferredRangeFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $formatPeriod = $this->navigation->preferredRangeFormat($start, $end); + self::assertSame($expected, $formatPeriod); + } + public static function providePeriods(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredRangeFormatTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => '1Y'], ]; } - - /** - * @dataProvider providePeriods - */ - public function testGivenStartAndEndDatesWhenCallPreferredRangeFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $formatPeriod = $this->navigation->preferredRangeFormat($start, $end); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationPreferredSqlFormatTest.php b/tests/unit/Support/NavigationPreferredSqlFormatTest.php index 24a9c174fa..9dce8d5d33 100644 --- a/tests/unit/Support/NavigationPreferredSqlFormatTest.php +++ b/tests/unit/Support/NavigationPreferredSqlFormatTest.php @@ -47,6 +47,15 @@ final class NavigationPreferredSqlFormatTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider provideDates + */ + public function testGivenStartAndEndDatesWhenCallPreferredSqlFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void + { + $formatPeriod = $this->navigation->preferredSqlFormat($start, $end); + self::assertSame($expected, $formatPeriod); + } + public static function provideDates(): iterable { return [ @@ -64,13 +73,4 @@ final class NavigationPreferredSqlFormatTest extends TestCase '2 years' => ['start' => Carbon::now(), 'end' => Carbon::now()->addYears(2), 'expected' => '%Y'], ]; } - - /** - * @dataProvider provideDates - */ - public function testGivenStartAndEndDatesWhenCallPreferredSqlFormatThenReturnsTheExpectedFormatSuccessful(Carbon $start, Carbon $end, string $expected): void - { - $formatPeriod = $this->navigation->preferredSqlFormat($start, $end); - self::assertSame($expected, $formatPeriod); - } } diff --git a/tests/unit/Support/NavigationStartOfPeriodTest.php b/tests/unit/Support/NavigationStartOfPeriodTest.php index 315cb1695c..fe9f5117b0 100644 --- a/tests/unit/Support/NavigationStartOfPeriodTest.php +++ b/tests/unit/Support/NavigationStartOfPeriodTest.php @@ -48,6 +48,15 @@ final class NavigationStartOfPeriodTest extends TestCase $this->navigation = new Navigation(); } + /** + * @dataProvider provideDates + */ + public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void + { + $period = $this->navigation->startOfPeriod($from, $frequency); + self::assertSame($expected->toDateString(), $period->toDateString()); + } + public static function provideDates(): iterable { return [ @@ -78,24 +87,6 @@ final class NavigationStartOfPeriodTest extends TestCase ]; } - public static function provideUnknownFrequencies(): iterable - { - return [ - '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], - 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], - ]; - } - - /** - * @dataProvider provideDates - */ - public function testGivenADateAndFrequencyWhenCalculateTheDateThenReturnsTheExpectedDateSuccessful(string $frequency, Carbon $from, Carbon $expected): void - { - $period = $this->navigation->startOfPeriod($from, $frequency); - self::assertSame($expected->toDateString(), $period->toDateString()); - } - /** * @dataProvider provideUnknownFrequencies */ @@ -111,4 +102,13 @@ final class NavigationStartOfPeriodTest extends TestCase $period = $this->navigation->startOfPeriod($from, $frequency); self::assertSame($expected->toDateString(), $period->toDateString()); } + + public static function provideUnknownFrequencies(): iterable + { + return [ + '1day' => ['frequency' => '1day', 'from' => Carbon::now(), 'expected' => Carbon::now()], + 'unknown' => ['frequency' => 'unknown', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + 'empty' => ['frequency' => '', 'from' => Carbon::now(), 'expected' => Carbon::now()->startOfDay()], + ]; + } } diff --git a/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php b/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php index c2abc6aeb2..0081ac0b19 100644 --- a/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php +++ b/tests/unit/Support/Search/QueryParser/AbstractQueryParserInterfaceParseQueryTester.php @@ -15,6 +15,20 @@ abstract class AbstractQueryParserInterfaceParseQueryTester extends TestCase { abstract protected function createParser(): QueryParserInterface; + /** + * @dataProvider queryDataProvider + * + * @param string $query The query string to parse + * @param Node $expected The expected parse result + */ + public function testQueryParsing(string $query, Node $expected): void + { + $actual = $this->createParser()->parse($query); + + self::assertObjectEquals($expected, $actual); + + } + public static function queryDataProvider(): iterable { return [ @@ -181,18 +195,4 @@ abstract class AbstractQueryParserInterfaceParseQueryTester extends TestCase ], ]; } - - /** - * @dataProvider queryDataProvider - * - * @param string $query The query string to parse - * @param Node $expected The expected parse result - */ - public function testQueryParsing(string $query, Node $expected): void - { - $actual = $this->createParser()->parse($query); - - self::assertObjectEquals($expected, $actual); - - } } From d9593db5e2c1578579670aaeb61cfa12e1dc76cc Mon Sep 17 00:00:00 2001 From: Lompi Date: Mon, 24 Feb 2025 16:55:00 +0100 Subject: [PATCH 10/52] Add support for PHP function `strpos` in expressions Signed-off-by: Lompi --- .../Expressions/ActionExpressionLanguageProvider.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php b/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php index a097377487..b80a0eaf50 100644 --- a/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php +++ b/app/TransactionRules/Expressions/ActionExpressionLanguageProvider.php @@ -60,6 +60,7 @@ class ActionExpressionLanguageProvider implements ExpressionFunctionProviderInte ExpressionFunction::fromPhp('substr'), ExpressionFunction::fromPhp('strlen'), + ExpressionFunction::fromPhp('strpos'), ]; } } From eda2b5f822cb8e4b16597af8cc655b5894302043 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 04:14:36 +0100 Subject: [PATCH 11/52] Auto commit for release 'develop' on 2025-03-03 --- .ci/php-cs-fixer/composer.lock | 36 +- composer.lock | 371 ++++++++++---------- config/firefly.php | 2 +- package-lock.json | 436 ++++++++++++------------ resources/assets/v1/src/locales/cs.json | 10 +- resources/assets/v1/src/locales/fr.json | 4 +- resources/assets/v1/src/locales/it.json | 48 +-- 7 files changed, 453 insertions(+), 454 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 610267380d..7384ece194 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -406,16 +406,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.70.0", + "version": "v3.70.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e" + "reference": "add1b3a05256392dbad63875240041b2c0349ceb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e", - "reference": "2ecd5aae0edc937f0d5aa4a22d1d705c6b2e084e", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/add1b3a05256392dbad63875240041b2c0349ceb", + "reference": "add1b3a05256392dbad63875240041b2c0349ceb", "shasum": "" }, "require": { @@ -497,7 +497,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.70.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.70.1" }, "funding": [ { @@ -505,7 +505,7 @@ "type": "github" } ], - "time": "2025-02-22T23:30:51+00:00" + "time": "2025-03-01T22:05:46+00:00" }, { "name": "psr/container", @@ -2242,16 +2242,16 @@ }, { "name": "symfony/process", - "version": "v7.2.0", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e" + "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", - "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", + "url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", + "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", "shasum": "" }, "require": { @@ -2283,7 +2283,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.2.0" + "source": "https://github.com/symfony/process/tree/v7.2.4" }, "funding": [ { @@ -2299,7 +2299,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:24:19+00:00" + "time": "2025-02-05T08:33:46+00:00" }, { "name": "symfony/service-contracts", @@ -2386,16 +2386,16 @@ }, { "name": "symfony/stopwatch", - "version": "v7.2.2", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "e46690d5b9d7164a6d061cab1e8d46141b9f49df" + "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/e46690d5b9d7164a6d061cab1e8d46141b9f49df", - "reference": "e46690d5b9d7164a6d061cab1e8d46141b9f49df", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd", + "reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd", "shasum": "" }, "require": { @@ -2428,7 +2428,7 @@ "description": "Provides a way to profile code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/stopwatch/tree/v7.2.2" + "source": "https://github.com/symfony/stopwatch/tree/v7.2.4" }, "funding": [ { @@ -2444,7 +2444,7 @@ "type": "tidelift" } ], - "time": "2024-12-18T14:28:33+00:00" + "time": "2025-02-24T10:49:57+00:00" }, { "name": "symfony/string", diff --git a/composer.lock b/composer.lock index 13150084d1..4522ae7422 100644 --- a/composer.lock +++ b/composer.lock @@ -129,16 +129,16 @@ }, { "name": "brick/math", - "version": "0.12.1", + "version": "0.12.3", "source": { "type": "git", "url": "https://github.com/brick/math.git", - "reference": "f510c0a40911935b77b86859eb5223d58d660df1" + "reference": "866551da34e9a618e64a819ee1e01c20d8a588ba" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/brick/math/zipball/f510c0a40911935b77b86859eb5223d58d660df1", - "reference": "f510c0a40911935b77b86859eb5223d58d660df1", + "url": "https://api.github.com/repos/brick/math/zipball/866551da34e9a618e64a819ee1e01c20d8a588ba", + "reference": "866551da34e9a618e64a819ee1e01c20d8a588ba", "shasum": "" }, "require": { @@ -147,7 +147,7 @@ "require-dev": { "php-coveralls/php-coveralls": "^2.2", "phpunit/phpunit": "^10.1", - "vimeo/psalm": "5.16.0" + "vimeo/psalm": "6.8.8" }, "type": "library", "autoload": { @@ -177,7 +177,7 @@ ], "support": { "issues": "https://github.com/brick/math/issues", - "source": "https://github.com/brick/math/tree/0.12.1" + "source": "https://github.com/brick/math/tree/0.12.3" }, "funding": [ { @@ -185,7 +185,7 @@ "type": "github" } ], - "time": "2023-11-29T23:19:16+00:00" + "time": "2025-02-28T13:11:00+00:00" }, { "name": "carbonphp/carbon-doctrine-types", @@ -1812,29 +1812,28 @@ }, { "name": "laravel-notification-channels/pushover", - "version": "4.0.0", + "version": "4.1.1", "source": { "type": "git", "url": "https://github.com/laravel-notification-channels/pushover.git", - "reference": "31ff8c124f54de69673145c90836dd6cf7a01223" + "reference": "68697f85a01c5f10168ad0ab05b14ef3e244cec4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel-notification-channels/pushover/zipball/31ff8c124f54de69673145c90836dd6cf7a01223", - "reference": "31ff8c124f54de69673145c90836dd6cf7a01223", + "url": "https://api.github.com/repos/laravel-notification-channels/pushover/zipball/68697f85a01c5f10168ad0ab05b14ef3e244cec4", + "reference": "68697f85a01c5f10168ad0ab05b14ef3e244cec4", "shasum": "" }, "require": { "guzzlehttp/guzzle": "^7.0.1", - "illuminate/notifications": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0", + "illuminate/notifications": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", + "illuminate/support": "^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0", "php": "^8.1" }, "require-dev": { - "dms/phpunit-arraysubset-asserts": ">=0.1.0", "mockery/mockery": "^1.3.1", - "orchestra/testbench": "^8.0 || ^9.0", - "phpunit/phpunit": "^9.3 || ^10.5" + "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0", + "phpunit/phpunit": "^9.3 || ^10.5 || ^11.5.3" }, "suggest": { "ext-exif": "Required for image attachment support" @@ -1862,28 +1861,34 @@ "email": "mail@casperboone.nl", "homepage": "https://casperboone.nl", "role": "Developer" + }, + { + "name": "Kevin Woblick", + "email": "mail@woblick.dev", + "homepage": "https://woblick.dev", + "role": "Developer" } ], "description": "Pushover notifications for Laravel.", "homepage": "https://github.com/laravel-notification-channels/pushover", "support": { "issues": "https://github.com/laravel-notification-channels/pushover/issues", - "source": "https://github.com/laravel-notification-channels/pushover/tree/4.0.0" + "source": "https://github.com/laravel-notification-channels/pushover/tree/4.1.1" }, - "time": "2024-03-20T08:14:56+00:00" + "time": "2025-03-01T09:05:11+00:00" }, { "name": "laravel/framework", - "version": "v11.43.2", + "version": "v11.44.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "99d1573698abc42222f04d25fcd5b213d0eedf21" + "reference": "e9a33da34815ac1ed46c7e4c477a775f4592f0a7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/99d1573698abc42222f04d25fcd5b213d0eedf21", - "reference": "99d1573698abc42222f04d25fcd5b213d0eedf21", + "url": "https://api.github.com/repos/laravel/framework/zipball/e9a33da34815ac1ed46c7e4c477a775f4592f0a7", + "reference": "e9a33da34815ac1ed46c7e4c477a775f4592f0a7", "shasum": "" }, "require": { @@ -2085,20 +2090,20 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-02-19T21:53:48+00:00" + "time": "2025-02-24T13:08:54+00:00" }, { "name": "laravel/passport", - "version": "v12.4.1", + "version": "v12.4.2", "source": { "type": "git", "url": "https://github.com/laravel/passport.git", - "reference": "e9959e07f751ae4a8ad102d5cb51cbe211181ec3" + "reference": "65a885607b62d361aedaeb10a946bc6b5a954262" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/passport/zipball/e9959e07f751ae4a8ad102d5cb51cbe211181ec3", - "reference": "e9959e07f751ae4a8ad102d5cb51cbe211181ec3", + "url": "https://api.github.com/repos/laravel/passport/zipball/65a885607b62d361aedaeb10a946bc6b5a954262", + "reference": "65a885607b62d361aedaeb10a946bc6b5a954262", "shasum": "" }, "require": { @@ -2161,7 +2166,7 @@ "issues": "https://github.com/laravel/passport/issues", "source": "https://github.com/laravel/passport" }, - "time": "2025-01-28T15:14:23+00:00" + "time": "2025-02-12T16:11:33+00:00" }, { "name": "laravel/prompts", @@ -2349,16 +2354,16 @@ }, { "name": "laravel/slack-notification-channel", - "version": "v3.4.4", + "version": "v3.5.0", "source": { "type": "git", "url": "https://github.com/laravel/slack-notification-channel.git", - "reference": "58890389d6b4b8021c8d34d78246d7dff5a57cb6" + "reference": "b9448136c2e93f51f0d603d05d6bf64412e5727c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/58890389d6b4b8021c8d34d78246d7dff5a57cb6", - "reference": "58890389d6b4b8021c8d34d78246d7dff5a57cb6", + "url": "https://api.github.com/repos/laravel/slack-notification-channel/zipball/b9448136c2e93f51f0d603d05d6bf64412e5727c", + "reference": "b9448136c2e93f51f0d603d05d6bf64412e5727c", "shasum": "" }, "require": { @@ -2408,9 +2413,9 @@ ], "support": { "issues": "https://github.com/laravel/slack-notification-channel/issues", - "source": "https://github.com/laravel/slack-notification-channel/tree/v3.4.4" + "source": "https://github.com/laravel/slack-notification-channel/tree/v3.5.0" }, - "time": "2025-01-24T15:40:14+00:00" + "time": "2025-02-23T14:43:55+00:00" }, { "name": "laravel/ui", @@ -2803,16 +2808,16 @@ }, { "name": "league/csv", - "version": "9.21.0", + "version": "9.22.0", "source": { "type": "git", "url": "https://github.com/thephpleague/csv.git", - "reference": "72196d11ebba22d868954cb39c0c7346207430cc" + "reference": "afc109aa11f3086b8be8dfffa04ac31480b36b76" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/csv/zipball/72196d11ebba22d868954cb39c0c7346207430cc", - "reference": "72196d11ebba22d868954cb39c0c7346207430cc", + "url": "https://api.github.com/repos/thephpleague/csv/zipball/afc109aa11f3086b8be8dfffa04ac31480b36b76", + "reference": "afc109aa11f3086b8be8dfffa04ac31480b36b76", "shasum": "" }, "require": { @@ -2822,19 +2827,23 @@ "require-dev": { "ext-dom": "*", "ext-xdebug": "*", - "friendsofphp/php-cs-fixer": "^3.64.0", - "phpbench/phpbench": "^1.3.1", - "phpstan/phpstan": "^1.12.11", + "friendsofphp/php-cs-fixer": "^3.69.0", + "phpbench/phpbench": "^1.4.0", + "phpstan/phpstan": "^1.12.18", "phpstan/phpstan-deprecation-rules": "^1.2.1", - "phpstan/phpstan-phpunit": "^1.4.1", - "phpstan/phpstan-strict-rules": "^1.6.1", - "phpunit/phpunit": "^10.5.16 || ^11.4.3", - "symfony/var-dumper": "^6.4.8 || ^7.1.8" + "phpstan/phpstan-phpunit": "^1.4.2", + "phpstan/phpstan-strict-rules": "^1.6.2", + "phpunit/phpunit": "^10.5.16 || ^11.5.7", + "symfony/var-dumper": "^6.4.8 || ^7.2.3" }, "suggest": { "ext-dom": "Required to use the XMLConverter and the HTMLConverter classes", "ext-iconv": "Needed to ease transcoding CSV using iconv stream filters", - "ext-mbstring": "Needed to ease transcoding CSV using mb stream filters" + "ext-mbstring": "Needed to ease transcoding CSV using mb stream filters", + "ext-mysqli": "Requiered to use the package with the MySQLi extension", + "ext-pdo": "Required to use the package with the PDO extension", + "ext-pgsql": "Requiered to use the package with the PgSQL extension", + "ext-sqlite3": "Required to use the package with the SQLite3 extension" }, "type": "library", "extra": { @@ -2847,7 +2856,7 @@ "src/functions_include.php" ], "psr-4": { - "League\\Csv\\": "src/" + "League\\Csv\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -2886,7 +2895,7 @@ "type": "github" } ], - "time": "2025-01-08T19:27:58+00:00" + "time": "2025-02-28T10:00:39+00:00" }, { "name": "league/event", @@ -5654,16 +5663,16 @@ }, { "name": "ramsey/collection", - "version": "2.0.0", + "version": "2.1.0", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5" + "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", - "reference": "a4b48764bfbb8f3a6a4d1aeb1a35bb5e9ecac4a5", + "url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", + "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", "shasum": "" }, "require": { @@ -5671,25 +5680,22 @@ }, "require-dev": { "captainhook/plugin-composer": "^5.3", - "ergebnis/composer-normalize": "^2.28.3", - "fakerphp/faker": "^1.21", + "ergebnis/composer-normalize": "^2.45", + "fakerphp/faker": "^1.24", "hamcrest/hamcrest-php": "^2.0", - "jangregor/phpstan-prophecy": "^1.0", - "mockery/mockery": "^1.5", + "jangregor/phpstan-prophecy": "^2.1", + "mockery/mockery": "^1.6", "php-parallel-lint/php-console-highlighter": "^1.0", - "php-parallel-lint/php-parallel-lint": "^1.3", - "phpcsstandards/phpcsutils": "^1.0.0-rc1", - "phpspec/prophecy-phpunit": "^2.0", - "phpstan/extension-installer": "^1.2", - "phpstan/phpstan": "^1.9", - "phpstan/phpstan-mockery": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "phpunit/phpunit": "^9.5", - "psalm/plugin-mockery": "^1.1", - "psalm/plugin-phpunit": "^0.18.4", - "ramsey/coding-standard": "^2.0.3", - "ramsey/conventional-commits": "^1.3", - "vimeo/psalm": "^5.4" + "php-parallel-lint/php-parallel-lint": "^1.4", + "phpspec/prophecy-phpunit": "^2.3", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-mockery": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^10.5", + "ramsey/coding-standard": "^2.3", + "ramsey/conventional-commits": "^1.6", + "roave/security-advisories": "dev-latest" }, "type": "library", "extra": { @@ -5727,19 +5733,9 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.0.0" + "source": "https://github.com/ramsey/collection/tree/2.1.0" }, - "funding": [ - { - "url": "https://github.com/ramsey", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/ramsey/collection", - "type": "tidelift" - } - ], - "time": "2022-12-31T21:50:55+00:00" + "time": "2025-03-02T04:48:29+00:00" }, { "name": "ramsey/uuid", @@ -5835,29 +5831,29 @@ }, { "name": "rcrowe/twigbridge", - "version": "v0.14.3", + "version": "v0.14.4", "source": { "type": "git", "url": "https://github.com/rcrowe/TwigBridge.git", - "reference": "b8a5591ad79e53adab08841ec06ca11e814b51b4" + "reference": "4fddf45ae010bfc75535ad9ab141301908117f34" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/b8a5591ad79e53adab08841ec06ca11e814b51b4", - "reference": "b8a5591ad79e53adab08841ec06ca11e814b51b4", + "url": "https://api.github.com/repos/rcrowe/TwigBridge/zipball/4fddf45ae010bfc75535ad9ab141301908117f34", + "reference": "4fddf45ae010bfc75535ad9ab141301908117f34", "shasum": "" }, "require": { - "illuminate/support": "^9|^10|^11", - "illuminate/view": "^9|^10|^11", + "illuminate/support": "^9|^10|^11|^12", + "illuminate/view": "^9|^10|^11|^12", "php": "^8.1", - "twig/twig": "~3.9" + "twig/twig": "~3.12" }, "require-dev": { "ext-json": "*", - "laravel/framework": "^9|^10|^11", + "laravel/framework": "^9|^10|^11|^12", "mockery/mockery": "^1.3.1", - "phpunit/phpunit": "^8.5.8 || ^9.3.7", + "phpunit/phpunit": "^8.5.8 || ^9.3.7 || ^10.0 || ^11.0 || ^12.0", "squizlabs/php_codesniffer": "^3.6" }, "type": "library", @@ -5901,9 +5897,9 @@ ], "support": { "issues": "https://github.com/rcrowe/TwigBridge/issues", - "source": "https://github.com/rcrowe/TwigBridge/tree/v0.14.3" + "source": "https://github.com/rcrowe/TwigBridge/tree/v0.14.4" }, - "time": "2024-04-24T08:52:10+00:00" + "time": "2025-02-25T15:40:57+00:00" }, { "name": "spatie/backtrace", @@ -6479,16 +6475,16 @@ }, { "name": "symfony/cache", - "version": "v7.2.3", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "8d773a575e446de220dca03d600b2d8e1c1c10ec" + "reference": "d33cd9e14326e14a4145c21e600602eaf17cc9e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/8d773a575e446de220dca03d600b2d8e1c1c10ec", - "reference": "8d773a575e446de220dca03d600b2d8e1c1c10ec", + "url": "https://api.github.com/repos/symfony/cache/zipball/d33cd9e14326e14a4145c21e600602eaf17cc9e7", + "reference": "d33cd9e14326e14a4145c21e600602eaf17cc9e7", "shasum": "" }, "require": { @@ -6557,7 +6553,7 @@ "psr6" ], "support": { - "source": "https://github.com/symfony/cache/tree/v7.2.3" + "source": "https://github.com/symfony/cache/tree/v7.2.4" }, "funding": [ { @@ -6573,7 +6569,7 @@ "type": "tidelift" } ], - "time": "2025-01-27T11:08:17+00:00" + "time": "2025-02-26T09:57:54+00:00" }, { "name": "symfony/cache-contracts", @@ -6952,16 +6948,16 @@ }, { "name": "symfony/error-handler", - "version": "v7.2.3", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "959a74d044a6db21f4caa6d695648dcb5584cb49" + "reference": "aabf79938aa795350c07ce6464dd1985607d95d5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/959a74d044a6db21f4caa6d695648dcb5584cb49", - "reference": "959a74d044a6db21f4caa6d695648dcb5584cb49", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/aabf79938aa795350c07ce6464dd1985607d95d5", + "reference": "aabf79938aa795350c07ce6464dd1985607d95d5", "shasum": "" }, "require": { @@ -7007,7 +7003,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v7.2.3" + "source": "https://github.com/symfony/error-handler/tree/v7.2.4" }, "funding": [ { @@ -7023,7 +7019,7 @@ "type": "tidelift" } ], - "time": "2025-01-07T09:39:55+00:00" + "time": "2025-02-02T20:27:07+00:00" }, { "name": "symfony/event-dispatcher", @@ -7311,16 +7307,16 @@ }, { "name": "symfony/http-client", - "version": "v7.2.3", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d" + "reference": "78981a2ffef6437ed92d4d7e2a86a82f256c6dc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/7ce6078c79a4a7afff931c413d2959d3bffbfb8d", - "reference": "7ce6078c79a4a7afff931c413d2959d3bffbfb8d", + "url": "https://api.github.com/repos/symfony/http-client/zipball/78981a2ffef6437ed92d4d7e2a86a82f256c6dc6", + "reference": "78981a2ffef6437ed92d4d7e2a86a82f256c6dc6", "shasum": "" }, "require": { @@ -7386,7 +7382,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v7.2.3" + "source": "https://github.com/symfony/http-client/tree/v7.2.4" }, "funding": [ { @@ -7402,7 +7398,7 @@ "type": "tidelift" } ], - "time": "2025-01-28T15:51:35+00:00" + "time": "2025-02-13T10:27:23+00:00" }, { "name": "symfony/http-client-contracts", @@ -7562,16 +7558,16 @@ }, { "name": "symfony/http-kernel", - "version": "v7.2.3", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "caae9807f8e25a9b43ce8cc6fafab6cf91f0cc9b" + "reference": "9f1103734c5789798fefb90e91de4586039003ed" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/caae9807f8e25a9b43ce8cc6fafab6cf91f0cc9b", - "reference": "caae9807f8e25a9b43ce8cc6fafab6cf91f0cc9b", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/9f1103734c5789798fefb90e91de4586039003ed", + "reference": "9f1103734c5789798fefb90e91de4586039003ed", "shasum": "" }, "require": { @@ -7656,7 +7652,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.2.3" + "source": "https://github.com/symfony/http-kernel/tree/v7.2.4" }, "funding": [ { @@ -7672,7 +7668,7 @@ "type": "tidelift" } ], - "time": "2025-01-29T07:40:13+00:00" + "time": "2025-02-26T11:01:22+00:00" }, { "name": "symfony/mailer", @@ -7825,16 +7821,16 @@ }, { "name": "symfony/mime", - "version": "v7.2.3", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "2fc3b4bd67e4747e45195bc4c98bea4628476204" + "reference": "87ca22046b78c3feaff04b337f33b38510fd686b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/2fc3b4bd67e4747e45195bc4c98bea4628476204", - "reference": "2fc3b4bd67e4747e45195bc4c98bea4628476204", + "url": "https://api.github.com/repos/symfony/mime/zipball/87ca22046b78c3feaff04b337f33b38510fd686b", + "reference": "87ca22046b78c3feaff04b337f33b38510fd686b", "shasum": "" }, "require": { @@ -7889,7 +7885,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.2.3" + "source": "https://github.com/symfony/mime/tree/v7.2.4" }, "funding": [ { @@ -7905,7 +7901,7 @@ "type": "tidelift" } ], - "time": "2025-01-27T11:08:17+00:00" + "time": "2025-02-19T08:51:20+00:00" }, { "name": "symfony/options-resolver", @@ -8612,16 +8608,16 @@ }, { "name": "symfony/process", - "version": "v7.2.0", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e" + "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", - "reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", + "url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", + "reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf", "shasum": "" }, "require": { @@ -8653,7 +8649,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v7.2.0" + "source": "https://github.com/symfony/process/tree/v7.2.4" }, "funding": [ { @@ -8669,7 +8665,7 @@ "type": "tidelift" } ], - "time": "2024-11-06T14:24:19+00:00" + "time": "2025-02-05T08:33:46+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -9007,16 +9003,16 @@ }, { "name": "symfony/translation", - "version": "v7.2.2", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "e2674a30132b7cc4d74540d6c2573aa363f05923" + "reference": "283856e6981286cc0d800b53bd5703e8e363f05a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/e2674a30132b7cc4d74540d6c2573aa363f05923", - "reference": "e2674a30132b7cc4d74540d6c2573aa363f05923", + "url": "https://api.github.com/repos/symfony/translation/zipball/283856e6981286cc0d800b53bd5703e8e363f05a", + "reference": "283856e6981286cc0d800b53bd5703e8e363f05a", "shasum": "" }, "require": { @@ -9082,7 +9078,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.2.2" + "source": "https://github.com/symfony/translation/tree/v7.2.4" }, "funding": [ { @@ -9098,7 +9094,7 @@ "type": "tidelift" } ], - "time": "2024-12-07T08:18:10+00:00" + "time": "2025-02-13T10:27:23+00:00" }, { "name": "symfony/translation-contracts", @@ -9337,16 +9333,16 @@ }, { "name": "symfony/var-exporter", - "version": "v7.2.0", + "version": "v7.2.4", "source": { "type": "git", "url": "https://github.com/symfony/var-exporter.git", - "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d" + "reference": "4ede73aa7a73d81506002d2caadbbdad1ef5b69a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-exporter/zipball/1a6a89f95a46af0f142874c9d650a6358d13070d", - "reference": "1a6a89f95a46af0f142874c9d650a6358d13070d", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/4ede73aa7a73d81506002d2caadbbdad1ef5b69a", + "reference": "4ede73aa7a73d81506002d2caadbbdad1ef5b69a", "shasum": "" }, "require": { @@ -9393,7 +9389,7 @@ "serialize" ], "support": { - "source": "https://github.com/symfony/var-exporter/tree/v7.2.0" + "source": "https://github.com/symfony/var-exporter/tree/v7.2.4" }, "funding": [ { @@ -9409,7 +9405,7 @@ "type": "tidelift" } ], - "time": "2024-10-18T07:58:17+00:00" + "time": "2025-02-13T10:27:23+00:00" }, { "name": "thecodingmachine/safe", @@ -10033,16 +10029,16 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v3.15.0", + "version": "v3.15.2", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "77cca4a1162d45e1fe64e7a71b4a3031656b6c86" + "reference": "0bc1e1361e7fffc2be156f46ad1fba6927c01729" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/77cca4a1162d45e1fe64e7a71b4a3031656b6c86", - "reference": "77cca4a1162d45e1fe64e7a71b4a3031656b6c86", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/0bc1e1361e7fffc2be156f46ad1fba6927c01729", + "reference": "0bc1e1361e7fffc2be156f46ad1fba6927c01729", "shasum": "" }, "require": { @@ -10053,6 +10049,9 @@ "php-debugbar/php-debugbar": "~2.1.1", "symfony/finder": "^6|^7" }, + "conflict": { + "maximebf/debugbar": "*" + }, "require-dev": { "mockery/mockery": "^1.3.3", "orchestra/testbench-dusk": "^7|^8|^9|^10", @@ -10102,7 +10101,7 @@ ], "support": { "issues": "https://github.com/barryvdh/laravel-debugbar/issues", - "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.15.0" + "source": "https://github.com/barryvdh/laravel-debugbar/tree/v3.15.2" }, "funding": [ { @@ -10114,7 +10113,7 @@ "type": "github" } ], - "time": "2025-02-21T15:00:44+00:00" + "time": "2025-02-25T15:25:22+00:00" }, { "name": "barryvdh/laravel-ide-helper", @@ -10264,22 +10263,22 @@ }, { "name": "cloudcreativity/json-api-testing", - "version": "v6.0.1", + "version": "v6.1.0", "source": { "type": "git", "url": "https://github.com/cloudcreativity/json-api-testing.git", - "reference": "1c0b742591868456f1ae7a86f872d4b0ca1466f4" + "reference": "6c7a09b75e4ea250983d5b80f6120f15db9914cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cloudcreativity/json-api-testing/zipball/1c0b742591868456f1ae7a86f872d4b0ca1466f4", - "reference": "1c0b742591868456f1ae7a86f872d4b0ca1466f4", + "url": "https://api.github.com/repos/cloudcreativity/json-api-testing/zipball/6c7a09b75e4ea250983d5b80f6120f15db9914cb", + "reference": "6c7a09b75e4ea250983d5b80f6120f15db9914cb", "shasum": "" }, "require": { "ext-json": "*", - "illuminate/contracts": "^10.0|^11.0", - "illuminate/support": "^10.0|^11.0", + "illuminate/contracts": "^10.0|^11.0|^12.0", + "illuminate/support": "^10.0|^11.0|^12.0", "php": "^8.2", "phpunit/phpunit": "^10.5|^11.0" }, @@ -10316,9 +10315,9 @@ ], "support": { "issues": "https://github.com/cloudcreativity/json-api/issues", - "source": "https://github.com/cloudcreativity/json-api-testing/tree/v6.0.1" + "source": "https://github.com/cloudcreativity/json-api-testing/tree/v6.1.0" }, - "time": "2024-11-30T16:42:37+00:00" + "time": "2025-02-24T20:34:56+00:00" }, { "name": "composer/class-map-generator", @@ -10681,29 +10680,29 @@ }, { "name": "laravel-json-api/testing", - "version": "v3.0.2", + "version": "v3.1.0", "source": { "type": "git", "url": "https://github.com/laravel-json-api/testing.git", - "reference": "1277a79cdabb3b1e3b08d28479c7b6c4019c25cd" + "reference": "bbf3b31b977955eff93c47ff101c4a134a3ffa8f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel-json-api/testing/zipball/1277a79cdabb3b1e3b08d28479c7b6c4019c25cd", - "reference": "1277a79cdabb3b1e3b08d28479c7b6c4019c25cd", + "url": "https://api.github.com/repos/laravel-json-api/testing/zipball/bbf3b31b977955eff93c47ff101c4a134a3ffa8f", + "reference": "bbf3b31b977955eff93c47ff101c4a134a3ffa8f", "shasum": "" }, "require": { - "cloudcreativity/json-api-testing": "^6.0.1", + "cloudcreativity/json-api-testing": "^6.1", "ext-json": "*", - "illuminate/http": "^11.0", - "illuminate/support": "^11.0", - "illuminate/testing": "^11.0", + "illuminate/http": "^11.0|^12.0", + "illuminate/support": "^11.0|^12.0", + "illuminate/testing": "^11.0|^12.0", "php": "^8.2" }, "require-dev": { - "laravel/framework": "^11.0", - "phpunit/phpunit": "^10.5" + "laravel/framework": "^11.0|^12.0", + "phpunit/phpunit": "^10.5|^11.0" }, "type": "library", "extra": { @@ -10740,9 +10739,9 @@ ], "support": { "issues": "https://github.com/laravel-json-api/testing/issues", - "source": "https://github.com/laravel-json-api/testing/tree/v3.0.2" + "source": "https://github.com/laravel-json-api/testing/tree/v3.1.0" }, - "time": "2024-11-30T16:50:45+00:00" + "time": "2025-02-24T20:39:08+00:00" }, { "name": "mockery/mockery", @@ -11065,16 +11064,16 @@ }, { "name": "php-debugbar/php-debugbar", - "version": "v2.1.5", + "version": "v2.1.6", "source": { "type": "git", "url": "https://github.com/php-debugbar/php-debugbar.git", - "reference": "3f589bbbaed53039d9699702c2908148647c27a1" + "reference": "16fa68da5617220594aa5e33fa9de415f94784a0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/3f589bbbaed53039d9699702c2908148647c27a1", - "reference": "3f589bbbaed53039d9699702c2908148647c27a1", + "url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/16fa68da5617220594aa5e33fa9de415f94784a0", + "reference": "16fa68da5617220594aa5e33fa9de415f94784a0", "shasum": "" }, "require": { @@ -11129,9 +11128,9 @@ ], "support": { "issues": "https://github.com/php-debugbar/php-debugbar/issues", - "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.1.5" + "source": "https://github.com/php-debugbar/php-debugbar/tree/v2.1.6" }, - "time": "2025-02-21T13:02:05+00:00" + "time": "2025-02-21T17:47:03+00:00" }, { "name": "phpmyadmin/sql-parser", @@ -11425,23 +11424,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "11.0.8", + "version": "11.0.9", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "418c59fd080954f8c4aa5631d9502ecda2387118" + "reference": "14d63fbcca18457e49c6f8bebaa91a87e8e188d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/418c59fd080954f8c4aa5631d9502ecda2387118", - "reference": "418c59fd080954f8c4aa5631d9502ecda2387118", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/14d63fbcca18457e49c6f8bebaa91a87e8e188d7", + "reference": "14d63fbcca18457e49c6f8bebaa91a87e8e188d7", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^5.3.1", + "nikic/php-parser": "^5.4.0", "php": ">=8.2", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-text-template": "^4.0.1", @@ -11453,7 +11452,7 @@ "theseer/tokenizer": "^1.2.3" }, "require-dev": { - "phpunit/phpunit": "^11.5.0" + "phpunit/phpunit": "^11.5.2" }, "suggest": { "ext-pcov": "PHP extension that provides line coverage", @@ -11491,7 +11490,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/11.0.8" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.9" }, "funding": [ { @@ -11499,7 +11498,7 @@ "type": "github" } ], - "time": "2024-12-11T12:34:27+00:00" + "time": "2025-02-25T13:26:39+00:00" }, { "name": "phpunit/php-file-iterator", @@ -11748,16 +11747,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.9", + "version": "11.5.10", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "c91c830e7108a81e5845aeb6ba8fe3c1a4351c0b" + "reference": "d5df2b32d729562ff8db634678d71085ee579006" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/c91c830e7108a81e5845aeb6ba8fe3c1a4351c0b", - "reference": "c91c830e7108a81e5845aeb6ba8fe3c1a4351c0b", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d5df2b32d729562ff8db634678d71085ee579006", + "reference": "d5df2b32d729562ff8db634678d71085ee579006", "shasum": "" }, "require": { @@ -11829,7 +11828,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.9" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.10" }, "funding": [ { @@ -11845,7 +11844,7 @@ "type": "tidelift" } ], - "time": "2025-02-21T06:08:50+00:00" + "time": "2025-02-25T06:11:48+00:00" }, { "name": "sebastian/cli-parser", diff --git a/config/firefly.php b/config/firefly.php index ef64d73fc4..8fa240ad59 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-02-24', + 'version' => 'develop/2025-03-03', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/package-lock.json b/package-lock.json index 4eb7c8af94..335294a29c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1723,9 +1723,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", - "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.0.tgz", + "integrity": "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==", "cpu": [ "ppc64" ], @@ -1740,9 +1740,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", - "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.0.tgz", + "integrity": "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==", "cpu": [ "arm" ], @@ -1757,9 +1757,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", - "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.0.tgz", + "integrity": "sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==", "cpu": [ "arm64" ], @@ -1774,9 +1774,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", - "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.0.tgz", + "integrity": "sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==", "cpu": [ "x64" ], @@ -1791,9 +1791,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", - "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.0.tgz", + "integrity": "sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==", "cpu": [ "arm64" ], @@ -1808,9 +1808,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", - "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.0.tgz", + "integrity": "sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==", "cpu": [ "x64" ], @@ -1825,9 +1825,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", - "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.0.tgz", + "integrity": "sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==", "cpu": [ "arm64" ], @@ -1842,9 +1842,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", - "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.0.tgz", + "integrity": "sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==", "cpu": [ "x64" ], @@ -1859,9 +1859,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", - "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.0.tgz", + "integrity": "sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==", "cpu": [ "arm" ], @@ -1876,9 +1876,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", - "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz", + "integrity": "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==", "cpu": [ "arm64" ], @@ -1893,9 +1893,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", - "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.0.tgz", + "integrity": "sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==", "cpu": [ "ia32" ], @@ -1910,9 +1910,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", - "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.0.tgz", + "integrity": "sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==", "cpu": [ "loong64" ], @@ -1927,9 +1927,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", - "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.0.tgz", + "integrity": "sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==", "cpu": [ "mips64el" ], @@ -1944,9 +1944,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", - "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.0.tgz", + "integrity": "sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==", "cpu": [ "ppc64" ], @@ -1961,9 +1961,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", - "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.0.tgz", + "integrity": "sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==", "cpu": [ "riscv64" ], @@ -1978,9 +1978,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", - "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.0.tgz", + "integrity": "sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==", "cpu": [ "s390x" ], @@ -1995,9 +1995,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", - "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.0.tgz", + "integrity": "sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==", "cpu": [ "x64" ], @@ -2012,9 +2012,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", - "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.0.tgz", + "integrity": "sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==", "cpu": [ "arm64" ], @@ -2029,9 +2029,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", - "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.0.tgz", + "integrity": "sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==", "cpu": [ "x64" ], @@ -2046,9 +2046,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", - "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.0.tgz", + "integrity": "sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==", "cpu": [ "arm64" ], @@ -2063,9 +2063,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", - "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.0.tgz", + "integrity": "sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==", "cpu": [ "x64" ], @@ -2080,9 +2080,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", - "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.0.tgz", + "integrity": "sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==", "cpu": [ "x64" ], @@ -2097,9 +2097,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", - "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.0.tgz", + "integrity": "sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==", "cpu": [ "arm64" ], @@ -2114,9 +2114,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", - "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.0.tgz", + "integrity": "sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==", "cpu": [ "ia32" ], @@ -2131,9 +2131,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", - "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.0.tgz", + "integrity": "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==", "cpu": [ "x64" ], @@ -2605,9 +2605,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", - "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.9.tgz", + "integrity": "sha512-qZdlImWXur0CFakn2BJ2znJOdqYZKiedEPEVNTBrpfPjc/YuTGcaYZcdmNFTkUj3DU0ZM/AElcM8Ybww3xVLzA==", "cpu": [ "arm" ], @@ -2619,9 +2619,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", - "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.9.tgz", + "integrity": "sha512-4KW7P53h6HtJf5Y608T1ISKvNIYLWRKMvfnG0c44M6In4DQVU58HZFEVhWINDZKp7FZps98G3gxwC1sb0wXUUg==", "cpu": [ "arm64" ], @@ -2633,9 +2633,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", - "integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.9.tgz", + "integrity": "sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ==", "cpu": [ "arm64" ], @@ -2647,9 +2647,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", - "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.9.tgz", + "integrity": "sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q==", "cpu": [ "x64" ], @@ -2661,9 +2661,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", - "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.9.tgz", + "integrity": "sha512-2lzjQPJbN5UnHm7bHIUKFMulGTQwdvOkouJDpPysJS+QFBGDJqcfh+CxxtG23Ik/9tEvnebQiylYoazFMAgrYw==", "cpu": [ "arm64" ], @@ -2675,9 +2675,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", - "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.9.tgz", + "integrity": "sha512-SLl0hi2Ah2H7xQYd6Qaiu01kFPzQ+hqvdYSoOtHYg/zCIFs6t8sV95kaoqjzjFwuYQLtOI0RZre/Ke0nPaQV+g==", "cpu": [ "x64" ], @@ -2689,9 +2689,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", - "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.9.tgz", + "integrity": "sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg==", "cpu": [ "arm" ], @@ -2703,9 +2703,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", - "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.9.tgz", + "integrity": "sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA==", "cpu": [ "arm" ], @@ -2717,9 +2717,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", - "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.9.tgz", + "integrity": "sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==", "cpu": [ "arm64" ], @@ -2731,9 +2731,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", - "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.9.tgz", + "integrity": "sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==", "cpu": [ "arm64" ], @@ -2745,9 +2745,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", - "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.9.tgz", + "integrity": "sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg==", "cpu": [ "loong64" ], @@ -2759,9 +2759,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", - "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.9.tgz", + "integrity": "sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA==", "cpu": [ "ppc64" ], @@ -2773,9 +2773,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", - "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.9.tgz", + "integrity": "sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg==", "cpu": [ "riscv64" ], @@ -2787,9 +2787,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", - "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.9.tgz", + "integrity": "sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ==", "cpu": [ "s390x" ], @@ -2801,9 +2801,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", - "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.9.tgz", + "integrity": "sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==", "cpu": [ "x64" ], @@ -2815,9 +2815,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", - "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.9.tgz", + "integrity": "sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==", "cpu": [ "x64" ], @@ -2829,9 +2829,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", - "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.9.tgz", + "integrity": "sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==", "cpu": [ "arm64" ], @@ -2843,9 +2843,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", - "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.9.tgz", + "integrity": "sha512-KB48mPtaoHy1AwDNkAJfHXvHp24H0ryZog28spEs0V48l3H1fr4i37tiyHsgKZJnCmvxsbATdZGBpbmxTE3a9w==", "cpu": [ "ia32" ], @@ -2857,9 +2857,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", - "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.9.tgz", + "integrity": "sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw==", "cpu": [ "x64" ], @@ -3147,9 +3147,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.13.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.5.tgz", - "integrity": "sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==", + "version": "22.13.8", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.8.tgz", + "integrity": "sha512-G3EfaZS+iOGYWLLRCEAXdWK9my08oHNZ+FHluRiggIYJPOXzhOiDgpVCUHaUvyIC5/fj7C/p637jdzC666AOKQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3914,9 +3914,9 @@ } }, "node_modules/axios": { - "version": "1.7.9", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.9.tgz", - "integrity": "sha512-LhLcE7Hbiryz8oMDdDptSrWowmB4Bl6RCt6sIJKpRB4XtVf0iEgewX3au/pJqm+Py1kCASkb/FFKjxQaLtxJvw==", + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.1.tgz", + "integrity": "sha512-NN+fvwH/kV01dYUQ3PTOZns4LWtWhOFCAhQ/pHb88WQ1hNe5V/dvFwc4VJcDL11LT9xSX0QtsR8sWUuyOuOq7g==", "dev": true, "license": "MIT", "dependencies": { @@ -4462,9 +4462,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001700", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", - "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", + "version": "1.0.30001701", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001701.tgz", + "integrity": "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw==", "dev": true, "funding": [ { @@ -4906,13 +4906,13 @@ "license": "MIT" }, "node_modules/core-js-compat": { - "version": "3.40.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.40.0.tgz", - "integrity": "sha512-0XEDpr5y5mijvw8Lbc6E5AkjrHfp7eEoPlu36SWeAbcL8fn1G1ANe8DBlo2XoNN89oVpxWwOjYIPVzR4ZvsKCQ==", + "version": "3.41.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.41.0.tgz", + "integrity": "sha512-RFsU9LySVue9RTwdDVX/T0e2Y6jRYWXERKElIjpuEOEnxaXffI0X7RUwVzfYLfzuLXSNJDYoRYUAmRUcyln20A==", "dev": true, "license": "MIT", "dependencies": { - "browserslist": "^4.24.3" + "browserslist": "^4.24.4" }, "funding": { "type": "opencollective", @@ -5677,9 +5677,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.103", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.103.tgz", - "integrity": "sha512-P6+XzIkfndgsrjROJWfSvVEgNHtPgbhVyTkwLjUM2HU/h7pZRORgaTlHqfAikqxKmdJMLW8fftrdGWbd/Ds0FA==", + "version": "1.5.109", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.109.tgz", + "integrity": "sha512-AidaH9JETVRr9DIPGfp1kAarm/W6hRJTPuCnkF+2MqhF4KaAgRIcBc8nvjk+YMXZhwfISof/7WG29eS4iGxQLQ==", "dev": true, "license": "ISC" }, @@ -5840,9 +5840,9 @@ } }, "node_modules/esbuild": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", - "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", + "integrity": "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5853,31 +5853,31 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.24.2", - "@esbuild/android-arm": "0.24.2", - "@esbuild/android-arm64": "0.24.2", - "@esbuild/android-x64": "0.24.2", - "@esbuild/darwin-arm64": "0.24.2", - "@esbuild/darwin-x64": "0.24.2", - "@esbuild/freebsd-arm64": "0.24.2", - "@esbuild/freebsd-x64": "0.24.2", - "@esbuild/linux-arm": "0.24.2", - "@esbuild/linux-arm64": "0.24.2", - "@esbuild/linux-ia32": "0.24.2", - "@esbuild/linux-loong64": "0.24.2", - "@esbuild/linux-mips64el": "0.24.2", - "@esbuild/linux-ppc64": "0.24.2", - "@esbuild/linux-riscv64": "0.24.2", - "@esbuild/linux-s390x": "0.24.2", - "@esbuild/linux-x64": "0.24.2", - "@esbuild/netbsd-arm64": "0.24.2", - "@esbuild/netbsd-x64": "0.24.2", - "@esbuild/openbsd-arm64": "0.24.2", - "@esbuild/openbsd-x64": "0.24.2", - "@esbuild/sunos-x64": "0.24.2", - "@esbuild/win32-arm64": "0.24.2", - "@esbuild/win32-ia32": "0.24.2", - "@esbuild/win32-x64": "0.24.2" + "@esbuild/aix-ppc64": "0.25.0", + "@esbuild/android-arm": "0.25.0", + "@esbuild/android-arm64": "0.25.0", + "@esbuild/android-x64": "0.25.0", + "@esbuild/darwin-arm64": "0.25.0", + "@esbuild/darwin-x64": "0.25.0", + "@esbuild/freebsd-arm64": "0.25.0", + "@esbuild/freebsd-x64": "0.25.0", + "@esbuild/linux-arm": "0.25.0", + "@esbuild/linux-arm64": "0.25.0", + "@esbuild/linux-ia32": "0.25.0", + "@esbuild/linux-loong64": "0.25.0", + "@esbuild/linux-mips64el": "0.25.0", + "@esbuild/linux-ppc64": "0.25.0", + "@esbuild/linux-riscv64": "0.25.0", + "@esbuild/linux-s390x": "0.25.0", + "@esbuild/linux-x64": "0.25.0", + "@esbuild/netbsd-arm64": "0.25.0", + "@esbuild/netbsd-x64": "0.25.0", + "@esbuild/openbsd-arm64": "0.25.0", + "@esbuild/openbsd-x64": "0.25.0", + "@esbuild/sunos-x64": "0.25.0", + "@esbuild/win32-arm64": "0.25.0", + "@esbuild/win32-ia32": "0.25.0", + "@esbuild/win32-x64": "0.25.0" } }, "node_modules/escalade": { @@ -6162,9 +6162,9 @@ } }, "node_modules/fastq": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", - "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "dev": true, "license": "ISC", "dependencies": { @@ -9998,9 +9998,9 @@ } }, "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, "license": "MIT", "engines": { @@ -10034,9 +10034,9 @@ } }, "node_modules/rollup": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", - "integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", + "version": "4.34.9", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.9.tgz", + "integrity": "sha512-nF5XYqWWp9hx/LrpC8sZvvvmq0TeTjQgaZHYmAgwysT9nh8sWnZhBnM8ZyVbbJFIQBLwHDNoMqsBZBbUo4U8sQ==", "dev": true, "license": "MIT", "dependencies": { @@ -10050,25 +10050,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.34.8", - "@rollup/rollup-android-arm64": "4.34.8", - "@rollup/rollup-darwin-arm64": "4.34.8", - "@rollup/rollup-darwin-x64": "4.34.8", - "@rollup/rollup-freebsd-arm64": "4.34.8", - "@rollup/rollup-freebsd-x64": "4.34.8", - "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", - "@rollup/rollup-linux-arm-musleabihf": "4.34.8", - "@rollup/rollup-linux-arm64-gnu": "4.34.8", - "@rollup/rollup-linux-arm64-musl": "4.34.8", - "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", - "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", - "@rollup/rollup-linux-riscv64-gnu": "4.34.8", - "@rollup/rollup-linux-s390x-gnu": "4.34.8", - "@rollup/rollup-linux-x64-gnu": "4.34.8", - "@rollup/rollup-linux-x64-musl": "4.34.8", - "@rollup/rollup-win32-arm64-msvc": "4.34.8", - "@rollup/rollup-win32-ia32-msvc": "4.34.8", - "@rollup/rollup-win32-x64-msvc": "4.34.8", + "@rollup/rollup-android-arm-eabi": "4.34.9", + "@rollup/rollup-android-arm64": "4.34.9", + "@rollup/rollup-darwin-arm64": "4.34.9", + "@rollup/rollup-darwin-x64": "4.34.9", + "@rollup/rollup-freebsd-arm64": "4.34.9", + "@rollup/rollup-freebsd-x64": "4.34.9", + "@rollup/rollup-linux-arm-gnueabihf": "4.34.9", + "@rollup/rollup-linux-arm-musleabihf": "4.34.9", + "@rollup/rollup-linux-arm64-gnu": "4.34.9", + "@rollup/rollup-linux-arm64-musl": "4.34.9", + "@rollup/rollup-linux-loongarch64-gnu": "4.34.9", + "@rollup/rollup-linux-powerpc64le-gnu": "4.34.9", + "@rollup/rollup-linux-riscv64-gnu": "4.34.9", + "@rollup/rollup-linux-s390x-gnu": "4.34.9", + "@rollup/rollup-linux-x64-gnu": "4.34.9", + "@rollup/rollup-linux-x64-musl": "4.34.9", + "@rollup/rollup-win32-arm64-msvc": "4.34.9", + "@rollup/rollup-win32-ia32-msvc": "4.34.9", + "@rollup/rollup-win32-x64-msvc": "4.34.9", "fsevents": "~2.3.2" } }, @@ -10124,9 +10124,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.85.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.85.0.tgz", - "integrity": "sha512-3ToiC1xZ1Y8aU7+CkgCI/tqyuPXEmYGJXO7H4uqp0xkLXUqp88rQQ4j1HmP37xSJLbCJPaIiv+cT1y+grssrww==", + "version": "1.85.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.85.1.tgz", + "integrity": "sha512-Uk8WpxM5v+0cMR0XjX9KfRIacmSG86RH4DCCZjLU2rFh5tyutt9siAXJ7G+YfxQ99Q6wrRMbMlVl6KqUms71ag==", "dev": true, "license": "MIT", "dependencies": { @@ -10937,9 +10937,9 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.11", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.11.tgz", - "integrity": "sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==", + "version": "5.3.12", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.12.tgz", + "integrity": "sha512-jDLYqo7oF8tJIttjXO6jBY5Hk8p3A8W4ttih7cCEq64fQFWmgJ4VqAQjKr7WwIDlmXKEc6QeoRb5ecjZ+2afcg==", "dev": true, "license": "MIT", "dependencies": { @@ -11218,9 +11218,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", - "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "dev": true, "funding": [ { @@ -11344,14 +11344,14 @@ } }, "node_modules/vite": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.1.1.tgz", - "integrity": "sha512-4GgM54XrwRfrOp297aIYspIti66k56v16ZnqHvrIM7mG+HjDlAwS7p+Srr7J6fGvEdOJ5JcQ/D9T7HhtdXDTzA==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.0.tgz", + "integrity": "sha512-7dPxoo+WsT/64rDcwoOjk76XHj+TqNTIvHKcuMQ1k4/SeHDaQt5GFAeLYzrimZrMpn/O6DtdI03WUjdxuPM0oQ==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.24.2", - "postcss": "^8.5.2", + "esbuild": "^0.25.0", + "postcss": "^8.5.3", "rollup": "^4.30.1" }, "bin": { diff --git a/resources/assets/v1/src/locales/cs.json b/resources/assets/v1/src/locales/cs.json index 683b4a7bc2..424bd9257e 100644 --- a/resources/assets/v1/src/locales/cs.json +++ b/resources/assets/v1/src/locales/cs.json @@ -30,7 +30,7 @@ "apply_rules_checkbox": "Apply rules", "fire_webhooks_checkbox": "Fire webhooks", "no_budget_pointer": "Zd\u00e1 se, \u017ee je\u0161t\u011b nem\u00e1te \u017e\u00e1dn\u00e9 rozpo\u010dty. M\u011bli byste n\u011bkter\u00e9 vytvo\u0159it na rozpo\u010dty<\/a>-. Rozpo\u010dty v\u00e1m mohou pomoci sledovat v\u00fddaje.", - "no_bill_pointer": "You seem to have no subscription yet. You should create some on the subscription<\/a>-page. Subscriptions can help you keep track of expenses.", + "no_bill_pointer": "Zd\u00e1 se, \u017ee je\u0161t\u011b nem\u00e1te \u017e\u00e1dn\u00e9 pravideln\u00e9 platby. M\u011bli byste n\u011bkter\u00e9 vytvo\u0159it na pravideln\u00e9 platby<\/a>-. Pravideln\u00e9 platby v\u00e1m mohou pomoci sledovat v\u00fddaje.", "source_account": "Zdrojov\u00fd \u00fa\u010det", "hidden_fields_preferences": "You can enable more transaction options in your preferences<\/a>.", "destination_account": "C\u00edlov\u00fd \u00fa\u010det", @@ -173,10 +173,10 @@ "list": { "title": "N\u00e1zev", "active": "Aktivn\u00ed?", - "native_currency": "Native currency", - "trigger": "Trigger", - "response": "Response", - "delivery": "Delivery", + "native_currency": "M\u00edstn\u00ed m\u011bna", + "trigger": "Spou\u0161t\u011b\u010d", + "response": "Odpov\u011b\u010f", + "delivery": "Dod\u00e1n\u00ed", "url": "URL", "secret": "Secret" }, diff --git a/resources/assets/v1/src/locales/fr.json b/resources/assets/v1/src/locales/fr.json index f6e1e2a03d..8112631d32 100644 --- a/resources/assets/v1/src/locales/fr.json +++ b/resources/assets/v1/src/locales/fr.json @@ -45,7 +45,7 @@ "is_reconciled_fields_dropped": "Comme cette op\u00e9ration est rapproch\u00e9e, vous ne pourrez pas modifier les comptes, ni le(s) montant(s) \u00e0 moins de retirer l'indicateur de r\u00e9conciliation.", "tags": "Tags", "no_budget": "(pas de budget)", - "no_bill": "(no subscription)", + "no_bill": "(aucun abonnement)", "category": "Cat\u00e9gorie", "attachments": "Pi\u00e8ces jointes", "notes": "Notes", @@ -168,7 +168,7 @@ "webhook_delivery": "Distribution", "from_currency_to_currency": "{from} → {to}", "to_currency_from_currency": "{to} → {from}", - "rate": "Rate" + "rate": "Taux" }, "list": { "title": "Titre", diff --git a/resources/assets/v1/src/locales/it.json b/resources/assets/v1/src/locales/it.json index 29bc997a34..a19428c7e5 100644 --- a/resources/assets/v1/src/locales/it.json +++ b/resources/assets/v1/src/locales/it.json @@ -1,25 +1,25 @@ { "firefly": { - "administrations_page_title": "Financial administrations", - "administrations_index_menu": "Financial administrations", - "temp_administrations_introduction": "Firefly III will soon get the ability to manage multiple financial administrations. Right now, you only have the one. You can set the title of this administration and its native currency. This replaces the previous setting where you would set your \"default currency\". This setting is now tied to the financial administration and can be different per administration.", - "administration_currency_form_help": "It may take a long time for the page to load if you change the native currency because transaction may need to be converted to your (new) native currency.", - "administrations_page_edit_sub_title_js": "Edit financial administration \"{title}\"", + "administrations_page_title": "Amministrazioni finanziarie", + "administrations_index_menu": "Amministrazioni finanziarie", + "temp_administrations_introduction": "Firefly III avr\u00e0 presto la possibilit\u00e0 di gestire pi\u00f9 amministrazioni finanziarie. In questo momento, hai solo il titolo. Puoi impostare il titolo di questa amministrazione e la sua valuta nativa. Questo sostituisce l'impostazione precedente, in cui si impostava la \"valuta predefinita\". Questa situazione \u00e8 ora legata all'amministrazione finanziaria e pu\u00f2 essere diversa per amministrazione.", + "administration_currency_form_help": "Se modifichi la valuta nativa, il caricamento della pagina potrebbe richiedere molto tempo, poich\u00e9 potrebbe essere necessario convertire la transazione nella (nuova) valuta nativa.", + "administrations_page_edit_sub_title_js": "Modifica amministrazione finanziaria \"{title}\"", "table": "Tabella", "welcome_back": "La tua situazione finanziaria", "flash_error": "Errore!", "flash_warning": "Avviso!", "flash_success": "Successo!", "close": "Chiudi", - "select_dest_account": "Please select or type a valid destination account name", - "select_source_account": "Please select or type a valid source account name", + "select_dest_account": "Si prega di selezionare o digitare un conto di destinazione valido", + "select_source_account": "Si prega di selezionare o digitare un conto di origine valido", "split_transaction_title": "Descrizione della transazione suddivisa", "errors_submission": "Errore durante l'invio. Controlla gli errori segnalati qui sotto.", - "is_reconciled": "Is reconciled", + "is_reconciled": "\u00c8 riconciliata", "split": "Dividi", "single_split": "Divisione", - "not_enough_currencies": "Not enough currencies", - "not_enough_currencies_enabled": "If you have just one currency enabled, there is no need to add exchange rates.", + "not_enough_currencies": "Valute non sufficienti", + "not_enough_currencies_enabled": "Se hai solo una valuta abilitata, non c'\u00e8 bisogno di aggiungere tassi di cambio.", "transaction_stored_link": "La transazione #{ID} (\"{title}\")<\/a> \u00e8 stata salvata.", "webhook_stored_link": "Il webhook #{ID} (\"{title}\")<\/a> \u00e8 stato archiviato.", "webhook_updated_link": "Il webhook #{ID} (\"{title}\")<\/a> \u00e8 stato aggiornato.", @@ -42,10 +42,10 @@ "submit": "Invia", "amount": "Importo", "date": "Data", - "is_reconciled_fields_dropped": "Because this transaction is reconciled, you will not be able to update the accounts, nor the amount(s) unless you remove the reconciliation flag.", + "is_reconciled_fields_dropped": "Poich\u00e9 questa transazione \u00e8 riconciliata, non potrai aggiornare i conti, n\u00e9 l'importo o gli importi a meno che non venga rimosso il contrassegno di riconciliazione.", "tags": "Etichette", "no_budget": "(nessun budget)", - "no_bill": "(no subscription)", + "no_bill": "(nessun pagamento ricorrente)", "category": "Categoria", "attachments": "Allegati", "notes": "Note", @@ -61,7 +61,7 @@ "destination_account_reconciliation": "Non \u00e8 possibile modificare il conto di destinazione di una transazione di riconciliazione.", "source_account_reconciliation": "Non puoi modificare il conto di origine di una transazione di riconciliazione.", "budget": "Budget", - "bill": "Subscription", + "bill": "Pagamento ricorrente", "you_create_withdrawal": "Stai creando un prelievo.", "you_create_transfer": "Stai creando un trasferimento.", "you_create_deposit": "Stai creando un deposito.", @@ -139,21 +139,21 @@ "response": "Risposta", "visit_webhook_url": "Visita URL webhook", "reset_webhook_secret": "Reimposta il segreto del webhook", - "header_exchange_rates": "Exchange rates", - "exchange_rates_intro": "Firefly III supports downloading and using exchange rates. Read more about this in the documentation<\/a>.", - "exchange_rates_from_to": "Between {from} and {to} (and the other way around)", - "exchange_rates_intro_rates": "Firefly III uses the following exchange rates. The inverse is automatically calculated when it is not provided. If no exchange rate exists for the date of the transaction, Firefly III will go back in time to find one. If none are present, the rate \"1\" will be used.", - "header_exchange_rates_rates": "Exchange rates", - "header_exchange_rates_table": "Table with exchange rates", - "help_rate_form": "On this day, how many {to} will you get for one {from}?", - "add_new_rate": "Add a new exchange rate", - "save_new_rate": "Save new rate" + "header_exchange_rates": "Tassi di cambio", + "exchange_rates_intro": "Firefly III supporta il download e l'utilizzo dei tassi di cambio. Per saperne di pi\u00f9, consulta la documentazione<\/a>.", + "exchange_rates_from_to": "Tra {from} e {to} (e viceversa)", + "exchange_rates_intro_rates": "Firefly III utilizza i seguenti tassi di cambio. L'inverso viene calcolato automaticamente quando non \u00e8 fornito. Se non esiste un tasso di cambio per la data della transazione, Firefly III torner\u00e0 indietro nel tempo per trovarne uno. Se nessuno \u00e8 presente, verr\u00e0 utilizzato il tasso \"1\".", + "header_exchange_rates_rates": "Tassi di cambio", + "header_exchange_rates_table": "Tabella con i tassi di cambio", + "help_rate_form": "In questo giorno, quanti {to} otterrai per un {from}?", + "add_new_rate": "Aggiungi un nuovo tasso di cambio", + "save_new_rate": "Salva nuovo tasso" }, "form": { "url": "URL", "active": "Attivo", "interest_date": "Data di valuta", - "administration_currency": "Native currency", + "administration_currency": "Valuta nativa", "title": "Titolo", "date": "Data", "book_date": "Data contabile", @@ -168,7 +168,7 @@ "webhook_delivery": "Consegna", "from_currency_to_currency": "{from} → {to}", "to_currency_from_currency": "{to} → {from}", - "rate": "Rate" + "rate": "Tasso" }, "list": { "title": "Titolo", From b442645280f7b7372c5e579a8e0140ae4a94febe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 3 Mar 2025 03:20:25 +0000 Subject: [PATCH 12/52] Bump diglactic/laravel-breadcrumbs from 9.0.0 to 10.0.0 Bumps [diglactic/laravel-breadcrumbs](https://github.com/diglactic/laravel-breadcrumbs) from 9.0.0 to 10.0.0. - [Release notes](https://github.com/diglactic/laravel-breadcrumbs/releases) - [Upgrade guide](https://github.com/diglactic/laravel-breadcrumbs/blob/main/UPGRADE.md) - [Commits](https://github.com/diglactic/laravel-breadcrumbs/compare/v9.0.0...v10.0.0) --- updated-dependencies: - dependency-name: diglactic/laravel-breadcrumbs dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- composer.json | 2 +- composer.lock | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 471d7667e7..5b1b754111 100644 --- a/composer.json +++ b/composer.json @@ -82,7 +82,7 @@ "ext-xml": "*", "ext-xmlwriter": "*", "bacon/bacon-qr-code": "^2", - "diglactic/laravel-breadcrumbs": "^9", + "diglactic/laravel-breadcrumbs": "^10", "gdbots/query-parser": "^3.0", "guzzlehttp/guzzle": "^7.8", "jc5/google2fa-laravel": "^2.0", diff --git a/composer.lock b/composer.lock index 4522ae7422..fbc5a34ead 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": "66d08e635e085134cefb638b91c3bb7a", + "content-hash": "f5bc893e4af6924e2fbfe02989dbe719", "packages": [ { "name": "bacon/bacon-qr-code", @@ -516,31 +516,30 @@ }, { "name": "diglactic/laravel-breadcrumbs", - "version": "v9.0.0", + "version": "v10.0.0", "source": { "type": "git", "url": "https://github.com/diglactic/laravel-breadcrumbs.git", - "reference": "88e8f01e013e811215770e27b40a74014c28f2c4" + "reference": "1bfe5e29aacf88beeab64ae3e860e0f2d8ace36a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/diglactic/laravel-breadcrumbs/zipball/88e8f01e013e811215770e27b40a74014c28f2c4", - "reference": "88e8f01e013e811215770e27b40a74014c28f2c4", + "url": "https://api.github.com/repos/diglactic/laravel-breadcrumbs/zipball/1bfe5e29aacf88beeab64ae3e860e0f2d8ace36a", + "reference": "1bfe5e29aacf88beeab64ae3e860e0f2d8ace36a", "shasum": "" }, "require": { "facade/ignition-contracts": "^1.0", - "laravel/framework": "^8.0 || ^9.0 || ^10.0 || ^11.0", - "php": "^7.3 || ^8.0" + "laravel/framework": "^10.0 || ^11.0 || ^12.0", + "php": "^8.1" }, "conflict": { "davejamesmiller/laravel-breadcrumbs": "*" }, "require-dev": { - "orchestra/testbench": "^6.0 || ^7.0 || ^8.0 || ^9.0", - "php-coveralls/php-coveralls": "^2.7", - "phpunit/phpunit": "^9.5 || ^10.5", - "spatie/phpunit-snapshot-assertions": "^4.2 || ^5.1" + "orchestra/testbench": "^8.0 || ^9.0 || ^10.0", + "phpunit/phpunit": "^10.5 || ^11.5", + "spatie/phpunit-snapshot-assertions": "^5.1" }, "type": "library", "extra": { @@ -581,9 +580,9 @@ ], "support": { "issues": "https://github.com/diglactic/laravel-breadcrumbs/issues", - "source": "https://github.com/diglactic/laravel-breadcrumbs/tree/v9.0.0" + "source": "https://github.com/diglactic/laravel-breadcrumbs/tree/v10.0.0" }, - "time": "2024-03-12T00:42:39+00:00" + "time": "2025-02-25T05:44:07+00:00" }, { "name": "doctrine/inflector", @@ -12877,7 +12876,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -12898,6 +12897,6 @@ "ext-xml": "*", "ext-xmlwriter": "*" }, - "platform-dev": {}, - "plugin-api-version": "2.6.0" + "platform-dev": [], + "plugin-api-version": "2.3.0" } From 8d12d476914b16acf6b85406b1fdeed80f0eaab0 Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 5 Mar 2025 12:13:56 +0100 Subject: [PATCH 13/52] fix #9908 --- app/Http/Requests/TagFormRequest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Requests/TagFormRequest.php b/app/Http/Requests/TagFormRequest.php index 2a30cd6344..a7c5b25645 100644 --- a/app/Http/Requests/TagFormRequest.php +++ b/app/Http/Requests/TagFormRequest.php @@ -74,7 +74,7 @@ class TagFormRequest extends FormRequest 'tag' => $tagRule, 'id' => $idRule, 'description' => 'max:32768|min:1|nullable', - 'date' => 'date|nullable', + 'date' => 'date|nullable|after:1984-09-17', ]; return Location::requestRules($rules); From b4455a38023cc7be669a6e4efd971a51b826bc47 Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 5 Mar 2025 12:18:14 +0100 Subject: [PATCH 14/52] Fix #9906 --- app/Exceptions/GracefulNotFoundHandler.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php index 0bd3c9408b..d12ecfc506 100644 --- a/app/Exceptions/GracefulNotFoundHandler.php +++ b/app/Exceptions/GracefulNotFoundHandler.php @@ -127,6 +127,10 @@ class GracefulNotFoundHandler extends ExceptionHandler case 'rules.edit': $request->session()->reflash(); + return redirect(route('rules.index')); + case 'rule-groups.edit': + $request->session()->reflash(); + return redirect(route('rules.index')); case 'transactions.mass.edit': From 8b4740d28cbd10377a210855e38daa9d419daa6b Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 5 Mar 2025 12:27:08 +0100 Subject: [PATCH 15/52] fix #9902 --- app/Support/JsonApi/Enrichments/AccountEnrichment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php index 094fb7014c..ba2300900b 100644 --- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php +++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php @@ -234,7 +234,7 @@ class AccountEnrichment implements EnrichmentInterface private function collectMetaData(): void { - $set = AccountMeta::whereIn('name', ['is_multi_currency', 'include_net_worth', 'currency_id', 'account_role', 'account_number', 'liability_direction', 'interest', 'interest_period', 'current_debt']) + $set = AccountMeta::whereIn('name', ['is_multi_currency', 'include_net_worth', 'currency_id', 'account_role', 'account_number', 'BIC', 'liability_direction', 'interest', 'interest_period', 'current_debt']) ->whereIn('account_id', $this->accountIds) ->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data'])->toArray() ; From 764e49985b6118372e10a9834acf52c7745061bb Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 5 Mar 2025 14:58:10 +0100 Subject: [PATCH 16/52] add default values --- .../Controllers/Summary/BasicController.php | 92 +++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index cb0a7bbb96..4aae8904a8 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -213,6 +213,47 @@ class BasicController extends Controller 'sub_title' => '', ]; } + if(0 === count($return)) { + $currency = $this->nativeCurrency; + // create objects for big array. + $return[] = [ + 'key' => sprintf('balance-in-%s', $currency->code), + 'title' => trans('firefly.box_balance_in_currency', ['currency' => $currency->symbol]), + 'monetary_value' => '0', + 'currency_id' => (string) $currency->id, + 'currency_code' => $currency->code, + 'currency_symbol' => $currency->symbol, + 'currency_decimal_places' => $currency->decimal_places, + 'value_parsed' => app('amount')->formatAnything($currency, '0', false), + 'local_icon' => 'balance-scale', + 'sub_title' => app('amount')->formatAnything($currency, '0', false) + .' + '.app('amount')->formatAnything($currency, '0', false), + ]; + $return[] = [ + 'key' => sprintf('spent-in-%s', $currency->code), + 'title' => trans('firefly.box_spent_in_currency', ['currency' => $currency->symbol]), + 'monetary_value' => '0', + 'currency_id' => (string) $currency->id, + 'currency_code' => $currency->code, + 'currency_symbol' => $currency->symbol, + 'currency_decimal_places' => $currency->decimal_places, + 'value_parsed' => app('amount')->formatAnything($currency, '0', false), + 'local_icon' => 'balance-scale', + 'sub_title' => '', + ]; + $return[] = [ + 'key' => sprintf('earned-in-%s', $currency->code), + 'title' => trans('firefly.box_earned_in_currency', ['currency' => $currency->symbol]), + 'monetary_value' => '0', + 'currency_id' => (string) $currency->id, + 'currency_code' => $currency->code, + 'currency_symbol' => $currency->symbol, + 'currency_decimal_places' => $currency->decimal_places, + 'value_parsed' => app('amount')->formatAnything($currency, '0', false), + 'local_icon' => 'balance-scale', + 'sub_title' => '', + ]; + } return $return; } @@ -268,6 +309,37 @@ class BasicController extends Controller } app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-'))); + if(0 === count($return)) { + $currency = $this->nativeCurrency; + unset($info); + unset($amount); + $return[] = [ + 'key' => sprintf('bills-paid-in-%s', $currency->code), + 'title' => trans('firefly.box_bill_paid_in_currency', ['currency' => $currency->symbol]), + 'monetary_value' => '0', + 'currency_id' => (string) $currency->id, + 'currency_code' => $currency->code, + 'currency_symbol' => $currency->symbol, + 'currency_decimal_places' => $currency->decimal_places, + 'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false), + 'local_icon' => 'check', + 'sub_title' => '', + ]; + $return[] = [ + 'key' => sprintf('bills-unpaid-in-%s', $currency->code), + 'title' => trans('firefly.box_bill_unpaid_in_currency', ['currency' => $currency->symbol]), + 'monetary_value' => '0', + 'currency_id' => (string) $currency->id, + 'currency_code' => $currency->code, + 'currency_symbol' => $currency->symbol, + 'currency_decimal_places' => $currency->decimal_places, + 'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false), + 'local_icon' => 'calendar-o', + 'sub_title' => '', + ]; + } + + return $return; } @@ -315,6 +387,26 @@ class BasicController extends Controller ), ]; } + if(0 === count($return)) { + $currency = $this->nativeCurrency; + $return[] = [ + 'key' => sprintf('left-to-spend-in-%s', $currency->code), + 'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]), + 'monetary_value' => '0', + 'currency_id' => (string) $currency->id, + 'currency_code' => $currency->code, + 'currency_symbol' => $currency->symbol, + 'currency_decimal_places' => $currency->decimal_places, + 'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false), + 'local_icon' => 'money', + 'sub_title' => app('amount')->formatFlat( + $currency->symbol, + $currency->decimal_places, + '0', + false + ), + ]; + } return $return; } From 8c2672cdf8f616e6572e41a83225c1d60180d686 Mon Sep 17 00:00:00 2001 From: Sander Dorigo Date: Wed, 5 Mar 2025 15:02:40 +0100 Subject: [PATCH 17/52] Fix #9895 --- app/Api/V1/Controllers/Autocomplete/AccountController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index 67aa55fef0..07434bf8c9 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -85,7 +85,7 @@ class AccountController extends Controller $result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit')); // set date to subday + end-of-day for account balance. so it is at $date 23:59:59 - $date->subDay()->endOfDay(); + $date->endOfDay(); /** @var Account $account */ foreach ($result as $account) { From 422a23e7000b3d3c76bab12549c40132e853fd30 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:50:17 +0100 Subject: [PATCH 18/52] Auto commit for release 'develop' on 2025-03-05 --- .ci/php-cs-fixer/composer.lock | 12 ++--- THANKS.md | 1 + .../Controllers/Summary/BasicController.php | 12 ++--- app/Exceptions/GracefulNotFoundHandler.php | 1 + composer.lock | 30 +++++------ config/firefly.php | 2 +- package-lock.json | 52 +++++++++---------- resources/assets/v1/src/locales/cs.json | 30 +++++------ 8 files changed, 71 insertions(+), 69 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 7384ece194..bbbae259e6 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -406,16 +406,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.70.1", + "version": "v3.70.2", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "add1b3a05256392dbad63875240041b2c0349ceb" + "reference": "1ca468270efbb75ce0c7566a79cca8ea2888584d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/add1b3a05256392dbad63875240041b2c0349ceb", - "reference": "add1b3a05256392dbad63875240041b2c0349ceb", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/1ca468270efbb75ce0c7566a79cca8ea2888584d", + "reference": "1ca468270efbb75ce0c7566a79cca8ea2888584d", "shasum": "" }, "require": { @@ -497,7 +497,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.70.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.70.2" }, "funding": [ { @@ -505,7 +505,7 @@ "type": "github" } ], - "time": "2025-03-01T22:05:46+00:00" + "time": "2025-03-03T21:07:23+00:00" }, { "name": "psr/container", diff --git a/THANKS.md b/THANKS.md index 90d3cf983f..d3ca98d6b6 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 +- Lompi - Jose Diaz-Gonzalez - SoftBrix diff --git a/app/Api/V1/Controllers/Summary/BasicController.php b/app/Api/V1/Controllers/Summary/BasicController.php index 4aae8904a8..57d30617ae 100644 --- a/app/Api/V1/Controllers/Summary/BasicController.php +++ b/app/Api/V1/Controllers/Summary/BasicController.php @@ -213,7 +213,7 @@ class BasicController extends Controller 'sub_title' => '', ]; } - if(0 === count($return)) { + if (0 === count($return)) { $currency = $this->nativeCurrency; // create objects for big array. $return[] = [ @@ -309,10 +309,10 @@ class BasicController extends Controller } app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-'))); - if(0 === count($return)) { + if (0 === count($return)) { $currency = $this->nativeCurrency; - unset($info); - unset($amount); + unset($info, $amount); + $return[] = [ 'key' => sprintf('bills-paid-in-%s', $currency->code), 'title' => trans('firefly.box_bill_paid_in_currency', ['currency' => $currency->symbol]), @@ -387,9 +387,9 @@ class BasicController extends Controller ), ]; } - if(0 === count($return)) { + if (0 === count($return)) { $currency = $this->nativeCurrency; - $return[] = [ + $return[] = [ 'key' => sprintf('left-to-spend-in-%s', $currency->code), 'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]), 'monetary_value' => '0', diff --git a/app/Exceptions/GracefulNotFoundHandler.php b/app/Exceptions/GracefulNotFoundHandler.php index d12ecfc506..371add870f 100644 --- a/app/Exceptions/GracefulNotFoundHandler.php +++ b/app/Exceptions/GracefulNotFoundHandler.php @@ -128,6 +128,7 @@ class GracefulNotFoundHandler extends ExceptionHandler $request->session()->reflash(); return redirect(route('rules.index')); + case 'rule-groups.edit': $request->session()->reflash(); diff --git a/composer.lock b/composer.lock index fbc5a34ead..927debd58a 100644 --- a/composer.lock +++ b/composer.lock @@ -11270,16 +11270,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.6", + "version": "2.1.7", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "6eaec7c6c9e90dcfe46ad1e1ffa5171e2dab641c" + "reference": "12567f91a74036d56ba0af6d56c8e73ac0e8d850" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/6eaec7c6c9e90dcfe46ad1e1ffa5171e2dab641c", - "reference": "6eaec7c6c9e90dcfe46ad1e1ffa5171e2dab641c", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/12567f91a74036d56ba0af6d56c8e73ac0e8d850", + "reference": "12567f91a74036d56ba0af6d56c8e73ac0e8d850", "shasum": "" }, "require": { @@ -11324,7 +11324,7 @@ "type": "github" } ], - "time": "2025-02-19T15:46:42+00:00" + "time": "2025-03-05T13:43:55+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -11746,16 +11746,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.10", + "version": "11.5.11", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d5df2b32d729562ff8db634678d71085ee579006" + "reference": "3946ac38410be7440186c6e74584f31b15107fc7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d5df2b32d729562ff8db634678d71085ee579006", - "reference": "d5df2b32d729562ff8db634678d71085ee579006", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3946ac38410be7440186c6e74584f31b15107fc7", + "reference": "3946ac38410be7440186c6e74584f31b15107fc7", "shasum": "" }, "require": { @@ -11769,7 +11769,7 @@ "phar-io/manifest": "^2.0.4", "phar-io/version": "^3.2.1", "php": ">=8.2", - "phpunit/php-code-coverage": "^11.0.8", + "phpunit/php-code-coverage": "^11.0.9", "phpunit/php-file-iterator": "^5.1.0", "phpunit/php-invoker": "^5.0.1", "phpunit/php-text-template": "^4.0.1", @@ -11827,7 +11827,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.10" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.11" }, "funding": [ { @@ -11843,7 +11843,7 @@ "type": "tidelift" } ], - "time": "2025-02-25T06:11:48+00:00" + "time": "2025-03-05T07:36:02+00:00" }, { "name": "sebastian/cli-parser", @@ -12876,7 +12876,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -12897,6 +12897,6 @@ "ext-xml": "*", "ext-xmlwriter": "*" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/config/firefly.php b/config/firefly.php index 8fa240ad59..21b6339de2 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-03-03', + 'version' => 'develop/2025-03-05', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/package-lock.json b/package-lock.json index 335294a29c..0b11b90753 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3147,9 +3147,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.13.8", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.8.tgz", - "integrity": "sha512-G3EfaZS+iOGYWLLRCEAXdWK9my08oHNZ+FHluRiggIYJPOXzhOiDgpVCUHaUvyIC5/fj7C/p637jdzC666AOKQ==", + "version": "22.13.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz", + "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", "dev": true, "license": "MIT", "dependencies": { @@ -3245,9 +3245,9 @@ "license": "MIT" }, "node_modules/@types/ws": { - "version": "8.5.14", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz", - "integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==", "dev": true, "license": "MIT", "dependencies": { @@ -3639,9 +3639,9 @@ } }, "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, "license": "MIT", "bin": { @@ -4172,9 +4172,9 @@ "license": "MIT" }, "node_modules/bootstrap5-autocomplete": { - "version": "1.1.36", - "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.36.tgz", - "integrity": "sha512-fZpklymmrwAls3n6YDMua2msnBB4pwmJgJgqMayHLfnvvc2dhKWwp/qu0pGJI99S8TwC+ZDjYtEsfl+4/FEZhg==", + "version": "1.1.37", + "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.37.tgz", + "integrity": "sha512-6y18ztqYoAaS3zsbJDymHY+zTK1OUly2etxZH9FnkeQ79C+H3k1LfRlIJsFFBErSF7u88ZEFj77IIBedqTPEyg==", "license": "MIT" }, "node_modules/bootstrap5-tags": { @@ -4411,14 +4411,14 @@ } }, "node_modules/call-bound": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", - "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "get-intrinsic": "^1.2.6" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -4462,9 +4462,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001701", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001701.tgz", - "integrity": "sha512-faRs/AW3jA9nTwmJBSO1PQ6L/EOgsB5HMQQq4iCu5zhPgVVgO/pZRHlmatwijZKetFw8/Pr4q6dEN8sJuq8qTw==", + "version": "1.0.30001702", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001702.tgz", + "integrity": "sha512-LoPe/D7zioC0REI5W73PeR1e1MLCipRGq/VkovJnd6Df+QVqT+vT33OXCp8QUd7kA7RZrHWxb1B36OQKI/0gOA==", "dev": true, "funding": [ { @@ -5677,9 +5677,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.109", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.109.tgz", - "integrity": "sha512-AidaH9JETVRr9DIPGfp1kAarm/W6hRJTPuCnkF+2MqhF4KaAgRIcBc8nvjk+YMXZhwfISof/7WG29eS4iGxQLQ==", + "version": "1.5.112", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.112.tgz", + "integrity": "sha512-oen93kVyqSb3l+ziUgzIOlWt/oOuy4zRmpwestMn4rhFWAoFJeFuCVte9F2fASjeZZo7l/Cif9TiyrdW4CwEMA==", "dev": true, "license": "ISC" }, @@ -10702,9 +10702,9 @@ } }, "node_modules/std-env": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", - "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.1.tgz", + "integrity": "sha512-vj5lIj3Mwf9D79hBkltk5qmkFI+biIKWS2IBxEyEU3AX1tUf7AoL8nSazCOiiqQsGKIq01SClsKEzweu34uwvA==", "dev": true, "license": "MIT" }, diff --git a/resources/assets/v1/src/locales/cs.json b/resources/assets/v1/src/locales/cs.json index 424bd9257e..6f6c0926fd 100644 --- a/resources/assets/v1/src/locales/cs.json +++ b/resources/assets/v1/src/locales/cs.json @@ -20,25 +20,25 @@ "single_split": "Rozd\u011blit", "not_enough_currencies": "Not enough currencies", "not_enough_currencies_enabled": "If you have just one currency enabled, there is no need to add exchange rates.", - "transaction_stored_link": "Transaction #{ID} (\"{title}\")<\/a> has been stored.", + "transaction_stored_link": "Transakce #{ID} (\"{title}\")<\/a> byla ulo\u017eena.", "webhook_stored_link": "Webhook #{ID} (\"{title}\")<\/a> byl ulo\u017een.", "webhook_updated_link": "Webhook #{ID}<\/a> (\"{title}\") byl aktualizov\u00e1n.", "transaction_updated_link": "Transaction #{ID}<\/a> (\"{title}\") has been updated.", - "transaction_new_stored_link": "Transaction #{ID}<\/a> has been stored.", + "transaction_new_stored_link": "Transakce #{ID}<\/a> byla ulo\u017eena.", "transaction_journal_information": "Informace o transakci", "submission_options": "Submission options", - "apply_rules_checkbox": "Apply rules", - "fire_webhooks_checkbox": "Fire webhooks", - "no_budget_pointer": "Zd\u00e1 se, \u017ee je\u0161t\u011b nem\u00e1te \u017e\u00e1dn\u00e9 rozpo\u010dty. M\u011bli byste n\u011bkter\u00e9 vytvo\u0159it na rozpo\u010dty<\/a>-. Rozpo\u010dty v\u00e1m mohou pomoci sledovat v\u00fddaje.", + "apply_rules_checkbox": "Aplikovat pravidla", + "fire_webhooks_checkbox": "Spustit webhooky", + "no_budget_pointer": "Zde<\/a> si m\u016f\u017eete spravovat rozpo\u010dty, kter\u00e9 v\u00e1m mohou pomoci sledovat v\u00fddaje.", "no_bill_pointer": "Zd\u00e1 se, \u017ee je\u0161t\u011b nem\u00e1te \u017e\u00e1dn\u00e9 pravideln\u00e9 platby. M\u011bli byste n\u011bkter\u00e9 vytvo\u0159it na pravideln\u00e9 platby<\/a>-. Pravideln\u00e9 platby v\u00e1m mohou pomoci sledovat v\u00fddaje.", "source_account": "Zdrojov\u00fd \u00fa\u010det", - "hidden_fields_preferences": "You can enable more transaction options in your preferences<\/a>.", + "hidden_fields_preferences": "Dal\u0161\u00ed vlastnosti transakc\u00ed m\u016f\u017eete zaznamenat kdy\u017e je zapnete v nastaven\u00ed<\/a>.", "destination_account": "C\u00edlov\u00fd \u00fa\u010det", "add_another_split": "P\u0159idat dal\u0161\u00ed roz\u00fa\u010dtov\u00e1n\u00ed", "submission": "Submission", "stored_journal": "\u00dasp\u011b\u0161n\u011b vytvo\u0159ena nov\u00e1 transakce \u201e:description\u201c", - "create_another": "After storing, return here to create another one.", - "reset_after": "Reset form after submission", + "create_another": "Po ulo\u017een\u00ed se vr\u00e1tit sem pro vytvo\u0159en\u00ed dal\u0161\u00ed.", + "reset_after": "Po odesl\u00e1n\u00ed vymazat obsah formul\u00e1\u0159e", "submit": "Odeslat", "amount": "\u010c\u00e1stka", "date": "Datum", @@ -57,14 +57,14 @@ "none_in_select_list": "(\u017e\u00e1dn\u00e9)", "no_piggy_bank": "(\u017e\u00e1dn\u00e1 pokladni\u010dka)", "description": "Popis", - "split_transaction_title_help": "If you create a split transaction, there must be a global description for all splits of the transaction.", + "split_transaction_title_help": "Ka\u017ed\u00e1 rozd\u011blen\u00e1 transakce mus\u00ed m\u00edt spole\u010dn\u00fd popis.", "destination_account_reconciliation": "C\u00edlov\u00fd \u00fa\u010det odsouhlasen\u00e9 transakce nelze upravit.", "source_account_reconciliation": "Nem\u016f\u017eete upravovat zdrojov\u00fd \u00fa\u010det srovn\u00e1vac\u00ed transakce.", "budget": "Rozpo\u010det", "bill": "Subscription", - "you_create_withdrawal": "You're creating a withdrawal.", - "you_create_transfer": "You're creating a transfer.", - "you_create_deposit": "You're creating a deposit.", + "you_create_withdrawal": "Vytv\u00e1\u0159\u00edte v\u00fdb\u011br.", + "you_create_transfer": "Vytv\u00e1\u0159\u00edte p\u0159evod.", + "you_create_deposit": "Vytv\u00e1\u0159\u00edte vklad.", "edit": "Upravit", "delete": "Odstranit", "name": "N\u00e1zev", @@ -103,9 +103,9 @@ "profile_oauth_confidential": "Confidential", "profile_oauth_confidential_help": "Require the client to authenticate with a secret. Confidential clients can hold credentials in a secure way without exposing them to unauthorized parties. Public applications, such as native desktop or JavaScript SPA applications, are unable to hold secrets securely.", "multi_account_warning_unknown": "Depending on the type of transaction you create, the source and\/or destination account of subsequent splits may be overruled by whatever is defined in the first split of the transaction.", - "multi_account_warning_withdrawal": "Keep in mind that the source account of subsequent splits will be overruled by whatever is defined in the first split of the withdrawal.", - "multi_account_warning_deposit": "Keep in mind that the destination account of subsequent splits will be overruled by whatever is defined in the first split of the deposit.", - "multi_account_warning_transfer": "Keep in mind that the source + destination account of subsequent splits will be overruled by whatever is defined in the first split of the transfer.", + "multi_account_warning_withdrawal": "Zdrojov\u00fd \u00fa\u010del v\u0161ech n\u00e1sleduj\u00edc\u00edch rozd\u011blen\u00ed je ovl\u00e1dan\u00fd zdrojov\u00fdm \u00fa\u010dtem prvn\u00edho rozd\u011blen\u00ed transakce.", + "multi_account_warning_deposit": "C\u00edlov\u00fd \u00fa\u010del v\u0161ech n\u00e1sleduj\u00edc\u00edch rozd\u011blen\u00ed je ovl\u00e1dan\u00fd c\u00edlov\u00fdm \u00fa\u010dtem prvn\u00edho rozd\u011blen\u00ed transakce.", + "multi_account_warning_transfer": "Zdrojov\u00fd i c\u00edlov\u00fd \u00fa\u010det v\u0161ech n\u00e1sleduj\u00edc\u00edch rozd\u011blen\u00ed jsou ovl\u00e1d\u00e1ny zdrojov\u00fdm a c\u00edlov\u00fdm \u00fa\u010dtem prvn\u00edho rozd\u011blen\u00ed transakce.", "webhook_trigger_STORE_TRANSACTION": "Po vytvo\u0159en\u00ed transakce", "webhook_trigger_UPDATE_TRANSACTION": "Po aktualizaci transakce", "webhook_trigger_DESTROY_TRANSACTION": "Po odstran\u011bn\u00ed transakce", From 0031c5a5ad1a672fb413c1f1bfc518e1f03d54a4 Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 5 Mar 2025 20:12:44 +0100 Subject: [PATCH 19/52] Fix #9914 --- .../Models/PiggyBank/UpdateRequest.php | 2 +- app/Factory/PiggyBankFactory.php | 65 ++++++++++--------- app/Rules/IsValidZeroOrMoreAmount.php | 11 ++++ app/Support/Request/ConvertsDataTypes.php | 12 +++- 4 files changed, 56 insertions(+), 34 deletions(-) diff --git a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php index 61312e094c..6aa7e417b8 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php @@ -82,7 +82,7 @@ class UpdateRequest extends FormRequest 'accounts' => 'required', 'accounts.*' => 'array|required', 'accounts.*.account_id' => ['required', 'numeric', 'belongsToUser:accounts,id'], - 'accounts.*.current_amount' => ['numeric', new IsValidZeroOrMoreAmount()], + 'accounts.*.current_amount' => ['numeric','nullable', new IsValidZeroOrMoreAmount(true)], 'object_group_id' => 'numeric|belongsToUser:object_groups,id', 'object_group_title' => ['min:1', 'max:255'], 'transaction_currency_id' => 'exists:transaction_currencies,id|nullable', diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php index fbe1b450fb..d0473beddc 100644 --- a/app/Factory/PiggyBankFactory.php +++ b/app/Factory/PiggyBankFactory.php @@ -67,7 +67,7 @@ class PiggyBankFactory public function store(array $data): PiggyBank { - $piggyBankData = $data; + $piggyBankData = $data; // unset some fields unset($piggyBankData['object_group_title'], $piggyBankData['transaction_currency_code'], $piggyBankData['transaction_currency_id'], $piggyBankData['accounts'], $piggyBankData['object_group_id'], $piggyBankData['notes']); @@ -91,11 +91,11 @@ class PiggyBankFactory throw new FireflyException('400005: Could not store new piggy bank.', 0, $e); } - $piggyBank = $this->setOrder($piggyBank, $data); + $piggyBank = $this->setOrder($piggyBank, $data); $this->linkToAccountIds($piggyBank, $data['accounts']); $this->piggyBankRepository->updateNote($piggyBank, $data['notes']); - $objectGroupTitle = $data['object_group_title'] ?? ''; + $objectGroupTitle = $data['object_group_title'] ?? ''; if ('' !== $objectGroupTitle) { $objectGroup = $this->findOrCreateObjectGroup($objectGroupTitle); if (null !== $objectGroup) { @@ -103,7 +103,7 @@ class PiggyBankFactory } } // try also with ID - $objectGroupId = (int) ($data['object_group_id'] ?? 0); + $objectGroupId = (int) ($data['object_group_id'] ?? 0); if (0 !== $objectGroupId) { $objectGroup = $this->findObjectGroupById($objectGroupId); if (null !== $objectGroup) { @@ -111,7 +111,7 @@ class PiggyBankFactory } } Log::debug('Touch piggy bank'); - $piggyBank->encrypted = false; + $piggyBank->encrypted = false; $piggyBank->save(); $piggyBank->touch(); @@ -144,11 +144,10 @@ class PiggyBankFactory // first find by ID: if ($piggyBankId > 0) { $piggyBank = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.id', $piggyBankId) - ->first(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.id', $piggyBankId) + ->first(['piggy_banks.*']); if (null !== $piggyBank) { return $piggyBank; } @@ -169,17 +168,16 @@ class PiggyBankFactory public function findByName(string $name): ?PiggyBank { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.name', $name) - ->first(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.name', $name) + ->first(['piggy_banks.*']); } private function setOrder(PiggyBank $piggyBank, array $data): PiggyBank { $this->resetOrder(); - $order = $this->getMaxOrder() + 1; + $order = $this->getMaxOrder() + 1; if (array_key_exists('order', $data)) { $order = $data['order']; } @@ -194,15 +192,14 @@ class PiggyBankFactory { // TODO duplicate code $set = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->get(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->get(['piggy_banks.*']); $current = 1; foreach ($set as $piggyBank) { if ($piggyBank->order !== $current) { @@ -227,12 +224,12 @@ class PiggyBankFactory // TODO this is a tedious check. Feels like a hack. $toBeLinked = []; foreach ($piggyBank->accounts as $account) { + Log::debug(sprintf('Checking account #%d', $account->id)); foreach ($accounts as $info) { - if ($account->id === $info['account_id']) { - if (array_key_exists($account->id, $accounts)) { - $toBeLinked[$account->id] = ['current_amount' => $account->pivot->current_amount ?? '0']; - Log::debug(sprintf('Prefilled for account #%d with amount %s', $account->id, $account->pivot->current_amount ?? '0')); - } + Log::debug(sprintf(' Checking other account #%d', $info['account_id'])); + if ((int) $account->id === (int) $info['account_id']) { + $toBeLinked[$account->id] = ['current_amount' => $account->pivot->current_amount ?? '0']; + Log::debug(sprintf('Prefilled for account #%d with amount %s', $account->id, $account->pivot->current_amount ?? '0')); } } } @@ -244,9 +241,13 @@ class PiggyBankFactory if (null === $account) { continue; } - if (array_key_exists('current_amount', $info)) { + if (array_key_exists('current_amount', $info) && null !== $info['current_amount']) { $toBeLinked[$account->id] = ['current_amount' => $info['current_amount']]; - Log::debug(sprintf('Will link account #%d with amount %s', $account->id, $account->pivot->current_amount ?? '0')); + Log::debug(sprintf('[a] Will link account #%d with amount %s', $account->id, $info['current_amount'])); + } + if (array_key_exists('current_amount', $info) && null === $info['current_amount']) { + $toBeLinked[$account->id] = ['current_amount' => $toBeLinked[$account->id]['current_amount'] ?? '0']; + Log::debug(sprintf('[b] Will link account #%d with amount %s', $account->id, $toBeLinked[$account->id]['current_amount'] ?? '0')); } if (!array_key_exists('current_amount', $info)) { $toBeLinked[$account->id] ??= []; diff --git a/app/Rules/IsValidZeroOrMoreAmount.php b/app/Rules/IsValidZeroOrMoreAmount.php index da87757a6a..91f08dad04 100644 --- a/app/Rules/IsValidZeroOrMoreAmount.php +++ b/app/Rules/IsValidZeroOrMoreAmount.php @@ -31,6 +31,14 @@ use Illuminate\Support\Facades\Log; class IsValidZeroOrMoreAmount implements ValidationRule { + private bool $nullable = false; + + public function __construct(bool $nullable = false) + { + $this->nullable = $nullable; + } + + use ValidatesAmountsTrait; /** @@ -38,6 +46,9 @@ class IsValidZeroOrMoreAmount implements ValidationRule */ public function validate(string $attribute, mixed $value, \Closure $fail): void { + if (true === $this->nullable && null === $value) { + return; + } $value = (string) $value; // must not be empty: if ($this->emptyString($value)) { diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index 18e93a8343..95dcea0c8c 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -400,9 +400,19 @@ trait ConvertsDataTypes if (!is_array($entry)) { continue; } + $amount = null; + if(array_key_exists('current_amount',$entry)) { + $amount = $this->clearString((string) ($entry['current_amount'] ?? '0')); + if(null === $entry['current_amount']) { + $amount = null; + } + } + if(!array_key_exists('current_amount',$entry)) { + $amount = null; + } $return[] = [ 'account_id' => $this->integerFromValue((string) ($entry['account_id'] ?? '0')), - 'current_amount' => $this->clearString((string) ($entry['current_amount'] ?? '0')), + 'current_amount' => $amount, ]; } From 775282ae026a4250d2954967592c8e8b802e1e26 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 7 Mar 2025 05:25:43 +0100 Subject: [PATCH 20/52] Fix #9941 --- config/search.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/config/search.php b/config/search.php index 85beccd0f4..9d6a323a66 100644 --- a/config/search.php +++ b/config/search.php @@ -134,6 +134,7 @@ return [ 'has_any_category' => ['alias' => false, 'needs_context' => false], 'has_any_budget' => ['alias' => false, 'needs_context' => false], 'has_any_bill' => ['alias' => false, 'needs_context' => false], + 'has_any_subscription' => ['alias' => true, 'needs_context' => false, 'alias_for' => 'has_any_bill'], 'has_any_tag' => ['alias' => false, 'needs_context' => false], 'any_notes' => ['alias' => false, 'needs_context' => false], 'has_any_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false], @@ -144,6 +145,7 @@ return [ 'has_no_category' => ['alias' => false, 'needs_context' => false], 'has_no_budget' => ['alias' => false, 'needs_context' => false], 'has_no_bill' => ['alias' => false, 'needs_context' => false], + 'has_no_subscription' => ['alias' => true, 'needs_context' => false, 'alias_for' => 'has_no_bill'], 'has_no_tag' => ['alias' => false, 'needs_context' => false], 'no_notes' => ['alias' => false, 'needs_context' => false], 'no_external_url' => ['alias' => false, 'needs_context' => false], From 7dede49aee599f59994a4ee6f18b441189b4291d Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 05:38:51 +0100 Subject: [PATCH 21/52] Add command to validate various settings. --- .../ValidatesEnvironmentVariables.php | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php diff --git a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php new file mode 100644 index 0000000000..3034ab9b97 --- /dev/null +++ b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php @@ -0,0 +1,93 @@ +validateLanguage(); + $this->validateGuard(); + $this->validateStaticToken(); + return Command::SUCCESS; + } + + private function validateLanguage(): void + { + $language = env('DEFAULT_LANGUAGE', 'en_US'); + $locale = env('DEFAULT_LOCALE', 'equal'); + $options = array_keys(config('firefly.languages')); + if (!in_array($language, $options)) { + $this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language)); + $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); + $this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options))); + exit(1); + } + $options[] = 'equal'; + if (!in_array($locale, $options)) { + $this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale)); + $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); + $this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options))); + exit(1); + } + } + + private function validateGuard(): void { + $guard = env('AUTHENTICATION_GUARD','web'); + if('web' !== $guard && 'remote_user_guard' !== $guard) { + $this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard)); + $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); + $this->friendlyError('Valid guards are: web, remote_user_guard'); + exit(1); + } + } + + private function validateStaticToken(): void { + $token = (string) env('STATIC_CRON_TOKEN',''); + if(0 !== strlen($token) && 32 !== strlen($token)) { + $this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.'); + $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); + exit(1); + } + } +} From 0bd0e6caebb094fc4fef5fe317cea42f8dd0870f Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 05:51:50 +0100 Subject: [PATCH 22/52] Add missing method to repository. --- app/Repositories/Currency/CurrencyRepository.php | 10 ++++++++++ .../Currency/CurrencyRepositoryInterface.php | 1 + 2 files changed, 11 insertions(+) diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 66ba81d933..138b5a25b2 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -38,6 +38,16 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf { use UserGroupTrait; + public function searchCurrency(string $search, int $limit): Collection + { + $query = TransactionCurrency::where('enabled', true); + if ('' !== $search) { + $query->whereLike('name', sprintf('%%%s%%', $search)); + } + + return $query->take($limit)->get(); + } + #[\Override] public function find(int $currencyId): ?TransactionCurrency { diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 79e7ffe0c1..2af04ab9ee 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -34,6 +34,7 @@ use Illuminate\Support\Collection; interface CurrencyRepositoryInterface { public function find(int $currencyId): ?TransactionCurrency; + public function searchCurrency(string $search, int $limit): Collection; /** * Find by currency code, return NULL if unfound. From 8eb0313841c373435c5ed7336ed74d58f5c41bfa Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 15:10:24 +0100 Subject: [PATCH 23/52] Remove references to user group specific repositories and instead use the normal ones. --- .../DestroyController.php | 2 +- .../CurrencyExchangeRate/IndexController.php | 2 +- .../CurrencyExchangeRate/ShowController.php | 2 +- .../CurrencyExchangeRate/StoreController.php | 2 +- .../CurrencyExchangeRate/UpdateController.php | 2 +- .../Autocomplete/AccountController.php | 2 +- .../Autocomplete/CategoryController.php | 2 +- .../Autocomplete/TagController.php | 2 +- .../Autocomplete/TransactionController.php | 2 +- .../Controllers/Chart/AccountController.php | 2 +- .../Controllers/Chart/BalanceController.php | 2 +- .../V2/Controllers/Chart/BudgetController.php | 4 +- .../Controllers/Chart/CategoryController.php | 2 +- .../Model/Account/IndexController.php | 2 +- .../Model/Account/ShowController.php | 2 +- .../Model/Account/UpdateController.php | 2 +- .../Model/Bill/IndexController.php | 2 +- .../Controllers/Model/Bill/ShowController.php | 2 +- .../Controllers/Model/Bill/SumController.php | 2 +- .../Model/PiggyBank/IndexController.php | 2 +- .../Controllers/Summary/BasicController.php | 10 +- .../Summary/NetWorthController.php | 2 +- .../Correction/CorrectsNativeAmounts.php | 2 +- .../Events/PreferencesEventHandler.php | 4 +- app/Handlers/Observer/AccountObserver.php | 2 +- app/Helpers/Report/NetWorth.php | 24 +--- app/Providers/AccountServiceProvider.php | 17 --- app/Providers/BillServiceProvider.php | 17 --- app/Providers/BudgetServiceProvider.php | 45 ------- app/Providers/CategoryServiceProvider.php | 16 --- app/Providers/CurrencyServiceProvider.php | 9 -- app/Providers/JournalServiceProvider.php | 15 --- app/Providers/PiggyBankServiceProvider.php | 15 --- app/Providers/TagServiceProvider.php | 16 --- .../ExchangeRate/ExchangeRateRepository.php | 114 ++++++++++++++++++ .../ExchangeRateRepositoryInterface.php | 44 +++++++ app/Support/Request/ConvertsDataTypes.php | 2 +- app/Transformers/V2/AccountTransformer.php | 2 +- app/Validation/AccountValidator.php | 25 +--- 39 files changed, 202 insertions(+), 221 deletions(-) create mode 100644 app/Repositories/ExchangeRate/ExchangeRateRepository.php create mode 100644 app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/DestroyController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/DestroyController.php index c56dba5cb6..ec6aa38ee9 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/DestroyController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/DestroyController.php @@ -30,7 +30,7 @@ use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\ValidationException; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use Illuminate\Http\JsonResponse; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php index d9dcb4a06d..ef88c982b3 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; use FireflyIII\Api\V2\Controllers\Controller; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php index fca243e2c0..d06132370d 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php index f3e1467e49..e0114242fc 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreRequest; use FireflyIII\Api\V2\Controllers\Controller; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php index 53fa47be42..ffde6543f7 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\UpdateRequest; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\CurrencyExchangeRate; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Autocomplete/AccountController.php b/app/Api/V2/Controllers/Autocomplete/AccountController.php index 946828aafb..231ff1504b 100644 --- a/app/Api/V2/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V2/Controllers/Autocomplete/AccountController.php @@ -30,7 +30,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountBalance; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Log; diff --git a/app/Api/V2/Controllers/Autocomplete/CategoryController.php b/app/Api/V2/Controllers/Autocomplete/CategoryController.php index be81418f58..de0d566888 100644 --- a/app/Api/V2/Controllers/Autocomplete/CategoryController.php +++ b/app/Api/V2/Controllers/Autocomplete/CategoryController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Autocomplete; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest; use FireflyIII\Models\Category; -use FireflyIII\Repositories\UserGroups\Category\CategoryRepositoryInterface; +use FireflyIII\Repositories\Category\CategoryRepositoryInterface; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Autocomplete/TagController.php b/app/Api/V2/Controllers/Autocomplete/TagController.php index d1cc4076db..0e06240793 100644 --- a/app/Api/V2/Controllers/Autocomplete/TagController.php +++ b/app/Api/V2/Controllers/Autocomplete/TagController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Autocomplete; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest; use FireflyIII\Models\Tag; -use FireflyIII\Repositories\UserGroups\Tag\TagRepositoryInterface; +use FireflyIII\Repositories\Tag\TagRepositoryInterface; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Autocomplete/TransactionController.php b/app/Api/V2/Controllers/Autocomplete/TransactionController.php index 2eeee9996c..3ff8780201 100644 --- a/app/Api/V2/Controllers/Autocomplete/TransactionController.php +++ b/app/Api/V2/Controllers/Autocomplete/TransactionController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Autocomplete; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Autocomplete\AutocompleteRequest; use FireflyIII\Models\TransactionJournal; -use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface; +use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Chart/AccountController.php b/app/Api/V2/Controllers/Chart/AccountController.php index e27f49dfe9..49c59cc26b 100644 --- a/app/Api/V2/Controllers/Chart/AccountController.php +++ b/app/Api/V2/Controllers/Chart/AccountController.php @@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\Chart\ChartRequest; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Chart\ChartData; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Http\Api\CleansChartData; diff --git a/app/Api/V2/Controllers/Chart/BalanceController.php b/app/Api/V2/Controllers/Chart/BalanceController.php index d462695bf4..85aec5c6e3 100644 --- a/app/Api/V2/Controllers/Chart/BalanceController.php +++ b/app/Api/V2/Controllers/Chart/BalanceController.php @@ -30,7 +30,7 @@ use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Chart\ChartData; use FireflyIII\Support\Http\Api\AccountBalanceGrouped; use FireflyIII\Support\Http\Api\CleansChartData; diff --git a/app/Api/V2/Controllers/Chart/BudgetController.php b/app/Api/V2/Controllers/Chart/BudgetController.php index 3f730c587e..424ef0a02e 100644 --- a/app/Api/V2/Controllers/Chart/BudgetController.php +++ b/app/Api/V2/Controllers/Chart/BudgetController.php @@ -32,8 +32,8 @@ use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use FireflyIII\Support\Http\Api\CleansChartData; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; diff --git a/app/Api/V2/Controllers/Chart/CategoryController.php b/app/Api/V2/Controllers/Chart/CategoryController.php index 20ca5fc27f..0a0639a94c 100644 --- a/app/Api/V2/Controllers/Chart/CategoryController.php +++ b/app/Api/V2/Controllers/Chart/CategoryController.php @@ -31,7 +31,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\CleansChartData; use FireflyIII\Support\Http\Api\ExchangeRateConverter; diff --git a/app/Api/V2/Controllers/Model/Account/IndexController.php b/app/Api/V2/Controllers/Model/Account/IndexController.php index 7fa619db0e..4f09b12828 100644 --- a/app/Api/V2/Controllers/Model/Account/IndexController.php +++ b/app/Api/V2/Controllers/Model/Account/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Account; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\Account\IndexRequest; use FireflyIII\Enums\UserRoleEnum; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Transformers\V2\AccountTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/Account/ShowController.php b/app/Api/V2/Controllers/Model/Account/ShowController.php index 4e7cbc218b..9849d3b3c0 100644 --- a/app/Api/V2/Controllers/Model/Account/ShowController.php +++ b/app/Api/V2/Controllers/Model/Account/ShowController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Account; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Account; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Transformers\V2\AccountTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Model/Account/UpdateController.php b/app/Api/V2/Controllers/Model/Account/UpdateController.php index e097b2fd63..8246b74cd2 100644 --- a/app/Api/V2/Controllers/Model/Account/UpdateController.php +++ b/app/Api/V2/Controllers/Model/Account/UpdateController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Account; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\Account\UpdateRequest; use FireflyIII\Models\Account; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Transformers\V2\AccountTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Model/Bill/IndexController.php b/app/Api/V2/Controllers/Model/Bill/IndexController.php index bb97d1f03f..4a311a6e20 100644 --- a/app/Api/V2/Controllers/Model/Bill/IndexController.php +++ b/app/Api/V2/Controllers/Model/Bill/IndexController.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V2\Controllers\Model\Bill; use FireflyIII\Api\V2\Controllers\Controller; -use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface; +use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\BillTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Model/Bill/ShowController.php b/app/Api/V2/Controllers/Model/Bill/ShowController.php index 3f225b8758..4b5387e022 100644 --- a/app/Api/V2/Controllers/Model/Bill/ShowController.php +++ b/app/Api/V2/Controllers/Model/Bill/ShowController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\Bill; -use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface; +use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\BillTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Model/Bill/SumController.php b/app/Api/V2/Controllers/Model/Bill/SumController.php index 3f8b61bdba..69b0dcc7aa 100644 --- a/app/Api/V2/Controllers/Model/Bill/SumController.php +++ b/app/Api/V2/Controllers/Model/Bill/SumController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Generic\DateRequest; -use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface; +use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php b/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php index 8030c3dec5..7d6027597c 100644 --- a/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php +++ b/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php @@ -25,7 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Api\V2\Controllers\Model\PiggyBank; use FireflyIII\Api\V2\Controllers\Controller; -use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface; +use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Transformers\V2\PiggyBankTransformer; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Summary/BasicController.php b/app/Api/V2/Controllers/Summary/BasicController.php index 41c45d4e98..80e83f48d7 100644 --- a/app/Api/V2/Controllers/Summary/BasicController.php +++ b/app/Api/V2/Controllers/Summary/BasicController.php @@ -34,11 +34,11 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Report\NetWorthInterface; use FireflyIII\Models\Account; use FireflyIII\Models\UserGroup; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Bill\BillRepositoryInterface; +use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use FireflyIII\Support\Http\Api\SummaryBalanceGrouped; diff --git a/app/Api/V2/Controllers/Summary/NetWorthController.php b/app/Api/V2/Controllers/Summary/NetWorthController.php index 74cd62e28d..f2c023620a 100644 --- a/app/Api/V2/Controllers/Summary/NetWorthController.php +++ b/app/Api/V2/Controllers/Summary/NetWorthController.php @@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\Generic\SingleDateRequest; use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Helpers\Report\NetWorthInterface; use FireflyIII\Models\Account; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use Illuminate\Http\JsonResponse; diff --git a/app/Console/Commands/Correction/CorrectsNativeAmounts.php b/app/Console/Commands/Correction/CorrectsNativeAmounts.php index 2744352158..abf952000f 100644 --- a/app/Console/Commands/Correction/CorrectsNativeAmounts.php +++ b/app/Console/Commands/Correction/CorrectsNativeAmounts.php @@ -39,7 +39,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface; -use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface; +use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use Illuminate\Console\Command; diff --git a/app/Handlers/Events/PreferencesEventHandler.php b/app/Handlers/Events/PreferencesEventHandler.php index e360da0ebe..57033f8fd4 100644 --- a/app/Handlers/Events/PreferencesEventHandler.php +++ b/app/Handlers/Events/PreferencesEventHandler.php @@ -28,8 +28,8 @@ use FireflyIII\Events\Preferences\UserGroupChangedDefaultCurrency; use FireflyIII\Models\Budget; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\UserGroup; -use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface; -use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; +use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\Facades\Amount; use Illuminate\Database\Query\Builder; use Illuminate\Support\Facades\Artisan; diff --git a/app/Handlers/Observer/AccountObserver.php b/app/Handlers/Observer/AccountObserver.php index 781da99341..0c05c2b6d5 100644 --- a/app/Handlers/Observer/AccountObserver.php +++ b/app/Handlers/Observer/AccountObserver.php @@ -30,7 +30,7 @@ use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Http\Api\ExchangeRateConverter; use Illuminate\Support\Facades\DB; diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index 898c7d984f..f69b301f90 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -30,7 +30,6 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Support\CacheProperties; use FireflyIII\Support\Facades\Amount; @@ -49,8 +48,6 @@ use Illuminate\Support\Facades\Log; class NetWorth implements NetWorthInterface { private AccountRepositoryInterface $accountRepository; - private AdminAccountRepositoryInterface $adminAccountRepository; - private CurrencyRepositoryInterface $currencyRepos; private User $user; private ?UserGroup $userGroup; @@ -85,7 +82,7 @@ class NetWorth implements NetWorthInterface /** @var Account $account */ foreach ($accounts as $account) { Log::debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name)); - $currency = $this->getRepository()->getAccountCurrency($account) ?? $default; + $currency = $this->accountRepository->getAccountCurrency($account) ?? $default; $useNative = $convertToNative && $default->id !== $currency->id; $currency = $useNative ? $default : $currency; $currencyCode = $currency->code; @@ -118,15 +115,6 @@ class NetWorth implements NetWorthInterface return $netWorth; } - private function getRepository(): AccountRepositoryInterface|AdminAccountRepositoryInterface - { - if (null === $this->userGroup) { - return $this->accountRepository; - } - - return $this->adminAccountRepository; - } - public function setUser(null|Authenticatable|User $user): void { if (!$user instanceof User) { @@ -146,8 +134,8 @@ class NetWorth implements NetWorthInterface public function setUserGroup(UserGroup $userGroup): void { $this->userGroup = $userGroup; - $this->adminAccountRepository = app(AdminAccountRepositoryInterface::class); - $this->adminAccountRepository->setUserGroup($userGroup); + $this->accountRepository = app(AccountRepositoryInterface::class); + $this->accountRepository->setUserGroup($userGroup); } /** @@ -163,7 +151,7 @@ class NetWorth implements NetWorthInterface Log::debug(sprintf('SumNetWorth: finalAccountsBalance("%s")', $date->format('Y-m-d H:i:s'))); $balances = Steam::finalAccountsBalance($accounts, $date); foreach ($accounts as $account) { - $currency = $this->getRepository()->getAccountCurrency($account); + $currency = $this->accountRepository->getAccountCurrency($account); $balance = $balances[$account->id]['balance'] ?? '0'; // always subtract virtual balance. @@ -188,14 +176,14 @@ class NetWorth implements NetWorthInterface private function getAccounts(): Collection { - $accounts = $this->getRepository()->getAccountsByType( + $accounts = $this->accountRepository->getAccountsByType( [AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value] ); $filtered = new Collection(); /** @var Account $account */ foreach ($accounts as $account) { - if (1 === (int) $this->getRepository()->getMetaValue($account, 'include_net_worth')) { + if (1 === (int) $this->accountRepository->getMetaValue($account, 'include_net_worth')) { $filtered->push($account); } } diff --git a/app/Providers/AccountServiceProvider.php b/app/Providers/AccountServiceProvider.php index 3f18539064..8dcc8bdc7a 100644 --- a/app/Providers/AccountServiceProvider.php +++ b/app/Providers/AccountServiceProvider.php @@ -29,8 +29,6 @@ use FireflyIII\Repositories\Account\AccountTasker; use FireflyIII\Repositories\Account\AccountTaskerInterface; use FireflyIII\Repositories\Account\OperationsRepository; use FireflyIII\Repositories\Account\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Account\AccountRepository as AdminAccountRepository; -use FireflyIII\Repositories\UserGroups\Account\AccountRepositoryInterface as AdminAccountRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -73,21 +71,6 @@ class AccountServiceProvider extends ServiceProvider } ); - $this->app->bind( - AdminAccountRepositoryInterface::class, - static function (Application $app) { - /** @var AdminAccountRepositoryInterface $repository */ - $repository = app(AdminAccountRepository::class); - - // phpstan thinks auth does not exist. - if ($app->auth->check()) { // @phpstan-ignore-line - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - $this->app->bind( OperationsRepositoryInterface::class, static function (Application $app) { diff --git a/app/Providers/BillServiceProvider.php b/app/Providers/BillServiceProvider.php index 409b3ba4a7..1e8038099c 100644 --- a/app/Providers/BillServiceProvider.php +++ b/app/Providers/BillServiceProvider.php @@ -25,8 +25,6 @@ namespace FireflyIII\Providers; use FireflyIII\Repositories\Bill\BillRepository; use FireflyIII\Repositories\Bill\BillRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Bill\BillRepository as AdminBillRepository; -use FireflyIII\Repositories\UserGroups\Bill\BillRepositoryInterface as AdminBillRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -60,20 +58,5 @@ class BillServiceProvider extends ServiceProvider } ); - // administration variant - $this->app->bind( - AdminBillRepositoryInterface::class, - static function (Application $app) { - /** @var AdminBillRepositoryInterface $repository */ - $repository = app(AdminBillRepository::class); - - // reference to auth is not understood by phpstan. - if ($app->auth->check()) { // @phpstan-ignore-line - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); } } diff --git a/app/Providers/BudgetServiceProvider.php b/app/Providers/BudgetServiceProvider.php index 69350c0977..c07e9d0612 100644 --- a/app/Providers/BudgetServiceProvider.php +++ b/app/Providers/BudgetServiceProvider.php @@ -33,12 +33,6 @@ use FireflyIII\Repositories\Budget\NoBudgetRepository; use FireflyIII\Repositories\Budget\NoBudgetRepositoryInterface; use FireflyIII\Repositories\Budget\OperationsRepository; use FireflyIII\Repositories\Budget\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepository as AdminAbRepository; -use FireflyIII\Repositories\UserGroups\Budget\AvailableBudgetRepositoryInterface as AdminAbRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\BudgetRepository as AdminBudgetRepository; -use FireflyIII\Repositories\UserGroups\Budget\BudgetRepositoryInterface as AdminBudgetRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Budget\OperationsRepository as AdminOperationsRepository; -use FireflyIII\Repositories\UserGroups\Budget\OperationsRepositoryInterface as AdminOperationsRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -73,19 +67,6 @@ class BudgetServiceProvider extends ServiceProvider } ); - $this->app->bind( - AdminBudgetRepositoryInterface::class, - static function (Application $app) { - /** @var AdminBudgetRepositoryInterface $repository */ - $repository = app(AdminBudgetRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - // available budget repos $this->app->bind( AvailableBudgetRepositoryInterface::class, @@ -100,20 +81,6 @@ class BudgetServiceProvider extends ServiceProvider } ); - // available budget repos - $this->app->bind( - AdminAbRepositoryInterface::class, - static function (Application $app) { - /** @var AdminAbRepositoryInterface $repository */ - $repository = app(AdminAbRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - // budget limit repository. $this->app->bind( BudgetLimitRepositoryInterface::class, @@ -152,18 +119,6 @@ class BudgetServiceProvider extends ServiceProvider $repository->setUser(auth()->user()); } - return $repository; - } - ); - $this->app->bind( - AdminOperationsRepositoryInterface::class, - static function (Application $app) { - /** @var AdminOperationsRepositoryInterface $repository */ - $repository = app(AdminOperationsRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line - $repository->setUser(auth()->user()); - } - return $repository; } ); diff --git a/app/Providers/CategoryServiceProvider.php b/app/Providers/CategoryServiceProvider.php index abfcd31037..d8bc20a299 100644 --- a/app/Providers/CategoryServiceProvider.php +++ b/app/Providers/CategoryServiceProvider.php @@ -29,8 +29,6 @@ use FireflyIII\Repositories\Category\NoCategoryRepository; use FireflyIII\Repositories\Category\NoCategoryRepositoryInterface; use FireflyIII\Repositories\Category\OperationsRepository; use FireflyIII\Repositories\Category\OperationsRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Category\CategoryRepository as UserGroupCategoryRepository; -use FireflyIII\Repositories\UserGroups\Category\CategoryRepositoryInterface as UserGroupCategoryRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -63,20 +61,6 @@ class CategoryServiceProvider extends ServiceProvider } ); - // phpstan does not understand reference to 'auth'. - $this->app->bind( - UserGroupCategoryRepositoryInterface::class, - static function (Application $app) { - /** @var UserGroupCategoryRepository $repository */ - $repository = app(UserGroupCategoryRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - $this->app->bind( OperationsRepositoryInterface::class, static function (Application $app) { diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 8e562d7c58..5ba0966719 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -27,8 +27,6 @@ use FireflyIII\Repositories\Currency\CurrencyRepository; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepository as GroupCurrencyRepository; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepository; -use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -74,12 +72,5 @@ class CurrencyServiceProvider extends ServiceProvider } ); - $this->app->bind( - ExchangeRateRepositoryInterface::class, - static function (Application $app) { - /** @var ExchangeRateRepository */ - return app(ExchangeRateRepository::class); - } - ); } } diff --git a/app/Providers/JournalServiceProvider.php b/app/Providers/JournalServiceProvider.php index a70532dc81..26ab3012ca 100644 --- a/app/Providers/JournalServiceProvider.php +++ b/app/Providers/JournalServiceProvider.php @@ -33,8 +33,6 @@ use FireflyIII\Repositories\Journal\JournalRepository; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepository; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Journal\JournalRepository as GroupJournalRepository; -use FireflyIII\Repositories\UserGroups\Journal\JournalRepositoryInterface as GroupJournalRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -76,19 +74,6 @@ class JournalServiceProvider extends ServiceProvider } ); - $this->app->bind( - GroupJournalRepositoryInterface::class, - static function (Application $app) { - /** @var GroupJournalRepositoryInterface $repository */ - $repository = app(GroupJournalRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - // also bind new API repository $this->app->bind( JournalAPIRepositoryInterface::class, diff --git a/app/Providers/PiggyBankServiceProvider.php b/app/Providers/PiggyBankServiceProvider.php index ec3c9653b4..7252098c8a 100644 --- a/app/Providers/PiggyBankServiceProvider.php +++ b/app/Providers/PiggyBankServiceProvider.php @@ -25,8 +25,6 @@ namespace FireflyIII\Providers; use FireflyIII\Repositories\PiggyBank\PiggyBankRepository; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; -use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepository as AdminPiggyBankRepository; -use FireflyIII\Repositories\UserGroups\PiggyBank\PiggyBankRepositoryInterface as AdminPiggyBankRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -57,18 +55,5 @@ class PiggyBankServiceProvider extends ServiceProvider return $repository; } ); - - $this->app->bind( - AdminPiggyBankRepositoryInterface::class, - static function (Application $app) { - /** @var AdminPiggyBankRepository $repository */ - $repository = app(AdminPiggyBankRepository::class); - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); } } diff --git a/app/Providers/TagServiceProvider.php b/app/Providers/TagServiceProvider.php index c226dc5e9d..ae29a28caa 100644 --- a/app/Providers/TagServiceProvider.php +++ b/app/Providers/TagServiceProvider.php @@ -27,8 +27,6 @@ use FireflyIII\Repositories\Tag\OperationsRepository; use FireflyIII\Repositories\Tag\OperationsRepositoryInterface; use FireflyIII\Repositories\Tag\TagRepository; use FireflyIII\Repositories\Tag\TagRepositoryInterface; -use FireflyIII\Repositories\UserGroups\Tag\TagRepository as UserGroupTagRepository; -use FireflyIII\Repositories\UserGroups\Tag\TagRepositoryInterface as UserGroupTagRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -61,20 +59,6 @@ class TagServiceProvider extends ServiceProvider } ); - $this->app->bind( - UserGroupTagRepositoryInterface::class, - static function (Application $app) { - /** @var UserGroupTagRepository $repository */ - $repository = app(UserGroupTagRepository::class); - - if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth) - $repository->setUser(auth()->user()); - } - - return $repository; - } - ); - $this->app->bind( OperationsRepositoryInterface::class, static function (Application $app) { diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/ExchangeRate/ExchangeRateRepository.php new file mode 100644 index 0000000000..1c30c93d26 --- /dev/null +++ b/app/Repositories/ExchangeRate/ExchangeRateRepository.php @@ -0,0 +1,114 @@ +userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); + } + + #[\Override] + public function getAll(): Collection + { + return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); + } + + #[\Override] + public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection + { + // orderBy('date', 'DESC')->toRawSql(); + return + $this->userGroup->currencyExchangeRates() + ->where(function (Builder $q1) use ($from, $to): void { + $q1->where(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ; + })->orWhere(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $to->id) + ->where('to_currency_id', $from->id) + ; + }); + }) + ->orderBy('date', 'DESC') + ->get(['currency_exchange_rates.*']) + ; + + } + + #[\Override] + public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate + { + /** @var null|CurrencyExchangeRate */ + return + $this->userGroup->currencyExchangeRates() + ->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ->where('date', $date->format('Y-m-d')) + ->first() + ; + } + + #[\Override] + public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate + { + $object = new CurrencyExchangeRate(); + $object->user_id = auth()->user()->id; + $object->user_group_id = $this->userGroup->id; + $object->from_currency_id = $from->id; + $object->to_currency_id = $to->id; + $object->rate = $rate; + $object->date = $date; + $object->date_tz = $date->format('e'); + $object->save(); + + return $object; + } + + #[\Override] + public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate + { + $object->rate = $rate; + if (null !== $date) { + $object->date = $date; + } + $object->save(); + + return $object; + } + +} diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php b/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php new file mode 100644 index 0000000000..fdb1f1c8d0 --- /dev/null +++ b/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php @@ -0,0 +1,44 @@ +source = null; $this->destination = null; $this->accountRepository = app(AccountRepositoryInterface::class); - $this->userGroupAccountRepository = app(UserGroupAccountRepositoryInterface::class); } public function getSource(): ?Account @@ -112,13 +108,11 @@ class AccountValidator public function setUser(User $user): void { $this->accountRepository->setUser($user); - $this->useUserGroupRepository = false; } public function setUserGroup(UserGroup $userGroup): void { - $this->userGroupAccountRepository->setUserGroup($userGroup); - $this->useUserGroupRepository = true; + $this->accountRepository->setUserGroup($userGroup); } public function validateDestination(array $array): bool @@ -265,7 +259,7 @@ class AccountValidator // find by ID if (null !== $accountId && $accountId > 0) { - $first = $this->getRepository()->find($accountId); + $first = $this->accountRepository->find($accountId); $accountType = null === $first ? 'invalid' : $first->accountType->type; $check = in_array($accountType, $validTypes, true); $check = $inverse ? !$check : $check; // reverse the validation check if necessary. @@ -278,7 +272,7 @@ class AccountValidator // find by iban if (null !== $accountIban && '' !== (string) $accountIban) { - $first = $this->getRepository()->findByIbanNull($accountIban, $validTypes); + $first = $this->accountRepository->findByIbanNull($accountIban, $validTypes); $accountType = null === $first ? 'invalid' : $first->accountType->type; $check = in_array($accountType, $validTypes, true); $check = $inverse ? !$check : $check; // reverse the validation check if necessary. @@ -291,7 +285,7 @@ class AccountValidator // find by number if (null !== $accountNumber && '' !== (string) $accountNumber) { - $first = $this->getRepository()->findByAccountNumber($accountNumber, $validTypes); + $first = $this->accountRepository->findByAccountNumber($accountNumber, $validTypes); $accountType = null === $first ? 'invalid' : $first->accountType->type; $check = in_array($accountType, $validTypes, true); $check = $inverse ? !$check : $check; // reverse the validation check if necessary. @@ -304,7 +298,7 @@ class AccountValidator // find by name: if ('' !== (string) $accountName) { - $first = $this->getRepository()->findByName($accountName, $validTypes); + $first = $this->accountRepository->findByName($accountName, $validTypes); if (null !== $first) { app('log')->debug(sprintf('Name: Found %s account #%d ("%s", IBAN "%s")', $first->accountType->type, $first->id, $first->name, $first->iban ?? 'no iban')); @@ -315,13 +309,4 @@ class AccountValidator return null; } - - private function getRepository(): AccountRepositoryInterface|UserGroupAccountRepositoryInterface - { - if ($this->useUserGroupRepository) { - return $this->userGroupAccountRepository; - } - - return $this->accountRepository; - } } From a8f36a24905507b64b7fed2f2bcff6c45739b524 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 15:52:50 +0100 Subject: [PATCH 24/52] Add missing methods so phpstan stops complaining. --- .../Account/AccountRepositoryInterface.php | 11 + .../Account/AccountTaskerInterface.php | 11 + .../Account/OperationsRepositoryInterface.php | 11 + .../AttachmentRepositoryInterface.php | 11 + .../AuditLogEntry/ALERepositoryInterface.php | 11 + .../Bill/BillRepositoryInterface.php | 11 + .../AvailableBudgetRepositoryInterface.php | 11 + .../Budget/BudgetLimitRepositoryInterface.php | 11 + .../Budget/BudgetRepositoryInterface.php | 12 + .../Budget/NoBudgetRepositoryInterface.php | 12 + .../Budget/OperationsRepositoryInterface.php | 12 + .../Category/CategoryRepositoryInterface.php | 12 + .../NoCategoryRepositoryInterface.php | 12 + .../OperationsRepositoryInterface.php | 12 + .../Currency/CurrencyRepository.php | 250 ++++++++++++++++++ .../Currency/CurrencyRepositoryInterface.php | 30 +++ .../ExchangeRateRepositoryInterface.php | 15 ++ .../Journal/JournalAPIRepositoryInterface.php | 12 + .../Journal/JournalCLIRepositoryInterface.php | 11 + .../Journal/JournalRepositoryInterface.php | 14 +- .../LinkType/LinkTypeRepositoryInterface.php | 12 + .../ObjectGroupRepositoryInterface.php | 12 + .../PiggyBankRepositoryInterface.php | 12 + .../RecurringRepositoryInterface.php | 12 + .../Rule/RuleRepositoryInterface.php | 12 + .../RuleGroupRepositoryInterface.php | 12 + .../Tag/OperationsRepositoryInterface.php | 12 + .../Tag/TagRepositoryInterface.php | 12 + .../TransactionGroupRepositoryInterface.php | 12 + .../TransactionTypeRepositoryInterface.php | 12 + .../User/UserRepositoryInterface.php | 10 + .../UserGroupRepositoryInterface.php | 11 + .../Currency/CurrencyRepositoryInterface.php | 2 - .../Webhook/WebhookRepositoryInterface.php | 12 + 34 files changed, 644 insertions(+), 3 deletions(-) diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 9079921991..548f8a6cef 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -24,16 +24,27 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Account; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\Location; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface AccountRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface AccountRepositoryInterface { diff --git a/app/Repositories/Account/AccountTaskerInterface.php b/app/Repositories/Account/AccountTaskerInterface.php index cb05d48a32..46bfce56bd 100644 --- a/app/Repositories/Account/AccountTaskerInterface.php +++ b/app/Repositories/Account/AccountTaskerInterface.php @@ -24,10 +24,21 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Account; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface AccountTaskerInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface AccountTaskerInterface { diff --git a/app/Repositories/Account/OperationsRepositoryInterface.php b/app/Repositories/Account/OperationsRepositoryInterface.php index 3a0dc10db5..3d8b973a6a 100644 --- a/app/Repositories/Account/OperationsRepositoryInterface.php +++ b/app/Repositories/Account/OperationsRepositoryInterface.php @@ -25,11 +25,22 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Account; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface OperationsRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Attachment/AttachmentRepositoryInterface.php b/app/Repositories/Attachment/AttachmentRepositoryInterface.php index 831a72c456..01f43cdb3b 100644 --- a/app/Repositories/Attachment/AttachmentRepositoryInterface.php +++ b/app/Repositories/Attachment/AttachmentRepositoryInterface.php @@ -23,12 +23,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Attachment; +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; /** * Interface AttachmentRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface AttachmentRepositoryInterface { diff --git a/app/Repositories/AuditLogEntry/ALERepositoryInterface.php b/app/Repositories/AuditLogEntry/ALERepositoryInterface.php index 84b48b8ad9..ff4353d5ca 100644 --- a/app/Repositories/AuditLogEntry/ALERepositoryInterface.php +++ b/app/Repositories/AuditLogEntry/ALERepositoryInterface.php @@ -24,12 +24,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\AuditLogEntry; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\AuditLogEntry; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Collection; /** * Interface ALERepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface ALERepositoryInterface { diff --git a/app/Repositories/Bill/BillRepositoryInterface.php b/app/Repositories/Bill/BillRepositoryInterface.php index 08cc1e4e4c..f39c1bf84a 100644 --- a/app/Repositories/Bill/BillRepositoryInterface.php +++ b/app/Repositories/Bill/BillRepositoryInterface.php @@ -24,13 +24,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Bill; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Bill; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; /** * Interface BillRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface BillRepositoryInterface { diff --git a/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php b/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php index a76b1b8d73..9889f72c50 100644 --- a/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php +++ b/app/Repositories/Budget/AvailableBudgetRepositoryInterface.php @@ -25,12 +25,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\AvailableBudget; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface AvailableBudgetRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface AvailableBudgetRepositoryInterface { diff --git a/app/Repositories/Budget/BudgetLimitRepositoryInterface.php b/app/Repositories/Budget/BudgetLimitRepositoryInterface.php index 0c752c213f..c56093ef61 100644 --- a/app/Repositories/Budget/BudgetLimitRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetLimitRepositoryInterface.php @@ -25,13 +25,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Budget; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface BudgetLimitRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface BudgetLimitRepositoryInterface { diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index dcdf30581d..70b65e2245 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -24,13 +24,25 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\AutoBudget; use FireflyIII\Models\Budget; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface BudgetRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface BudgetRepositoryInterface { diff --git a/app/Repositories/Budget/NoBudgetRepositoryInterface.php b/app/Repositories/Budget/NoBudgetRepositoryInterface.php index 00ad60b41d..b9d42d769d 100644 --- a/app/Repositories/Budget/NoBudgetRepositoryInterface.php +++ b/app/Repositories/Budget/NoBudgetRepositoryInterface.php @@ -25,11 +25,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface NoBudgetRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface NoBudgetRepositoryInterface { diff --git a/app/Repositories/Budget/OperationsRepositoryInterface.php b/app/Repositories/Budget/OperationsRepositoryInterface.php index d4685070af..decf5de365 100644 --- a/app/Repositories/Budget/OperationsRepositoryInterface.php +++ b/app/Repositories/Budget/OperationsRepositoryInterface.php @@ -25,12 +25,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Budget; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Budget; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface OperationsRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index e181475879..3500bf632e 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -24,12 +24,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Category; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface CategoryRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface CategoryRepositoryInterface { diff --git a/app/Repositories/Category/NoCategoryRepositoryInterface.php b/app/Repositories/Category/NoCategoryRepositoryInterface.php index 41b5f2a3e5..5ebcc50d28 100644 --- a/app/Repositories/Category/NoCategoryRepositoryInterface.php +++ b/app/Repositories/Category/NoCategoryRepositoryInterface.php @@ -25,10 +25,22 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface NoCategoryRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface NoCategoryRepositoryInterface { diff --git a/app/Repositories/Category/OperationsRepositoryInterface.php b/app/Repositories/Category/OperationsRepositoryInterface.php index 12531923df..c7ecc886eb 100644 --- a/app/Repositories/Category/OperationsRepositoryInterface.php +++ b/app/Repositories/Category/OperationsRepositoryInterface.php @@ -25,10 +25,22 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface OperationsRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 138b5a25b2..db51f1f0dd 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -24,12 +24,25 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Currency; use Carbon\Carbon; +use FireflyIII\Events\Preferences\UserGroupChangedDefaultCurrency; +use FireflyIII\Exceptions\FireflyException; +use FireflyIII\Factory\TransactionCurrencyFactory; +use FireflyIII\Models\AccountMeta; +use FireflyIII\Models\AvailableBudget; +use FireflyIII\Models\Bill; +use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\CurrencyExchangeRate; +use FireflyIII\Models\RecurrenceTransaction; +use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Repositories\User\UserRepositoryInterface; +use FireflyIII\Services\Internal\Destroy\CurrencyDestroyService; +use FireflyIII\Services\Internal\Update\CurrencyUpdateService; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; /** * Class CurrencyRepository. @@ -38,6 +51,243 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf { use UserGroupTrait; + /** + * @throws FireflyException + */ + public function currencyInUse(TransactionCurrency $currency): bool + { + $result = $this->currencyInUseAt($currency); + + return null !== $result; + } + public function disable(TransactionCurrency $currency): void + { + $this->userGroup->currencies()->detach($currency->id); + $currency->enabled = false; + $currency->save(); + } + public function enable(TransactionCurrency $currency): void + { + $this->userGroup->currencies()->syncWithoutDetaching([$currency->id]); + $currency->enabled = false; + $currency->save(); + } + + public function update(TransactionCurrency $currency, array $data): TransactionCurrency + { + app('log')->debug('Now in update()'); + // can be true, false, null + $enabled = array_key_exists('enabled', $data) ? $data['enabled'] : null; + // can be true, false, but method only responds to "true". + $default = array_key_exists('default', $data) ? $data['default'] : false; + + // remove illegal combo's: + if (false === $enabled && true === $default) { + $enabled = true; + } + + // update currency with current user specific settings + $currency->refreshForUser($this->user); + + // currency is enabled, must be disabled. + if (false === $enabled) { + app('log')->debug(sprintf('Disabled currency %s for user #%d', $currency->code, $this->userGroup->id)); + $this->userGroup->currencies()->detach($currency->id); + } + // currency must be enabled + if (true === $enabled) { + app('log')->debug(sprintf('Enabled currency %s for user #%d', $currency->code, $this->userGroup->id)); + $this->userGroup->currencies()->detach($currency->id); + $this->userGroup->currencies()->syncWithoutDetaching([$currency->id => ['group_default' => false]]); + } + + // currency must be made default. + if (true === $default) { + $this->makeDefault($currency); + } + + /** @var CurrencyUpdateService $service */ + $service = app(CurrencyUpdateService::class); + + return $service->update($currency, $data); + } + public function destroy(TransactionCurrency $currency): bool + { + /** @var UserRepositoryInterface $repository */ + $repository = app(UserRepositoryInterface::class); + if ($repository->hasRole($this->user, 'owner')) { + /** @var CurrencyDestroyService $service */ + $service = app(CurrencyDestroyService::class); + $service->destroy($currency); + } + + return true; + } + /** + * @throws FireflyException + */ + public function store(array $data): TransactionCurrency + { + /** @var TransactionCurrencyFactory $factory */ + $factory = app(TransactionCurrencyFactory::class); + $result = $factory->create($data); + + if (true === $data['enabled']) { + $this->userGroup->currencies()->attach($result->id); + } + + return $result; + } + public function makeDefault(TransactionCurrency $currency): void + { + $current = app('amount')->getNativeCurrencyByUserGroup($this->userGroup); + app('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) { + $this->userGroup->currencies()->updateExistingPivot($item->id, ['group_default' => false]); + } + $this->userGroup->currencies()->syncWithoutDetaching([$currency->id => ['group_default' => true]]); + if ($current->id !== $currency->id) { + Log::debug('Trigger on a different default currency.'); + // clear all native amounts through an event. + event(new UserGroupChangedDefaultCurrency($this->userGroup)); + } + } + public function isFallbackCurrency(TransactionCurrency $currency): bool + { + return $currency->code === config('firefly.default_currency', 'EUR'); + } + /** + * Returns ALL currencies, regardless of whether they are enabled or not. + */ + public function getAll(): Collection + { + $all = TransactionCurrency::orderBy('code', 'ASC')->get(); + $local = $this->get(); + + return $all->map(static function (TransactionCurrency $current) use ($local) { + $hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) { + return $entry->id === $current->id; + }); + $isNative = $local->contains(static function (TransactionCurrency $entry) use ($current) { + return 1 === (int) $entry->pivot->group_default && $entry->id === $current->id; + }); + $current->userGroupEnabled = $hasId; + $current->userGroupNative = $isNative; + + return $current; + }); + } + + private function countJournals(TransactionCurrency $currency): int + { + $count = $currency->transactions()->whereNull('deleted_at')->count() + $currency->transactionJournals()->whereNull('deleted_at')->count(); + + // also count foreign: + return $count + Transaction::where('foreign_currency_id', $currency->id)->count(); + } + /** + * @throws FireflyException + */ + public function currencyInUseAt(TransactionCurrency $currency): ?string + { + app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); + $countJournals = $this->countJournals($currency); + if ($countJournals > 0) { + app('log')->info(sprintf('Count journals is %d, return true.', $countJournals)); + + return 'journals'; + } + + // is the only currency left + if (1 === $this->getAll()->count()) { + app('log')->info('Is the last currency in the system, return true. '); + + return 'last_left'; + } + + // is being used in accounts: + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string) $currency->id))->count(); + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + + // second search using integer check. + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int) $currency->id))->count(); + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + + // is being used in bills: + $bills = Bill::where('transaction_currency_id', $currency->id)->count(); + if ($bills > 0) { + app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills)); + + return 'bills'; + } + + // is being used in recurring transactions + $recurringAmount = RecurrenceTransaction::where('transaction_currency_id', $currency->id)->count(); + $recurringForeign = RecurrenceTransaction::where('foreign_currency_id', $currency->id)->count(); + + if ($recurringAmount > 0 || $recurringForeign > 0) { + app('log')->info(sprintf('Used in %d recurring transactions as (foreign) currency id, return true. ', $recurringAmount + $recurringForeign)); + + return 'recurring'; + } + + // 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() + ; + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + + // is being used in available budgets + $availableBudgets = AvailableBudget::where('transaction_currency_id', $currency->id)->count(); + if ($availableBudgets > 0) { + app('log')->info(sprintf('Used in %d available budgets as currency, return true. ', $availableBudgets)); + + return 'available_budgets'; + } + + // is being used in budget limits + $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count(); + if ($budgetLimit > 0) { + app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); + + return 'budget_limits'; + } + + // 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(); + if ($count > 0) { + app('log')->info('Is the default currency of the user, return true.'); + + return 'current_default'; + } + + // 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(); + if ($count > 0) { + app('log')->info('Is the default currency of the user group, return true.'); + + return 'current_default'; + } + + app('log')->debug('Currency is not used, return false.'); + + return null; + } + public function searchCurrency(string $search, int $limit): Collection { $query = TransactionCurrency::where('enabled', true); diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 2af04ab9ee..2c36d54ad4 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -24,17 +24,47 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Currency; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface CurrencyRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface CurrencyRepositoryInterface { public function find(int $currencyId): ?TransactionCurrency; public function searchCurrency(string $search, int $limit): Collection; + public function isFallbackCurrency(TransactionCurrency $currency): bool; + public function getAll(): Collection; + public function store(array $data): TransactionCurrency; + public function makeDefault(TransactionCurrency $currency): void; + public function destroy(TransactionCurrency $currency): bool; + public function enable(TransactionCurrency $currency): void; + public function disable(TransactionCurrency $currency): void; + public function update(TransactionCurrency $currency, array $data): TransactionCurrency; + + /** + * @throws FireflyException + */ + public function currencyInUse(TransactionCurrency $currency); + /** + * @throws FireflyException + */ + public function currencyInUseAt(TransactionCurrency $currency): ?string; /** * Find by currency code, return NULL if unfound. diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php b/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php index fdb1f1c8d0..21d3ee030f 100644 --- a/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php +++ b/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php @@ -24,10 +24,25 @@ declare(strict_types=1); namespace FireflyIII\Repositories\ExchangeRate; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; + +/** + * Interface ExchangeRateRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + */ interface ExchangeRateRepositoryInterface { public function deleteRate(CurrencyExchangeRate $rate): void; diff --git a/app/Repositories/Journal/JournalAPIRepositoryInterface.php b/app/Repositories/Journal/JournalAPIRepositoryInterface.php index 03c84a6eba..fe85b3c481 100644 --- a/app/Repositories/Journal/JournalAPIRepositoryInterface.php +++ b/app/Repositories/Journal/JournalAPIRepositoryInterface.php @@ -24,12 +24,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Journal; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface JournalAPIRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface JournalAPIRepositoryInterface { diff --git a/app/Repositories/Journal/JournalCLIRepositoryInterface.php b/app/Repositories/Journal/JournalCLIRepositoryInterface.php index 80d582c547..4a43340142 100644 --- a/app/Repositories/Journal/JournalCLIRepositoryInterface.php +++ b/app/Repositories/Journal/JournalCLIRepositoryInterface.php @@ -25,11 +25,22 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Journal; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface JournalCLIRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) */ interface JournalCLIRepositoryInterface { diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index f9187b4dbb..91023da448 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -24,15 +24,27 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Journal; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalLink; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** - * Interface JournalRepositoryInterface. + * Interface JournalRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface JournalRepositoryInterface { diff --git a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php index 7586243925..86608faef4 100644 --- a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php +++ b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php @@ -23,13 +23,25 @@ declare(strict_types=1); namespace FireflyIII\Repositories\LinkType; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\LinkType; use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionJournalLink; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface LinkTypeRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface LinkTypeRepositoryInterface { diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php index 7c83b41bce..dc6944becd 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php @@ -24,11 +24,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\ObjectGroup; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\ObjectGroup; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface ObjectGroupRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface ObjectGroupRepositoryInterface { diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php index 215e1514d7..af418b2c0b 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php @@ -24,15 +24,27 @@ declare(strict_types=1); namespace FireflyIII\Repositories\PiggyBank; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\PiggyBank; use FireflyIII\Models\PiggyBankRepetition; use FireflyIII\Models\TransactionJournal; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface PiggyBankRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface PiggyBankRepositoryInterface { diff --git a/app/Repositories/Recurring/RecurringRepositoryInterface.php b/app/Repositories/Recurring/RecurringRepositoryInterface.php index caa8debe4d..3db8ffe890 100644 --- a/app/Repositories/Recurring/RecurringRepositoryInterface.php +++ b/app/Repositories/Recurring/RecurringRepositoryInterface.php @@ -25,15 +25,27 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Recurring; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Recurrence; use FireflyIII\Models\RecurrenceRepetition; use FireflyIII\Models\RecurrenceTransaction; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; /** * Interface RecurringRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface RecurringRepositoryInterface { diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php index 24e060f64b..6748b33d89 100644 --- a/app/Repositories/Rule/RuleRepositoryInterface.php +++ b/app/Repositories/Rule/RuleRepositoryInterface.php @@ -23,14 +23,26 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Rule; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; use FireflyIII\Models\RuleTrigger; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface RuleRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface RuleRepositoryInterface { diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php index d924a588ca..b488ef25c3 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php +++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php @@ -23,11 +23,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\RuleGroup; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\RuleGroup; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface RuleGroupRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface RuleGroupRepositoryInterface { diff --git a/app/Repositories/Tag/OperationsRepositoryInterface.php b/app/Repositories/Tag/OperationsRepositoryInterface.php index 61f6f46429..04ed347f7c 100644 --- a/app/Repositories/Tag/OperationsRepositoryInterface.php +++ b/app/Repositories/Tag/OperationsRepositoryInterface.php @@ -25,10 +25,22 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface OperationsRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php index 6937f42bcb..18d7cc0681 100644 --- a/app/Repositories/Tag/TagRepositoryInterface.php +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -24,12 +24,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Location; use FireflyIII\Models\Tag; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface TagRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface TagRepositoryInterface { diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php index a2f50a9b0d..a1d903e4a2 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php @@ -24,15 +24,27 @@ declare(strict_types=1); namespace FireflyIII\Repositories\TransactionGroup; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Exceptions\DuplicateTransactionException; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Location; use FireflyIII\Models\TransactionGroup; +use FireflyIII\Models\UserGroup; use FireflyIII\Support\NullArrayObject; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface TransactionGroupRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface TransactionGroupRepositoryInterface { diff --git a/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php b/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php index c61d5f28a0..753624e8db 100644 --- a/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php +++ b/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php @@ -24,11 +24,23 @@ declare(strict_types=1); namespace FireflyIII\Repositories\TransactionType; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\TransactionType; +use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface TransactionTypeRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface TransactionTypeRepositoryInterface { diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index 48124fedc8..50c84ecb12 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -23,14 +23,24 @@ declare(strict_types=1); namespace FireflyIII\Repositories\User; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\InvitedUser; use FireflyIII\Models\Role; +use FireflyIII\Models\UserGroup; use FireflyIII\User; use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface UserRepositoryInterface. + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface UserRepositoryInterface { diff --git a/app/Repositories/UserGroup/UserGroupRepositoryInterface.php b/app/Repositories/UserGroup/UserGroupRepositoryInterface.php index 7db436290f..5b2e72685a 100644 --- a/app/Repositories/UserGroup/UserGroupRepositoryInterface.php +++ b/app/Repositories/UserGroup/UserGroupRepositoryInterface.php @@ -24,11 +24,22 @@ declare(strict_types=1); namespace FireflyIII\Repositories\UserGroup; +use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\UserGroup; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface UserGroupRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface UserGroupRepositoryInterface { diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php index c49b3b4fb8..4402332170 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php @@ -88,8 +88,6 @@ interface CurrencyRepositoryInterface public function getByIds(array $ids): Collection; - public function getUserGroup(): UserGroup; - public function isFallbackCurrency(TransactionCurrency $currency): bool; public function makeDefault(TransactionCurrency $currency): void; diff --git a/app/Repositories/Webhook/WebhookRepositoryInterface.php b/app/Repositories/Webhook/WebhookRepositoryInterface.php index 928889f3c9..c1b8073b05 100644 --- a/app/Repositories/Webhook/WebhookRepositoryInterface.php +++ b/app/Repositories/Webhook/WebhookRepositoryInterface.php @@ -24,13 +24,25 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Webhook; +use FireflyIII\Enums\UserRoleEnum; +use FireflyIII\Models\UserGroup; use FireflyIII\Models\Webhook; use FireflyIII\Models\WebhookAttempt; use FireflyIII\Models\WebhookMessage; +use FireflyIII\User; +use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Support\Collection; /** * Interface WebhookRepositoryInterface + * + * @method setUserGroup(UserGroup $group) + * @method getUserGroup() + * @method getUser() + * @method checkUserGroupAccess(UserRoleEnum $role) + * @method setUser(null|Authenticatable|User $user) + * @method setUserGroupById(int $userGroupId) + * */ interface WebhookRepositoryInterface { From cd08c16dee5074c2588ed22056abeb93573860d5 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 15:57:59 +0100 Subject: [PATCH 25/52] Replace missing methods. --- .../Autocomplete/AccountController.php | 2 +- .../Autocomplete/TagController.php | 2 +- .../Model/Account/IndexController.php | 2 +- .../Correction/CorrectsUnevenAmount.php | 3 +-- .../ValidatesEnvironmentVariables.php | 26 +++++++++++-------- .../Account/AccountRepository.php | 6 +++++ .../Account/AccountRepositoryInterface.php | 1 + app/Validation/Account/DepositValidation.php | 6 ++--- app/Validation/Account/OBValidation.php | 2 +- .../Account/WithdrawalValidation.php | 2 +- 10 files changed, 31 insertions(+), 21 deletions(-) diff --git a/app/Api/V2/Controllers/Autocomplete/AccountController.php b/app/Api/V2/Controllers/Autocomplete/AccountController.php index 231ff1504b..ab52c9bddc 100644 --- a/app/Api/V2/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V2/Controllers/Autocomplete/AccountController.php @@ -69,7 +69,7 @@ class AccountController extends Controller public function accounts(AutocompleteRequest $request): JsonResponse { $params = $request->getParameters(); - $result = $this->repository->searchAccount($params['query'], $params['account_types'], $params['page'], $params['size']); + $result = $this->repository->searchAccount($params['query'], $params['account_types'], $params['size']); $return = []; /** @var Account $account */ diff --git a/app/Api/V2/Controllers/Autocomplete/TagController.php b/app/Api/V2/Controllers/Autocomplete/TagController.php index 0e06240793..de80a16b92 100644 --- a/app/Api/V2/Controllers/Autocomplete/TagController.php +++ b/app/Api/V2/Controllers/Autocomplete/TagController.php @@ -59,7 +59,7 @@ class TagController extends Controller public function tags(AutocompleteRequest $request): JsonResponse { $queryParameters = $request->getParameters(); - $result = $this->repository->searchTag($queryParameters['query'], $queryParameters['size']); + $result = $this->repository->searchTag($queryParameters['query']); $filtered = $result->map( static function (Tag $item) { return [ diff --git a/app/Api/V2/Controllers/Model/Account/IndexController.php b/app/Api/V2/Controllers/Model/Account/IndexController.php index 4f09b12828..5ee6adfc02 100644 --- a/app/Api/V2/Controllers/Model/Account/IndexController.php +++ b/app/Api/V2/Controllers/Model/Account/IndexController.php @@ -67,7 +67,7 @@ class IndexController extends Controller $types = $request->getAccountTypes(); $sorting = $request->getSortInstructions('accounts'); $filters = $request->getFilterInstructions('accounts'); - $accounts = $this->repository->getAccountsByType($types, $sorting, $filters); + $accounts = $this->repository->getAccountsByType($types, $sorting); $pageSize = $this->parameters->get('limit'); $count = $accounts->count(); diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index fdd809887f..94855811d3 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -122,8 +122,7 @@ class CorrectsUnevenAmount extends Command $journals = DB::table('transactions') ->groupBy('transaction_journal_id') ->whereNull('deleted_at') - ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]) // @phpstan-ignore-line - ; + ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]); /** @var \stdClass $entry */ foreach ($journals as $entry) { diff --git a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php index 3034ab9b97..f86a4424e6 100644 --- a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php +++ b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php @@ -27,6 +27,7 @@ use Illuminate\Console\Command; class ValidatesEnvironmentVariables extends Command { use ShowsFriendlyMessages; + /** * The name and signature of the console command. * @@ -37,7 +38,7 @@ class ValidatesEnvironmentVariables extends Command /** * The console command description. * - * @var string + * @var string|null */ protected $description = 'Makes sure you use the correct variables.'; @@ -54,17 +55,18 @@ class ValidatesEnvironmentVariables extends Command private function validateLanguage(): void { - $language = env('DEFAULT_LANGUAGE', 'en_US'); - $locale = env('DEFAULT_LOCALE', 'equal'); + $language = config('firefly.default_language'); + $locale = config('firefly.default_locale'); $options = array_keys(config('firefly.languages')); - if (!in_array($language, $options)) { + + if (!in_array($language, $options, true)) { $this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); $this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options))); exit(1); } $options[] = 'equal'; - if (!in_array($locale, $options)) { + if (!in_array($locale, $options, true)) { $this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); $this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options))); @@ -72,9 +74,10 @@ class ValidatesEnvironmentVariables extends Command } } - private function validateGuard(): void { - $guard = env('AUTHENTICATION_GUARD','web'); - if('web' !== $guard && 'remote_user_guard' !== $guard) { + private function validateGuard(): void + { + $guard = env('AUTHENTICATION_GUARD', 'web'); + if ('web' !== $guard && 'remote_user_guard' !== $guard) { $this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); $this->friendlyError('Valid guards are: web, remote_user_guard'); @@ -82,9 +85,10 @@ class ValidatesEnvironmentVariables extends Command } } - private function validateStaticToken(): void { - $token = (string) env('STATIC_CRON_TOKEN',''); - if(0 !== strlen($token) && 32 !== strlen($token)) { + private function validateStaticToken(): void + { + $token = (string) env('STATIC_CRON_TOKEN', ''); + if (0 !== strlen($token) && 32 !== strlen($token)) { $this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.'); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); exit(1); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 0309b66f95..eda47f0eec 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -65,6 +65,12 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return true; } + #[\Override] + public function getAccountBalances(Account $account): Collection + { + return $account->accountBalances; + } + /** * Find account with same name OR same IBAN or both, but not the same type or ID. */ diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 548f8a6cef..463f0853c0 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -52,6 +52,7 @@ interface AccountRepositoryInterface * Moved here from account CRUD. */ public function count(array $types): int; + public function getAccountBalances(Account $account): Collection; /** * Moved here from account CRUD. diff --git a/app/Validation/Account/DepositValidation.php b/app/Validation/Account/DepositValidation.php index 9f7b67f39a..87e2e69f43 100644 --- a/app/Validation/Account/DepositValidation.php +++ b/app/Validation/Account/DepositValidation.php @@ -126,7 +126,7 @@ trait DepositValidation // if the user submits an ID, but that ID is not of the correct type, // return false. if (null !== $accountId) { - $search = $this->getRepository()->find($accountId); + $search = $this->accountRepository->find($accountId); if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) { app('log')->debug(sprintf('User submitted an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type)); app('log')->debug(sprintf('Firefly III accepts ID #%d as valid account data.', $accountId)); @@ -140,7 +140,7 @@ trait DepositValidation // if user submits an IBAN: if (null !== $accountIban) { - $search = $this->getRepository()->findByIbanNull($accountIban, $validTypes); + $search = $this->accountRepository->findByIbanNull($accountIban, $validTypes); if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) { app('log')->debug(sprintf('User submitted IBAN ("%s"), which is a "%s", so this is not a valid source.', $accountIban, $search->accountType->type)); $result = false; @@ -154,7 +154,7 @@ trait DepositValidation // if user submits a number: if (null !== $accountNumber && '' !== $accountNumber) { - $search = $this->getRepository()->findByAccountNumber($accountNumber, $validTypes); + $search = $this->accountRepository->findByAccountNumber($accountNumber, $validTypes); if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) { app('log')->debug( sprintf('User submitted number ("%s"), which is a "%s", so this is not a valid source.', $accountNumber, $search->accountType->type) diff --git a/app/Validation/Account/OBValidation.php b/app/Validation/Account/OBValidation.php index dcc174c4c7..a3f32afeb0 100644 --- a/app/Validation/Account/OBValidation.php +++ b/app/Validation/Account/OBValidation.php @@ -101,7 +101,7 @@ trait OBValidation // return false. if (null !== $accountId && null === $accountName) { app('log')->debug('Source ID is not null, but name is null.'); - $search = $this->getRepository()->find($accountId); + $search = $this->accountRepository->find($accountId); // the source resulted in an account, but it's not of a valid type. if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) { diff --git a/app/Validation/Account/WithdrawalValidation.php b/app/Validation/Account/WithdrawalValidation.php index 649f795f86..9456e4ecf9 100644 --- a/app/Validation/Account/WithdrawalValidation.php +++ b/app/Validation/Account/WithdrawalValidation.php @@ -87,7 +87,7 @@ trait WithdrawalValidation // if there's an ID it must be of the "validTypes". if (null !== $accountId && 0 !== $accountId) { - $found = $this->getRepository()->find($accountId); + $found = $this->accountRepository->find($accountId); if (null !== $found) { $type = $found->accountType->type; if (in_array($type, $validTypes, true)) { From a4f887921a447fb89bb786e164d38f5085986d44 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 19:34:18 +0100 Subject: [PATCH 26/52] Fix #9948 --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 1d9afab05e..e53ccacbe9 100644 --- a/.env.example +++ b/.env.example @@ -326,7 +326,7 @@ USE_RUNNING_BALANCE=false FIREFLY_III_LAYOUT=v1 # -# Which Query Parser implementation to use for the search rngine and rules +# Which Query Parser implementation to use for the search engine and rules # 'new' is experimental, 'legacy' is the classic one # QUERY_PARSER_IMPLEMENTATION=legacy From 30b7e17b6f7c13ff18633cc3aa8873ee9d0cc113 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 8 Mar 2025 19:55:21 +0100 Subject: [PATCH 27/52] Various code cleanup and sorting. --- .../Models/Account/ShowController.php | 2 - .../Models/Account/StoreController.php | 1 - .../Models/Account/UpdateController.php | 1 - .../Models/PiggyBank/ListController.php | 1 - .../TransactionCurrency/ListController.php | 1 - .../Controllers/Search/AccountController.php | 1 - .../ValidatesEnvironmentVariables.php | 4 +- app/Handlers/Observer/AccountObserver.php | 3 +- app/Helpers/Report/NetWorth.php | 56 +- .../Controllers/PiggyBank/IndexController.php | 2 +- .../Account/AccountRepository.php | 137 ++--- .../Account/AccountRepositoryInterface.php | 3 +- app/Repositories/Account/AccountTasker.php | 58 +- .../Account/OperationsRepository.php | 68 ++- .../Attachment/AttachmentRepository.php | 12 +- .../AuditLogEntry/ALERepository.php | 2 +- app/Repositories/Bill/BillRepository.php | 143 +++-- .../Budget/AvailableBudgetRepository.php | 58 +- .../Budget/BudgetLimitRepository.php | 252 ++++---- app/Repositories/Budget/BudgetRepository.php | 132 ++-- .../Budget/NoBudgetRepository.php | 12 +- .../Budget/OperationsRepository.php | 44 +- .../Category/CategoryRepository.php | 29 +- .../Category/NoCategoryRepository.php | 50 +- .../Category/OperationsRepository.php | 85 ++- .../Currency/CurrencyRepository.php | 562 ++++++++++-------- .../Currency/CurrencyRepositoryInterface.php | 59 +- .../ExchangeRate/ExchangeRateRepository.php | 25 +- .../Journal/JournalAPIRepository.php | 9 +- .../Journal/JournalCLIRepository.php | 26 +- .../Journal/JournalRepository.php | 11 +- .../LinkType/LinkTypeRepository.php | 31 +- .../ObjectGroup/ObjectGroupRepository.php | 17 +- .../PiggyBank/ModifiesPiggyBanks.php | 53 +- .../PiggyBank/PiggyBankRepository.php | 108 ++-- .../Recurring/RecurringRepository.php | 90 ++- app/Repositories/Rule/RuleRepository.php | 86 ++- .../RuleGroup/RuleGroupRepository.php | 141 ++--- app/Repositories/Tag/OperationsRepository.php | 30 +- app/Repositories/Tag/TagRepository.php | 27 +- .../TransactionGroupRepository.php | 89 ++- .../TransactionTypeRepository.php | 2 +- app/Repositories/User/UserRepository.php | 41 +- .../User/UserRepositoryInterface.php | 4 +- .../UserGroup/UserGroupRepository.php | 37 +- .../UserGroups/Account/AccountRepository.php | 73 ++- .../Account/AccountRepositoryInterface.php | 1 - .../UserGroups/Bill/BillRepository.php | 20 +- .../Budget/AvailableBudgetRepository.php | 7 +- .../UserGroups/Budget/BudgetRepository.php | 14 +- .../Budget/OperationsRepository.php | 17 +- .../Currency/CurrencyRepository.php | 21 +- .../Currency/CurrencyRepositoryInterface.php | 1 - .../ExchangeRate/ExchangeRateRepository.php | 47 +- .../UserGroups/Journal/JournalRepository.php | 3 +- .../PiggyBank/PiggyBankRepository.php | 17 +- .../Webhook/WebhookRepository.php | 22 +- .../JsonApi/Enrichments/AccountEnrichment.php | 21 +- .../TransactionGroupEnrichment.php | 4 +- config/auth.php | 4 - 60 files changed, 1402 insertions(+), 1475 deletions(-) diff --git a/app/Api/V1/Controllers/Models/Account/ShowController.php b/app/Api/V1/Controllers/Models/Account/ShowController.php index acd960559b..3fe8919495 100644 --- a/app/Api/V1/Controllers/Models/Account/ShowController.php +++ b/app/Api/V1/Controllers/Models/Account/ShowController.php @@ -97,7 +97,6 @@ class ShowController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $accounts = $enrichment->enrich($accounts); @@ -133,7 +132,6 @@ class ShowController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $account = $enrichment->enrichSingle($account); diff --git a/app/Api/V1/Controllers/Models/Account/StoreController.php b/app/Api/V1/Controllers/Models/Account/StoreController.php index 6dda3b0564..3b8b21d17e 100644 --- a/app/Api/V1/Controllers/Models/Account/StoreController.php +++ b/app/Api/V1/Controllers/Models/Account/StoreController.php @@ -76,7 +76,6 @@ class StoreController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $account = $enrichment->enrichSingle($account); diff --git a/app/Api/V1/Controllers/Models/Account/UpdateController.php b/app/Api/V1/Controllers/Models/Account/UpdateController.php index fdbe785d0a..e30f53d63f 100644 --- a/app/Api/V1/Controllers/Models/Account/UpdateController.php +++ b/app/Api/V1/Controllers/Models/Account/UpdateController.php @@ -80,7 +80,6 @@ class UpdateController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $account = $enrichment->enrichSingle($account); diff --git a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php index 8149807d71..610927fe9b 100644 --- a/app/Api/V1/Controllers/Models/PiggyBank/ListController.php +++ b/app/Api/V1/Controllers/Models/PiggyBank/ListController.php @@ -84,7 +84,6 @@ class ListController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $accounts = $enrichment->enrich($accounts); diff --git a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php index dc035a4532..acac15728d 100644 --- a/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php +++ b/app/Api/V1/Controllers/Models/TransactionCurrency/ListController.php @@ -107,7 +107,6 @@ class ListController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $accounts = $enrichment->enrich($accounts); diff --git a/app/Api/V1/Controllers/Search/AccountController.php b/app/Api/V1/Controllers/Search/AccountController.php index f978f66855..71e1e02a43 100644 --- a/app/Api/V1/Controllers/Search/AccountController.php +++ b/app/Api/V1/Controllers/Search/AccountController.php @@ -88,7 +88,6 @@ class AccountController extends Controller $admin = auth()->user(); $enrichment = new AccountEnrichment(); $enrichment->setUser($admin); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->nativeCurrency); $accounts = $enrichment->enrich($accounts); diff --git a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php index f86a4424e6..0f6414bbf1 100644 --- a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php +++ b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php @@ -76,7 +76,7 @@ class ValidatesEnvironmentVariables extends Command private function validateGuard(): void { - $guard = env('AUTHENTICATION_GUARD', 'web'); + $guard = config('auth.defaults.guard'); if ('web' !== $guard && 'remote_user_guard' !== $guard) { $this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); @@ -87,7 +87,7 @@ class ValidatesEnvironmentVariables extends Command private function validateStaticToken(): void { - $token = (string) env('STATIC_CRON_TOKEN', ''); + $token = (string) config('firefly.static_cron_token'); if (0 !== strlen($token) && 32 !== strlen($token)) { $this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.'); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); diff --git a/app/Handlers/Observer/AccountObserver.php b/app/Handlers/Observer/AccountObserver.php index 0c05c2b6d5..b8f13c845d 100644 --- a/app/Handlers/Observer/AccountObserver.php +++ b/app/Handlers/Observer/AccountObserver.php @@ -88,7 +88,8 @@ class AccountObserver } $journalIds = Transaction::where('account_id', $account->id)->get(['transactions.transaction_journal_id'])->pluck('transaction_journal_id')->toArray(); - $groupIds = TransactionJournal::whereIn('id', $journalIds)->get(['transaction_journals.transaction_group_id'])->pluck('transaction_group_id')->toArray(); + $groupIds = TransactionJournal::whereIn('id', $journalIds)->get(['transaction_journals.transaction_group_id'])->pluck('transaction_group_id')->toArray(); // @phpstan-ignore-line + if (count($journalIds) > 0) { Transaction::whereIn('transaction_journal_id', $journalIds)->delete(); TransactionJournal::whereIn('id', $journalIds)->delete(); diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index f69b301f90..4d2147f8aa 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -47,10 +47,10 @@ use Illuminate\Support\Facades\Log; */ class NetWorth implements NetWorthInterface { - private AccountRepositoryInterface $accountRepository; + private AccountRepositoryInterface $accountRepository; private CurrencyRepositoryInterface $currencyRepos; - private User $user; - private ?UserGroup $userGroup; + private User $user; // @phpstan-ignore-line + private ?UserGroup $userGroup; // @phpstan-ignore-line /** * This method collects the user's net worth in ALL the user's currencies @@ -74,29 +74,29 @@ class NetWorth implements NetWorthInterface return $cache->get(); } Log::debug(sprintf('Now in byAccounts("%s", "%s")', $ids, $date->format('Y-m-d H:i:s'))); - $default = Amount::getNativeCurrency(); - $netWorth = []; + $default = Amount::getNativeCurrency(); + $netWorth = []; Log::debug(sprintf('NetWorth: finalAccountsBalance("%s")', $date->format('Y-m-d H:i:s'))); - $balances = Steam::finalAccountsBalance($accounts, $date); + $balances = Steam::finalAccountsBalance($accounts, $date); /** @var Account $account */ foreach ($accounts as $account) { Log::debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name)); - $currency = $this->accountRepository->getAccountCurrency($account) ?? $default; - $useNative = $convertToNative && $default->id !== $currency->id; - $currency = $useNative ? $default : $currency; - $currencyCode = $currency->code; - $balance = '0'; - $nativeBalance = '0'; + $currency = $this->accountRepository->getAccountCurrency($account) ?? $default; + $useNative = $convertToNative && $default->id !== $currency->id; + $currency = $useNative ? $default : $currency; + $currencyCode = $currency->code; + $balance = '0'; + $nativeBalance = '0'; if (array_key_exists($account->id, $balances)) { $balance = $balances[$account->id]['balance'] ?? '0'; $nativeBalance = $balances[$account->id]['native_balance'] ?? '0'; } Log::debug(sprintf('Balance is %s, native balance is %s', $balance, $nativeBalance)); // always subtract virtual balance again. - $balance = '' !== (string) $account->virtual_balance ? bcsub($balance, $account->virtual_balance) : $balance; - $nativeBalance = '' !== (string) $account->native_virtual_balance ? bcsub($nativeBalance, $account->native_virtual_balance) : $nativeBalance; - $amountToUse = $useNative ? $nativeBalance : $balance; + $balance = '' !== (string) $account->virtual_balance ? bcsub($balance, $account->virtual_balance) : $balance; + $nativeBalance = '' !== (string) $account->native_virtual_balance ? bcsub($nativeBalance, $account->native_virtual_balance) : $nativeBalance; + $amountToUse = $useNative ? $nativeBalance : $balance; Log::debug(sprintf('Will use %s %s', $currencyCode, $amountToUse)); $netWorth[$currencyCode] ??= [ @@ -115,27 +115,23 @@ class NetWorth implements NetWorthInterface return $netWorth; } - public function setUser(null|Authenticatable|User $user): void + public function setUser(null | Authenticatable | User $user): void { if (!$user instanceof User) { return; } - $this->user = $user; - $this->userGroup = null; - - // make repository: - $this->accountRepository = app(AccountRepositoryInterface::class); - $this->accountRepository->setUser($this->user); - - $this->currencyRepos = app(CurrencyRepositoryInterface::class); - $this->currencyRepos->setUser($this->user); + $this->user = $user; + $this->setUserGroup($user->userGroup); } public function setUserGroup(UserGroup $userGroup): void { - $this->userGroup = $userGroup; + $this->userGroup = $userGroup; $this->accountRepository = app(AccountRepositoryInterface::class); $this->accountRepository->setUserGroup($userGroup); + + $this->currencyRepos = app(CurrencyRepositoryInterface::class); + $this->currencyRepos->setUserGroup($this->userGroup); } /** @@ -151,16 +147,16 @@ class NetWorth implements NetWorthInterface Log::debug(sprintf('SumNetWorth: finalAccountsBalance("%s")', $date->format('Y-m-d H:i:s'))); $balances = Steam::finalAccountsBalance($accounts, $date); foreach ($accounts as $account) { - $currency = $this->accountRepository->getAccountCurrency($account); - $balance = $balances[$account->id]['balance'] ?? '0'; + $currency = $this->accountRepository->getAccountCurrency($account); + $balance = $balances[$account->id]['balance'] ?? '0'; // always subtract virtual balance. - $virtualBalance = $account->virtual_balance; + $virtualBalance = $account->virtual_balance; if ('' !== $virtualBalance) { $balance = bcsub($balance, $virtualBalance); } - $return[$currency->id] ??= [ + $return[$currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, 'symbol' => $currency->symbol, diff --git a/app/Http/Controllers/PiggyBank/IndexController.php b/app/Http/Controllers/PiggyBank/IndexController.php index 154eaf3517..469c326243 100644 --- a/app/Http/Controllers/PiggyBank/IndexController.php +++ b/app/Http/Controllers/PiggyBank/IndexController.php @@ -148,7 +148,6 @@ class IndexController extends Controller // enrich each account. $enrichment = new AccountEnrichment(); $enrichment->setUser(auth()->user()); - $enrichment->setConvertToNative($this->convertToNative); $enrichment->setNative($this->defaultCurrency); $return = []; @@ -158,6 +157,7 @@ class IndexController extends Controller /** @var Account $account */ foreach ($accounts as $account) { + /** @var Account $account */ $account = $enrichment->enrichSingle($account); $array = $accountTransformer->transform($account); $accountId = (int) $array['id']; diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index eda47f0eec..8a8cb8a908 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -45,6 +45,7 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Storage; +use Override; /** * Class AccountRepository. @@ -65,12 +66,6 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return true; } - #[\Override] - public function getAccountBalances(Account $account): Collection - { - return $account->accountBalances; - } - /** * Find account with same name OR same IBAN or both, but not the same type or ID. */ @@ -81,8 +76,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac /** @var Account $account */ foreach ($accounts as $account) { $byName = $this->user->accounts()->where('name', $account->name) - ->where('id', '!=', $account->id)->first() - ; + ->where('id', '!=', $account->id)->first(); if (null !== $byName) { $result->push($account); $result->push($byName); @@ -91,8 +85,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac } if (null !== $account->iban) { $byIban = $this->user->accounts()->where('iban', $account->iban) - ->where('id', '!=', $account->id)->first() - ; + ->where('id', '!=', $account->id)->first(); if (null !== $byIban) { $result->push($account); $result->push($byIban); @@ -118,8 +111,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); } - ) - ; + ); if (0 !== count($types)) { $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -146,7 +138,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function findByName(string $name, array $types): ?Account { - $query = $this->user->accounts(); + $query = $this->user->accounts(); if (0 !== count($types)) { $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -168,6 +160,12 @@ 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. */ @@ -194,10 +192,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { $query = $this->user->accounts()->with( [ // @phpstan-ignore-line - 'accountmeta' => static function (HasMany $query): void { - $query->where('name', 'account_role'); - }, - 'attachments', + 'accountmeta' => static function (HasMany $query): void { + $query->where('name', 'account_role'); + }, + 'attachments', ] ); if (0 !== count($types)) { @@ -213,7 +211,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getAttachments(Account $account): Collection { - $set = $account->attachments()->get(); + $set = $account->attachments()->get(); /** @var Storage $disk */ $disk = Storage::disk('upload'); @@ -235,7 +233,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getCashAccount(): Account { /** @var AccountType $type */ - $type = AccountType::where('type', AccountTypeEnum::CASH->value)->first(); + $type = AccountType::where('type', AccountTypeEnum::CASH->value)->first(); /** @var AccountFactory $factory */ $factory = app(AccountFactory::class); @@ -247,10 +245,9 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getCreditTransactionGroup(Account $account): ?TransactionGroup { $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::LIABILITY_CREDIT->value]) - ->first(['transaction_journals.*']) - ; + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::LIABILITY_CREDIT->value]) + ->first(['transaction_journals.*']); return $journal?->transactionGroup; } @@ -259,9 +256,9 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { $query = $this->user->accounts()->with( [ // @phpstan-ignore-line - 'accountmeta' => static function (HasMany $query): void { - $query->where('name', 'account_role'); - }, + 'accountmeta' => static function (HasMany $query): void { + $query->where('name', 'account_role'); + }, ] ); if (0 !== count($types)) { @@ -294,11 +291,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac */ public function getOpeningBalanceAmount(Account $account, bool $convertToNative): ?string { - $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) - ->first(['transaction_journals.*']) - ; + $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) + ->first(['transaction_journals.*']); if (null === $journal) { return null; } @@ -319,10 +315,9 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getOpeningBalanceDate(Account $account): ?string { return TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) - ->first(['transaction_journals.*'])?->date->format('Y-m-d H:i:s') - ; + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) + ->first(['transaction_journals.*'])?->date->format('Y-m-d H:i:s'); } public function getOpeningBalanceGroup(Account $account): ?TransactionGroup @@ -335,10 +330,9 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getOpeningBalance(Account $account): ?TransactionJournal { return TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value]) - ->first(['transaction_journals.*']) - ; + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value]) + ->first(['transaction_journals.*']); } public function getPiggyBanks(Account $account): Collection @@ -358,19 +352,18 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac $name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]); /** @var AccountType $type */ - $type = AccountType::where('type', AccountTypeEnum::RECONCILIATION->value)->first(); + $type = AccountType::where('type', AccountTypeEnum::RECONCILIATION->value)->first(); /** @var null|Account $current */ - $current = $this->user->accounts()->where('account_type_id', $type->id) - ->where('name', $name) - ->first() - ; + $current = $this->user->accounts()->where('account_type_id', $type->id) + ->where('name', $name) + ->first(); if (null !== $current) { return $current; } - $data = [ + $data = [ 'account_type_id' => null, 'account_type_name' => AccountTypeEnum::RECONCILIATION->value, 'active' => true, @@ -380,7 +373,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac ]; /** @var AccountFactory $factory */ - $factory = app(AccountFactory::class); + $factory = app(AccountFactory::class); $factory->setUser($account->user); return $factory->create($data); @@ -388,8 +381,8 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac 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)) { @@ -453,7 +446,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function maxOrder(string $type): int { - $sets = [ + $sets = [ AccountTypeEnum::ASSET->value => [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value], AccountTypeEnum::EXPENSE->value => [AccountTypeEnum::EXPENSE->value, AccountTypeEnum::BENEFICIARY->value], AccountTypeEnum::REVENUE->value => [AccountTypeEnum::REVENUE->value], @@ -469,7 +462,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac } $specials = [AccountTypeEnum::CASH->value, AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::IMPORT->value, AccountTypeEnum::RECONCILIATION->value]; - $order = (int) $this->getAccountsByType($specials)->max('order'); + $order = (int) $this->getAccountsByType($specials)->max('order'); app('log')->debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order)); return $order; @@ -520,13 +513,12 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { /** @var null|TransactionJournal $first */ $first = $account->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'ASC') - ->orderBy('transaction_journals.order', 'DESC') - ->where('transaction_journals.user_id', $this->user->id) - ->orderBy('transaction_journals.id', 'ASC') - ->first(['transaction_journals.id']) - ; + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'ASC') + ->orderBy('transaction_journals.order', 'DESC') + ->where('transaction_journals.user_id', $this->user->id) + ->orderBy('transaction_journals.id', 'ASC') + ->first(['transaction_journals.id']); if (null !== $first) { /** @var null|TransactionJournal */ return TransactionJournal::find($first->id); @@ -562,11 +554,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac } } // reset the rest to zero. - $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; + $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; $this->user->accounts()->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->whereNotIn('account_types.type', $all) - ->update(['order' => 0]) - ; + ->whereNotIn('account_types.type', $all) + ->update(['order' => 0]); } /** @@ -583,12 +574,11 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function searchAccount(string $query, array $types, int $limit): Collection { $dbQuery = $this->user->accounts() - ->where('active', true) - ->orderBy('accounts.order', 'ASC') - ->orderBy('accounts.account_type_id', 'ASC') - ->orderBy('accounts.name', 'ASC') - ->with(['accountType']) - ; + ->where('active', true) + ->orderBy('accounts.order', 'ASC') + ->orderBy('accounts.account_type_id', 'ASC') + ->orderBy('accounts.name', 'ASC') + ->with(['accountType']); if ('' !== $query) { // split query on spaces just in case: $parts = explode(' ', $query); @@ -608,13 +598,12 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function searchAccountNr(string $query, array $types, int $limit): Collection { $dbQuery = $this->user->accounts()->distinct() - ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') - ->where('accounts.active', true) - ->orderBy('accounts.order', 'ASC') - ->orderBy('accounts.account_type_id', 'ASC') - ->orderBy('accounts.name', 'ASC') - ->with(['accountType', 'accountMeta']) - ; + ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') + ->where('accounts.active', true) + ->orderBy('accounts.order', 'ASC') + ->orderBy('accounts.account_type_id', 'ASC') + ->orderBy('accounts.name', 'ASC') + ->with(['accountType', 'accountMeta']); if ('' !== $query) { // split query on spaces just in case: $parts = explode(' ', $query); diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 463f0853c0..006b2d7eed 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -52,7 +52,6 @@ interface AccountRepositoryInterface * Moved here from account CRUD. */ public function count(array $types): int; - public function getAccountBalances(Account $account): Collection; /** * Moved here from account CRUD. @@ -72,6 +71,8 @@ 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/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index 2447de9f43..c314a6a59b 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -47,28 +47,28 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface */ public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array { - $yesterday = clone $start; + $yesterday = clone $start; $yesterday->subDay()->endOfDay(); // exactly up until $start but NOT including. $end->endOfDay(); // needs to be end of day to be correct. Log::debug(sprintf('getAccountReport: finalAccountsBalance("%s")', $yesterday->format('Y-m-d H:i:s'))); Log::debug(sprintf('getAccountReport: finalAccountsBalance("%s")', $end->format('Y-m-d H:i:s'))); - $startSet = Steam::finalAccountsBalance($accounts, $yesterday); - $endSet = Steam::finalAccountsBalance($accounts, $end); + $startSet = Steam::finalAccountsBalance($accounts, $yesterday); + $endSet = Steam::finalAccountsBalance($accounts, $end); Log::debug('Start of accountreport'); /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); - $return = [ + $return = [ 'accounts' => [], 'sums' => [], ]; /** @var Account $account */ foreach ($accounts as $account) { - $id = $account->id; - $currency = $repository->getAccountCurrency($account) ?? $defaultCurrency; + $id = $account->id; + $currency = $repository->getAccountCurrency($account) ?? $defaultCurrency; $return['sums'][$currency->id] ??= [ 'start' => '0', 'end' => '0', @@ -79,7 +79,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface 'currency_name' => $currency->name, 'currency_decimal_places' => $currency->decimal_places, ]; - $entry = [ + $entry = [ 'name' => $account->name, 'id' => $account->id, 'currency_id' => $currency->id, @@ -90,9 +90,9 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface ]; // get first journal date: - $first = $repository->oldestJournal($account); - $entry['start_balance'] = $startSet[$account->id]['balance'] ?? '0'; - $entry['end_balance'] = $endSet[$account->id]['balance'] ?? '0'; + $first = $repository->oldestJournal($account); + $entry['start_balance'] = $startSet[$account->id]['balance'] ?? '0'; + $entry['end_balance'] = $endSet[$account->id]['balance'] ?? '0'; // first journal exists, and is on start, then this is the actual opening balance: if (null !== $first && $first->date->isSameDay($yesterday) && TransactionTypeEnum::OPENING_BALANCE->value === $first->transactionType->type) { @@ -127,13 +127,13 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $collector->setSourceAccounts($accounts)->setRange($start, $end); $collector->excludeDestinationAccounts($accounts); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value])->withAccountInformation(); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); - $report = $this->groupExpenseByDestination($journals); + $report = $this->groupExpenseByDestination($journals); // sort the result // Obtain a list of columns - $sum = []; + $sum = []; foreach ($report['accounts'] as $accountId => $row) { $sum[$accountId] = (float) $row['sum']; // intentional float } @@ -151,9 +151,9 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ - $currencyRepos = app(CurrencyRepositoryInterface::class); - $currencies = [$defaultCurrency->id => $defaultCurrency]; - $report = [ + $currencyRepos = app(CurrencyRepositoryInterface::class); + $currencies = [$defaultCurrency->id => $defaultCurrency]; + $report = [ 'accounts' => [], 'sums' => [], ]; @@ -163,8 +163,8 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $sourceId = (int) $journal['destination_account_id']; $currencyId = (int) $journal['currency_id']; $key = sprintf('%s-%s', $sourceId, $currencyId); - $currencies[$currencyId] ??= $currencyRepos->find($currencyId); - $report['accounts'][$key] ??= [ + $currencies[$currencyId] ??= $currencyRepos->find($currencyId); + $report['accounts'][$key] ??= [ 'id' => $sourceId, 'name' => $journal['destination_account_name'], 'sum' => '0', @@ -189,7 +189,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string) $report['accounts'][$key]['count']); } $currencyId = $report['accounts'][$key]['currency_id']; - $report['sums'][$currencyId] ??= [ + $report['sums'][$currencyId] ??= [ 'sum' => '0', 'currency_id' => $report['accounts'][$key]['currency_id'], 'currency_name' => $report['accounts'][$key]['currency_name'], @@ -217,11 +217,11 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $collector->setDestinationAccounts($accounts)->setRange($start, $end); $collector->excludeSourceAccounts($accounts); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value])->withAccountInformation(); - $report = $this->groupIncomeBySource($collector->getExtractedJournals()); + $report = $this->groupIncomeBySource($collector->getExtractedJournals()); // sort the result // Obtain a list of columns - $sum = []; + $sum = []; foreach ($report['accounts'] as $accountId => $row) { $sum[$accountId] = (float) $row['sum']; // intentional float } @@ -239,20 +239,20 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ - $currencyRepos = app(CurrencyRepositoryInterface::class); - $currencies = [$defaultCurrency->id => $defaultCurrency]; - $report = [ + $currencyRepos = app(CurrencyRepositoryInterface::class); + $currencies = [$defaultCurrency->id => $defaultCurrency]; + $report = [ 'accounts' => [], 'sums' => [], ]; /** @var array $journal */ foreach ($array as $journal) { - $sourceId = (int) $journal['source_account_id']; - $currencyId = (int) $journal['currency_id']; - $key = sprintf('%s-%s', $sourceId, $currencyId); + $sourceId = (int) $journal['source_account_id']; + $currencyId = (int) $journal['currency_id']; + $key = sprintf('%s-%s', $sourceId, $currencyId); if (!array_key_exists($key, $report['accounts'])) { - $currencies[$currencyId] ??= $currencyRepos->find($currencyId); + $currencies[$currencyId] ??= $currencyRepos->find($currencyId); $report['accounts'][$key] = [ 'id' => $sourceId, 'name' => $journal['source_account_name'], @@ -276,7 +276,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string) $report['accounts'][$key]['count']); } $currencyId = $report['accounts'][$key]['currency_id']; - $report['sums'][$currencyId] ??= [ + $report['sums'][$currencyId] ??= [ 'sum' => '0', 'currency_id' => $report['accounts'][$key]['currency_id'], 'currency_name' => $report['accounts'][$key]['currency_name'], diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php index fb71bb7235..67639f8a51 100644 --- a/app/Repositories/Account/OperationsRepository.php +++ b/app/Repositories/Account/OperationsRepository.php @@ -70,8 +70,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn { $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $journalId = (int) $journal['transaction_journal_id']; + $currencyId = (int) $journal['currency_id']; + $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId] ??= [ 'currency_id' => $journal['currency_id'], 'currency_name' => $journal['currency_name'], @@ -123,7 +123,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $expense = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); return $this->groupByCurrency($journals, 'negative'); @@ -140,7 +141,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $opposing = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $start->startOfDay(); $end->endOfDay(); @@ -173,15 +175,14 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn if (null !== $currency) { $collector->setCurrency($currency); } - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); // same but for foreign currencies: if (null !== $currency) { /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([$type])->withAccountInformation() - ->setForeignCurrency($currency) - ; + ->setForeignCurrency($currency); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { if (null !== $accounts) { $collector->setSourceAccounts($accounts); @@ -199,10 +200,10 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } } - $result = $collector->getExtractedJournals(); + $result = $collector->getExtractedJournals(); // do not use array_merge because you want keys to overwrite (otherwise you get double results): - $journals = $result + $journals; + $journals = $result + $journals; } return $journals; @@ -224,7 +225,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $expense = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); return $this->groupByDirection($journals, 'destination', 'negative'); @@ -246,7 +248,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $expense = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); return $this->groupByDirection($journals, 'source', 'negative'); @@ -261,7 +264,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $revenue = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); return $this->groupByCurrency($journals, 'positive'); @@ -276,7 +280,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $revenue = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); return $this->groupByDirection($journals, 'destination', 'positive'); @@ -291,7 +296,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $revenue = null, ?TransactionCurrency $currency = null - ): array { + ): array + { $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); return $this->groupByDirection($journals, 'source', 'positive'); @@ -312,7 +318,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn foreach ($journals as $journal) { $return = $this->groupByEitherJournal($return, $journal); } - $final = []; + $final = []; foreach ($return as $array) { $array['difference_float'] = (float) $array['difference']; $array['in_float'] = (float) $array['in']; @@ -325,12 +331,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn private function groupByEitherJournal(array $return, array $journal): array { - $sourceId = $journal['source_account_id']; - $destinationId = $journal['destination_account_id']; - $currencyId = $journal['currency_id']; - $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); - $destKey = sprintf('%d-%d', $currencyId, $destinationId); - $amount = app('steam')->positive($journal['amount']); + $sourceId = $journal['source_account_id']; + $destinationId = $journal['destination_account_id']; + $currencyId = $journal['currency_id']; + $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); + $destKey = sprintf('%d-%d', $currencyId, $destinationId); + $amount = app('steam')->positive($journal['amount']); // source first $return[$sourceKey] ??= [ @@ -347,7 +353,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; // dest next: - $return[$destKey] ??= [ + $return[$destKey] ??= [ 'id' => (string) $destinationId, 'name' => $journal['destination_account_name'], 'difference' => '0', @@ -365,15 +371,15 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], $return[$sourceKey]['in']); // destination account? money comes in: - $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); - $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); + $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); + $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); // foreign currency if (null !== $journal['foreign_currency_id'] && null !== $journal['foreign_amount']) { - $currencyId = $journal['foreign_currency_id']; - $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); - $destKey = sprintf('%d-%d', $currencyId, $destinationId); - $amount = app('steam')->positive($journal['foreign_amount']); + $currencyId = $journal['foreign_currency_id']; + $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); + $destKey = sprintf('%d-%d', $currencyId, $destinationId); + $amount = app('steam')->positive($journal['foreign_amount']); // same as above: // source first @@ -391,7 +397,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; // dest next: - $return[$destKey] ??= [ + $return[$destKey] ??= [ 'id' => (string) $destinationId, 'name' => $journal['destination_account_name'], 'difference' => '0', @@ -408,8 +414,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], $return[$sourceKey]['in']); // destination account? money comes in: - $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); - $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); + $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); + $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); } return $return; diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index 17ec138917..df62a9d0b2 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Attachment; +use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\AttachmentFactory; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; @@ -35,6 +36,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Storage; use League\Flysystem\UnableToDeleteFile; +use LogicException; /** * Class AttachmentRepository. @@ -44,14 +46,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn use UserGroupTrait; /** - * @throws \Exception + * @throws Exception */ public function destroy(Attachment $attachment): bool { /** @var AttachmentHelperInterface $helper */ $helper = app(AttachmentHelperInterface::class); - $path = $helper->getAttachmentLocation($attachment); + $path = $helper->getAttachmentLocation($attachment); try { Storage::disk('upload')->delete($path); @@ -118,7 +120,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn /** @var AttachmentFactory $factory */ $factory = app(AttachmentFactory::class); $factory->setUser($this->user); - $result = $factory->create($data); + $result = $factory->create($data); if (null === $result) { throw new FireflyException('Could not store attachment.'); } @@ -158,14 +160,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn if (null !== $dbNote) { try { $dbNote->delete(); - } catch (\LogicException $e) { + } catch (LogicException $e) { app('log')->error($e->getMessage()); } } return true; } - $dbNote = $attachment->notes()->first(); + $dbNote = $attachment->notes()->first(); if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($attachment); diff --git a/app/Repositories/AuditLogEntry/ALERepository.php b/app/Repositories/AuditLogEntry/ALERepository.php index 02f60db94e..42faf9f02c 100644 --- a/app/Repositories/AuditLogEntry/ALERepository.php +++ b/app/Repositories/AuditLogEntry/ALERepository.php @@ -41,7 +41,7 @@ class ALERepository implements ALERepositoryInterface public function store(array $data): AuditLogEntry { - $auditLogEntry = new AuditLogEntry(); + $auditLogEntry = new AuditLogEntry(); $auditLogEntry->auditable()->associate($data['auditable']); $auditLogEntry->changer()->associate($data['changer']); diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 9d067a5c3a..faf89f6a72 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -62,8 +62,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%%%s', $query)); } $search->orderBy('name', 'ASC') - ->where('active', true) - ; + ->where('active', true); return $search->take($limit)->get(); } @@ -75,8 +74,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%s%%', $query)); } $search->orderBy('name', 'ASC') - ->where('active', true) - ; + ->where('active', true); return $search->take($limit)->get(); } @@ -178,10 +176,9 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getBills(): Collection { return $this->user->bills() - ->orderBy('order', 'ASC') - ->orderBy('active', 'DESC') - ->orderBy('name', 'ASC')->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('active', 'DESC') + ->orderBy('name', 'ASC')->get(); } public function getBillsForAccounts(Collection $accounts): Collection @@ -205,25 +202,24 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $ids = $accounts->pluck('id')->toArray(); return $this->user->bills() - ->leftJoin( - 'transaction_journals', - static function (JoinClause $join): void { - $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); - } - ) - ->leftJoin( - 'transactions', - static function (JoinClause $join): void { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); - } - ) - ->whereIn('transactions.account_id', $ids) - ->whereNull('transaction_journals.deleted_at') - ->orderBy('bills.active', 'DESC') - ->orderBy('bills.name', 'ASC') - ->groupBy($fields) - ->get($fields) - ; + ->leftJoin( + 'transaction_journals', + static function (JoinClause $join): void { + $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); + } + ) + ->leftJoin( + 'transactions', + static function (JoinClause $join): void { + $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); + } + ) + ->whereIn('transactions.account_id', $ids) + ->whereNull('transaction_journals.deleted_at') + ->orderBy('bills.active', 'DESC') + ->orderBy('bills.name', 'ASC') + ->groupBy($fields) + ->get($fields); } /** @@ -248,7 +244,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getOverallAverage(Bill $bill): array { /** @var JournalRepositoryInterface $repos */ - $repos = app(JournalRepositoryInterface::class); + $repos = app(JournalRepositoryInterface::class); $repos->setUser($this->user); // get and sort on currency @@ -261,7 +257,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $transaction = $journal->transactions()->where('amount', '<', 0)->first(); $currencyId = (int) $journal->transaction_currency_id; $currency = $journal->transactionCurrency; - $result[$currencyId] ??= [ + $result[$currencyId] ??= [ 'sum' => '0', 'native_sum' => '0', 'count' => 0, @@ -296,9 +292,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getPaginator(int $size): LengthAwarePaginator { return $this->user->bills() - ->orderBy('active', 'DESC') - ->orderBy('name', 'ASC')->paginate($size) - ; + ->orderBy('active', 'DESC') + ->orderBy('name', 'ASC')->paginate($size); } /** @@ -311,14 +306,13 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface Log::debug(sprintf('Search for linked journals between %s and %s', $start->toW3cString(), $end->toW3cString())); return $bill->transactionJournals() - ->before($end)->after($start)->get( + ->before($end)->after($start)->get( [ 'transaction_journals.id', 'transaction_journals.date', 'transaction_journals.transaction_group_id', ] - ) - ; + ); } /** @@ -327,11 +321,10 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getRulesForBill(Bill $bill): Collection { return $this->user->rules() - ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') - ->where('rule_actions.action_type', 'link_to_bill') - ->where('rule_actions.action_value', $bill->name) - ->get(['rules.*']) - ; + ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') + ->where('rule_actions.action_type', 'link_to_bill') + ->where('rule_actions.action_value', $bill->name) + ->get(['rules.*']); } /** @@ -342,16 +335,15 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface */ public function getRulesForBills(Collection $collection): array { - $rules = $this->user->rules() - ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') - ->where('rule_actions.action_type', 'link_to_bill') - ->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active']) - ; - $array = []; + $rules = $this->user->rules() + ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') + ->where('rule_actions.action_type', 'link_to_bill') + ->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active']); + $array = []; /** @var Rule $rule */ foreach ($rules as $rule) { - $array[$rule->action_value] ??= []; + $array[$rule->action_value] ??= []; $array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active]; } $return = []; @@ -365,28 +357,27 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getYearAverage(Bill $bill, Carbon $date): array { /** @var JournalRepositoryInterface $repos */ - $repos = app(JournalRepositoryInterface::class); + $repos = app(JournalRepositoryInterface::class); $repos->setUser($this->user); // get and sort on currency - $result = []; + $result = []; $journals = $bill->transactionJournals() - ->where('date', '>=', $date->year.'-01-01 00:00:00') - ->where('date', '<=', $date->year.'-12-31 23:59:59') - ->get() - ; + ->where('date', '>=', $date->year . '-01-01 00:00:00') + ->where('date', '<=', $date->year . '-12-31 23:59:59') + ->get(); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { /** @var null|Transaction $transaction */ - $transaction = $journal->transactions()->where('amount', '<', 0)->first(); + $transaction = $journal->transactions()->where('amount', '<', 0)->first(); if (null === $transaction) { continue; } $currencyId = (int) $journal->transaction_currency_id; $currency = $journal->transactionCurrency; - $result[$currencyId] ??= [ + $result[$currencyId] ??= [ 'sum' => '0', 'native_sum' => '0', 'count' => 0, @@ -436,7 +427,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface */ public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($bill->id); $cache->addProperty('nextExpectedMatch'); $cache->addProperty($date); @@ -444,17 +435,17 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface return $cache->get(); } // find the most recent date for this bill NOT in the future. Cache this date: - $start = clone $bill->date; + $start = clone $bill->date; $start->startOfDay(); - app('log')->debug('nextExpectedMatch: Start is '.$start->format('Y-m-d')); + app('log')->debug('nextExpectedMatch: Start is ' . $start->format('Y-m-d')); while ($start < $date) { app('log')->debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d H:i:s'), $date->format('Y-m-d H:i:s'))); $start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); - app('log')->debug('Start is now '.$start->format('Y-m-d H:i:s')); + app('log')->debug('Start is now ' . $start->format('Y-m-d H:i:s')); } - $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); + $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); $end->endOfDay(); // see if the bill was paid in this period. @@ -466,8 +457,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $start = clone $end; $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); } - app('log')->debug('nextExpectedMatch: Final start is '.$start->format('Y-m-d')); - app('log')->debug('nextExpectedMatch: Matching end is '.$end->format('Y-m-d')); + app('log')->debug('nextExpectedMatch: Final start is ' . $start->format('Y-m-d')); + app('log')->debug('nextExpectedMatch: Matching end is ' . $end->format('Y-m-d')); $cache->store($start); @@ -528,8 +519,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface foreach ($bills as $bill) { /** @var Collection $set */ - $set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']); - $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; + $set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']); + $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; $return[(int) $currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, @@ -538,7 +529,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface 'decimal_places' => $currency->decimal_places, 'sum' => '0', ]; - $setAmount = '0'; + $setAmount = '0'; /** @var TransactionJournal $transactionJournal */ foreach ($set as $transactionJournal) { @@ -555,10 +546,10 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getActiveBills(): Collection { return $this->user->bills() - ->where('active', true) - ->orderBy('bills.name', 'ASC') - ->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) // @phpstan-ignore-line - ; + ->where('active', true) + ->orderBy('bills.name', 'ASC') + ->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) // @phpstan-ignore-line + ; } public function sumUnpaidInRange(Carbon $start, Carbon $end): array @@ -572,9 +563,9 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface /** @var Bill $bill */ foreach ($bills as $bill) { // app('log')->debug(sprintf('Processing bill #%d ("%s")', $bill->id, $bill->name)); - $dates = $this->getPayDatesInRange($bill, $start, $end); - $count = $bill->transactionJournals()->after($start)->before($end)->count(); - $total = $dates->count() - $count; + $dates = $this->getPayDatesInRange($bill, $start, $end); + $count = $bill->transactionJournals()->after($start)->before($end)->count(); + $total = $dates->count() - $count; // app('log')->debug(sprintf('Pay dates: %d, count: %d, left: %d', $dates->count(), $count, $total)); // app('log')->debug('dates', $dates->toArray()); @@ -583,10 +574,10 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface // Log::debug(sprintf('min field is %s, max field is %s', $minField, $maxField)); if ($total > 0) { - $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; - $average = bcdiv(bcadd($bill->{$maxField} ?? '0', $bill->{$minField} ?? '0'), '2'); + $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; + $average = bcdiv(bcadd($bill->{$maxField} ?? '0', $bill->{$minField} ?? '0'), '2'); Log::debug(sprintf('Amount to pay is %s %s (%d times)', $currency->code, $average, $total)); - $return[$currency->id] ??= [ + $return[$currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, 'symbol' => $currency->symbol, @@ -624,7 +615,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface // app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d'))); - $currentStart = clone $nextExpectedMatch; + $currentStart = clone $nextExpectedMatch; } return $set; diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index fddb77e0ec..78d56290b3 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -48,9 +48,9 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { - $start = $availableBudget->start_date->format('Y-m-d'); - $end = $availableBudget->end_date->format('Y-m-d'); - $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end); + $start = $availableBudget->start_date->format('Y-m-d'); + $end = $availableBudget->end_date->format('Y-m-d'); + $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end); if (array_key_exists($key, $exists)) { app('log')->debug(sprintf('Found duplicate AB: %s %s, %s-%s. Has been deleted', $availableBudget->transaction_currency_id, $availableBudget->amount, $start, $end)); $availableBudget->delete(); @@ -64,7 +64,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U */ public function get(?Carbon $start = null, ?Carbon $end = null): Collection { - $query = $this->user->availableBudgets()->with(['transactionCurrency']); + $query = $this->user->availableBudgets()->with(['transactionCurrency']); if (null !== $start && null !== $end) { $query->where( static function (Builder $q1) use ($start, $end): void { @@ -105,23 +105,21 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U { /** @var null|AvailableBudget */ return $this->user->availableBudgets() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d')) - ->first() - ; + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d')) + ->first(); } public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string { - $amount = '0'; + $amount = '0'; /** @var null|AvailableBudget $availableBudget */ $availableBudget = $this->user->availableBudgets() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first() - ; + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->first(); if (null !== $availableBudget) { $amount = $availableBudget->amount; } @@ -134,15 +132,14 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U Log::debug(sprintf('Now in %s(%s, %s)', __METHOD__, $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); $return = []; $availableBudgets = $this->user->availableBudgets() - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->get() - ; + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->get(); Log::debug(sprintf('Found %d available budgets', $availableBudgets->count())); // use native amount if necessary? - $convertToNative = Amount::convertToNative($this->user); - $default = Amount::getNativeCurrency(); + $convertToNative = Amount::convertToNative($this->user); + $default = Amount::getNativeCurrency(); /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { @@ -187,10 +184,9 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U public function getAvailableBudgetsByExactDate(Carbon $start, Carbon $end): Collection { return $this->user->availableBudgets() - ->where('start_date', '=', $start->format('Y-m-d')) - ->where('end_date', '=', $end->format('Y-m-d')) - ->get() - ; + ->where('start_date', '=', $start->format('Y-m-d')) + ->where('end_date', '=', $end->format('Y-m-d')) + ->get(); } public function getByCurrencyDate(Carbon $start, Carbon $end, TransactionCurrency $currency): ?AvailableBudget @@ -200,8 +196,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->availableBudgets() ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first() - ; + ->where('end_date', $end->format('Y-m-d'))->first(); } /** @@ -210,13 +205,12 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): AvailableBudget { /** @var null|AvailableBudget */ - $availableBudget = $this->user->availableBudgets() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first() - ; + $availableBudget = $this->user->availableBudgets() + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->first(); if (null === $availableBudget) { - $availableBudget = new AvailableBudget(); + $availableBudget = new AvailableBudget(); $availableBudget->user()->associate($this->user); $availableBudget->transactionCurrency()->associate($currency); $availableBudget->start_date = $start->startOfDay(); @@ -236,7 +230,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U if ($start instanceof Carbon) { $start = $data['start']->startOfDay(); } - $end = $data['end']; + $end = $data['end']; if ($end instanceof Carbon) { $end = $data['end']->endOfDay(); } diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index 17bf27e34c..faac33d84b 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -33,10 +33,10 @@ use FireflyIII\Models\Note; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Override; /** * Class BudgetLimitRepository @@ -51,10 +51,10 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup */ public function budgeted(Carbon $start, Carbon $end, TransactionCurrency $currency, ?Collection $budgets = null): string { - $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') + $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') // same complex where query as below. - ->where( + ->where( static function (Builder $q5) use ($start, $end): void { $q5->where( static function (Builder $q1) use ($start, $end): void { @@ -64,30 +64,27 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); } ) - ->orWhere( - static function (Builder $q3) use ($start, $end): void { - $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); - $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); - } - ) - ; + ->orWhere( + static function (Builder $q3) use ($start, $end): void { + $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); + $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); + } + ); } ) - ->orWhere( - static function (Builder $q4) use ($start, $end): void { - // or start is before start AND end is after end. - $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); - $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); - } - ) - ; + ->orWhere( + static function (Builder $q4) use ($start, $end): void { + // or start is before start AND end is after end. + $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); + $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); + } + ); } ) - ->where('budget_limits.transaction_currency_id', $currency->id) - ->whereNull('budgets.deleted_at') - ->where('budgets.active', true) - ->where('budgets.user_id', $this->user->id) - ; + ->where('budget_limits.transaction_currency_id', $currency->id) + ->whereNull('budgets.deleted_at') + ->where('budgets.active', true) + ->where('budgets.user_id', $this->user->id); if (null !== $budgets && $budgets->count() > 0) { $query->whereIn('budget_limits.budget_id', $budgets->pluck('id')->toArray()); } @@ -139,19 +136,17 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup // both are NULL: if (null === $start && null === $end) { return BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->with(['budget']) - ->where('budgets.user_id', $this->user->id) - ->whereNull('budgets.deleted_at') - ->get(['budget_limits.*']) - ; + ->with(['budget']) + ->where('budgets.user_id', $this->user->id) + ->whereNull('budgets.deleted_at') + ->get(['budget_limits.*']); } // one of the two is NULL. if (null === $start xor null === $end) { $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->with(['budget']) - ->whereNull('budgets.deleted_at') - ->where('budgets.user_id', $this->user->id) - ; + ->with(['budget']) + ->whereNull('budgets.deleted_at') + ->where('budgets.user_id', $this->user->id); if (null !== $end) { // end date must be before $end. $query->where('end_date', '<=', $end->format('Y-m-d 00:00:00')); @@ -166,39 +161,36 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup // neither are NULL: return BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->with(['budget']) - ->where('budgets.user_id', $this->user->id) - ->whereNull('budgets.deleted_at') - ->where( - static function (Builder $q5) use ($start, $end): void { - $q5->where( - static function (Builder $q1) use ($start, $end): void { - $q1->where( - static function (Builder $q2) use ($start, $end): void { - $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d')); - $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); - } - ) - ->orWhere( - static function (Builder $q3) use ($start, $end): void { - $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); - $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); - } - ) - ; - } - ) - ->orWhere( - static function (Builder $q4) use ($start, $end): void { - // or start is before start AND end is after end. - $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); - $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); - } - ) - ; - } - )->get(['budget_limits.*']) - ; + ->with(['budget']) + ->where('budgets.user_id', $this->user->id) + ->whereNull('budgets.deleted_at') + ->where( + static function (Builder $q5) use ($start, $end): void { + $q5->where( + static function (Builder $q1) use ($start, $end): void { + $q1->where( + static function (Builder $q2) use ($start, $end): void { + $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d')); + $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); + } + ) + ->orWhere( + static function (Builder $q3) use ($start, $end): void { + $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); + $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); + } + ); + } + ) + ->orWhere( + static function (Builder $q4) use ($start, $end): void { + // or start is before start AND end is after end. + $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); + $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); + } + ); + } + )->get(['budget_limits.*']); } public function getBudgetLimits(Budget $budget, ?Carbon $start = null, ?Carbon $end = null): Collection @@ -223,41 +215,38 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup // when both dates are set: return $budget->budgetlimits() - ->where( - static function (Builder $q5) use ($start, $end): void { - $q5->where( - static function (Builder $q1) use ($start, $end): void { - // budget limit ends within period - $q1->where( - static function (Builder $q2) use ($start, $end): void { - $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d 00:00:00')); - $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d 23:59:59')); - } - ) - // budget limit start within period - ->orWhere( - static function (Builder $q3) use ($start, $end): void { - $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00')); - $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59')); - } - ) - ; - } - ) - ->orWhere( - static function (Builder $q4) use ($start, $end): void { - // or start is before start AND end is after end. - $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d 23:59:59')); - $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d 00:00:00')); - } - ) - ; - } - )->orderBy('budget_limits.start_date', 'DESC')->get(['budget_limits.*']) - ; + ->where( + static function (Builder $q5) use ($start, $end): void { + $q5->where( + static function (Builder $q1) use ($start, $end): void { + // budget limit ends within period + $q1->where( + static function (Builder $q2) use ($start, $end): void { + $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d 00:00:00')); + $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d 23:59:59')); + } + ) + // budget limit start within period + ->orWhere( + static function (Builder $q3) use ($start, $end): void { + $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00')); + $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59')); + } + ); + } + ) + ->orWhere( + static function (Builder $q4) use ($start, $end): void { + // or start is before start AND end is after end. + $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d 23:59:59')); + $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d 00:00:00')); + } + ); + } + )->orderBy('budget_limits.start_date', 'DESC')->get(['budget_limits.*']); } - #[\Override] + #[Override] public function getNoteText(BudgetLimit $budgetLimit): string { return (string) $budgetLimit->notes()->first()?->text; @@ -270,35 +259,34 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup { // if no currency has been provided, use the user's default currency: /** @var TransactionCurrencyFactory $factory */ - $factory = app(TransactionCurrencyFactory::class); - $currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null); + $factory = app(TransactionCurrencyFactory::class); + $currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null); if (null === $currency) { $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); } - $currency->enabled = true; + $currency->enabled = true; $currency->save(); // find the budget: /** @var null|Budget $budget */ - $budget = $this->user->budgets()->find((int) $data['budget_id']); + $budget = $this->user->budgets()->find((int) $data['budget_id']); if (null === $budget) { throw new FireflyException('200004: Budget does not exist.'); } // find limit with same date range and currency. - $limit = $budget->budgetlimits() - ->where('budget_limits.start_date', $data['start_date']->format('Y-m-d')) - ->where('budget_limits.end_date', $data['end_date']->format('Y-m-d')) - ->where('budget_limits.transaction_currency_id', $currency->id) - ->first(['budget_limits.*']) - ; + $limit = $budget->budgetlimits() + ->where('budget_limits.start_date', $data['start_date']->format('Y-m-d')) + ->where('budget_limits.end_date', $data['end_date']->format('Y-m-d')) + ->where('budget_limits.transaction_currency_id', $currency->id) + ->first(['budget_limits.*']); if (null !== $limit) { throw new FireflyException('200027: Budget limit already exists.'); } app('log')->debug('No existing budget limit, create a new one'); // or create one and return it. - $limit = new BudgetLimit(); + $limit = new BudgetLimit(); $limit->budget()->associate($budget); $limit->start_date = $data['start_date']->format('Y-m-d'); $limit->end_date = $data['end_date']->format('Y-m-d'); @@ -306,7 +294,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup $limit->transaction_currency_id = $currency->id; $limit->save(); - $noteText = (string) ($data['notes'] ?? ''); + $noteText = (string) ($data['notes'] ?? ''); if ('' !== $noteText) { $this->setNoteText($limit, $noteText); } @@ -320,13 +308,12 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup { /** @var null|BudgetLimit */ return $budget->budgetlimits() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first() - ; + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->first(); } - #[\Override] + #[Override] public function setNoteText(BudgetLimit $budgetLimit, string $text): void { $dbNote = $budgetLimit->notes()->first(); @@ -348,8 +335,8 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup */ public function update(BudgetLimit $budgetLimit, array $data): BudgetLimit { - $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount; - $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id; + $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount; + $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id; if (array_key_exists('start', $data)) { $budgetLimit->start_date = $data['start']->startOfDay(); @@ -361,7 +348,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup } // if no currency has been provided, use the user's default currency: - $currency = null; + $currency = null; // update if relevant: if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) { @@ -373,7 +360,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup if (null === $currency) { $currency = $budgetLimit->transactionCurrency ?? app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); } - $currency->enabled = true; + $currency->enabled = true; $currency->save(); $budgetLimit->transaction_currency_id = $currency->id; @@ -390,29 +377,26 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit { // count the limits: - $limits = $budget->budgetlimits() - ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) - ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) - ->count('budget_limits.*') - ; + $limits = $budget->budgetlimits() + ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) + ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) + ->count('budget_limits.*'); app('log')->debug(sprintf('Found %d budget limits.', $limits)); // there might be a budget limit for these dates: /** @var null|BudgetLimit $limit */ - $limit = $budget->budgetlimits() - ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) - ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) - ->first(['budget_limits.*']) - ; + $limit = $budget->budgetlimits() + ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) + ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) + ->first(['budget_limits.*']); // if more than 1 limit found, delete the others: if ($limits > 1 && null !== $limit) { app('log')->debug(sprintf('Found more than 1, delete all except #%d', $limit->id)); $budget->budgetlimits() - ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) - ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) - ->where('budget_limits.id', '!=', $limit->id)->delete() - ; + ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) + ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) + ->where('budget_limits.id', '!=', $limit->id)->delete(); } // delete if amount is zero. @@ -434,7 +418,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup } app('log')->debug('No existing budget limit, create a new one'); // or create one and return it. - $limit = new BudgetLimit(); + $limit = new BudgetLimit(); $limit->budget()->associate($budget); $limit->start_date = $start->startOfDay(); $limit->start_date_tz = $start->format('e'); diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index 858f48f417..a7ae5c923e 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -63,8 +63,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%%%s', $query)); } $search->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', true) - ; + ->orderBy('name', 'ASC')->where('active', true); return $search->take($limit)->get(); } @@ -76,8 +75,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%s%%', $query)); } $search->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', true) - ; + ->orderBy('name', 'ASC')->where('active', true); return $search->take($limit)->get(); } @@ -85,7 +83,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function budgetedInPeriod(Carbon $start, Carbon $end): array { app('log')->debug(sprintf('Now in budgetedInPeriod("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d'))); - $return = []; + $return = []; /** @var BudgetLimitRepository $limitRepository */ $limitRepository = app(BudgetLimitRepository::class); @@ -102,9 +100,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface /** @var BudgetLimit $limit */ foreach ($limits as $limit) { app('log')->debug(sprintf('Budget limit #%d', $limit->id)); - $currency = $limit->transactionCurrency; - $rate = $converter->getCurrencyRate($currency, $defaultCurrency, $end); - $currencyCode = $currency->code; + $currency = $limit->transactionCurrency; + $rate = $converter->getCurrencyRate($currency, $defaultCurrency, $end); + $currencyCode = $currency->code; $return[$currencyCode] ??= [ 'currency_id' => (string) $currency->id, 'currency_name' => $currency->name, @@ -159,10 +157,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getActiveBudgets(): Collection { return $this->user->budgets()->where('active', true) - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC') - ->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get(); } /** @@ -202,19 +199,19 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array { app('log')->debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d'))); - $return = []; + $return = []; /** @var BudgetLimitRepository $limitRepository */ $limitRepository = app(BudgetLimitRepository::class); $limitRepository->setUser($this->user); app('log')->debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name)); - $limits = $limitRepository->getBudgetLimits($budget, $start, $end); + $limits = $limitRepository->getBudgetLimits($budget, $start, $end); /** @var BudgetLimit $limit */ foreach ($limits as $limit) { app('log')->debug(sprintf('Budget limit #%d', $limit->id)); - $currency = $limit->transactionCurrency; + $currency = $limit->transactionCurrency; $return[$currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, @@ -283,7 +280,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { app('log')->debug('Now in update()'); - $oldName = $budget->name; + $oldName = $budget->name; if (array_key_exists('name', $data)) { $budget->name = $data['name']; $this->updateRuleActions($oldName, $budget->name); @@ -298,7 +295,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $budget->save(); // update or create auto-budget: - $autoBudget = $this->getAutoBudget($budget); + $autoBudget = $this->getAutoBudget($budget); // first things first: delete when no longer required: $autoBudgetType = array_key_exists('auto_budget_type', $data) ? $data['auto_budget_type'] : null; @@ -324,11 +321,10 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { $types = ['set_budget']; $actions = RuleAction::leftJoin('rules', 'rules.id', '=', 'rule_actions.rule_id') - ->where('rules.user_id', $this->user->id) - ->whereIn('rule_actions.action_type', $types) - ->where('rule_actions.action_value', $oldName) - ->get(['rule_actions.*']) - ; + ->where('rules.user_id', $this->user->id) + ->whereIn('rule_actions.action_type', $types) + ->where('rule_actions.action_value', $oldName) + ->get(['rule_actions.*']); app('log')->debug(sprintf('Found %d actions to update.', $actions->count())); /** @var RuleAction $action */ @@ -343,11 +339,10 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { $types = ['budget_is']; $triggers = RuleTrigger::leftJoin('rules', 'rules.id', '=', 'rule_triggers.rule_id') - ->where('rules.user_id', $this->user->id) - ->whereIn('rule_triggers.trigger_type', $types) - ->where('rule_triggers.trigger_value', $oldName) - ->get(['rule_triggers.*']) - ; + ->where('rules.user_id', $this->user->id) + ->whereIn('rule_triggers.trigger_type', $types) + ->where('rule_triggers.trigger_value', $oldName) + ->get(['rule_triggers.*']); app('log')->debug(sprintf('Found %d triggers to update.', $triggers->count())); /** @var RuleTrigger $trigger */ @@ -391,7 +386,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $autoBudget = $this->getAutoBudget($budget); // grab default currency: - $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); if (null === $autoBudget) { // at this point it's a blind assumption auto_budget_type is 1 or 2. @@ -471,8 +466,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getBudgets(): Collection { return $this->user->budgets()->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->get() - ; + ->orderBy('name', 'ASC')->get(); } public function destroyAutoBudget(Budget $budget): void @@ -530,7 +524,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getAttachments(Budget $budget): Collection { - $set = $budget->attachments()->get(); + $set = $budget->attachments()->get(); $disk = Storage::disk('upload'); @@ -556,9 +550,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getInactiveBudgets(): Collection { return $this->user->budgets() - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', 0)->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC')->where('active', 0)->get(); } public function getNoteText(Budget $budget): ?string @@ -578,8 +571,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%%%s%%', $query)); } $search->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', true) - ; + ->orderBy('name', 'ASC')->where('active', true); return $search->take($limit)->get(); } @@ -599,8 +591,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // exclude specific liabilities $repository = app(AccountRepositoryInterface::class); $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); /** @var Account $account */ foreach ($subset as $account) { @@ -611,20 +603,19 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // start collecting: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user) - ->setRange($start, $end) - ->excludeDestinationAccounts($selection) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) - ->setBudgets($this->getActiveBudgets()) - ; + ->setRange($start, $end) + ->excludeDestinationAccounts($selection) + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) + ->setBudgets($this->getActiveBudgets()); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'id' => (string) $currencyId, 'name' => $journal['currency_name'], 'symbol' => $journal['currency_symbol'], @@ -635,9 +626,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); // also do foreign amount: - $foreignId = (int) $journal['foreign_currency_id']; + $foreignId = (int) $journal['foreign_currency_id']; if (0 !== $foreignId) { - $array[$foreignId] ??= [ + $array[$foreignId] ??= [ 'id' => (string) $foreignId, 'name' => $journal['foreign_currency_name'], 'symbol' => $journal['foreign_currency_symbol'], @@ -661,8 +652,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // exclude specific liabilities $repository = app(AccountRepositoryInterface::class); $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); /** @var Account $account */ foreach ($subset as $account) { @@ -673,20 +664,19 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // start collecting: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user) - ->setRange($start, $end) - ->excludeDestinationAccounts($selection) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) - ->setBudget($budget) - ; + ->setRange($start, $end) + ->excludeDestinationAccounts($selection) + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) + ->setBudget($budget); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'id' => (string) $currencyId, 'name' => $journal['currency_name'], 'symbol' => $journal['currency_symbol'], @@ -697,9 +687,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); // also do foreign amount: - $foreignId = (int) $journal['foreign_currency_id']; + $foreignId = (int) $journal['foreign_currency_id']; if (0 !== $foreignId) { - $array[$foreignId] ??= [ + $array[$foreignId] ??= [ 'id' => (string) $foreignId, 'name' => $journal['foreign_currency_name'], 'symbol' => $journal['foreign_currency_symbol'], @@ -721,7 +711,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface */ public function store(array $data): Budget { - $order = $this->getMaxOrder(); + $order = $this->getMaxOrder(); try { $newBudget = Budget::create( @@ -748,7 +738,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface if (!array_key_exists('auto_budget_type', $data) || !array_key_exists('auto_budget_amount', $data) || !array_key_exists('auto_budget_period', $data)) { return $newBudget; } - $type = $data['auto_budget_type']; + $type = $data['auto_budget_type']; if ('none' === $type) { return $newBudget; } @@ -767,8 +757,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface } /** @var CurrencyRepositoryInterface $repos */ - $repos = app(CurrencyRepositoryInterface::class); - $currency = null; + $repos = app(CurrencyRepositoryInterface::class); + $currency = null; if (array_key_exists('currency_id', $data)) { $currency = $repos->find((int) $data['currency_id']); } @@ -779,7 +769,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); } - $autoBudget = new AutoBudget(); + $autoBudget = new AutoBudget(); $autoBudget->budget()->associate($newBudget); $autoBudget->transaction_currency_id = $currency->id; $autoBudget->auto_budget_type = $type; @@ -788,11 +778,11 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $autoBudget->save(); // create initial budget limit. - $today = today(config('app.timezone')); - $start = app('navigation')->startOfPeriod($today, $autoBudget->period); - $end = app('navigation')->endOfPeriod($start, $autoBudget->period); + $today = today(config('app.timezone')); + $start = app('navigation')->startOfPeriod($today, $autoBudget->period); + $end = app('navigation')->endOfPeriod($start, $autoBudget->period); - $limitRepos = app(BudgetLimitRepositoryInterface::class); + $limitRepos = app(BudgetLimitRepositoryInterface::class); $limitRepos->setUser($this->user); $limitRepos->store( [ diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php index fa9d367d8a..b4c67ba329 100644 --- a/app/Repositories/Budget/NoBudgetRepository.php +++ b/app/Repositories/Budget/NoBudgetRepository.php @@ -45,17 +45,17 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf $carbonFormat = app('navigation')->preferredCarbonFormat($start, $end); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts($accounts)->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); $collector->withoutBudget(); - $journals = $collector->getExtractedJournals(); - $data = []; + $journals = $collector->getExtractedJournals(); + $data = []; /** @var array $journal */ foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $data[$currencyId] ??= [ 'id' => 0, @@ -68,7 +68,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf 'currency_decimal_places' => $journal['currency_decimal_places'], 'entries' => [], ]; - $date = $journal['date']->format($carbonFormat); + $date = $journal['date']->format($carbonFormat); if (!array_key_exists($date, $data[$currencyId]['entries'])) { $data[$currencyId]['entries'][$date] = '0'; @@ -82,7 +82,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?TransactionCurrency $currency = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); if (null !== $accounts && $accounts->count() > 0) { diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index eb6c70a52d..10ae195108 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -62,7 +62,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ++$count; app('log')->debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total)); } - $avg = $total; + $avg = $total; if ($count > 0) { $avg = bcdiv($total, (string) $count); } @@ -84,21 +84,21 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // get all transactions: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts($accounts)->setRange($start, $end); $collector->setBudgets($budgets); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); // loop transactions: /** @var array $journal */ foreach ($journals as $journal) { // prep data array for currency: - $budgetId = (int) $journal['budget_id']; - $budgetName = $journal['budget_name']; - $currencyId = (int) $journal['currency_id']; - $key = sprintf('%d-%d', $budgetId, $currencyId); + $budgetId = (int) $journal['budget_id']; + $budgetName = $journal['budget_name']; + $currencyId = (int) $journal['currency_id']; + $key = sprintf('%d-%d', $budgetId, $currencyId); - $data[$key] ??= [ + $data[$key] ??= [ 'id' => $budgetId, 'name' => sprintf('%s (%s)', $budgetName, $journal['currency_name']), 'sum' => '0', @@ -136,13 +136,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setBudgets($this->getBudgets()); } $collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $budgetId = (int) $journal['budget_id']; - $budgetName = (string) $journal['budget_name']; + $currencyId = (int) $journal['currency_id']; + $budgetId = (int) $journal['budget_id']; + $budgetName = (string) $journal['budget_name']; // catch "no category" entries. if (0 === $budgetId) { @@ -150,7 +150,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'budgets' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -202,7 +202,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $budgets = null, ?TransactionCurrency $currency = null - ): array { + ): array + { Log::debug(sprintf('Start of %s.', __METHOD__)); // this collector excludes all transfers TO liabilities (which are also withdrawals) // because those expenses only become expenses once they move from the liability to the friend. @@ -210,8 +211,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $repository = app(AccountRepositoryInterface::class); $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); /** @var Account $account */ foreach ($subset as $account) { @@ -221,12 +222,11 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user) - ->setRange($start, $end) + ->setRange($start, $end) // ->excludeDestinationAccounts($selection) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) - ; + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); if (null !== $accounts) { $collector->setAccounts($accounts); @@ -239,7 +239,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCurrency($currency); } $collector->setBudgets($budgets); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); // same but for transactions in the foreign currency: if (null !== $currency) { diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 19d1447857..195d163494 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; +use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\CategoryFactory; use FireflyIII\Models\Attachment; @@ -150,7 +151,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf public function store(array $data): Category { /** @var CategoryFactory $factory */ - $factory = app(CategoryFactory::class); + $factory = app(CategoryFactory::class); $factory->setUser($this->user); $category = $factory->findOrCreate(null, $data['name']); @@ -176,7 +177,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf public function updateNotes(Category $category, string $notes): void { - $dbNote = $category->notes()->first(); + $dbNote = $category->notes()->first(); if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($category); @@ -222,10 +223,9 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf private function getFirstTransactionDate(Category $category): ?Carbon { // check transactions: - $query = $category->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'ASC') - ; + $query = $category->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'ASC'); $lastTransaction = $query->first(['transaction_journals.*']); if (null !== $lastTransaction) { @@ -237,7 +237,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf public function getAttachments(Category $category): Collection { - $set = $category->attachments()->get(); + $set = $category->attachments()->get(); $disk = Storage::disk('upload'); @@ -271,7 +271,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ public function lastUseDate(Category $category, Collection $accounts): ?Carbon { @@ -297,7 +297,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf private function getLastJournalDate(Category $category, Collection $accounts): ?Carbon { - $query = $category->transactionJournals()->orderBy('date', 'DESC'); + $query = $category->transactionJournals()->orderBy('date', 'DESC'); if ($accounts->count() > 0) { $query->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id'); @@ -314,15 +314,14 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ private function getLastTransactionDate(Category $category, Collection $accounts): ?Carbon { // check transactions: - $query = $category->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'DESC') - ; + $query = $category->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'DESC'); if ($accounts->count() > 0) { // filter journals: $query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray()); @@ -347,7 +346,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ public function update(Category $category, array $data): Category { diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index d8ea7ce007..866f3b464f 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -52,12 +52,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $currencyId = (int) $journal['currency_id']; + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -74,12 +74,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn // add journal to array: // only a subset of the fields. - $journalId = (int) $journal['transaction_journal_id']; + $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] - = [ - 'amount' => app('steam')->negative($journal['amount']), - 'date' => $journal['date'], - ]; + = [ + 'amount' => app('steam')->negative($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; @@ -98,12 +98,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $currencyId = (int) $journal['currency_id']; + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -120,12 +120,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn ]; // add journal to array: // only a subset of the fields. - $journalId = (int) $journal['transaction_journal_id']; + $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] - = [ - 'amount' => app('steam')->positive($journal['amount']), - 'date' => $journal['date'], - ]; + = [ + 'amount' => app('steam')->positive($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; @@ -137,7 +137,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->withoutCategory(); if (null !== $accounts && $accounts->count() > 0) { @@ -161,12 +161,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -189,12 +189,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php index a0f5b168a7..e7e4043cdd 100644 --- a/app/Repositories/Category/OperationsRepository.php +++ b/app/Repositories/Category/OperationsRepository.php @@ -31,7 +31,6 @@ use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; @@ -64,13 +63,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -78,7 +77,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -141,13 +140,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -155,7 +154,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -194,8 +193,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::TRANSFER->value]) - ->setDestinationAccounts($accounts)->excludeSourceAccounts($accounts) - ; + ->setDestinationAccounts($accounts)->excludeSourceAccounts($accounts); if (null !== $categories && $categories->count() > 0) { $collector->setCategories($categories); } @@ -203,13 +201,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -217,7 +215,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -257,8 +255,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::TRANSFER->value]) - ->setSourceAccounts($accounts)->excludeDestinationAccounts($accounts) - ; + ->setSourceAccounts($accounts)->excludeDestinationAccounts($accounts); if (null !== $categories && $categories->count() > 0) { $collector->setCategories($categories); } @@ -266,13 +263,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -280,7 +277,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -321,7 +318,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $categories = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); if (null !== $accounts && $accounts->count() > 0) { @@ -344,10 +341,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function sumIncome(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $categories = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end) - ->setTypes([TransactionTypeEnum::DEPOSIT->value]) - ; + ->setTypes([TransactionTypeEnum::DEPOSIT->value]); if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); @@ -363,12 +359,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn foreach ($journals as $journal) { // Almost the same as in \FireflyIII\Repositories\Budget\OperationsRepository::sumExpenses - $amount = '0'; - $currencyId = (int) $journal['currency_id']; - $currencyName = $journal['currency_name']; - $currencySymbol = $journal['currency_symbol']; - $currencyCode = $journal['currency_code']; - $currencyDecimalPlaces = $journal['currency_decimal_places']; + $amount = '0'; + $currencyId = (int) $journal['currency_id']; + $currencyName = $journal['currency_name']; + $currencySymbol = $journal['currency_symbol']; + $currencyCode = $journal['currency_code']; + $currencyDecimalPlaces = $journal['currency_decimal_places']; if ($convertToNative) { $amount = Amount::getAmountFromJournal($journal); if ($default->id !== (int) $journal['currency_id'] && $default->id !== (int) $journal['foreign_currency_id']) { @@ -393,7 +389,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $amount = $journal['amount']; } - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => (string) $currencyId, 'currency_name' => $currencyName, @@ -415,8 +411,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end) - ->setTypes([TransactionTypeEnum::TRANSFER->value]) - ; + ->setTypes([TransactionTypeEnum::TRANSFER->value]); if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); @@ -425,12 +420,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $categories = $this->getCategories(); } $collector->setCategories($categories); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index db51f1f0dd..902b333a41 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -40,9 +40,9 @@ use FireflyIII\Services\Internal\Destroy\CurrencyDestroyService; use FireflyIII\Services\Internal\Update\CurrencyUpdateService; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Override; /** * Class CurrencyRepository. @@ -60,12 +60,235 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf return null !== $result; } + + /** + * @throws FireflyException + */ + public function currencyInUseAt(TransactionCurrency $currency): ?string + { + app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); + $countJournals = $this->countJournals($currency); + if ($countJournals > 0) { + app('log')->info(sprintf('Count journals is %d, return true.', $countJournals)); + + return 'journals'; + } + + // is the only currency left + if (1 === $this->getAll()->count()) { + app('log')->info('Is the last currency in the system, return true. '); + + return 'last_left'; + } + + // is being used in accounts: + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string) $currency->id))->count(); + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + + // second search using integer check. + $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int) $currency->id))->count(); + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + + // is being used in bills: + $bills = Bill::where('transaction_currency_id', $currency->id)->count(); + if ($bills > 0) { + app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills)); + + return 'bills'; + } + + // is being used in recurring transactions + $recurringAmount = RecurrenceTransaction::where('transaction_currency_id', $currency->id)->count(); + $recurringForeign = RecurrenceTransaction::where('foreign_currency_id', $currency->id)->count(); + + if ($recurringAmount > 0 || $recurringForeign > 0) { + app('log')->info(sprintf('Used in %d recurring transactions as (foreign) currency id, return true. ', $recurringAmount + $recurringForeign)); + + return 'recurring'; + } + + // 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(); + if ($meta > 0) { + app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); + + return 'account_meta'; + } + + // is being used in available budgets + $availableBudgets = AvailableBudget::where('transaction_currency_id', $currency->id)->count(); + if ($availableBudgets > 0) { + app('log')->info(sprintf('Used in %d available budgets as currency, return true. ', $availableBudgets)); + + return 'available_budgets'; + } + + // is being used in budget limits + $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count(); + if ($budgetLimit > 0) { + app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); + + return 'budget_limits'; + } + + // 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(); + if ($count > 0) { + app('log')->info('Is the default currency of the user, return true.'); + + return 'current_default'; + } + + // 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(); + if ($count > 0) { + app('log')->info('Is the default currency of the user group, return true.'); + + return 'current_default'; + } + + app('log')->debug('Currency is not used, return false.'); + + return null; + } + + private function countJournals(TransactionCurrency $currency): int + { + $count = $currency->transactions()->whereNull('deleted_at')->count() + $currency->transactionJournals()->whereNull('deleted_at')->count(); + + // also count foreign: + return $count + Transaction::where('foreign_currency_id', $currency->id)->count(); + } + + /** + * Returns ALL currencies, regardless of whether they are enabled or not. + */ + public function getAll(): Collection + { + $all = TransactionCurrency::orderBy('code', 'ASC')->get(); + $local = $this->get(); + + return $all->map(static function (TransactionCurrency $current) use ($local) { + $hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) { + return $entry->id === $current->id; + }); + $isNative = $local->contains(static function (TransactionCurrency $entry) use ($current) { + return 1 === (int) $entry->pivot->group_default && $entry->id === $current->id; + }); + $current->userGroupEnabled = $hasId; + $current->userGroupNative = $isNative; + + return $current; + }); + } + + public function get(): Collection + { + $all = $this->userGroup->currencies()->orderBy('code', 'ASC')->withPivot(['group_default'])->get(); + $all->map(static function (TransactionCurrency $current) { // @phpstan-ignore-line + $current->userGroupEnabled = true; + $current->userGroupNative = 1 === (int) $current->pivot->group_default; + + return $current; + }); + + /** @var Collection */ + return $all; + } + + public function destroy(TransactionCurrency $currency): bool + { + /** @var UserRepositoryInterface $repository */ + $repository = app(UserRepositoryInterface::class); + if ($repository->hasRole($this->user, 'owner')) { + /** @var CurrencyDestroyService $service */ + $service = app(CurrencyDestroyService::class); + $service->destroy($currency); + } + + return true; + } + public function disable(TransactionCurrency $currency): void { $this->userGroup->currencies()->detach($currency->id); $currency->enabled = false; $currency->save(); } + + public function findByName(string $name): ?TransactionCurrency + { + return TransactionCurrency::where('name', $name)->first(); + } + + /** + * Find by object, ID or code. Returns user default or system default. + * + * @throws FireflyException + */ + public function findCurrency(?int $currencyId, ?string $currencyCode): TransactionCurrency + { + $result = $this->findCurrencyNull($currencyId, $currencyCode); + + if (null === $result) { + app('log')->debug('Grabbing default currency for this user...'); + + /** @var null|TransactionCurrency $result */ + $result = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + } + + app('log')->debug(sprintf('Final result: %s', $result->code)); + if (false === $result->enabled) { + app('log')->debug(sprintf('Also enabled currency %s', $result->code)); + $this->enable($result); + } + + return $result; + } + + /** + * Find by object, ID or code. Returns NULL if nothing found. + */ + public function findCurrencyNull(?int $currencyId, ?string $currencyCode): ?TransactionCurrency + { + app('log')->debug('Now in findCurrencyNull()'); + $result = $this->find((int) $currencyId); + if (null === $result) { + app('log')->debug(sprintf('Searching for currency with code %s...', $currencyCode)); + $result = $this->findByCode((string) $currencyCode); + } + if (null !== $result && false === $result->enabled) { + app('log')->debug(sprintf('Also enabled currency %s', $result->code)); + $this->enable($result); + } + + return $result; + } + + #[Override] + public function find(int $currencyId): ?TransactionCurrency + { + return TransactionCurrency::find($currencyId); + } + + /** + * Find by currency code, return NULL if unfound. + */ + public function findByCode(string $currencyCode): ?TransactionCurrency + { + return TransactionCurrency::where('code', $currencyCode)->first(); + } + public function enable(TransactionCurrency $currency): void { $this->userGroup->currencies()->syncWithoutDetaching([$currency->id]); @@ -73,6 +296,91 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf $currency->save(); } + /** + * Returns the complete set of transactions but needs + * no user object. + */ + public function getCompleteSet(): Collection + { + return TransactionCurrency::where('enabled', true)->orderBy('code', 'ASC')->get(); + } + + /** + * Get currency exchange rate. + */ + public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate + { + if ($fromCurrency->id === $toCurrency->id) { + $rate = new CurrencyExchangeRate(); + $rate->rate = '1'; + $rate->id = 0; + + return $rate; + } + + /** @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(); + if (null !== $rate) { + app('log')->debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d'))); + + return $rate; + } + + return null; + } + + public function isFallbackCurrency(TransactionCurrency $currency): bool + { + return $currency->code === config('firefly.default_currency', 'EUR'); + } + + public function searchCurrency(string $search, int $limit): Collection + { + $query = TransactionCurrency::where('enabled', true); + if ('' !== $search) { + $query->whereLike('name', sprintf('%%%s%%', $search)); + } + + return $query->take($limit)->get(); + } + + /** + * TODO must be a factory + */ + public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate + { + return CurrencyExchangeRate::create( + [ + 'user_id' => $this->user->id, + 'user_group_id' => $this->user->user_group_id, + 'from_currency_id' => $fromCurrency->id, + 'to_currency_id' => $toCurrency->id, + 'date' => $date, + 'date_tz' => $date->format('e'), + 'rate' => $rate, + ] + ); + } + + /** + * @throws FireflyException + */ + public function store(array $data): TransactionCurrency + { + /** @var TransactionCurrencyFactory $factory */ + $factory = app(TransactionCurrencyFactory::class); + $result = $factory->create($data); + + if (true === $data['enabled']) { + $this->userGroup->currencies()->attach($result->id); + } + + return $result; + } + public function update(TransactionCurrency $currency, array $data): TransactionCurrency { app('log')->debug('Now in update()'); @@ -111,33 +419,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf return $service->update($currency, $data); } - public function destroy(TransactionCurrency $currency): bool - { - /** @var UserRepositoryInterface $repository */ - $repository = app(UserRepositoryInterface::class); - if ($repository->hasRole($this->user, 'owner')) { - /** @var CurrencyDestroyService $service */ - $service = app(CurrencyDestroyService::class); - $service->destroy($currency); - } - return true; - } - /** - * @throws FireflyException - */ - public function store(array $data): TransactionCurrency - { - /** @var TransactionCurrencyFactory $factory */ - $factory = app(TransactionCurrencyFactory::class); - $result = $factory->create($data); - - if (true === $data['enabled']) { - $this->userGroup->currencies()->attach($result->id); - } - - return $result; - } public function makeDefault(TransactionCurrency $currency): void { $current = app('amount')->getNativeCurrencyByUserGroup($this->userGroup); @@ -153,230 +435,4 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf event(new UserGroupChangedDefaultCurrency($this->userGroup)); } } - public function isFallbackCurrency(TransactionCurrency $currency): bool - { - return $currency->code === config('firefly.default_currency', 'EUR'); - } - /** - * Returns ALL currencies, regardless of whether they are enabled or not. - */ - public function getAll(): Collection - { - $all = TransactionCurrency::orderBy('code', 'ASC')->get(); - $local = $this->get(); - - return $all->map(static function (TransactionCurrency $current) use ($local) { - $hasId = $local->contains(static function (TransactionCurrency $entry) use ($current) { - return $entry->id === $current->id; - }); - $isNative = $local->contains(static function (TransactionCurrency $entry) use ($current) { - return 1 === (int) $entry->pivot->group_default && $entry->id === $current->id; - }); - $current->userGroupEnabled = $hasId; - $current->userGroupNative = $isNative; - - return $current; - }); - } - - private function countJournals(TransactionCurrency $currency): int - { - $count = $currency->transactions()->whereNull('deleted_at')->count() + $currency->transactionJournals()->whereNull('deleted_at')->count(); - - // also count foreign: - return $count + Transaction::where('foreign_currency_id', $currency->id)->count(); - } - /** - * @throws FireflyException - */ - public function currencyInUseAt(TransactionCurrency $currency): ?string - { - app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); - $countJournals = $this->countJournals($currency); - if ($countJournals > 0) { - app('log')->info(sprintf('Count journals is %d, return true.', $countJournals)); - - return 'journals'; - } - - // is the only currency left - if (1 === $this->getAll()->count()) { - app('log')->info('Is the last currency in the system, return true. '); - - return 'last_left'; - } - - // is being used in accounts: - $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((string) $currency->id))->count(); - if ($meta > 0) { - app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); - - return 'account_meta'; - } - - // second search using integer check. - $meta = AccountMeta::where('name', 'currency_id')->where('data', json_encode((int) $currency->id))->count(); - if ($meta > 0) { - app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); - - return 'account_meta'; - } - - // is being used in bills: - $bills = Bill::where('transaction_currency_id', $currency->id)->count(); - if ($bills > 0) { - app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills)); - - return 'bills'; - } - - // is being used in recurring transactions - $recurringAmount = RecurrenceTransaction::where('transaction_currency_id', $currency->id)->count(); - $recurringForeign = RecurrenceTransaction::where('foreign_currency_id', $currency->id)->count(); - - if ($recurringAmount > 0 || $recurringForeign > 0) { - app('log')->info(sprintf('Used in %d recurring transactions as (foreign) currency id, return true. ', $recurringAmount + $recurringForeign)); - - return 'recurring'; - } - - // 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() - ; - if ($meta > 0) { - app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); - - return 'account_meta'; - } - - // is being used in available budgets - $availableBudgets = AvailableBudget::where('transaction_currency_id', $currency->id)->count(); - if ($availableBudgets > 0) { - app('log')->info(sprintf('Used in %d available budgets as currency, return true. ', $availableBudgets)); - - return 'available_budgets'; - } - - // is being used in budget limits - $budgetLimit = BudgetLimit::where('transaction_currency_id', $currency->id)->count(); - if ($budgetLimit > 0) { - app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); - - return 'budget_limits'; - } - - // 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(); - if ($count > 0) { - app('log')->info('Is the default currency of the user, return true.'); - - return 'current_default'; - } - - // 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(); - if ($count > 0) { - app('log')->info('Is the default currency of the user group, return true.'); - - return 'current_default'; - } - - app('log')->debug('Currency is not used, return false.'); - - return null; - } - - public function searchCurrency(string $search, int $limit): Collection - { - $query = TransactionCurrency::where('enabled', true); - if ('' !== $search) { - $query->whereLike('name', sprintf('%%%s%%', $search)); - } - - return $query->take($limit)->get(); - } - - #[\Override] - public function find(int $currencyId): ?TransactionCurrency - { - return TransactionCurrency::find($currencyId); - } - - /** - * Find by currency code, return NULL if unfound. - */ - public function findByCode(string $currencyCode): ?TransactionCurrency - { - return TransactionCurrency::where('code', $currencyCode)->first(); - } - - /** - * Returns the complete set of transactions but needs - * no user object. - */ - public function getCompleteSet(): Collection - { - return TransactionCurrency::where('enabled', true)->orderBy('code', 'ASC')->get(); - } - public function get(): Collection - { - $all = $this->userGroup->currencies()->orderBy('code', 'ASC')->withPivot(['group_default'])->get(); - $all->map(static function (TransactionCurrency $current) { // @phpstan-ignore-line - $current->userGroupEnabled = true; - $current->userGroupNative = 1 === (int) $current->pivot->group_default; - - return $current; - }); - - /** @var Collection */ - return $all; - } - - /** - * Get currency exchange rate. - */ - public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate - { - if ($fromCurrency->id === $toCurrency->id) { - $rate = new CurrencyExchangeRate(); - $rate->rate = '1'; - $rate->id = 0; - - return $rate; - } - - /** @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() - ; - if (null !== $rate) { - app('log')->debug(sprintf('Found cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d'))); - - return $rate; - } - - return null; - } - - /** - * TODO must be a factory - */ - public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate - { - return CurrencyExchangeRate::create( - [ - 'user_id' => $this->user->id, - 'user_group_id' => $this->user->user_group_id, - 'from_currency_id' => $fromCurrency->id, - 'to_currency_id' => $toCurrency->id, - 'date' => $date, - 'date_tz' => $date->format('e'), - 'rate' => $rate, - ] - ); - } } diff --git a/app/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 2c36d54ad4..95dc252f46 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -46,26 +46,24 @@ use Illuminate\Support\Collection; */ interface CurrencyRepositoryInterface { - public function find(int $currencyId): ?TransactionCurrency; - public function searchCurrency(string $search, int $limit): Collection; - public function isFallbackCurrency(TransactionCurrency $currency): bool; - public function getAll(): Collection; - public function store(array $data): TransactionCurrency; - public function makeDefault(TransactionCurrency $currency): void; - public function destroy(TransactionCurrency $currency): bool; - public function enable(TransactionCurrency $currency): void; - public function disable(TransactionCurrency $currency): void; - public function update(TransactionCurrency $currency, array $data): TransactionCurrency; + /** + * @throws FireflyException + */ + public function currencyInUse(TransactionCurrency $currency): bool; - /** - * @throws FireflyException - */ - public function currencyInUse(TransactionCurrency $currency); /** * @throws FireflyException */ public function currencyInUseAt(TransactionCurrency $currency): ?string; + public function destroy(TransactionCurrency $currency): bool; + + public function disable(TransactionCurrency $currency): void; + + public function enable(TransactionCurrency $currency): void; + + public function find(int $currencyId): ?TransactionCurrency; + /** * Find by currency code, return NULL if unfound. * @@ -73,6 +71,21 @@ interface CurrencyRepositoryInterface */ public function findByCode(string $currencyCode): ?TransactionCurrency; + public function findByName(string $name): ?TransactionCurrency; + + public function findCurrency(?int $currencyId, ?string $currencyCode): TransactionCurrency; + + public function findCurrencyNull(?int $currencyId, ?string $currencyCode): ?TransactionCurrency; + + /** + * Get the user group's currencies. + * + * @return Collection + */ + public function get(): Collection; + + public function getAll(): Collection; + /** * Returns the complete set of transactions but needs * no user object. @@ -81,14 +94,6 @@ interface CurrencyRepositoryInterface */ public function getCompleteSet(): Collection; - /** - * Get the user group's currencies. - * - * @return Collection - */ - public function get(): Collection; - - /** * Get currency exchange rate. * @@ -96,10 +101,20 @@ interface CurrencyRepositoryInterface */ public function getExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date): ?CurrencyExchangeRate; + public function isFallbackCurrency(TransactionCurrency $currency): bool; + + public function makeDefault(TransactionCurrency $currency): void; + + public function searchCurrency(string $search, int $limit): Collection; + /** * Set currency exchange rate. * * Used in download exchange rate cron job. Needs the user object! */ public function setExchangeRate(TransactionCurrency $fromCurrency, TransactionCurrency $toCurrency, Carbon $date, float $rate): CurrencyExchangeRate; + + public function store(array $data): TransactionCurrency; + + public function update(TransactionCurrency $currency, array $data): TransactionCurrency; } diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/ExchangeRate/ExchangeRateRepository.php index 1c30c93d26..e086f53ecc 100644 --- a/app/Repositories/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/ExchangeRate/ExchangeRateRepository.php @@ -30,24 +30,25 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use Override; class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGroupInterface { use UserGroupTrait; - #[\Override] + #[Override] public function deleteRate(CurrencyExchangeRate $rate): void { $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); } - #[\Override] + #[Override] public function getAll(): Collection { return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); } - #[\Override] + #[Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { // orderBy('date', 'DESC')->toRawSql(); @@ -56,21 +57,18 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro ->where(function (Builder $q1) use ($from, $to): void { $q1->where(function (Builder $q) use ($from, $to): void { $q->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id) - ; + ->where('to_currency_id', $to->id); })->orWhere(function (Builder $q) use ($from, $to): void { $q->where('from_currency_id', $to->id) - ->where('to_currency_id', $from->id) - ; + ->where('to_currency_id', $from->id); }); }) ->orderBy('date', 'DESC') - ->get(['currency_exchange_rates.*']) - ; + ->get(['currency_exchange_rates.*']); } - #[\Override] + #[Override] public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate { /** @var null|CurrencyExchangeRate */ @@ -79,11 +77,10 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro ->where('from_currency_id', $from->id) ->where('to_currency_id', $to->id) ->where('date', $date->format('Y-m-d')) - ->first() - ; + ->first(); } - #[\Override] + #[Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { $object = new CurrencyExchangeRate(); @@ -99,7 +96,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro return $object; } - #[\Override] + #[Override] public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { $object->rate = $rate; diff --git a/app/Repositories/Journal/JournalAPIRepository.php b/app/Repositories/Journal/JournalAPIRepository.php index 97efb75814..05682f09a2 100644 --- a/app/Repositories/Journal/JournalAPIRepository.php +++ b/app/Repositories/Journal/JournalAPIRepository.php @@ -47,10 +47,9 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn public function findTransaction(int $transactionId): ?Transaction { return Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->where('transaction_journals.user_id', $this->user->id) - ->where('transactions.id', $transactionId) - ->first(['transactions.*']) - ; + ->where('transaction_journals.user_id', $this->user->id) + ->where('transactions.id', $transactionId) + ->first(['transactions.*']); } /** @@ -60,7 +59,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn */ public function getAttachments(TransactionJournal $journal): Collection { - $set = $journal->attachments; + $set = $journal->attachments; $disk = Storage::disk('upload'); diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php index c3b51cd860..220f4833b0 100644 --- a/app/Repositories/Journal/JournalCLIRepository.php +++ b/app/Repositories/Journal/JournalCLIRepository.php @@ -32,6 +32,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use stdClass; /** * Class JournalCLIRepository @@ -46,10 +47,9 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn public function getAllJournals(array $types): Collection { return TransactionJournal::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->whereIn('transaction_types.type', $types) - ->with(['user', 'transactionType', 'transactionCurrency', 'transactions', 'transactions.account']) - ->get(['transaction_journals.*']) - ; + ->whereIn('transaction_types.type', $types) + ->with(['user', 'transactionType', 'transactionCurrency', 'transactions', 'transactions.account']) + ->get(['transaction_journals.*']); } /** @@ -57,7 +57,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn */ public function getJournalBudgetId(TransactionJournal $journal): int { - $budget = $journal->budgets()->first(); + $budget = $journal->budgets()->first(); if (null !== $budget) { return $budget->id; } @@ -77,7 +77,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn */ public function getJournalCategoryId(TransactionJournal $journal): int { - $category = $journal->categories()->first(); + $category = $journal->categories()->first(); if (null !== $category) { return $category->id; } @@ -129,7 +129,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn */ public function getMetaField(TransactionJournal $journal, string $field): ?string { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty('journal-meta-updated'); $cache->addProperty($journal->id); $cache->addProperty($field); @@ -138,12 +138,12 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn return $cache->get(); } - $entry = $journal->transactionJournalMeta()->where('name', $field)->first(); + $entry = $journal->transactionJournalMeta()->where('name', $field)->first(); if (null === $entry) { return null; } - $value = $entry->data; + $value = $entry->data; if (is_array($value)) { $return = implode(',', $value); @@ -179,12 +179,11 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn public function getSplitJournals(): Collection { $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->groupBy('transaction_journals.id') - ; + ->groupBy('transaction_journals.id'); $result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line $journalIds = []; - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($result as $row) { if ((int) $row->transaction_count > 2) { $journalIds[] = (int) $row->id; @@ -193,8 +192,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn $journalIds = array_unique($journalIds); return TransactionJournal::with(['transactions']) - ->whereIn('id', $journalIds)->get() - ; + ->whereIn('id', $journalIds)->get(); } /** diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 7ef358d137..19936aa599 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -67,8 +67,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac ->transactionJournals() ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') ->whereIn('transaction_types.type', $types) - ->get(['transaction_journals.*']) - ; + ->get(['transaction_journals.*']); } /** @@ -102,7 +101,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac */ public function getJournalTotal(TransactionJournal $journal): string { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($journal->id); $cache->addProperty('amount-positive'); if ($cache->has()) { @@ -151,8 +150,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac return new Carbon($cache->get()); } $entry = TransactionJournalMeta::where('transaction_journal_id', $journalId) - ->where('name', $field)->first() - ; + ->where('name', $field)->first(); if (null === $entry) { return null; } @@ -195,8 +193,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac public function searchJournalDescriptions(string $search, int $limit): Collection { $query = $this->user->transactionJournals() - ->orderBy('date', 'DESC') - ; + ->orderBy('date', 'DESC'); if ('' !== $search) { $query->whereLike('description', sprintf('%%%s%%', $search)); } diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index 024e097959..401c9dc023 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\LinkType; +use Exception; use FireflyIII\Events\DestroyedTransactionLink; use FireflyIII\Models\LinkType; use FireflyIII\Models\Note; @@ -71,7 +72,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf } /** - * @throws \Exception + * @throws Exception */ public function destroyLink(TransactionJournalLink $link): bool { @@ -116,13 +117,12 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf public function getJournalLinks(?LinkType $linkType = null): Collection { $query = TransactionJournalLink::with(['source', 'destination']) - ->leftJoin('transaction_journals as source_journals', 'journal_links.source_id', '=', 'source_journals.id') - ->leftJoin('transaction_journals as dest_journals', 'journal_links.destination_id', '=', 'dest_journals.id') - ->where('source_journals.user_id', $this->user->id) - ->where('dest_journals.user_id', $this->user->id) - ->whereNull('source_journals.deleted_at') - ->whereNull('dest_journals.deleted_at') - ; + ->leftJoin('transaction_journals as source_journals', 'journal_links.source_id', '=', 'source_journals.id') + ->leftJoin('transaction_journals as dest_journals', 'journal_links.destination_id', '=', 'dest_journals.id') + ->where('source_journals.user_id', $this->user->id) + ->where('dest_journals.user_id', $this->user->id) + ->whereNull('source_journals.deleted_at') + ->whereNull('dest_journals.deleted_at'); if (null !== $linkType) { $query->where('journal_links.link_type_id', $linkType->id); @@ -172,7 +172,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf /** * Store link between two journals. * - * @throws \Exception + * @throws Exception */ public function storeLink(array $information, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink { @@ -192,7 +192,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf return $existing; } - $link = new TransactionJournalLink(); + $link = new TransactionJournalLink(); $link->linkType()->associate($linkType); if ('inward' === $information['direction']) { app('log')->debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $inward->id, $outward->id)); @@ -233,13 +233,12 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf public function findSpecificLink(LinkType $linkType, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink { return TransactionJournalLink::where('link_type_id', $linkType->id) - ->where('source_id', $inward->id) - ->where('destination_id', $outward->id)->first() - ; + ->where('source_id', $inward->id) + ->where('destination_id', $outward->id)->first(); } /** - * @throws \Exception + * @throws Exception */ private function setNoteText(TransactionJournalLink $link, string $text): void { @@ -281,7 +280,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf /** * Update an existing transaction journal link. * - * @throws \Exception + * @throws Exception */ public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink { @@ -297,7 +296,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf $journalLink->refresh(); } - $journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id']; + $journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id']; $journalLink->save(); if (array_key_exists('notes', $data) && null !== $data['notes']) { $this->setNoteText($journalLink, $data['notes']); diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php index 4299155670..66559e3ee8 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php @@ -53,10 +53,9 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup public function get(): Collection { return $this->user->objectGroups() - ->with(['piggyBanks', 'bills']) - ->orderBy('order', 'ASC') - ->orderBy('title', 'ASC')->get() - ; + ->with(['piggyBanks', 'bills']) + ->orderBy('order', 'ASC') + ->orderBy('title', 'ASC')->get(); } public function deleteEmpty(): void @@ -149,18 +148,16 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup if ($newOrder > $oldOrder) { $this->user->objectGroups()->where('object_groups.order', '<=', $newOrder)->where('object_groups.order', '>', $oldOrder) - ->where('object_groups.id', '!=', $objectGroup->id) - ->decrement('object_groups.order') - ; + ->where('object_groups.id', '!=', $objectGroup->id) + ->decrement('object_groups.order'); $objectGroup->order = $newOrder; $objectGroup->save(); } if ($newOrder < $oldOrder) { $this->user->objectGroups()->where('object_groups.order', '>=', $newOrder)->where('object_groups.order', '<', $oldOrder) - ->where('object_groups.id', '!=', $objectGroup->id) - ->increment('object_groups.order') - ; + ->where('object_groups.id', '!=', $objectGroup->id) + ->increment('object_groups.order'); $objectGroup->order = $newOrder; $objectGroup->save(); diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index 568e37895d..af0e803881 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\PiggyBank; +use Exception; use FireflyIII\Events\Model\PiggyBank\ChangedAmount; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\PiggyBankFactory; @@ -68,9 +69,9 @@ trait ModifiesPiggyBanks $pivot->native_current_amount = null; // also update native_current_amount. - $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); if ($userCurrency->id !== $piggyBank->transaction_currency_id) { - $converter = new ExchangeRateConverter(); + $converter = new ExchangeRateConverter(); $converter->setIgnoreSettings(true); $pivot->native_current_amount = $converter->convert($piggyBank->transactionCurrency, $userCurrency, today(), $pivot->current_amount); } @@ -91,9 +92,9 @@ trait ModifiesPiggyBanks $pivot->native_current_amount = null; // also update native_current_amount. - $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); if ($userCurrency->id !== $piggyBank->transaction_currency_id) { - $converter = new ExchangeRateConverter(); + $converter = new ExchangeRateConverter(); $converter->setIgnoreSettings(true); $pivot->native_current_amount = $converter->convert($piggyBank->transactionCurrency, $userCurrency, today(), $pivot->current_amount); } @@ -125,8 +126,8 @@ trait ModifiesPiggyBanks Log::debug(sprintf('Maximum amount: %s', $maxAmount)); } - $compare = bccomp($amount, $maxAmount); - $result = $compare <= 0; + $compare = bccomp($amount, $maxAmount); + $result = $compare <= 0; Log::debug(sprintf('Compare <= 0? %d, so canAddAmount is %s', $compare, var_export($result, true))); @@ -141,7 +142,7 @@ trait ModifiesPiggyBanks } /** - * @throws \Exception + * @throws Exception */ public function destroy(PiggyBank $piggyBank): bool { @@ -160,11 +161,11 @@ trait ModifiesPiggyBanks public function setCurrentAmount(PiggyBank $piggyBank, string $amount): PiggyBank { - $repetition = $this->getRepetition($piggyBank); + $repetition = $this->getRepetition($piggyBank); if (null === $repetition) { return $piggyBank; } - $max = $piggyBank->target_amount; + $max = $piggyBank->target_amount; if (1 === bccomp($amount, $max) && 0 !== bccomp($piggyBank->target_amount, '0')) { $amount = $max; } @@ -207,14 +208,14 @@ trait ModifiesPiggyBanks public function update(PiggyBank $piggyBank, array $data): PiggyBank { - $piggyBank = $this->updateProperties($piggyBank, $data); + $piggyBank = $this->updateProperties($piggyBank, $data); if (array_key_exists('notes', $data)) { $this->updateNote($piggyBank, (string) $data['notes']); } // update the order of the piggy bank: - $oldOrder = $piggyBank->order; - $newOrder = (int) ($data['order'] ?? $oldOrder); + $oldOrder = $piggyBank->order; + $newOrder = (int) ($data['order'] ?? $oldOrder); if ($oldOrder !== $newOrder) { $this->setOrder($piggyBank, $newOrder); } @@ -307,7 +308,7 @@ trait ModifiesPiggyBanks return; } - $dbNote = $piggyBank->notes()->first(); + $dbNote = $piggyBank->notes()->first(); if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($piggyBank); @@ -318,16 +319,15 @@ trait ModifiesPiggyBanks public function setOrder(PiggyBank $piggyBank, int $newOrder): bool { - $oldOrder = $piggyBank->order; + $oldOrder = $piggyBank->order; // Log::debug(sprintf('Will move piggy bank #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder)); if ($newOrder > $oldOrder) { PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder) - ->where('piggy_banks.id', '!=', $piggyBank->id) - ->distinct()->decrement('piggy_banks.order') - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder) + ->where('piggy_banks.id', '!=', $piggyBank->id) + ->distinct()->decrement('piggy_banks.order'); $piggyBank->order = $newOrder; Log::debug(sprintf('[1] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder)); @@ -336,12 +336,11 @@ trait ModifiesPiggyBanks return true; } PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.order', '>=', $newOrder)->where('piggy_banks.order', '<', $oldOrder) - ->where('piggy_banks.id', '!=', $piggyBank->id) - ->distinct()->increment('piggy_banks.order') - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.order', '>=', $newOrder)->where('piggy_banks.order', '<', $oldOrder) + ->where('piggy_banks.id', '!=', $piggyBank->id) + ->distinct()->increment('piggy_banks.order'); $piggyBank->order = $newOrder; Log::debug(sprintf('[2] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder)); @@ -362,7 +361,7 @@ trait ModifiesPiggyBanks } // if this account contains less than the amount, remove the current amount, update the amount and continue. $this->removeAmount($piggyBank, $account, $current); - $amount = bcsub($amount, $current); + $amount = bcsub($amount, $current); } } } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index 4616fd1415..cdf2e86837 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -41,6 +41,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; +use Override; /** * Class PiggyBankRepository. @@ -56,10 +57,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte Log::channel('audit')->info('Delete all piggy banks through destroyAll'); PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->delete() - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->delete(); } public function findPiggyBank(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank @@ -90,10 +90,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function find(int $piggyBankId): ?PiggyBank { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']); } /** @@ -102,15 +101,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function findByName(string $name): ?PiggyBank { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.name', $name)->first(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.name', $name)->first(['piggy_banks.*']); } public function getAttachments(PiggyBank $piggyBank): Collection { - $set = $piggyBank->attachments()->get(); + $set = $piggyBank->attachments()->get(); $disk = Storage::disk('upload'); @@ -157,15 +155,15 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte { app('log')->debug(sprintf('Now in getExactAmount(%d, %d)', $piggyBank->id, $journal->id)); - $operator = null; - $currency = null; + $operator = null; + $currency = null; /** @var JournalRepositoryInterface $journalRepost */ - $journalRepost = app(JournalRepositoryInterface::class); + $journalRepost = app(JournalRepositoryInterface::class); $journalRepost->setUser($this->user); /** @var AccountRepositoryInterface $accountRepos */ - $accountRepos = app(AccountRepositoryInterface::class); + $accountRepos = app(AccountRepositoryInterface::class); $accountRepos->setUser($this->user); $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); @@ -173,11 +171,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte app('log')->debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code)); /** @var Transaction $source */ - $source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first(); + $source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first(); /** @var Transaction $destination */ - $destination = $journal->transactions()->with(['account'])->where('amount', '>', 0)->first(); - $hits = 0; + $destination = $journal->transactions()->with(['account'])->where('amount', '>', 0)->first(); + $hits = 0; foreach ($piggyBank->accounts as $account) { // matches source, which means amount will be removed from piggy: @@ -209,7 +207,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte } // currency of the account + the piggy bank currency are almost the same. // which amount from the transaction matches? - $amount = null; + $amount = null; if ((int) $source->transaction_currency_id === $currency->id) { app('log')->debug('Use normal amount'); $amount = app('steam')->{$operator}($source->amount); // @phpstan-ignore-line @@ -225,9 +223,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte } app('log')->debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount)); - $currentAmount = $this->getCurrentAmount($piggyBank); - $room = bcsub($piggyBank->target_amount, $currentAmount); - $compare = bcmul($currentAmount, '-1'); + $currentAmount = $this->getCurrentAmount($piggyBank); + $room = bcsub($piggyBank->target_amount, $currentAmount); + $compare = bcmul($currentAmount, '-1'); if (0 === bccomp($piggyBank->target_amount, '0')) { // amount is zero? then the "room" is positive amount of we wish to add or remove. @@ -308,15 +306,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function getPiggyBanks(): Collection { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']); } public function getRepetition(PiggyBank $piggyBank, bool $overrule = false): ?PiggyBankRepetition @@ -382,24 +379,23 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte return $balance; } - #[\Override] + #[Override] public function purgeAll(): void { PiggyBank::withTrashed() - ->whereNotNull('piggy_banks.deleted_at') - ->leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->delete() - ; + ->whereNotNull('piggy_banks.deleted_at') + ->leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->delete(); } - #[\Override] + #[Override] public function resetOrder(): void { $factory = new PiggyBankFactory(); @@ -410,21 +406,19 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function searchPiggyBank(string $query, int $limit): Collection { $search = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->distinct() - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->distinct(); if ('' !== $query) { $search->whereLike('piggy_banks.name', sprintf('%%%s%%', $query)); } $search->orderBy('piggy_banks.order', 'ASC') - ->orderBy('piggy_banks.name', 'ASC') - ; + ->orderBy('piggy_banks.name', 'ASC'); return $search->take($limit)->get(['piggy_banks.*']); } diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index 1d6c47c5ac..539dcf799b 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -45,7 +45,6 @@ use FireflyIII\Support\Repositories\Recurring\CalculateXOccurrencesSince; use FireflyIII\Support\Repositories\Recurring\FiltersWeekends; use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; -use FireflyIII\User; use Illuminate\Database\Eloquent\Builder; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; @@ -68,9 +67,9 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte // if not, loop set and try to read the recurrence_date. If it matches start or end, return it as well. $set = TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence): void { - $q1->where('name', 'recurrence_id'); - $q1->where('data', json_encode((string) $recurrence->id)); - })->get(['journal_meta.transaction_journal_id']); + $q1->where('name', 'recurrence_id'); + $q1->where('data', json_encode((string) $recurrence->id)); + })->get(['journal_meta.transaction_journal_id']); // there are X journals made for this recurrence. Any of them meant for today? foreach ($set as $journalMeta) { @@ -80,9 +79,8 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $q2->where('name', 'recurrence_date'); $q2->where('data', json_encode($string)); }) - ->where('transaction_journal_id', $journalMeta->transaction_journal_id) - ->count() - ; + ->where('transaction_journal_id', $journalMeta->transaction_journal_id) + ->count(); if ($count > 0) { app('log')->debug(sprintf('Looks like journal #%d was already created', $journalMeta->transaction_journal_id)); @@ -99,12 +97,11 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function get(): Collection { return $this->user->recurrences() - ->with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) - ->orderBy('active', 'DESC') - ->orderBy('transaction_type_id', 'ASC') - ->orderBy('title', 'ASC') - ->get() - ; + ->with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) + ->orderBy('active', 'DESC') + ->orderBy('transaction_type_id', 'ASC') + ->orderBy('title', 'ASC') + ->get(); } /** @@ -130,10 +127,9 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte { // grab ALL recurring transactions: return Recurrence::with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) - ->orderBy('active', 'DESC') - ->orderBy('title', 'ASC') - ->get() - ; + ->orderBy('active', 'DESC') + ->orderBy('title', 'ASC') + ->get(); } public function getBillId(RecurrenceTransaction $recTransaction): ?int @@ -208,11 +204,10 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte { Log::debug(sprintf('Now in getJournalCount(#%d, "%s", "%s")', $recurrence->id, $start?->format('Y-m-d H:i:s'), $end?->format('Y-m-d H:i:s'))); $query = TransactionJournal::leftJoin('journal_meta', 'journal_meta.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transaction_journals.user_id', $recurrence->user_id) - ->whereNull('transaction_journals.deleted_at') - ->where('journal_meta.name', 'recurrence_id') - ->where('journal_meta.data', '"'.$recurrence->id.'"') - ; + ->where('transaction_journals.user_id', $recurrence->user_id) + ->whereNull('transaction_journals.deleted_at') + ->where('journal_meta.name', 'recurrence_id') + ->where('journal_meta.data', '"' . $recurrence->id . '"'); if (null !== $start) { $query->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')); } @@ -231,11 +226,10 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function getJournalIds(Recurrence $recurrence): array { return TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') - ->where('transaction_journals.user_id', $this->user->id) - ->where('journal_meta.name', '=', 'recurrence_id') - ->where('journal_meta.data', '=', json_encode((string) $recurrence->id)) - ->get(['journal_meta.transaction_journal_id'])->pluck('transaction_journal_id')->toArray() - ; + ->where('transaction_journals.user_id', $this->user->id) + ->where('journal_meta.name', '=', 'recurrence_id') + ->where('journal_meta.data', '=', json_encode((string) $recurrence->id)) + ->get(['journal_meta.transaction_journal_id'])->pluck('transaction_journal_id')->toArray(); } /** @@ -283,24 +277,22 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function getTransactionPaginator(Recurrence $recurrence, int $page, int $pageSize): LengthAwarePaginator { $journalMeta = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') - ->whereNull('transaction_journals.deleted_at') - ->where('transaction_journals.user_id', $this->user->id) - ->where('name', 'recurrence_id') - ->where('data', json_encode((string) $recurrence->id)) - ->get()->pluck('transaction_journal_id')->toArray() - ; + ->whereNull('transaction_journals.deleted_at') + ->where('transaction_journals.user_id', $this->user->id) + ->where('name', 'recurrence_id') + ->where('data', json_encode((string) $recurrence->id)) + ->get()->pluck('transaction_journal_id')->toArray(); $search = []; foreach ($journalMeta as $journalId) { $search[] = (int) $journalId; } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($recurrence->user); $collector->withCategoryInformation()->withBudgetInformation()->setLimit($pageSize)->setPage($page) - ->withAccountInformation() - ; + ->withAccountInformation(); $collector->setJournalIds($search); return $collector->getPaginatedGroups(); @@ -309,12 +301,11 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function getTransactions(Recurrence $recurrence): Collection { $journalMeta = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') - ->whereNull('transaction_journals.deleted_at') - ->where('transaction_journals.user_id', $this->user->id) - ->where('name', 'recurrence_id') - ->where('data', json_encode((string) $recurrence->id)) - ->get()->pluck('transaction_journal_id')->toArray() - ; + ->whereNull('transaction_journals.deleted_at') + ->where('transaction_journals.user_id', $this->user->id) + ->where('name', 'recurrence_id') + ->where('data', json_encode((string) $recurrence->id)) + ->get()->pluck('transaction_journal_id')->toArray(); $search = []; foreach ($journalMeta as $journalId) { @@ -325,7 +316,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($recurrence->user); $collector->withCategoryInformation()->withBudgetInformation()->withAccountInformation(); @@ -468,21 +459,21 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte ); } if ('ndom' === $repetition->repetition_type) { - $parts = explode(',', $repetition->repetition_moment); + $parts = explode(',', $repetition->repetition_moment); // first part is number of week, second is weekday. $dayOfWeek = trans(sprintf('config.dow_%s', $parts[1]), [], $language); return (string) trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language); } if ('yearly' === $repetition->repetition_type) { - $today = today(config('app.timezone'))->endOfYear(); - $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment); + $today = today(config('app.timezone'))->endOfYear(); + $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment); if (null === $repDate) { $repDate = clone $today; } $diffInYears = (int) $today->diffInYears($repDate, true); $repDate->addYears($diffInYears); // technically not necessary. - $string = $repDate->isoFormat((string) trans('config.month_and_day_no_year_js')); + $string = $repDate->isoFormat((string) trans('config.month_and_day_no_year_js')); return (string) trans('firefly.recurring_yearly', ['date' => $string], $language); } @@ -497,8 +488,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $search->whereLike('recurrences.title', sprintf('%%%s%%', $query)); } $search - ->orderBy('recurrences.title', 'ASC') - ; + ->orderBy('recurrences.title', 'ASC'); return $search->take($limit)->get(['id', 'title', 'description']); } @@ -544,7 +534,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $occurrences = []; $mutator = clone $start; $mutator->startOfDay(); - $skipMod = $repetition->repetition_skip + 1; + $skipMod = $repetition->repetition_skip + 1; app('log')->debug(sprintf('Calculating occurrences for rep type "%s"', $repetition->repetition_type)); app('log')->debug(sprintf('Mutator is now: %s', $mutator->format('Y-m-d'))); diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index ca214c6edd..07698ce7f5 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Rule; +use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; @@ -42,7 +43,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface use UserGroupTrait; /** - * @throws \Exception + * @throws Exception */ public function destroy(Rule $rule): bool { @@ -111,7 +112,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface { $count = $rule->ruleTriggers()->count(); if (0 === $count) { - throw new FireflyException('Rules should have more than zero triggers, rule #'.$rule->id.' has none!'); + throw new FireflyException('Rules should have more than zero triggers, rule #' . $rule->id . ' has none!'); } return $rule->ruleTriggers()->where('trigger_type', 'user_action')->first()->trigger_value; @@ -141,7 +142,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface if ('user_action' === $trigger->trigger_type) { continue; } - $triggerType = $trigger->trigger_type; + $triggerType = $trigger->trigger_type; if (str_starts_with($trigger->trigger_type, '-')) { $triggerType = substr($trigger->trigger_type, 1); } @@ -160,14 +161,13 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function getStoreRules(): Collection { $collection = $this->user->rules() - ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') - ->where('rules.active', true) - ->where('rule_groups.active', true) - ->orderBy('rule_groups.order', 'ASC') - ->orderBy('rules.order', 'ASC') - ->orderBy('rules.id', 'ASC') - ->with(['ruleGroup', 'ruleTriggers'])->get(['rules.*']) - ; + ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') + ->where('rules.active', true) + ->where('rule_groups.active', true) + ->orderBy('rule_groups.order', 'ASC') + ->orderBy('rules.order', 'ASC') + ->orderBy('rules.id', 'ASC') + ->with(['ruleGroup', 'ruleTriggers'])->get(['rules.*']); $filtered = new Collection(); /** @var Rule $rule */ @@ -186,14 +186,13 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function getUpdateRules(): Collection { $collection = $this->user->rules() - ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') - ->where('rules.active', true) - ->where('rule_groups.active', true) - ->orderBy('rule_groups.order', 'ASC') - ->orderBy('rules.order', 'ASC') - ->orderBy('rules.id', 'ASC') - ->with(['ruleGroup', 'ruleTriggers'])->get() - ; + ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') + ->where('rules.active', true) + ->where('rule_groups.active', true) + ->orderBy('rule_groups.order', 'ASC') + ->orderBy('rules.order', 'ASC') + ->orderBy('rules.id', 'ASC') + ->with(['ruleGroup', 'ruleTriggers'])->get(); $filtered = new Collection(); /** @var Rule $rule */ @@ -216,8 +215,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface $search->whereLike('rules.title', sprintf('%%%s%%', $query)); } $search->orderBy('rules.order', 'ASC') - ->orderBy('rules.title', 'ASC') - ; + ->orderBy('rules.title', 'ASC'); return $search->take($limit)->get(['id', 'title', 'description']); } @@ -227,7 +225,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface */ public function store(array $data): Rule { - $ruleGroup = null; + $ruleGroup = null; if (array_key_exists('rule_group_id', $data)) { $ruleGroup = $this->user->ruleGroups()->find($data['rule_group_id']); } @@ -241,7 +239,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface /** @var RuleGroup $ruleGroup */ // start by creating a new rule: - $rule = new Rule(); + $rule = new Rule(); $rule->user()->associate($this->user); $rule->userGroup()->associate($this->user->userGroup); @@ -285,7 +283,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface private function setRuleTrigger(string $moment, Rule $rule): void { /** @var null|RuleTrigger $trigger */ - $trigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first(); + $trigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first(); if (null !== $trigger) { $trigger->trigger_value = $moment; $trigger->save(); @@ -313,20 +311,19 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function setOrder(Rule $rule, int $newOrder): void { - $oldOrder = $rule->order; - $groupId = $rule->rule_group_id; - $maxOrder = $this->maxOrder($rule->ruleGroup); - $newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder; + $oldOrder = $rule->order; + $groupId = $rule->rule_group_id; + $maxOrder = $this->maxOrder($rule->ruleGroup); + $newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder; app('log')->debug(sprintf('New order will be %d', $newOrder)); if ($newOrder > $oldOrder) { $this->user->rules() - ->where('rules.rule_group_id', $groupId) - ->where('rules.order', '<=', $newOrder) - ->where('rules.order', '>', $oldOrder) - ->where('rules.id', '!=', $rule->id) - ->decrement('rules.order') - ; + ->where('rules.rule_group_id', $groupId) + ->where('rules.order', '<=', $newOrder) + ->where('rules.order', '>', $oldOrder) + ->where('rules.id', '!=', $rule->id) + ->decrement('rules.order'); $rule->order = $newOrder; app('log')->debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder)); $rule->save(); @@ -335,12 +332,11 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface } $this->user->rules() - ->where('rules.rule_group_id', $groupId) - ->where('rules.order', '>=', $newOrder) - ->where('rules.order', '<', $oldOrder) - ->where('rules.id', '!=', $rule->id) - ->increment('rules.order') - ; + ->where('rules.rule_group_id', $groupId) + ->where('rules.order', '>=', $newOrder) + ->where('rules.order', '<', $oldOrder) + ->where('rules.id', '!=', $rule->id) + ->increment('rules.order'); $rule->order = $newOrder; app('log')->debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder)); $rule->save(); @@ -365,7 +361,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface // empty the value in case the rule needs no context // TODO create a helper to automatically return these. - $needTrue = [ + $needTrue = [ 'reconciled', 'has_attachments', 'has_any_category', @@ -392,7 +388,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface $value = ''; } - $triggerValues = [ + $triggerValues = [ 'action' => $type, 'value' => $value, 'stop_processing' => $stopProcessing, @@ -406,7 +402,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function storeTrigger(Rule $rule, array $values): RuleTrigger { - $ruleTrigger = new RuleTrigger(); + $ruleTrigger = new RuleTrigger(); $ruleTrigger->rule()->associate($rule); $ruleTrigger->order = $values['order']; $ruleTrigger->active = $values['active']; @@ -439,7 +435,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function storeAction(Rule $rule, array $values): RuleAction { - $ruleAction = new RuleAction(); + $ruleAction = new RuleAction(); $ruleAction->rule()->associate($rule); $ruleAction->order = $values['order']; $ruleAction->active = $values['active']; @@ -469,7 +465,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface } $rule->save(); $rule->refresh(); - $group = $rule->ruleGroup; + $group = $rule->ruleGroup; // update the order: $this->resetRuleOrder($group); if (array_key_exists('order', $data)) { diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index 8615e346ec..f065c377f6 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\RuleGroup; +use Exception; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; @@ -47,8 +48,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte ->orderBy('order', 'ASC') ->orderBy('active', 'DESC') ->orderBy('title', 'ASC') - ->get(['rule_groups.id']) - ; + ->get(['rule_groups.id']); $index = 1; /** @var RuleGroup $ruleGroup */ @@ -72,7 +72,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } /** - * @throws \Exception + * @throws Exception */ public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool { @@ -105,8 +105,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte ->whereNull('deleted_at') ->orderBy('order', 'ASC') ->orderBy('title', 'DESC') - ->get() - ; + ->get(); $count = 1; /** @var RuleGroup $entry */ @@ -128,11 +127,10 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function resetRuleOrder(RuleGroup $ruleGroup): bool { $set = $ruleGroup->rules() - ->orderBy('order', 'ASC') - ->orderBy('title', 'DESC') - ->orderBy('updated_at', 'DESC') - ->get(['rules.*']) - ; + ->orderBy('order', 'ASC') + ->orderBy('title', 'DESC') + ->orderBy('updated_at', 'DESC') + ->get(['rules.*']); $count = 1; /** @var Rule $entry */ @@ -154,11 +152,10 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte private function resetRuleActionOrder(Rule $rule): void { $actions = $rule->ruleActions() - ->orderBy('order', 'ASC') - ->orderBy('active', 'DESC') - ->orderBy('action_type', 'ASC') - ->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('active', 'DESC') + ->orderBy('action_type', 'ASC') + ->get(); $index = 1; /** @var RuleAction $action */ @@ -175,11 +172,10 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte private function resetRuleTriggerOrder(Rule $rule): void { $triggers = $rule->ruleTriggers() - ->orderBy('order', 'ASC') - ->orderBy('active', 'DESC') - ->orderBy('trigger_type', 'ASC') - ->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('active', 'DESC') + ->orderBy('trigger_type', 'ASC') + ->get(); $index = 1; /** @var RuleTrigger $trigger */ @@ -226,51 +222,47 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function getActiveRules(RuleGroup $group): Collection { return $group->rules() - ->where('rules.active', true) - ->get(['rules.*']) - ; + ->where('rules.active', true) + ->get(['rules.*']); } public function getActiveStoreRules(RuleGroup $group): Collection { return $group->rules() - ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') - ->where('rule_triggers.trigger_type', 'user_action') - ->where('rule_triggers.trigger_value', 'store-journal') - ->where('rules.active', true) - ->get(['rules.*']) - ; + ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') + ->where('rule_triggers.trigger_type', 'user_action') + ->where('rule_triggers.trigger_value', 'store-journal') + ->where('rules.active', true) + ->get(['rules.*']); } public function getActiveUpdateRules(RuleGroup $group): Collection { return $group->rules() - ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') - ->where('rule_triggers.trigger_type', 'user_action') - ->where('rule_triggers.trigger_value', 'update-journal') - ->where('rules.active', true) - ->get(['rules.*']) - ; + ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') + ->where('rule_triggers.trigger_type', 'user_action') + ->where('rule_triggers.trigger_value', 'update-journal') + ->where('rules.active', true) + ->get(['rules.*']); } public function getAllRuleGroupsWithRules(?string $filter): Collection { $groups = $this->user->ruleGroups() - ->orderBy('order', 'ASC') - ->with( - [ // @phpstan-ignore-line - 'rules' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleTriggers' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleActions' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - ] - )->get() - ; + ->orderBy('order', 'ASC') + ->with( + [ // @phpstan-ignore-line + 'rules' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleTriggers' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleActions' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + ] + )->get(); if (null === $filter) { return $groups; } @@ -311,22 +303,21 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function getRuleGroupsWithRules(?string $filter): Collection { $groups = $this->user->ruleGroups() - ->orderBy('order', 'ASC') - ->where('active', true) - ->with( - [ // @phpstan-ignore-line - 'rules' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleTriggers' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleActions' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - ] - )->get() - ; + ->orderBy('order', 'ASC') + ->where('active', true) + ->with( + [ // @phpstan-ignore-line + 'rules' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleTriggers' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleActions' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + ] + )->get(); if (null === $filter) { return $groups; } @@ -360,8 +351,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function getRules(RuleGroup $group): Collection { return $group->rules() - ->get(['rules.*']) - ; + ->get(['rules.*']); } public function maxOrder(): int @@ -376,8 +366,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte $search->whereLike('rule_groups.title', sprintf('%%%s%%', $query)); } $search->orderBy('rule_groups.order', 'ASC') - ->orderBy('rule_groups.title', 'ASC') - ; + ->orderBy('rule_groups.title', 'ASC'); return $search->take($limit)->get(['id', 'title', 'description']); } @@ -405,13 +394,12 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function setOrder(RuleGroup $ruleGroup, int $newOrder): void { - $oldOrder = $ruleGroup->order; + $oldOrder = $ruleGroup->order; if ($newOrder > $oldOrder) { $this->user->ruleGroups()->where('rule_groups.order', '<=', $newOrder)->where('rule_groups.order', '>', $oldOrder) - ->where('rule_groups.id', '!=', $ruleGroup->id) - ->decrement('order') - ; + ->where('rule_groups.id', '!=', $ruleGroup->id) + ->decrement('order'); $ruleGroup->order = $newOrder; app('log')->debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder)); $ruleGroup->save(); @@ -420,9 +408,8 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } $this->user->ruleGroups()->where('rule_groups.order', '>=', $newOrder)->where('rule_groups.order', '<', $oldOrder) - ->where('rule_groups.id', '!=', $ruleGroup->id) - ->increment('order') - ; + ->where('rule_groups.id', '!=', $ruleGroup->id) + ->increment('order'); $ruleGroup->order = $newOrder; app('log')->debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder)); $ruleGroup->save(); diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php index 9fe781fd00..d15dd83b6a 100644 --- a/app/Repositories/Tag/OperationsRepository.php +++ b/app/Repositories/Tag/OperationsRepository.php @@ -47,9 +47,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $tagIds = []; + $tagIds = []; if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } @@ -66,7 +66,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $array = []; $listedJournals = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $array[$currencyId] ??= [ 'tags' => [], 'currency_id' => $currencyId, @@ -78,9 +78,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // may have multiple tags: foreach ($journal['tags'] as $tag) { - $tagId = (int) $tag['id']; - $tagName = (string) $tag['name']; - $journalId = (int) $journal['transaction_journal_id']; + $tagId = (int) $tag['id']; + $tagName = (string) $tag['name']; + $journalId = (int) $journal['transaction_journal_id']; if (!in_array($tagId, $tagIds, true)) { continue; } @@ -89,7 +89,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn if (in_array($journalId, $listedJournals, true)) { continue; } - $listedJournals[] = $journalId; + $listedJournals[] = $journalId; $array[$currencyId]['tags'][$tagId] ??= [ 'id' => $tagId, 'name' => $tagName, @@ -130,9 +130,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function listIncome(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $tagIds = []; + $tagIds = []; if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } @@ -150,7 +150,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $listedJournals = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $array[$currencyId] ??= [ 'tags' => [], 'currency_id' => $currencyId, @@ -162,9 +162,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // may have multiple tags: foreach ($journal['tags'] as $tag) { - $tagId = (int) $tag['id']; - $tagName = (string) $tag['name']; - $journalId = (int) $journal['transaction_journal_id']; + $tagId = (int) $tag['id']; + $tagName = (string) $tag['name']; + $journalId = (int) $journal['transaction_journal_id']; if (!in_array($tagId, $tagIds, true)) { continue; @@ -173,9 +173,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn if (in_array($journalId, $listedJournals, true)) { continue; } - $listedJournals[] = $journalId; + $listedJournals[] = $journalId; - $array[$currencyId]['tags'][$tagId] ??= [ + $array[$currencyId]['tags'][$tagId] ??= [ 'id' => $tagId, 'name' => $tagName, 'transaction_journals' => [], diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 3e74489477..7a4039869e 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -24,6 +24,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; +use Exception; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Factory\TagFactory; use FireflyIII\Helpers\Collector\GroupCollectorInterface; @@ -51,7 +52,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface } /** - * @throws \Exception + * @throws Exception */ public function destroy(Tag $tag): bool { @@ -119,7 +120,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface return $set->each( static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line /** @var null|Note $note */ - $note = $attachment->notes()->first(); + $note = $attachment->notes()->first(); // only used in v1 view of tags $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null === $note ? '' : $note->text; @@ -130,7 +131,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface public function getTagsInYear(?int $year): array { // get all tags in the year (if present): - $tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag'); + $tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag'); // add date range (or not): if (null === $year) { @@ -140,7 +141,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface if (null !== $year) { app('log')->debug(sprintf('Get tags with year %s.', $year)); - $tagQuery->where('tags.date', '>=', $year.'-01-01 00:00:00')->where('tags.date', '<=', $year.'-12-31 23:59:59'); + $tagQuery->where('tags.date', '>=', $year . '-01-01 00:00:00')->where('tags.date', '<=', $year . '-12-31 23:59:59'); } $collection = $tagQuery->get(); $return = []; @@ -235,13 +236,13 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface } $collector->setTag($tag)->withAccountInformation(); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); - $sums = []; + $sums = []; /** @var array $journal */ foreach ($journals as $journal) { - $found = false; + $found = false; /** @var array $localTag */ foreach ($journal['tags'] as $localTag) { @@ -252,7 +253,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface if (false === $found) { continue; } - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $sums[$currencyId] ??= [ 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -266,14 +267,14 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface ]; // add amount to correct type: - $amount = app('steam')->positive((string) $journal['amount']); - $type = $journal['transaction_type_type']; + $amount = app('steam')->positive((string) $journal['amount']); + $type = $journal['transaction_type_type']; if (TransactionTypeEnum::WITHDRAWAL->value === $type) { $amount = bcmul($amount, '-1'); } $sums[$currencyId][$type] = bcadd($sums[$currencyId][$type], $amount); - $foreignCurrencyId = $journal['foreign_currency_id']; + $foreignCurrencyId = $journal['foreign_currency_id']; if (null !== $foreignCurrencyId && 0 !== $foreignCurrencyId) { $sums[$foreignCurrencyId] ??= [ 'currency_id' => $foreignCurrencyId, @@ -287,7 +288,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface TransactionTypeEnum::OPENING_BALANCE->value => '0', ]; // add foreign amount to correct type: - $amount = app('steam')->positive((string) $journal['foreign_amount']); + $amount = app('steam')->positive((string) $journal['foreign_amount']); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { $amount = bcmul($amount, '-1'); } @@ -352,7 +353,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface // otherwise, update or create. if (!(null === $data['latitude'] && null === $data['longitude'] && null === $data['zoom_level'])) { - $location = $this->getLocation($tag); + $location = $this->getLocation($tag); if (null === $location) { $location = new Location(); $location->locatable()->associate($tag); diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index 97a5b7f48c..4e8085fb7a 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -25,6 +25,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\TransactionGroup; use Carbon\Carbon; +use Exception; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\DuplicateTransactionException; use FireflyIII\Exceptions\FireflyException; @@ -140,22 +141,21 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, { $repository = app(AttachmentRepositoryInterface::class); $repository->setUser($this->user); - $journals = $group->transactionJournals->pluck('id')->toArray(); - $set = Attachment::whereIn('attachable_id', $journals) - ->where('attachable_type', TransactionJournal::class) - ->where('uploaded', true) - ->whereNull('deleted_at')->get() - ; + $journals = $group->transactionJournals->pluck('id')->toArray(); + $set = Attachment::whereIn('attachable_id', $journals) + ->where('attachable_type', TransactionJournal::class) + ->where('uploaded', true) + ->whereNull('deleted_at')->get(); - $result = []; + $result = []; /** @var Attachment $attachment */ foreach ($set as $attachment) { - $journalId = $attachment->attachable_id; - $result[$journalId] ??= []; - $current = $attachment->toArray(); - $current['file_exists'] = true; - $current['notes'] = $repository->getNoteText($attachment); + $journalId = $attachment->attachable_id; + $result[$journalId] ??= []; + $current = $attachment->toArray(); + $current['file_exists'] = true; + $current['notes'] = $repository->getNoteText($attachment); // already determined that this attachable is a TransactionJournal. $current['journal_title'] = $attachment->attachable->description; $result[$journalId][] = $current; @@ -171,9 +171,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, { /** @var null|Note $note */ $note = Note::where('noteable_id', $journalId) - ->where('noteable_type', TransactionJournal::class) - ->first() - ; + ->where('noteable_type', TransactionJournal::class) + ->first(); if (null === $note) { return null; } @@ -194,14 +193,13 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $q->orWhereIn('destination_id', $journals); } ) - ->with(['source', 'destination', 'source.transactions']) - ->leftJoin('link_types', 'link_types.id', '=', 'journal_links.link_type_id') - ->get(['journal_links.*', 'link_types.inward', 'link_types.outward', 'link_types.editable']) - ; + ->with(['source', 'destination', 'source.transactions']) + ->leftJoin('link_types', 'link_types.id', '=', 'journal_links.link_type_id') + ->get(['journal_links.*', 'link_types.inward', 'link_types.outward', 'link_types.editable']); /** @var TransactionJournalLink $entry */ foreach ($set as $entry) { - $journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id; + $journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id; $return[$journalId] ??= []; // phpstan: the editable field is provided by the query. @@ -265,10 +263,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, if (0 === bccomp('0', $transaction->foreign_amount)) { return ''; } - $currency = $transaction->foreignCurrency; - $type = $journal->transactionType->type; - $amount = app('steam')->positive($transaction->foreign_amount); - $return = ''; + $currency = $transaction->foreignCurrency; + $type = $journal->transactionType->type; + $amount = app('steam')->positive($transaction->foreign_amount); + $return = ''; if (TransactionTypeEnum::WITHDRAWAL->value === $type) { $return = app('amount')->formatAnything($currency, app('steam')->negative($amount)); } @@ -291,16 +289,15 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, /** * Return object with all found meta field things as Carbon objects. * - * @throws \Exception + * @throws Exception */ public function getMetaDateFields(int $journalId, array $fields): NullArrayObject { $query = DB::table('journal_meta') - ->where('transaction_journal_id', $journalId) - ->whereIn('name', $fields) - ->whereNull('deleted_at') - ->get(['name', 'data']) - ; + ->where('transaction_journal_id', $journalId) + ->whereIn('name', $fields) + ->whereNull('deleted_at') + ->get(['name', 'data']); $return = []; foreach ($query as $row) { @@ -316,11 +313,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, public function getMetaFields(int $journalId, array $fields): NullArrayObject { $query = DB::table('journal_meta') - ->where('transaction_journal_id', $journalId) - ->whereIn('name', $fields) - ->whereNull('deleted_at') - ->get(['name', 'data']) - ; + ->where('transaction_journal_id', $journalId) + ->whereIn('name', $fields) + ->whereNull('deleted_at') + ->get(['name', 'data']); $return = []; foreach ($query as $row) { @@ -341,9 +337,8 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $journals = $group->transactionJournals->pluck('id')->toArray(); $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); $data = PiggyBankEvent::whereIn('transaction_journal_id', $journals) - ->with('piggyBank', 'piggyBank.account') - ->get(['piggy_bank_events.*']) - ; + ->with('piggyBank', 'piggyBank.account') + ->get(['piggy_bank_events.*']); /** @var PiggyBankEvent $row */ foreach ($data as $row) { @@ -351,14 +346,13 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, continue; } // get currency preference. - $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id) - ->where('name', 'currency_id') - ->first() - ; + $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id) + ->where('name', 'currency_id') + ->first(); if (null !== $currencyPreference) { $currency = TransactionCurrency::where('id', $currencyPreference->data)->first(); } - $journalId = $row->transaction_journal_id; + $journalId = $row->transaction_journal_id; $return[$journalId] ??= []; $return[$journalId][] = [ @@ -385,11 +379,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, public function getTags(int $journalId): array { $result = DB::table('tag_transaction_journal') - ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') - ->where('tag_transaction_journal.transaction_journal_id', $journalId) - ->orderBy('tags.tag', 'ASC') - ->get(['tags.tag']) - ; + ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') + ->where('tag_transaction_journal.transaction_journal_id', $journalId) + ->orderBy('tags.tag', 'ASC') + ->get(['tags.tag']); return $result->pluck('tag')->toArray(); } diff --git a/app/Repositories/TransactionType/TransactionTypeRepository.php b/app/Repositories/TransactionType/TransactionTypeRepository.php index 0576e9018c..79a4b38557 100644 --- a/app/Repositories/TransactionType/TransactionTypeRepository.php +++ b/app/Repositories/TransactionType/TransactionTypeRepository.php @@ -42,7 +42,7 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface return $type; } $typeString ??= TransactionTypeEnum::WITHDRAWAL->value; - $search = $this->findByType($typeString); + $search = $this->findByType($typeString); if (null === $search) { $search = $this->findByType(TransactionTypeEnum::WITHDRAWAL->value); } diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 9abc8554a3..8b28036de3 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -23,6 +23,7 @@ declare(strict_types=1); namespace FireflyIII\Repositories\User; +use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\GroupMembership; @@ -34,6 +35,7 @@ use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; use Illuminate\Support\Str; +use Override; /** * Class UserRepository. @@ -44,17 +46,17 @@ class UserRepository implements UserRepositoryInterface * This updates the users email address and records some things so it can be confirmed or undone later. * The user is blocked until the change is confirmed. * - * @throws \Exception + * @throws Exception * * @see updateEmail */ public function changeEmail(User $user, string $newEmail): bool { - $oldEmail = $user->email; + $oldEmail = $user->email; // save old email as pref app('preferences')->setForUser($user, 'previous_email_latest', $oldEmail); - app('preferences')->setForUser($user, 'previous_email_'.date('Y-m-d-H-i-s'), $oldEmail); + app('preferences')->setForUser($user, 'previous_email_' . date('Y-m-d-H-i-s'), $oldEmail); // set undo and confirm token: app('preferences')->setForUser($user, 'email_change_undo_token', bin2hex(random_bytes(16))); @@ -99,7 +101,7 @@ class UserRepository implements UserRepositoryInterface } /** - * @throws \Exception + * @throws Exception */ public function destroy(User $user): bool { @@ -171,7 +173,7 @@ class UserRepository implements UserRepositoryInterface public function getRolesInGroup(User $user, int $groupId): array { /** @var null|UserGroup $group */ - $group = UserGroup::find($groupId); + $group = UserGroup::find($groupId); if (null === $group) { throw new FireflyException(sprintf('Could not find group #%d', $groupId)); } @@ -197,7 +199,7 @@ class UserRepository implements UserRepositoryInterface */ public function getUserData(User $user): array { - $return = []; + $return = []; // two factor: $return['has_2fa'] = null !== $user->mfa_secret; @@ -213,12 +215,11 @@ class UserRepository implements UserRepositoryInterface $return['categories'] = $user->categories()->count(); $return['budgets'] = $user->budgets()->count(); $return['budgets_with_limits'] = BudgetLimit::distinct() - ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->where('amount', '>', 0) - ->whereNull('budgets.deleted_at') - ->where('budgets.user_id', $user->id) - ->count('budget_limits.budget_id') - ; + ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') + ->where('amount', '>', 0) + ->whereNull('budgets.deleted_at') + ->where('budgets.user_id', $user->id) + ->count('budget_limits.budget_id'); $return['rule_groups'] = $user->ruleGroups()->count(); $return['rules'] = $user->rules()->count(); $return['tags'] = $user->tags()->count(); @@ -226,7 +227,7 @@ class UserRepository implements UserRepositoryInterface return $return; } - public function hasRole(null|Authenticatable|User $user, string $role): bool + public function hasRole(null | Authenticatable | User $user, string $role): bool { if (null === $user) { return false; @@ -243,7 +244,7 @@ class UserRepository implements UserRepositoryInterface return false; } - #[\Override] + #[Override] public function getUserGroups(User $user): Collection { $memberships = $user->groupMemberships()->get(); @@ -255,7 +256,7 @@ class UserRepository implements UserRepositoryInterface /** @var null|UserGroup $group */ $group = $membership->userGroup()->first(); if (null !== $group) { - $groupId = $group->id; + $groupId = $group->id; if (in_array($groupId, array_keys($set), true)) { continue; } @@ -267,14 +268,14 @@ class UserRepository implements UserRepositoryInterface return $collection; } - public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser + public function inviteUser(null | Authenticatable | User $user, string $email): InvitedUser { if (!$user instanceof User) { throw new FireflyException('User is not a User object.'); } - $now = today(config('app.timezone')); + $now = today(config('app.timezone')); $now->addDays(2); - $invitee = new InvitedUser(); + $invitee = new InvitedUser(); $invitee->user()->associate($user); $invitee->invite_code = Str::random(64); $invitee->email = $email; @@ -385,11 +386,11 @@ class UserRepository implements UserRepositoryInterface if ('' === $newEmail) { return true; } - $oldEmail = $user->email; + $oldEmail = $user->email; // save old email as pref app('preferences')->setForUser($user, 'admin_previous_email_latest', $oldEmail); - app('preferences')->setForUser($user, 'admin_previous_email_'.date('Y-m-d-H-i-s'), $oldEmail); + app('preferences')->setForUser($user, 'admin_previous_email_' . date('Y-m-d-H-i-s'), $oldEmail); $user->email = $newEmail; $user->save(); diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index 50c84ecb12..feb490ef96 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -106,9 +106,9 @@ interface UserRepositoryInterface public function getUserGroups(User $user): Collection; - public function hasRole(null|Authenticatable|User $user, string $role): bool; + public function hasRole(null | Authenticatable | User $user, string $role): bool; - public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser; + public function inviteUser(null | Authenticatable | User $user, string $email): InvitedUser; public function redeemCode(string $code): void; diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index e75221c4e3..553013b943 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -35,6 +35,8 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; use Illuminate\Support\Collection; +use Override; +use ValueError; /** * Class UserGroupRepository @@ -51,7 +53,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte /** @var GroupMembership $membership */ foreach ($memberships as $membership) { /** @var null|User $user */ - $user = $membership->user()->first(); + $user = $membership->user()->first(); if (null === $user) { continue; } @@ -80,8 +82,8 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte // all users are now moved away from user group. // time to DESTROY all objects. // we have to do this one by one to trigger the necessary observers :( - $objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups', - 'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks', + $objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups', + 'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks', ]; foreach ($objects as $object) { foreach ($userGroup->{$object}()->get() as $item) { // @phpstan-ignore-line @@ -108,7 +110,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte /** @var null|UserGroup $group */ $group = $membership->userGroup()->first(); if (null !== $group) { - $groupId = $group->id; + $groupId = $group->id; if (in_array($groupId, array_keys($set), true)) { continue; } @@ -133,14 +135,14 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte while ($exists && $loop < 10) { $existingGroup = $this->findByName($groupName); if (null === $existingGroup) { - $exists = false; + $exists = false; /** @var null|UserGroup $existingGroup */ $existingGroup = $this->store(['user' => $user, 'title' => $groupName]); } if (null !== $existingGroup) { // group already exists - $groupName = sprintf('%s-%s', $user->email, substr(sha1(rand(1000, 9999).microtime()), 0, 4)); + $groupName = sprintf('%s-%s', $user->email, substr(sha1(rand(1000, 9999) . microtime()), 0, 4)); } ++$loop; } @@ -161,7 +163,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte $data['user'] = $this->user; /** @var UserGroupFactory $factory */ - $factory = app(UserGroupFactory::class); + $factory = app(UserGroupFactory::class); return $factory->create($data); } @@ -176,13 +178,13 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte return UserGroup::all(); } - #[\Override] + #[Override] public function getById(int $id): ?UserGroup { return UserGroup::find($id); } - #[\Override] + #[Override] public function getMembershipsFromGroupId(int $groupId): Collection { return $this->user->groupMemberships()->where('user_group_id', $groupId)->get(); @@ -192,10 +194,10 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte { $userGroup->title = $data['title']; $userGroup->save(); - $currency = null; + $currency = null; /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class); + $repository = app(CurrencyRepositoryInterface::class); if (array_key_exists('native_currency_code', $data)) { $repository->setUser($this->user); @@ -221,11 +223,11 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte */ public function updateMembership(UserGroup $userGroup, array $data): UserGroup { - $owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first(); + $owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first(); app('log')->debug('in update membership'); /** @var null|User $user */ - $user = null; + $user = null; if (array_key_exists('id', $data)) { /** @var null|User $user */ $user = User::find($data['id']); @@ -264,9 +266,8 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte if ($membershipCount > 1) { // group has multiple members. How many are owner, except the user we're editing now? $ownerCount = $userGroup->groupMemberships() - ->where('user_role_id', $owner->id) - ->where('user_id', '!=', $user->id)->count() - ; + ->where('user_role_id', $owner->id) + ->where('user_id', '!=', $user->id)->count(); // if there are no other owners and the current users does not get or keep the owner role, refuse. if ( 0 === $ownerCount @@ -286,7 +287,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte foreach ($rolesSimplified as $role) { try { $enum = UserRoleEnum::from($role); - } catch (\ValueError $e) { + } catch (ValueError $e) { // TODO error message continue; } @@ -313,7 +314,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte return $roles; } - #[\Override] + #[Override] public function useUserGroup(UserGroup $userGroup): void { $this->user->user_group_id = $userGroup->id; diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index 97877aeb3e..a82c50d8b1 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -37,6 +37,8 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; +use Override; +use stdClass; /** * Class AccountRepository @@ -47,7 +49,7 @@ class AccountRepository implements AccountRepositoryInterface { use UserGroupTrait; - #[\Override] + #[Override] public function countAccounts(array $types): int { $query = $this->userGroup->accounts(); @@ -70,8 +72,7 @@ class AccountRepository implements AccountRepositoryInterface $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); } - ) - ; + ); if (0 !== count($types)) { $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -98,7 +99,7 @@ class AccountRepository implements AccountRepositoryInterface public function findByName(string $name, array $types): ?Account { - $query = $this->userGroup->accounts(); + $query = $this->userGroup->accounts(); if (0 !== count($types)) { $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -120,7 +121,7 @@ class AccountRepository implements AccountRepositoryInterface return $account; } - #[\Override] + #[Override] public function getAccountBalances(Account $account): Collection { return $account->accountBalances; @@ -128,8 +129,8 @@ class AccountRepository implements AccountRepositoryInterface 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)) { @@ -174,13 +175,12 @@ class AccountRepository implements AccountRepositoryInterface return $account; } - #[\Override] + #[Override] public function getAccountTypes(Collection $accounts): Collection { return AccountType::leftJoin('accounts', 'accounts.account_type_id', '=', 'account_types.id') - ->whereIn('accounts.id', $accounts->pluck('id')->toArray()) - ->get(['accounts.id', 'account_types.type']) - ; + ->whereIn('accounts.id', $accounts->pluck('id')->toArray()) + ->get(['accounts.id', 'account_types.type']); } public function getAccountsById(array $accountIds): Collection @@ -197,7 +197,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[\Override] + #[Override] public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection { $query = $this->userGroup->accounts(); @@ -237,17 +237,17 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[\Override] + #[Override] public function getLastActivity(Collection $accounts): array { return Transaction::whereIn('account_id', $accounts->pluck('id')->toArray()) - ->leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id') - ->groupBy('transactions.account_id') - ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) as date_max')])->toArray() // @phpstan-ignore-line - ; + ->leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id') + ->groupBy('transactions.account_id') + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) as date_max')])->toArray() // @phpstan-ignore-line + ; } - #[\Override] + #[Override] public function getMetaValues(Collection $accounts, array $fields): Collection { $query = AccountMeta::whereIn('account_id', $accounts->pluck('id')->toArray()); @@ -258,23 +258,22 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data']); } - #[\Override] + #[Override] public function getObjectGroups(Collection $accounts): array { $groupIds = []; $return = []; $set = DB::table('object_groupables')->where('object_groupable_type', Account::class) - ->whereIn('object_groupable_id', $accounts->pluck('id')->toArray())->get() - ; + ->whereIn('object_groupable_id', $accounts->pluck('id')->toArray())->get(); - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($set as $row) { $groupIds[] = $row->object_group_id; } $groupIds = array_unique($groupIds); $groups = ObjectGroup::whereIn('id', $groupIds)->get(); - /** @var \stdClass $row */ + /** @var stdClass $row */ foreach ($set as $row) { if (!array_key_exists($row->object_groupable_id, $return)) { /** @var null|ObjectGroup $group */ @@ -312,18 +311,17 @@ class AccountRepository implements AccountRepositoryInterface } } // reset the rest to zero. - $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; + $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; $this->user->accounts()->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->whereNotIn('account_types.type', $all) - ->update(['order' => 0]) - ; + ->whereNotIn('account_types.type', $all) + ->update(['order' => 0]); } public function getAccountsByType(array $types, ?array $sort = [], ?array $filters = []): Collection { - $sortable = ['name', 'active']; // TODO yes this is a duplicate array. - $res = array_intersect([AccountTypeEnum::ASSET->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value], $types); - $query = $this->userGroup->accounts(); + $sortable = ['name', 'active']; // TODO yes this is a duplicate array. + $res = array_intersect([AccountTypeEnum::ASSET->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value], $types); + $query = $this->userGroup->accounts(); if (0 !== count($types)) { $query->accountTypeIn($types); } @@ -370,7 +368,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[\Override] + #[Override] public function update(Account $account, array $data): Account { /** @var AccountUpdateService $service */ @@ -383,13 +381,12 @@ class AccountRepository implements AccountRepositoryInterface { // search by group, not by user $dbQuery = $this->userGroup->accounts() - ->where('active', true) - ->orderBy('accounts.updated_at', 'ASC') - ->orderBy('accounts.order', 'ASC') - ->orderBy('accounts.account_type_id', 'ASC') - ->orderBy('accounts.name', 'ASC') - ->with(['accountType']) - ; + ->where('active', true) + ->orderBy('accounts.updated_at', 'ASC') + ->orderBy('accounts.order', 'ASC') + ->orderBy('accounts.account_type_id', 'ASC') + ->orderBy('accounts.name', 'ASC') + ->with(['accountType']); // split query on spaces just in case: if ('' !== trim($query)) { diff --git a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php index b024467486..247dfdb0bd 100644 --- a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php +++ b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php @@ -26,7 +26,6 @@ namespace FireflyIII\Repositories\UserGroups\Account; use FireflyIII\Models\Account; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Models\UserGroup; use Illuminate\Support\Collection; /** diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php index ad2558a70f..25d0748772 100644 --- a/app/Repositories/UserGroups/Bill/BillRepository.php +++ b/app/Repositories/UserGroups/Bill/BillRepository.php @@ -62,9 +62,8 @@ class BillRepository implements BillRepositoryInterface public function getBills(): Collection { return $this->userGroup->bills() - ->orderBy('bills.name', 'ASC') - ->get(['bills.*']) - ; + ->orderBy('bills.name', 'ASC') + ->get(['bills.*']); } public function sumPaidInRange(Carbon $start, Carbon $end): array @@ -102,13 +101,13 @@ class BillRepository implements BillRepositoryInterface /** @var null|Transaction $sourceTransaction */ $sourceTransaction = $transactionJournal->transactions()->where('amount', '<', 0)->first(); if (null !== $sourceTransaction) { - $amount = $sourceTransaction->amount; + $amount = $sourceTransaction->amount; if ((int) $sourceTransaction->foreign_currency_id === $currency->id) { // use foreign amount instead! $amount = (string) $sourceTransaction->foreign_amount; } // convert to native currency - $nativeAmount = $amount; + $nativeAmount = $amount; if ($currencyId !== $default->id) { // get rate and convert. $nativeAmount = $converter->convert($currency, $default, $transactionJournal->date, $amount); @@ -130,10 +129,9 @@ class BillRepository implements BillRepositoryInterface public function getActiveBills(): Collection { return $this->userGroup->bills() - ->where('active', true) - ->orderBy('bills.name', 'ASC') - ->get(['bills.*']) - ; + ->where('active', true) + ->orderBy('bills.name', 'ASC') + ->get(['bills.*']); } public function sumUnpaidInRange(Carbon $start, Carbon $end): array @@ -155,7 +153,7 @@ class BillRepository implements BillRepositoryInterface $currencyId = $bill->transaction_currency_id; $average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2'); $nativeAverage = $converter->convert($currency, $default, $start, $average); - $return[$currencyId] ??= [ + $return[$currencyId] ??= [ 'currency_id' => (string) $currency->id, 'currency_name' => $currency->name, 'currency_symbol' => $currency->symbol, @@ -202,7 +200,7 @@ class BillRepository implements BillRepositoryInterface // app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d'))); - $currentStart = clone $nextExpectedMatch; + $currentStart = clone $nextExpectedMatch; } return $set; diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php index e6118cb938..7d1fee23b6 100644 --- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php @@ -46,14 +46,13 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface $converter = new ExchangeRateConverter(); $default = app('amount')->getNativeCurrency(); $availableBudgets = $this->userGroup->availableBudgets() - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->get() - ; + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->get(); /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { $currencyId = $availableBudget->transaction_currency_id; - $return[$currencyId] ??= [ + $return[$currencyId] ??= [ 'currency_id' => $currencyId, 'currency_code' => $availableBudget->transactionCurrency->code, 'currency_symbol' => $availableBudget->transactionCurrency->symbol, diff --git a/app/Repositories/UserGroups/Budget/BudgetRepository.php b/app/Repositories/UserGroups/Budget/BudgetRepository.php index cb43479b71..6aa36ca1f5 100644 --- a/app/Repositories/UserGroups/Budget/BudgetRepository.php +++ b/app/Repositories/UserGroups/Budget/BudgetRepository.php @@ -39,18 +39,16 @@ class BudgetRepository implements BudgetRepositoryInterface public function getActiveBudgets(): Collection { return $this->userGroup->budgets()->where('active', true) - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC') - ->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get(); } public function getBudgets(): Collection { return $this->userGroup->budgets() - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC') - ->get() - ; + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get(); } } diff --git a/app/Repositories/UserGroups/Budget/OperationsRepository.php b/app/Repositories/UserGroups/Budget/OperationsRepository.php index 63a0b22644..e23c69bac3 100644 --- a/app/Repositories/UserGroups/Budget/OperationsRepository.php +++ b/app/Repositories/UserGroups/Budget/OperationsRepository.php @@ -28,6 +28,7 @@ use Carbon\Carbon; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; +use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; @@ -58,13 +59,13 @@ class OperationsRepository implements OperationsRepositoryInterface $collector->setBudgets($this->getBudgets()); } $collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $budgetId = (int) $journal['budget_id']; - $budgetName = (string) $journal['budget_name']; + $currencyId = (int) $journal['currency_id']; + $budgetId = (int) $journal['budget_id']; + $budgetName = (string) $journal['budget_name']; // catch "no budget" entries. if (0 === $budgetId) { @@ -72,7 +73,7 @@ class OperationsRepository implements OperationsRepositoryInterface } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'budgets' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -90,8 +91,8 @@ class OperationsRepository implements OperationsRepositoryInterface // add journal to array: // only a subset of the fields. - $journalId = (int) $journal['transaction_journal_id']; - $final = [ + $journalId = (int) $journal['transaction_journal_id']; + $final = [ 'amount' => app('steam')->negative($journal['amount']), 'currency_id' => $journal['currency_id'], 'foreign_amount' => null, diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php index 73bce5a06b..ece6df1bec 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php @@ -66,7 +66,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function currencyInUseAt(TransactionCurrency $currency): ?string { app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); - $countJournals = $this->countJournals($currency); + $countJournals = $this->countJournals($currency); if ($countJournals > 0) { app('log')->info(sprintf('Count journals is %d, return true.', $countJournals)); @@ -81,7 +81,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -89,7 +89,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -97,7 +97,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills)); @@ -115,10 +115,9 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -134,7 +133,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); @@ -142,7 +141,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info('Is the default currency of the user, return true.'); @@ -150,7 +149,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info('Is the default currency of the user group, return true.'); diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php index 4402332170..f876c65e84 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepositoryInterface.php @@ -26,7 +26,6 @@ namespace FireflyIII\Repositories\UserGroups\Currency; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; -use FireflyIII\Models\UserGroup; use Illuminate\Support\Collection; /** diff --git a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php index 2460d7d572..a25682decc 100644 --- a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php @@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; +use Override; /** * Class ExchangeRateRepository @@ -40,55 +41,51 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface { use UserGroupTrait; - #[\Override] + #[Override] public function deleteRate(CurrencyExchangeRate $rate): void { $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); } - #[\Override] + #[Override] public function getAll(): Collection { return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); } - #[\Override] + #[Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { // orderBy('date', 'DESC')->toRawSql(); return $this->userGroup->currencyExchangeRates() - ->where(function (Builder $q1) use ($from, $to): void { - $q1->where(function (Builder $q) use ($from, $to): void { - $q->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id) - ; - })->orWhere(function (Builder $q) use ($from, $to): void { - $q->where('from_currency_id', $to->id) - ->where('to_currency_id', $from->id) - ; - }); - }) - ->orderBy('date', 'DESC') - ->get(['currency_exchange_rates.*']) - ; + ->where(function (Builder $q1) use ($from, $to): void { + $q1->where(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id); + })->orWhere(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $to->id) + ->where('to_currency_id', $from->id); + }); + }) + ->orderBy('date', 'DESC') + ->get(['currency_exchange_rates.*']); } - #[\Override] + #[Override] public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate { /** @var null|CurrencyExchangeRate */ return $this->userGroup->currencyExchangeRates() - ->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id) - ->where('date', $date->format('Y-m-d')) - ->first() - ; + ->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ->where('date', $date->format('Y-m-d')) + ->first(); } - #[\Override] + #[Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { $object = new CurrencyExchangeRate(); @@ -104,7 +101,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface return $object; } - #[\Override] + #[Override] public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { $object->rate = $rate; diff --git a/app/Repositories/UserGroups/Journal/JournalRepository.php b/app/Repositories/UserGroups/Journal/JournalRepository.php index 8926573acd..d3070d7f0a 100644 --- a/app/Repositories/UserGroups/Journal/JournalRepository.php +++ b/app/Repositories/UserGroups/Journal/JournalRepository.php @@ -40,8 +40,7 @@ class JournalRepository implements JournalRepositoryInterface public function searchJournalDescriptions(array $query, int $limit): Collection { $search = $this->userGroup->transactionJournals() - ->orderBy('date', 'DESC') - ; + ->orderBy('date', 'DESC'); if (count($query) > 0) { // split query on spaces just in case: $search->where(function (EloquentBuilder $q) use ($query): void { diff --git a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php index c1312306f7..33816f8a97 100644 --- a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php @@ -40,14 +40,13 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface public function getPiggyBanks(): Collection { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_group_id', $this->userGroup->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']) - ; + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_group_id', $this->userGroup->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']); } } diff --git a/app/Repositories/Webhook/WebhookRepository.php b/app/Repositories/Webhook/WebhookRepository.php index 0cc7dee0e2..5f40b2c718 100644 --- a/app/Repositories/Webhook/WebhookRepository.php +++ b/app/Repositories/Webhook/WebhookRepository.php @@ -67,23 +67,21 @@ class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterfac public function getMessages(Webhook $webhook): Collection { return $webhook->webhookMessages() - ->orderBy('created_at', 'DESC') - ->get(['webhook_messages.*']) - ; + ->orderBy('created_at', 'DESC') + ->get(['webhook_messages.*']); } public function getReadyMessages(Webhook $webhook): Collection { return $webhook->webhookMessages() - ->where('webhook_messages.sent', 0) - ->where('webhook_messages.errored', 0) - ->get(['webhook_messages.*']) - ->filter( - static function (WebhookMessage $message) { // @phpstan-ignore-line - return $message->webhookAttempts()->count() <= 2; - } - )->splice(0, 3) - ; + ->where('webhook_messages.sent', 0) + ->where('webhook_messages.errored', 0) + ->get(['webhook_messages.*']) + ->filter( + static function (WebhookMessage $message) { // @phpstan-ignore-line + return $message->webhookAttempts()->count() <= 2; + } + )->splice(0, 3); } public function store(array $data): Webhook diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php index ba2300900b..be8a179503 100644 --- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php +++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php @@ -49,19 +49,9 @@ use Illuminate\Support\Facades\Log; */ class AccountEnrichment implements EnrichmentInterface { - // private array $balances; - // private array $currencies; - // private CurrencyRepositoryInterface $currencyRepository; - // private TransactionCurrency $default; - // private ?Carbon $end; - // private array $grouped; - // private array $objectGroups; - // private AccountRepositoryInterface $repository; - // private ?Carbon $start; private Collection $collection; - private bool $convertToNative; private User $user; private UserGroup $userGroup; private TransactionCurrency $native; @@ -76,7 +66,6 @@ class AccountEnrichment implements EnrichmentInterface public function __construct() { - $this->convertToNative = false; $this->accountIds = []; $this->openingBalances = []; $this->currencies = []; @@ -197,7 +186,10 @@ class AccountEnrichment implements EnrichmentInterface // use new group collector: /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); - $collector->setUser($this->user)->setAccounts($this->collection) + $collector + ->setUser($this->user) + ->setUserGroup($this->userGroup) + ->setAccounts($this->collection) ->withAccountInformation() ->setTypes([TransactionTypeEnum::OPENING_BALANCE->value]) ; @@ -269,11 +261,6 @@ class AccountEnrichment implements EnrichmentInterface $this->userGroup = $user->userGroup; } - public function setConvertToNative(bool $convertToNative): void - { - $this->convertToNative = $convertToNative; - } - public function setNative(TransactionCurrency $native): void { $this->native = $native; diff --git a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php index 0a74fd05db..ff70a0ba5f 100644 --- a/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php +++ b/app/Support/JsonApi/Enrichments/TransactionGroupEnrichment.php @@ -47,8 +47,8 @@ class TransactionGroupEnrichment implements EnrichmentInterface private array $tags; private array $locations; private array $journalIds; - private User $user; - private UserGroup $userGroup; + private User $user; // @phpstan-ignore-line + private UserGroup $userGroup; // @phpstan-ignore-line private array $metaData; private array $dateFields; private array $attachmentCount; diff --git a/config/auth.php b/config/auth.php index 64c07ce59b..de43714e23 100644 --- a/config/auth.php +++ b/config/auth.php @@ -24,10 +24,6 @@ declare(strict_types=1); use FireflyIII\User; -if ('ldap' === strtolower((string) env('AUTHENTICATION_GUARD'))) { - exit('LDAP is no longer supported by Firefly III v5.7+. Sorry about that. You will have to switch to "remote_user_guard", and use tools like Authelia or Keycloak to use LDAP together with Firefly III.'); -} - return [ /* |-------------------------------------------------------------------------- From d84405191f27d24a4a80111e4b2ddf15eabe683a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 09:53:19 +0100 Subject: [PATCH 28/52] Add debug timers. --- .../Controllers/Account/ShowController.php | 55 +++++++++++++------ 1 file changed, 39 insertions(+), 16 deletions(-) diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index 24ac82cea2..a2b7a027a9 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -29,10 +29,11 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Models\Account; -use FireflyIII\Models\Transaction; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Support\Debug\Timer; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Http\Controllers\PeriodOverview; +use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; @@ -82,7 +83,7 @@ class ShowController extends Controller public function show(Request $request, Account $account, ?Carbon $start = null, ?Carbon $end = null) { - $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); + $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); if (!$this->isEditableAccount($account)) { return $this->redirectAccountToAccount($account); @@ -114,33 +115,55 @@ class ShowController extends Controller $subTitle = (string) trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]); $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); $firstTransaction = $this->repository->oldestJournalDate($account) ?? $start; + + Log::debug('Start period overview'); + Timer::start('period-overview'); + $periods = $this->getAccountPeriodOverview($account, $firstTransaction, $end); + Log::debug('End period overview'); + Timer::stop('period-overview'); + // if layout = v2, overrule the page title. if ('v1' !== config('view.layout')) { $subTitle = (string) trans('firefly.all_journals_for_account', ['name' => $account->name]); } - + Log::debug('Collect transactions'); + Timer::start('collection'); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); - $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation()->setRange($start, $end); - + $collector = app(GroupCollectorInterface::class); + $collector + ->setAccounts(new Collection([$account])) + ->setLimit($pageSize) + ->setPage($page) + ->withAPIInformation() + ->setRange($start, $end); // this search will not include transaction groups where this asset account (or liability) // is just part of ONE of the journals. To force this: $collector->setExpandGroupSearch(true); + $groups = $collector->getPaginatedGroups(); + + Log::debug('End collect transactions'); + Timer::stop('collection'); + + // enrich data in arrays. + + // enrich +// $enrichment = new TransactionGroupEnrichment(); +// $enrichment->setUser(auth()->user()); +// $groups->setCollection($enrichment->enrich($groups->getCollection())); - $groups = $collector->getPaginatedGroups(); $groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')])); - $showAll = false; + $showAll = false; // correct - $now = today()->endOfDay(); + $now = today()->endOfDay(); if ($now->gt($end) || $now->lt($start)) { $now = $end; } Log::debug(sprintf('show: Call finalAccountBalance with date/time "%s"', $now->toIso8601String())); - $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $now), $account, $this->convertToNative, $accountCurrency); + $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $now), $account, $this->convertToNative, $accountCurrency); return view( 'accounts.show', @@ -184,7 +207,7 @@ class ShowController extends Controller $today = today(config('app.timezone')); $accountCurrency = $this->repository->getAccountCurrency($account); $start = $this->repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth(); - $subTitleIcon = config('firefly.subIconsByIdentifier.'.$account->accountType->type); + $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type); $page = (int) $request->get('page'); $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; $currency = $this->repository->getAccountCurrency($account) ?? $this->defaultCurrency; @@ -194,20 +217,20 @@ class ShowController extends Controller $end->endOfDay(); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation(); // this search will not include transaction groups where this asset account (or liability) // is just part of ONE of the journals. To force this: $collector->setExpandGroupSearch(true); - $groups = $collector->getPaginatedGroups(); + $groups = $collector->getPaginatedGroups(); $groups->setPath(route('accounts.show.all', [$account->id])); - $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); - $showAll = true; + $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); + $showAll = true; // correct Log::debug(sprintf('showAll: Call finalAccountBalance with date/time "%s"', $end->toIso8601String())); - $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $end), $account, $this->convertToNative, $accountCurrency); + $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $end), $account, $this->convertToNative, $accountCurrency); return view( 'accounts.show', From db2cab3cef225f4a9ab24e160b6fba1d2fe8ad12 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 09:53:27 +0100 Subject: [PATCH 29/52] Add custom method. --- .../Account/AccountRepository.php | 30 +++++++++++++++++++ .../Account/AccountRepositoryInterface.php | 2 ++ 2 files changed, 32 insertions(+) diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 8a8cb8a908..26f3cc12f7 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -641,4 +641,34 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return $factory->create($data); } + + #[\Override] public function periodCollection(Account $account, Carbon $start, Carbon $end): array + { + return $account->transactions() + ->leftJoin('transaction_journals','transaction_journals.id','=','transactions.transaction_journal_id') + ->leftJoin('transaction_types','transaction_types.id','=','transaction_journals.transaction_type_id') + ->leftJoin('transaction_currencies','transaction_currencies.id','=','transactions.transaction_currency_id') + ->leftJoin('transaction_currencies as foreign_currencies','foreign_currencies.id','=','transactions.foreign_currency_id') + ->where('transaction_journals.date','>=',$start) + ->where('transaction_journals.date','<=',$end) + ->get([ + // currencies + 'transaction_currencies.id as currency_id', + 'transaction_currencies.code as currency_code', + 'transaction_currencies.name as currency_name', + 'transaction_currencies.symbol as currency_symbol', + 'transaction_currencies.decimal_places as currency_decimal_places', + + // foreign + 'foreign_currencies.id as foreign_currency_id', + 'foreign_currencies.code as foreign_currency_code', + 'foreign_currencies.name as foreign_currency_name', + 'foreign_currencies.symbol as foreign_currency_symbol', + 'foreign_currencies.decimal_places as foreign_decimal_places', + + // fields + 'transaction_journals.date', 'transaction_types.type', 'transaction_journals.transaction_currency_id', 'transactions.amount']) + ->toArray(); + + } } diff --git a/app/Repositories/Account/AccountRepositoryInterface.php b/app/Repositories/Account/AccountRepositoryInterface.php index 006b2d7eed..6bfb568c28 100644 --- a/app/Repositories/Account/AccountRepositoryInterface.php +++ b/app/Repositories/Account/AccountRepositoryInterface.php @@ -71,6 +71,8 @@ interface AccountRepositoryInterface public function findByName(string $name, array $types): ?Account; + public function periodCollection(Account $account, Carbon $start, Carbon $end): array; + public function getAccountBalances(Account $account): Collection; public function getAccountCurrency(Account $account): ?TransactionCurrency; From fe2def968493112b54815a7a3cd60cd22c8b2b0b Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 09:53:36 +0100 Subject: [PATCH 30/52] Fix nullpointer. --- .../PiggyBank/PiggyBankRepository.php | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index cdf2e86837..e99fa16363 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -305,15 +305,21 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function getPiggyBanks(): Collection { - return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']); + $query = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id'); + if (null === $this->user) { + $query->where('accounts.user_group_id', $this->userGroup->id); + } + if (null !== $this->user) { + $query->where('accounts.user_id', $this->user->id); + } + return $query + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']); } public function getRepetition(PiggyBank $piggyBank, bool $overrule = false): ?PiggyBankRepetition From 26df1be871c67d507e913b7082ec45e88ff6280c Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 09:53:52 +0100 Subject: [PATCH 31/52] Remove debug --- app/Support/Debug/Timer.php | 46 +++++++++++++++++++++++++++++++++++++ app/Support/Preferences.php | 4 ++-- 2 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 app/Support/Debug/Timer.php diff --git a/app/Support/Debug/Timer.php b/app/Support/Debug/Timer.php new file mode 100644 index 0000000000..f1930e2c75 --- /dev/null +++ b/app/Support/Debug/Timer.php @@ -0,0 +1,46 @@ +id, $name)); + //Log::debug(sprintf('getForUser(#%d, "%s")', $user->id, $name)); // don't care about user group ID, except for some specific preferences. $userGroupId = $this->getUserGroupId($user, $name); $query = Preference::where('user_id', $user->id)->where('name', $name); @@ -90,7 +90,7 @@ class Preferences } if (null !== $preference) { - Log::debug(sprintf('Found preference #%d for user #%d: %s', $preference->id, $user->id, $name)); + //Log::debug(sprintf('Found preference #%d for user #%d: %s', $preference->id, $user->id, $name)); return $preference; } From 08f13aebe3d18e37119eaf30abf59b9793ab14b0 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 09:54:06 +0100 Subject: [PATCH 32/52] Fix period overview for account --- .../Http/Controllers/PeriodOverview.php | 309 ++++++++++-------- 1 file changed, 167 insertions(+), 142 deletions(-) diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php index 5d4811d1fb..baeff70934 100644 --- a/app/Support/Http/Controllers/PeriodOverview.php +++ b/app/Support/Http/Controllers/PeriodOverview.php @@ -31,9 +31,12 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Account; use FireflyIII\Models\Category; use FireflyIII\Models\Tag; +use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Support\CacheProperties; +use FireflyIII\Support\Debug\Timer; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Log; /** * Trait PeriodOverview. @@ -65,6 +68,7 @@ use Illuminate\Support\Collection; trait PeriodOverview { protected JournalRepositoryInterface $journalRepos; + protected AccountRepositoryInterface $accountRepository; /** * This method returns "period entries", so nov-2015, dec-2015, etc etc (this depends on the users session range) @@ -75,11 +79,13 @@ trait PeriodOverview */ protected function getAccountPeriodOverview(Account $account, Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); + Timer::start('account-period-total'); + $this->accountRepository = app(AccountRepositoryInterface::class); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('account-show-period-entries'); @@ -89,56 +95,75 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; - // collect all expenses in this period: - /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); - $collector->setAccounts(new Collection([$account])); - $collector->setRange($start, $end); - $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); - - // collect all income in this period: - /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); - $collector->setAccounts(new Collection([$account])); - $collector->setRange($start, $end); - $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); - - // collect all transfers in this period: - /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); - $collector->setAccounts(new Collection([$account])); - $collector->setRange($start, $end); - $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); - $transferSet = $collector->getExtractedJournals(); + // run a custom query because doing this with the collector is MEGA slow. + $transactions = $this->accountRepository->periodCollection($account, $start, $end); // loop dates foreach ($dates as $currentDate) { $title = app('navigation')->periodShow($currentDate['start'], $currentDate['period']); - $earned = $this->filterJournalsByDate($earnedSet, $currentDate['start'], $currentDate['end']); - $spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']); - $transferredAway = $this->filterTransferredAway($account, $this->filterJournalsByDate($transferSet, $currentDate['start'], $currentDate['end'])); - $transferredIn = $this->filterTransferredIn($account, $this->filterJournalsByDate($transferSet, $currentDate['start'], $currentDate['end'])); + [$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']); + [$transactions, $earned] = $this->filterTransactionsByType(TransactionTypeEnum::DEPOSIT, $transactions, $currentDate['start'], $currentDate['end']); + [$transactions, $transferredAway] = $this->filterTransfers('away',$transactions, $currentDate['start'], $currentDate['end']); + [$transactions, $transferredIn] = $this->filterTransfers('in',$transactions, $currentDate['start'], $currentDate['end']); $entries[] - = [ - 'title' => $title, - 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - - 'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred_away' => $this->groupByCurrency($transferredAway), - 'transferred_in' => $this->groupByCurrency($transferredIn), - ]; + = [ + 'title' => $title, + 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred_away' => $this->groupByCurrency($transferredAway), + 'transferred_in' => $this->groupByCurrency($transferredIn), + ]; } $cache->store($entries); + Timer::stop('account-period-total'); return $entries; } + private function filterTransfers(string $direction, array $transactions, Carbon $start, Carbon $end): array + { + $result = []; + /** + * @var int $index + * @var array $item + */ + foreach ($transactions as $index => $item) { + $date = Carbon::parse($item['date']); + if ($date >= $start && $date <= $end) { + if ($direction === 'away' && bccomp($item['amount'], '0') === -1) { + $result[] = $item; + unset($transactions[$index]); + } + if ($direction === 'in' && bccomp($item['amount'], '0') === 1) { + $result[] = $item; + unset($transactions[$index]); + } + } + } + return [$transactions, $result]; + } + + private function filterTransactionsByType(TransactionTypeEnum $type, array $transactions, Carbon $start, Carbon $end): array + { + $result = []; + /** + * @var int $index + * @var array $item + */ + foreach ($transactions as $index => $item) { + $date = Carbon::parse($item['date']); + if($item['type'] === $type->value && $date >= $start && $date <= $end) { + $result[] = $item; + unset($transactions[$index]); + } + } + + return [$transactions, $result]; + } /** * Filter a list of journals by a set of dates, and then group them by currency. @@ -197,13 +222,13 @@ trait PeriodOverview /** @var array $journal */ foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $currencyCode = $journal['currency_code']; - $currencyName = $journal['currency_name']; - $currencySymbol = $journal['currency_symbol']; - $currencyDecimalPlaces = $journal['currency_decimal_places']; - $foreignCurrencyId = $journal['foreign_currency_id']; - $amount = $journal['amount'] ?? '0'; + $currencyId = (int) $journal['currency_id']; + $currencyCode = $journal['currency_code']; + $currencyName = $journal['currency_name']; + $currencySymbol = $journal['currency_symbol']; + $currencyDecimalPlaces = $journal['currency_decimal_places']; + $foreignCurrencyId = $journal['foreign_currency_id']; + $amount = $journal['amount'] ?? '0'; if ($this->convertToNative && $currencyId !== $this->defaultCurrency->id && $foreignCurrencyId !== $this->defaultCurrency->id) { $amount = $journal['native_amount'] ?? '0'; @@ -246,11 +271,11 @@ trait PeriodOverview */ protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for entries with their amounts. - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty($range); @@ -262,32 +287,32 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all expenses in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setCategory($category); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); + $earnedSet = $collector->getExtractedJournals(); // collect all income in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setCategory($category); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); + $spentSet = $collector->getExtractedJournals(); // collect all transfers in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setCategory($category); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); - $transferSet = $collector->getExtractedJournals(); + $transferSet = $collector->getExtractedJournals(); foreach ($dates as $currentDate) { $spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']); $earned = $this->filterJournalsByDate($earnedSet, $currentDate['start'], $currentDate['end']); @@ -295,17 +320,17 @@ trait PeriodOverview $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'transactions' => 0, - 'title' => $title, - 'route' => route( - 'categories.show', - [$category->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] - ), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'transactions' => 0, + 'title' => $title, + 'route' => route( + 'categories.show', + [$category->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] + ), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } $cache->store($entries); @@ -321,11 +346,11 @@ trait PeriodOverview */ protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty($this->convertToNative); @@ -336,28 +361,28 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // get all expenses without a budget. /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setRange($start, $end)->withoutBudget()->withAccountInformation()->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); foreach ($dates as $currentDate) { $set = $this->filterJournalsByDate($journals, $currentDate['start'], $currentDate['end']); $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'title' => $title, - 'route' => route('budgets.no-budget', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($set), - 'spent' => $this->groupByCurrency($set), - 'earned' => [], - 'transferred_away' => [], - 'transferred_in' => [], - ]; + 'title' => $title, + 'route' => route('budgets.no-budget', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($set), + 'spent' => $this->groupByCurrency($set), + 'earned' => [], + 'transferred_away' => [], + 'transferred_in' => [], + ]; } $cache->store($entries); @@ -374,38 +399,38 @@ trait PeriodOverview protected function getNoCategoryPeriodOverview(Carbon $theDate): array { app('log')->debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d'))); - $range = app('navigation')->getViewRange(true); - $first = $this->journalRepos->firstNull(); - $start = null === $first ? new Carbon() : $first->date; - $end = clone $theDate; - $end = app('navigation')->endOfPeriod($end, $range); + $range = app('navigation')->getViewRange(true); + $first = $this->journalRepos->firstNull(); + $start = null === $first ? new Carbon() : $first->date; + $end = clone $theDate; + $end = app('navigation')->endOfPeriod($end, $range); app('log')->debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d'))); app('log')->debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d'))); // properties for cache - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all expenses in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->withoutCategory(); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); + $earnedSet = $collector->getExtractedJournals(); // collect all income in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->withoutCategory(); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); + $spentSet = $collector->getExtractedJournals(); // collect all transfers in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->withoutCategory(); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); @@ -419,13 +444,13 @@ trait PeriodOverview $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'title' => $title, - 'route' => route('categories.no-category', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'title' => $title, + 'route' => route('categories.no-category', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } app('log')->debug('End of loops'); @@ -439,11 +464,11 @@ trait PeriodOverview */ protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags. { - $range = app('navigation')->getViewRange(true); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('tag-period-entries'); @@ -453,37 +478,37 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all expenses in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTag($tag); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); + $earnedSet = $collector->getExtractedJournals(); // collect all income in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTag($tag); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); + $spentSet = $collector->getExtractedJournals(); // collect all transfers in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTag($tag); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); - $transferSet = $collector->getExtractedJournals(); + $transferSet = $collector->getExtractedJournals(); // filer all of them: - $earnedSet = $this->filterJournalsByTag($earnedSet, $tag); - $spentSet = $this->filterJournalsByTag($spentSet, $tag); - $transferSet = $this->filterJournalsByTag($transferSet, $tag); + $earnedSet = $this->filterJournalsByTag($earnedSet, $tag); + $spentSet = $this->filterJournalsByTag($spentSet, $tag); + $transferSet = $this->filterJournalsByTag($transferSet, $tag); foreach ($dates as $currentDate) { $spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']); @@ -492,17 +517,17 @@ trait PeriodOverview $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'transactions' => 0, - 'title' => $title, - 'route' => route( - 'tags.show', - [$tag->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] - ), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'transactions' => 0, + 'title' => $title, + 'route' => route( + 'tags.show', + [$tag->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] + ), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } return $entries; @@ -512,7 +537,7 @@ trait PeriodOverview { $return = []; foreach ($set as $entry) { - $found = false; + $found = false; /** @var array $localTag */ foreach ($entry['tags'] as $localTag) { @@ -534,12 +559,12 @@ trait PeriodOverview */ protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); - $types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType)); + $range = app('navigation')->getViewRange(true); + $types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType)); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('transactions-period-entries'); @@ -549,13 +574,13 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all journals in this period (regardless of type) - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTypes($types)->setRange($start, $end); - $genericSet = $collector->getExtractedJournals(); + $genericSet = $collector->getExtractedJournals(); foreach ($dates as $currentDate) { $spent = []; @@ -574,14 +599,14 @@ trait PeriodOverview $transferred = $this->filterJournalsByDate($genericSet, $currentDate['start'], $currentDate['end']); } $entries[] - = [ - 'title' => $title, - 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + = [ + 'title' => $title, + 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } return $entries; From 453ccd32710bc4d3660211a119400759f694042f Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 09:54:14 +0100 Subject: [PATCH 33/52] Clean up overview. --- resources/views/list/periods.twig | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/resources/views/list/periods.twig b/resources/views/list/periods.twig index 2fde0b1c41..489ba2abe1 100644 --- a/resources/views/list/periods.twig +++ b/resources/views/list/periods.twig @@ -32,7 +32,11 @@ {{ 'earned'|_ }} - {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }} + {% if entry.amount < 0 %} + {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }} + {% else %} + {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }} + {% endif %} @@ -58,7 +62,11 @@ {{ 'transferred_away'|_ }} - {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }} + {% if entry.amount < 0 %} + {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }} + {% else %} + {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }} + {% endif %} @@ -71,7 +79,11 @@ {{ 'transferred_in'|_ }} - {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }} + {% if entry.amount < 0 %} + {{ formatAmountBySymbol(entry.amount*-1, entry.currency_symbol, entry.currency_decimal_places) }} + {% else %} + {{ formatAmountBySymbol(entry.amount, entry.currency_symbol, entry.currency_decimal_places) }} + {% endif %} From a8e1c22c931b7c47c5ce0ee87b3bb78d6e000087 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 10:35:12 +0100 Subject: [PATCH 34/52] Fix #9876 --- app/Http/Middleware/AcceptHeaders.php | 10 ++++++++-- .../Api/Data/Bulk/ValidatesBulkTransactionQuery.php | 9 ++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/Http/Middleware/AcceptHeaders.php b/app/Http/Middleware/AcceptHeaders.php index e3cd497da4..812713f226 100644 --- a/app/Http/Middleware/AcceptHeaders.php +++ b/app/Http/Middleware/AcceptHeaders.php @@ -50,13 +50,19 @@ class AcceptHeaders throw new BadHttpHeaderException(sprintf('Accept header "%s" is not something this server can provide.', $request->header('Accept'))); } // if bad 'Content-Type' header, refuse service. - if (('POST' === $method || 'PUT' === $method) && !$request->hasHeader('Content-Type')) { + + // some routes are exempt from this. + $exempt = [ + 'api.v1.data.bulk.transactions' + ]; + + if (('POST' === $method || 'PUT' === $method) && !$request->hasHeader('Content-Type') && !in_array($request->route()->getName(), $exempt, true)) { $error = new BadHttpHeaderException('Content-Type header cannot be empty.'); $error->statusCode = 415; throw $error; } - if (('POST' === $method || 'PUT' === $method) && !$this->acceptsHeader($submitted, $contentTypes)) { + if (('POST' === $method || 'PUT' === $method) && !$this->acceptsHeader($submitted, $contentTypes) && !in_array($request->route()->getName(), $exempt, true)) { $error = new BadHttpHeaderException(sprintf('Content-Type cannot be "%s"', $submitted)); $error->statusCode = 415; diff --git a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php index bef98c6709..6dd7501261 100644 --- a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php +++ b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php @@ -33,10 +33,13 @@ trait ValidatesBulkTransactionQuery { $data = $validator->getData(); // assumption is all validation has already taken place and the query key exists. - $json = json_decode($data['query'], true, 8, JSON_THROW_ON_ERROR); + $query =$data['query'] ?? '[]'; + $json = json_decode($query, true, 8, JSON_THROW_ON_ERROR); - if (array_key_exists('account_id', $json['where']) - && array_key_exists('account_id', $json['update']) + if ( + array_key_exists('where', $json) && + array_key_exists('update', $json) && + array_key_exists('account_id', $json['where']) && array_key_exists('account_id', $json['update']) ) { // find both accounts, must be same type. // already validated: belongs to this user. From 2f17701b681f617de490ee99fe1e0cfc19df0a0e Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 9 Mar 2025 18:44:39 +0100 Subject: [PATCH 35/52] Fix #9954 --- app/Factory/BillFactory.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php index 24aa6a7e7e..8504e8b4bd 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -55,6 +55,9 @@ class BillFactory $skip = array_key_exists('skip', $data) ? $data['skip'] : 0; $active = array_key_exists('active', $data) ? $data['active'] : 0; + $data['extension_date'] = $data['extension_date'] ?? null; + $data['end_date'] = $data['end_date'] ?? null; + /** @var Bill $bill */ $bill = Bill::create( [ From 9e398beb07b6ad199cc59a9f4d891989bb3b67ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 03:19:15 +0000 Subject: [PATCH 36/52] Bump phpstan/phpstan from 2.1.7 to 2.1.8 Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 2.1.7 to 2.1.8. - [Release notes](https://github.com/phpstan/phpstan/releases) - [Changelog](https://github.com/phpstan/phpstan/blob/2.1.x/CHANGELOG.md) - [Commits](https://github.com/phpstan/phpstan/compare/2.1.7...2.1.8) --- updated-dependencies: - dependency-name: phpstan/phpstan dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- composer.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/composer.lock b/composer.lock index 91b59861a3..6a458c839c 100644 --- a/composer.lock +++ b/composer.lock @@ -11270,16 +11270,16 @@ }, { "name": "phpstan/phpstan", - "version": "2.1.7", + "version": "2.1.8", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "12567f91a74036d56ba0af6d56c8e73ac0e8d850" + "reference": "f9adff3b87c03b12cc7e46a30a524648e497758f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/12567f91a74036d56ba0af6d56c8e73ac0e8d850", - "reference": "12567f91a74036d56ba0af6d56c8e73ac0e8d850", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/f9adff3b87c03b12cc7e46a30a524648e497758f", + "reference": "f9adff3b87c03b12cc7e46a30a524648e497758f", "shasum": "" }, "require": { @@ -11324,7 +11324,7 @@ "type": "github" } ], - "time": "2025-03-05T13:43:55+00:00" + "time": "2025-03-09T09:30:48+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -12876,7 +12876,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": {}, + "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -12897,6 +12897,6 @@ "ext-xml": "*", "ext-xmlwriter": "*" }, - "platform-dev": {}, - "plugin-api-version": "2.6.0" + "platform-dev": [], + "plugin-api-version": "2.3.0" } From a4a4590c451536d78b332354758bfaa33646ce2b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 03:41:42 +0000 Subject: [PATCH 37/52] Bump axios from 1.8.1 to 1.8.2 Bumps [axios](https://github.com/axios/axios) from 1.8.1 to 1.8.2. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v1.8.1...v1.8.2) --- updated-dependencies: - dependency-name: axios dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 10 +++++----- resources/assets/v1/package.json | 2 +- resources/assets/v2/package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0b11b90753..72846ccb82 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3914,9 +3914,9 @@ } }, "node_modules/axios": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.1.tgz", - "integrity": "sha512-NN+fvwH/kV01dYUQ3PTOZns4LWtWhOFCAhQ/pHb88WQ1hNe5V/dvFwc4VJcDL11LT9xSX0QtsR8sWUuyOuOq7g==", + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", + "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", "dev": true, "license": "MIT", "dependencies": { @@ -12272,7 +12272,7 @@ "devDependencies": { "@johmun/vue-tags-input": "^2", "@vue/compiler-sfc": "^3.5.11", - "axios": "^1.7", + "axios": "^1.8", "bootstrap-sass": "^3", "cross-env": "^7.0", "font-awesome": "^4.7.0", @@ -12312,7 +12312,7 @@ "store": "^2.0.12" }, "devDependencies": { - "axios": "^1.7.4", + "axios": "^1.8.2", "laravel-vite-plugin": "^1.0.5", "patch-package": "^8.0.0", "sass": "^1.78.0", diff --git a/resources/assets/v1/package.json b/resources/assets/v1/package.json index 9e317ca79f..a9b6d966bc 100644 --- a/resources/assets/v1/package.json +++ b/resources/assets/v1/package.json @@ -16,7 +16,7 @@ "devDependencies": { "@johmun/vue-tags-input": "^2", "@vue/compiler-sfc": "^3.5.11", - "axios": "^1.7", + "axios": "^1.8", "bootstrap-sass": "^3", "cross-env": "^7.0", "font-awesome": "^4.7.0", diff --git a/resources/assets/v2/package.json b/resources/assets/v2/package.json index eaf1b74bf2..1c1018dcf9 100644 --- a/resources/assets/v2/package.json +++ b/resources/assets/v2/package.json @@ -8,7 +8,7 @@ "postinstall": "patch-package --error-on-fail" }, "devDependencies": { - "axios": "^1.7.4", + "axios": "^1.8.2", "laravel-vite-plugin": "^1.0.5", "patch-package": "^8.0.0", "sass": "^1.78.0", From b481cf53e725d06dfc5cf8a0622436f506db4eb2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Mar 2025 03:41:58 +0000 Subject: [PATCH 38/52] Bump vite from 6.2.0 to 6.2.1 Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.0 to 6.2.1. - [Release notes](https://github.com/vitejs/vite/releases) - [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md) - [Commits](https://github.com/vitejs/vite/commits/create-vite@6.2.1/packages/vite) --- updated-dependencies: - dependency-name: vite dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0b11b90753..b487b5f110 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11344,9 +11344,9 @@ } }, "node_modules/vite": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.0.tgz", - "integrity": "sha512-7dPxoo+WsT/64rDcwoOjk76XHj+TqNTIvHKcuMQ1k4/SeHDaQt5GFAeLYzrimZrMpn/O6DtdI03WUjdxuPM0oQ==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.1.tgz", + "integrity": "sha512-n2GnqDb6XPhlt9B8olZPrgMD/es/Nd1RdChF6CBD/fHW6pUyUTt2sQW2fPRX5GiD9XEa6+8A6A4f2vT6pSsE7Q==", "dev": true, "license": "MIT", "dependencies": { From 458a337521cee00ffaa0e138bf02bb161f6a71dd Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 13 Mar 2025 20:23:53 +0100 Subject: [PATCH 39/52] Fix #9770 --- .../Admin/ConfigurationController.php | 9 ++++--- .../Admin/NotificationController.php | 27 ++++++++++--------- app/Notifications/ReturnsSettings.php | 2 +- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/app/Http/Controllers/Admin/ConfigurationController.php b/app/Http/Controllers/Admin/ConfigurationController.php index 7e7403fb57..33afca23c0 100644 --- a/app/Http/Controllers/Admin/ConfigurationController.php +++ b/app/Http/Controllers/Admin/ConfigurationController.php @@ -26,6 +26,7 @@ namespace FireflyIII\Http\Controllers\Admin; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Middleware\IsDemoUser; use FireflyIII\Http\Requests\ConfigurationRequest; +use FireflyIII\Support\Facades\FireflyConfig; use Illuminate\Contracts\View\Factory; use Illuminate\Http\RedirectResponse; use Illuminate\Support\Facades\Log; @@ -68,8 +69,8 @@ class ConfigurationController extends Controller // all available configuration and their default value in case // they don't exist yet. - $singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; - $isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; + $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'); return view( @@ -89,8 +90,8 @@ class ConfigurationController extends Controller Log::channel('audit')->info('User updates global configuration.', $data); // store config values - app('fireflyconfig')->set('single_user_mode', $data['single_user_mode']); - app('fireflyconfig')->set('is_demo_site', $data['is_demo_site']); + FireflyConfig::set('single_user_mode', $data['single_user_mode']); + FireflyConfig::set('is_demo_site', $data['is_demo_site']); // flash message session()->flash('success', (string) trans('firefly.configuration_updated')); diff --git a/app/Http/Controllers/Admin/NotificationController.php b/app/Http/Controllers/Admin/NotificationController.php index aafcb69f69..39823066d1 100644 --- a/app/Http/Controllers/Admin/NotificationController.php +++ b/app/Http/Controllers/Admin/NotificationController.php @@ -28,6 +28,7 @@ use FireflyIII\Events\Test\OwnerTestNotificationChannel; use FireflyIII\Http\Controllers\Controller; use FireflyIII\Http\Requests\NotificationRequest; use FireflyIII\Notifications\Notifiables\OwnerNotifiable; +use FireflyIII\Support\Facades\FireflyConfig; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Support\Facades\Log; @@ -44,14 +45,14 @@ class NotificationController extends Controller $subTitleIcon = 'envelope-o'; // notification settings: - $slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; - $pushoverAppToken = app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data; - $pushoverUserToken = app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data; - $ntfyServer = app('fireflyconfig')->getEncrypted('ntfy_server', 'https://ntfy.sh')->data; - $ntfyTopic = app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data; - $ntfyAuth = app('fireflyconfig')->get('ntfy_auth', false)->data; - $ntfyUser = app('fireflyconfig')->getEncrypted('ntfy_user', '')->data; - $ntfyPass = app('fireflyconfig')->getEncrypted('ntfy_pass', '')->data; + $slackUrl = FireflyConfig::getEncrypted('slack_webhook_url', '')->data; + $pushoverAppToken = FireflyConfig::getEncrypted('pushover_app_token', '')->data; + $pushoverUserToken = FireflyConfig::getEncrypted('pushover_user_token', '')->data; + $ntfyServer = FireflyConfig::getEncrypted('ntfy_server', 'https://ntfy.sh')->data; + $ntfyTopic = FireflyConfig::getEncrypted('ntfy_topic', '')->data; + $ntfyAuth = FireflyConfig::get('ntfy_auth', false)->data; + $ntfyUser = FireflyConfig::getEncrypted('ntfy_user', '')->data; + $ntfyPass = FireflyConfig::getEncrypted('ntfy_pass', '')->data; $channels = config('notifications.channels'); $forcedAvailability = []; @@ -59,7 +60,7 @@ class NotificationController extends Controller $notifications = []; foreach (config('notifications.notifications.owner') as $key => $info) { if (true === $info['enabled']) { - $notifications[$key] = app('fireflyconfig')->get(sprintf('notification_%s', $key), true)->data; + $notifications[$key] = FireflyConfig::get(sprintf('notification_%s', $key), true)->data; } } @@ -98,19 +99,19 @@ class NotificationController extends Controller foreach (config('notifications.notifications.owner') as $key => $info) { if (array_key_exists($key, $all)) { - app('fireflyconfig')->set(sprintf('notification_%s', $key), $all[$key]); + FireflyConfig::set(sprintf('notification_%s', $key), $all[$key]); } } $variables = ['slack_webhook_url', 'pushover_app_token', 'pushover_user_token', 'ntfy_server', 'ntfy_topic', 'ntfy_user', 'ntfy_pass']; foreach ($variables as $variable) { if ('' === $all[$variable]) { - app('fireflyconfig')->delete($variable); + FireflyConfig::delete($variable); } if ('' !== $all[$variable]) { - app('fireflyconfig')->setEncrypted($variable, $all[$variable]); + FireflyConfig::setEncrypted($variable, $all[$variable]); } } - app('fireflyconfig')->set('ntfy_auth', $all['ntfy_auth'] ?? false); + FireflyConfig::set('ntfy_auth', $all['ntfy_auth'] ?? false); session()->flash('success', (string) trans('firefly.notification_settings_saved')); diff --git a/app/Notifications/ReturnsSettings.php b/app/Notifications/ReturnsSettings.php index 870b600792..942e459df4 100644 --- a/app/Notifications/ReturnsSettings.php +++ b/app/Notifications/ReturnsSettings.php @@ -55,7 +55,7 @@ class ReturnsSettings if ('user' === $type && null !== $user) { $settings['ntfy_server'] = Preferences::getEncryptedForUser($user, 'ntfy_server', 'https://ntfy.sh')->data; $settings['ntfy_topic'] = Preferences::getEncryptedForUser($user, 'ntfy_topic', '')->data; - $settings['ntfy_auth'] = Preferences::getForUser($user, 'ntfy_auth', false)->data; + $settings['ntfy_auth'] = '1' === Preferences::getForUser($user, 'ntfy_auth', false)->data; $settings['ntfy_user'] = Preferences::getEncryptedForUser($user, 'ntfy_user', '')->data; $settings['ntfy_pass'] = Preferences::getEncryptedForUser($user, 'ntfy_pass', '')->data; Log::debug(sprintf('Auth is %s, user = "%s"', var_export($settings['ntfy_auth'], true), $settings['ntfy_user'])); From fc98d66ef49601e573f99b28653a254d4205cee4 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 17:45:16 +0100 Subject: [PATCH 40/52] Auto commit for release 'develop' on 2025-03-14 --- .ci/php-cs-fixer/composer.lock | 24 +- .../Models/PiggyBank/UpdateRequest.php | 2 +- .../Correction/CorrectsUnevenAmount.php | 3 +- .../ValidatesEnvironmentVariables.php | 19 +- app/Factory/BillFactory.php | 4 +- app/Factory/PiggyBankFactory.php | 47 +- app/Helpers/Report/NetWorth.php | 36 +- .../Controllers/Account/ShowController.php | 34 +- app/Http/Middleware/AcceptHeaders.php | 4 +- .../Account/AccountRepository.php | 144 +++-- app/Repositories/Account/AccountTasker.php | 58 +- .../Account/OperationsRepository.php | 68 +-- .../Attachment/AttachmentRepository.php | 12 +- .../AuditLogEntry/ALERepository.php | 2 +- app/Repositories/Bill/BillRepository.php | 143 ++--- .../Budget/AvailableBudgetRepository.php | 58 +- .../Budget/BudgetLimitRepository.php | 251 ++++---- app/Repositories/Budget/BudgetRepository.php | 132 ++-- .../Budget/BudgetRepositoryInterface.php | 1 - .../Budget/NoBudgetRepository.php | 12 +- .../Budget/NoBudgetRepositoryInterface.php | 1 - .../Budget/OperationsRepository.php | 44 +- .../Budget/OperationsRepositoryInterface.php | 1 - .../Category/CategoryRepository.php | 29 +- .../Category/CategoryRepositoryInterface.php | 1 - .../Category/NoCategoryRepository.php | 50 +- .../NoCategoryRepositoryInterface.php | 1 - .../Category/OperationsRepository.php | 84 +-- .../OperationsRepositoryInterface.php | 1 - .../Currency/CurrencyRepository.php | 31 +- .../Currency/CurrencyRepositoryInterface.php | 1 - .../ExchangeRate/ExchangeRateRepository.php | 49 +- .../ExchangeRateRepositoryInterface.php | 2 +- .../Journal/JournalAPIRepository.php | 9 +- .../Journal/JournalAPIRepositoryInterface.php | 1 - .../Journal/JournalCLIRepository.php | 26 +- .../Journal/JournalRepository.php | 11 +- .../Journal/JournalRepositoryInterface.php | 1 - .../LinkType/LinkTypeRepository.php | 31 +- .../LinkType/LinkTypeRepositoryInterface.php | 1 - .../ObjectGroup/ObjectGroupRepository.php | 17 +- .../ObjectGroupRepositoryInterface.php | 1 - .../PiggyBank/ModifiesPiggyBanks.php | 53 +- .../PiggyBank/PiggyBankRepository.php | 98 +-- .../PiggyBankRepositoryInterface.php | 1 - .../Recurring/RecurringRepository.php | 89 +-- .../RecurringRepositoryInterface.php | 1 - app/Repositories/Rule/RuleRepository.php | 86 +-- .../Rule/RuleRepositoryInterface.php | 1 - .../RuleGroup/RuleGroupRepository.php | 141 +++-- .../RuleGroupRepositoryInterface.php | 1 - app/Repositories/Tag/OperationsRepository.php | 30 +- .../Tag/OperationsRepositoryInterface.php | 1 - app/Repositories/Tag/TagRepository.php | 27 +- .../Tag/TagRepositoryInterface.php | 1 - .../TransactionGroupRepository.php | 89 +-- .../TransactionGroupRepositoryInterface.php | 1 - .../TransactionTypeRepository.php | 2 +- .../TransactionTypeRepositoryInterface.php | 1 - app/Repositories/User/UserRepository.php | 41 +- .../User/UserRepositoryInterface.php | 5 +- .../UserGroup/UserGroupRepository.php | 37 +- .../UserGroupRepositoryInterface.php | 1 - .../UserGroups/Account/AccountRepository.php | 73 +-- .../Account/AccountRepositoryInterface.php | 1 - .../UserGroups/Bill/BillRepository.php | 20 +- .../Budget/AvailableBudgetRepository.php | 7 +- .../UserGroups/Budget/BudgetRepository.php | 14 +- .../Budget/OperationsRepository.php | 16 +- .../Currency/CurrencyRepository.php | 21 +- .../ExchangeRate/ExchangeRateRepository.php | 47 +- .../UserGroups/Journal/JournalRepository.php | 3 +- .../PiggyBank/PiggyBankRepository.php | 17 +- .../Webhook/WebhookRepository.php | 22 +- .../Webhook/WebhookRepositoryInterface.php | 1 - app/Rules/IsValidZeroOrMoreAmount.php | 4 +- app/Support/Debug/Timer.php | 2 +- .../Http/Controllers/PeriodOverview.php | 253 ++++---- .../JsonApi/Enrichments/AccountEnrichment.php | 2 - app/Support/Preferences.php | 4 +- app/Support/Request/ConvertsDataTypes.php | 8 +- app/Validation/AccountValidator.php | 14 +- .../Bulk/ValidatesBulkTransactionQuery.php | 12 +- composer.lock | 16 +- config/firefly.php | 2 +- config/search.php | 462 +++++++------- package-lock.json | 566 +++++++++--------- resources/assets/v1/src/locales/cs.json | 18 +- resources/assets/v1/src/locales/es.json | 2 +- resources/assets/v1/src/locales/zh-cn.json | 12 +- 90 files changed, 1933 insertions(+), 1840 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index bbbae259e6..c98a125350 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -406,16 +406,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.70.2", + "version": "v3.72.0", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "1ca468270efbb75ce0c7566a79cca8ea2888584d" + "reference": "900389362c43d116fee1ffc51f7878145fa61b57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/1ca468270efbb75ce0c7566a79cca8ea2888584d", - "reference": "1ca468270efbb75ce0c7566a79cca8ea2888584d", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/900389362c43d116fee1ffc51f7878145fa61b57", + "reference": "900389362c43d116fee1ffc51f7878145fa61b57", "shasum": "" }, "require": { @@ -445,18 +445,18 @@ "symfony/stopwatch": "^5.4 || ^6.4 || ^7.0" }, "require-dev": { - "facile-it/paraunit": "^1.3.1 || ^2.5", - "infection/infection": "^0.29.10", - "justinrainbow/json-schema": "^5.3 || ^6.0", + "facile-it/paraunit": "^1.3.1 || ^2.6", + "infection/infection": "^0.29.14", + "justinrainbow/json-schema": "^5.3 || ^6.2", "keradus/cli-executor": "^2.1", "mikey179/vfsstream": "^1.6.12", "php-coveralls/php-coveralls": "^2.7", "php-cs-fixer/accessible-object": "^1.1", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", - "phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.7", - "symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.0", - "symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.0" + "phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12", + "symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.3", + "symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.3" }, "suggest": { "ext-dom": "For handling output formats in XML", @@ -497,7 +497,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.70.2" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.72.0" }, "funding": [ { @@ -505,7 +505,7 @@ "type": "github" } ], - "time": "2025-03-03T21:07:23+00:00" + "time": "2025-03-13T11:25:37+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php index 6aa7e417b8..c6c23c72ca 100644 --- a/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php +++ b/app/Api/V1/Requests/Models/PiggyBank/UpdateRequest.php @@ -82,7 +82,7 @@ class UpdateRequest extends FormRequest 'accounts' => 'required', 'accounts.*' => 'array|required', 'accounts.*.account_id' => ['required', 'numeric', 'belongsToUser:accounts,id'], - 'accounts.*.current_amount' => ['numeric','nullable', new IsValidZeroOrMoreAmount(true)], + 'accounts.*.current_amount' => ['numeric', 'nullable', new IsValidZeroOrMoreAmount(true)], 'object_group_id' => 'numeric|belongsToUser:object_groups,id', 'object_group_title' => ['min:1', 'max:255'], 'transaction_currency_id' => 'exists:transaction_currencies,id|nullable', diff --git a/app/Console/Commands/Correction/CorrectsUnevenAmount.php b/app/Console/Commands/Correction/CorrectsUnevenAmount.php index 94855811d3..d2b2e9e364 100644 --- a/app/Console/Commands/Correction/CorrectsUnevenAmount.php +++ b/app/Console/Commands/Correction/CorrectsUnevenAmount.php @@ -122,7 +122,8 @@ class CorrectsUnevenAmount extends Command $journals = DB::table('transactions') ->groupBy('transaction_journal_id') ->whereNull('deleted_at') - ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]); + ->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]) + ; /** @var \stdClass $entry */ foreach ($journals as $entry) { diff --git a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php index 0f6414bbf1..1848770afe 100644 --- a/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php +++ b/app/Console/Commands/Integrity/ValidatesEnvironmentVariables.php @@ -1,4 +1,6 @@ validateLanguage(); $this->validateGuard(); $this->validateStaticToken(); + return Command::SUCCESS; } private function validateLanguage(): void { - $language = config('firefly.default_language'); - $locale = config('firefly.default_locale'); - $options = array_keys(config('firefly.languages')); + $language = config('firefly.default_language'); + $locale = config('firefly.default_locale'); + $options = array_keys(config('firefly.languages')); if (!in_array($language, $options, true)) { $this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); $this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options))); + exit(1); } $options[] = 'equal'; @@ -70,6 +74,7 @@ class ValidatesEnvironmentVariables extends Command $this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); $this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options))); + exit(1); } } @@ -81,6 +86,7 @@ class ValidatesEnvironmentVariables extends Command $this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard)); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); $this->friendlyError('Valid guards are: web, remote_user_guard'); + exit(1); } } @@ -88,9 +94,10 @@ class ValidatesEnvironmentVariables extends Command private function validateStaticToken(): void { $token = (string) config('firefly.static_cron_token'); - if (0 !== strlen($token) && 32 !== strlen($token)) { + if ('' !== $token && 32 !== strlen($token)) { $this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.'); $this->friendlyError('Please check your .env file and make sure you use a valid setting.'); + exit(1); } } diff --git a/app/Factory/BillFactory.php b/app/Factory/BillFactory.php index 8504e8b4bd..12b8c9b686 100644 --- a/app/Factory/BillFactory.php +++ b/app/Factory/BillFactory.php @@ -55,8 +55,8 @@ class BillFactory $skip = array_key_exists('skip', $data) ? $data['skip'] : 0; $active = array_key_exists('active', $data) ? $data['active'] : 0; - $data['extension_date'] = $data['extension_date'] ?? null; - $data['end_date'] = $data['end_date'] ?? null; + $data['extension_date'] ??= null; + $data['end_date'] ??= null; /** @var Bill $bill */ $bill = Bill::create( diff --git a/app/Factory/PiggyBankFactory.php b/app/Factory/PiggyBankFactory.php index d0473beddc..068cd0841a 100644 --- a/app/Factory/PiggyBankFactory.php +++ b/app/Factory/PiggyBankFactory.php @@ -67,7 +67,7 @@ class PiggyBankFactory public function store(array $data): PiggyBank { - $piggyBankData = $data; + $piggyBankData = $data; // unset some fields unset($piggyBankData['object_group_title'], $piggyBankData['transaction_currency_code'], $piggyBankData['transaction_currency_id'], $piggyBankData['accounts'], $piggyBankData['object_group_id'], $piggyBankData['notes']); @@ -91,11 +91,11 @@ class PiggyBankFactory throw new FireflyException('400005: Could not store new piggy bank.', 0, $e); } - $piggyBank = $this->setOrder($piggyBank, $data); + $piggyBank = $this->setOrder($piggyBank, $data); $this->linkToAccountIds($piggyBank, $data['accounts']); $this->piggyBankRepository->updateNote($piggyBank, $data['notes']); - $objectGroupTitle = $data['object_group_title'] ?? ''; + $objectGroupTitle = $data['object_group_title'] ?? ''; if ('' !== $objectGroupTitle) { $objectGroup = $this->findOrCreateObjectGroup($objectGroupTitle); if (null !== $objectGroup) { @@ -103,7 +103,7 @@ class PiggyBankFactory } } // try also with ID - $objectGroupId = (int) ($data['object_group_id'] ?? 0); + $objectGroupId = (int) ($data['object_group_id'] ?? 0); if (0 !== $objectGroupId) { $objectGroup = $this->findObjectGroupById($objectGroupId); if (null !== $objectGroup) { @@ -111,7 +111,7 @@ class PiggyBankFactory } } Log::debug('Touch piggy bank'); - $piggyBank->encrypted = false; + $piggyBank->encrypted = false; $piggyBank->save(); $piggyBank->touch(); @@ -144,10 +144,11 @@ class PiggyBankFactory // first find by ID: if ($piggyBankId > 0) { $piggyBank = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.id', $piggyBankId) - ->first(['piggy_banks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.id', $piggyBankId) + ->first(['piggy_banks.*']) + ; if (null !== $piggyBank) { return $piggyBank; } @@ -168,16 +169,17 @@ class PiggyBankFactory public function findByName(string $name): ?PiggyBank { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.name', $name) - ->first(['piggy_banks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.name', $name) + ->first(['piggy_banks.*']) + ; } private function setOrder(PiggyBank $piggyBank, array $data): PiggyBank { $this->resetOrder(); - $order = $this->getMaxOrder() + 1; + $order = $this->getMaxOrder() + 1; if (array_key_exists('order', $data)) { $order = $data['order']; } @@ -192,14 +194,15 @@ class PiggyBankFactory { // TODO duplicate code $set = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->get(['piggy_banks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->get(['piggy_banks.*']) + ; $current = 1; foreach ($set as $piggyBank) { if ($piggyBank->order !== $current) { diff --git a/app/Helpers/Report/NetWorth.php b/app/Helpers/Report/NetWorth.php index 4d2147f8aa..968e8e2640 100644 --- a/app/Helpers/Report/NetWorth.php +++ b/app/Helpers/Report/NetWorth.php @@ -74,29 +74,29 @@ class NetWorth implements NetWorthInterface return $cache->get(); } Log::debug(sprintf('Now in byAccounts("%s", "%s")', $ids, $date->format('Y-m-d H:i:s'))); - $default = Amount::getNativeCurrency(); - $netWorth = []; + $default = Amount::getNativeCurrency(); + $netWorth = []; Log::debug(sprintf('NetWorth: finalAccountsBalance("%s")', $date->format('Y-m-d H:i:s'))); - $balances = Steam::finalAccountsBalance($accounts, $date); + $balances = Steam::finalAccountsBalance($accounts, $date); /** @var Account $account */ foreach ($accounts as $account) { Log::debug(sprintf('Now at account #%d ("%s")', $account->id, $account->name)); - $currency = $this->accountRepository->getAccountCurrency($account) ?? $default; - $useNative = $convertToNative && $default->id !== $currency->id; - $currency = $useNative ? $default : $currency; - $currencyCode = $currency->code; - $balance = '0'; - $nativeBalance = '0'; + $currency = $this->accountRepository->getAccountCurrency($account) ?? $default; + $useNative = $convertToNative && $default->id !== $currency->id; + $currency = $useNative ? $default : $currency; + $currencyCode = $currency->code; + $balance = '0'; + $nativeBalance = '0'; if (array_key_exists($account->id, $balances)) { $balance = $balances[$account->id]['balance'] ?? '0'; $nativeBalance = $balances[$account->id]['native_balance'] ?? '0'; } Log::debug(sprintf('Balance is %s, native balance is %s', $balance, $nativeBalance)); // always subtract virtual balance again. - $balance = '' !== (string) $account->virtual_balance ? bcsub($balance, $account->virtual_balance) : $balance; - $nativeBalance = '' !== (string) $account->native_virtual_balance ? bcsub($nativeBalance, $account->native_virtual_balance) : $nativeBalance; - $amountToUse = $useNative ? $nativeBalance : $balance; + $balance = '' !== (string) $account->virtual_balance ? bcsub($balance, $account->virtual_balance) : $balance; + $nativeBalance = '' !== (string) $account->native_virtual_balance ? bcsub($nativeBalance, $account->native_virtual_balance) : $nativeBalance; + $amountToUse = $useNative ? $nativeBalance : $balance; Log::debug(sprintf('Will use %s %s', $currencyCode, $amountToUse)); $netWorth[$currencyCode] ??= [ @@ -115,7 +115,7 @@ class NetWorth implements NetWorthInterface return $netWorth; } - public function setUser(null | Authenticatable | User $user): void + public function setUser(null|Authenticatable|User $user): void { if (!$user instanceof User) { return; @@ -130,7 +130,7 @@ class NetWorth implements NetWorthInterface $this->accountRepository = app(AccountRepositoryInterface::class); $this->accountRepository->setUserGroup($userGroup); - $this->currencyRepos = app(CurrencyRepositoryInterface::class); + $this->currencyRepos = app(CurrencyRepositoryInterface::class); $this->currencyRepos->setUserGroup($this->userGroup); } @@ -147,16 +147,16 @@ class NetWorth implements NetWorthInterface Log::debug(sprintf('SumNetWorth: finalAccountsBalance("%s")', $date->format('Y-m-d H:i:s'))); $balances = Steam::finalAccountsBalance($accounts, $date); foreach ($accounts as $account) { - $currency = $this->accountRepository->getAccountCurrency($account); - $balance = $balances[$account->id]['balance'] ?? '0'; + $currency = $this->accountRepository->getAccountCurrency($account); + $balance = $balances[$account->id]['balance'] ?? '0'; // always subtract virtual balance. - $virtualBalance = $account->virtual_balance; + $virtualBalance = $account->virtual_balance; if ('' !== $virtualBalance) { $balance = bcsub($balance, $virtualBalance); } - $return[$currency->id] ??= [ + $return[$currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, 'symbol' => $currency->symbol, diff --git a/app/Http/Controllers/Account/ShowController.php b/app/Http/Controllers/Account/ShowController.php index a2b7a027a9..8a602f59e4 100644 --- a/app/Http/Controllers/Account/ShowController.php +++ b/app/Http/Controllers/Account/ShowController.php @@ -83,7 +83,7 @@ class ShowController extends Controller public function show(Request $request, Account $account, ?Carbon $start = null, ?Carbon $end = null) { - $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); + $objectType = config(sprintf('firefly.shortNamesByFullName.%s', $account->accountType->type)); if (!$this->isEditableAccount($account)) { return $this->redirectAccountToAccount($account); @@ -130,18 +130,20 @@ class ShowController extends Controller } Log::debug('Collect transactions'); Timer::start('collection'); + /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector ->setAccounts(new Collection([$account])) ->setLimit($pageSize) ->setPage($page) ->withAPIInformation() - ->setRange($start, $end); + ->setRange($start, $end) + ; // this search will not include transaction groups where this asset account (or liability) // is just part of ONE of the journals. To force this: $collector->setExpandGroupSearch(true); - $groups = $collector->getPaginatedGroups(); + $groups = $collector->getPaginatedGroups(); Log::debug('End collect transactions'); Timer::stop('collection'); @@ -149,21 +151,21 @@ class ShowController extends Controller // enrich data in arrays. // enrich -// $enrichment = new TransactionGroupEnrichment(); -// $enrichment->setUser(auth()->user()); -// $groups->setCollection($enrichment->enrich($groups->getCollection())); + // $enrichment = new TransactionGroupEnrichment(); + // $enrichment->setUser(auth()->user()); + // $groups->setCollection($enrichment->enrich($groups->getCollection())); $groups->setPath(route('accounts.show', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')])); - $showAll = false; + $showAll = false; // correct - $now = today()->endOfDay(); + $now = today()->endOfDay(); if ($now->gt($end) || $now->lt($start)) { $now = $end; } Log::debug(sprintf('show: Call finalAccountBalance with date/time "%s"', $now->toIso8601String())); - $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $now), $account, $this->convertToNative, $accountCurrency); + $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $now), $account, $this->convertToNative, $accountCurrency); return view( 'accounts.show', @@ -207,7 +209,7 @@ class ShowController extends Controller $today = today(config('app.timezone')); $accountCurrency = $this->repository->getAccountCurrency($account); $start = $this->repository->oldestJournalDate($account) ?? today(config('app.timezone'))->startOfMonth(); - $subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type); + $subTitleIcon = config('firefly.subIconsByIdentifier.'.$account->accountType->type); $page = (int) $request->get('page'); $pageSize = (int) app('preferences')->get('listPageSize', 50)->data; $currency = $this->repository->getAccountCurrency($account) ?? $this->defaultCurrency; @@ -217,20 +219,20 @@ class ShowController extends Controller $end->endOfDay(); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page)->withAccountInformation()->withCategoryInformation(); // this search will not include transaction groups where this asset account (or liability) // is just part of ONE of the journals. To force this: $collector->setExpandGroupSearch(true); - $groups = $collector->getPaginatedGroups(); + $groups = $collector->getPaginatedGroups(); $groups->setPath(route('accounts.show.all', [$account->id])); - $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); - $showAll = true; + $chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]); + $showAll = true; // correct Log::debug(sprintf('showAll: Call finalAccountBalance with date/time "%s"', $end->toIso8601String())); - $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $end), $account, $this->convertToNative, $accountCurrency); + $balances = Steam::filterAccountBalance(Steam::finalAccountBalance($account, $end), $account, $this->convertToNative, $accountCurrency); return view( 'accounts.show', diff --git a/app/Http/Middleware/AcceptHeaders.php b/app/Http/Middleware/AcceptHeaders.php index 812713f226..54c9d1f643 100644 --- a/app/Http/Middleware/AcceptHeaders.php +++ b/app/Http/Middleware/AcceptHeaders.php @@ -52,8 +52,8 @@ class AcceptHeaders // if bad 'Content-Type' header, refuse service. // some routes are exempt from this. - $exempt = [ - 'api.v1.data.bulk.transactions' + $exempt = [ + 'api.v1.data.bulk.transactions', ]; if (('POST' === $method || 'PUT' === $method) && !$request->hasHeader('Content-Type') && !in_array($request->route()->getName(), $exempt, true)) { diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 26f3cc12f7..be01bb7268 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -45,7 +45,6 @@ use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Storage; -use Override; /** * Class AccountRepository. @@ -76,7 +75,8 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac /** @var Account $account */ foreach ($accounts as $account) { $byName = $this->user->accounts()->where('name', $account->name) - ->where('id', '!=', $account->id)->first(); + ->where('id', '!=', $account->id)->first() + ; if (null !== $byName) { $result->push($account); $result->push($byName); @@ -85,7 +85,8 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac } if (null !== $account->iban) { $byIban = $this->user->accounts()->where('iban', $account->iban) - ->where('id', '!=', $account->id)->first(); + ->where('id', '!=', $account->id)->first() + ; if (null !== $byIban) { $result->push($account); $result->push($byIban); @@ -111,7 +112,8 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); } - ); + ) + ; if (0 !== count($types)) { $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -138,7 +140,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function findByName(string $name, array $types): ?Account { - $query = $this->user->accounts(); + $query = $this->user->accounts(); if (0 !== count($types)) { $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -160,7 +162,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return $account; } - #[Override] + #[\Override] public function getAccountBalances(Account $account): Collection { return $account->accountBalances; @@ -192,10 +194,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { $query = $this->user->accounts()->with( [ // @phpstan-ignore-line - 'accountmeta' => static function (HasMany $query): void { - $query->where('name', 'account_role'); - }, - 'attachments', + 'accountmeta' => static function (HasMany $query): void { + $query->where('name', 'account_role'); + }, + 'attachments', ] ); if (0 !== count($types)) { @@ -211,7 +213,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getAttachments(Account $account): Collection { - $set = $account->attachments()->get(); + $set = $account->attachments()->get(); /** @var Storage $disk */ $disk = Storage::disk('upload'); @@ -233,7 +235,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getCashAccount(): Account { /** @var AccountType $type */ - $type = AccountType::where('type', AccountTypeEnum::CASH->value)->first(); + $type = AccountType::where('type', AccountTypeEnum::CASH->value)->first(); /** @var AccountFactory $factory */ $factory = app(AccountFactory::class); @@ -245,9 +247,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getCreditTransactionGroup(Account $account): ?TransactionGroup { $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::LIABILITY_CREDIT->value]) - ->first(['transaction_journals.*']); + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::LIABILITY_CREDIT->value]) + ->first(['transaction_journals.*']) + ; return $journal?->transactionGroup; } @@ -256,9 +259,9 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { $query = $this->user->accounts()->with( [ // @phpstan-ignore-line - 'accountmeta' => static function (HasMany $query): void { - $query->where('name', 'account_role'); - }, + 'accountmeta' => static function (HasMany $query): void { + $query->where('name', 'account_role'); + }, ] ); if (0 !== count($types)) { @@ -291,10 +294,11 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac */ public function getOpeningBalanceAmount(Account $account, bool $convertToNative): ?string { - $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) - ->first(['transaction_journals.*']); + $journal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) + ->first(['transaction_journals.*']) + ; if (null === $journal) { return null; } @@ -315,9 +319,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getOpeningBalanceDate(Account $account): ?string { return TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) - ->first(['transaction_journals.*'])?->date->format('Y-m-d H:i:s'); + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value, TransactionTypeEnum::LIABILITY_CREDIT->value]) + ->first(['transaction_journals.*'])?->date->format('Y-m-d H:i:s') + ; } public function getOpeningBalanceGroup(Account $account): ?TransactionGroup @@ -330,9 +335,10 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function getOpeningBalance(Account $account): ?TransactionJournal { return TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transactions.account_id', $account->id) - ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value]) - ->first(['transaction_journals.*']); + ->where('transactions.account_id', $account->id) + ->transactionTypes([TransactionTypeEnum::OPENING_BALANCE->value]) + ->first(['transaction_journals.*']) + ; } public function getPiggyBanks(Account $account): Collection @@ -352,18 +358,19 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac $name = trans('firefly.reconciliation_account_name', ['name' => $account->name, 'currency' => $currency->code]); /** @var AccountType $type */ - $type = AccountType::where('type', AccountTypeEnum::RECONCILIATION->value)->first(); + $type = AccountType::where('type', AccountTypeEnum::RECONCILIATION->value)->first(); /** @var null|Account $current */ - $current = $this->user->accounts()->where('account_type_id', $type->id) - ->where('name', $name) - ->first(); + $current = $this->user->accounts()->where('account_type_id', $type->id) + ->where('name', $name) + ->first() + ; if (null !== $current) { return $current; } - $data = [ + $data = [ 'account_type_id' => null, 'account_type_name' => AccountTypeEnum::RECONCILIATION->value, 'active' => true, @@ -373,7 +380,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac ]; /** @var AccountFactory $factory */ - $factory = app(AccountFactory::class); + $factory = app(AccountFactory::class); $factory->setUser($account->user); return $factory->create($data); @@ -381,8 +388,8 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac 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)) { @@ -446,7 +453,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function maxOrder(string $type): int { - $sets = [ + $sets = [ AccountTypeEnum::ASSET->value => [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value], AccountTypeEnum::EXPENSE->value => [AccountTypeEnum::EXPENSE->value, AccountTypeEnum::BENEFICIARY->value], AccountTypeEnum::REVENUE->value => [AccountTypeEnum::REVENUE->value], @@ -462,7 +469,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac } $specials = [AccountTypeEnum::CASH->value, AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::IMPORT->value, AccountTypeEnum::RECONCILIATION->value]; - $order = (int) $this->getAccountsByType($specials)->max('order'); + $order = (int) $this->getAccountsByType($specials)->max('order'); app('log')->debug(sprintf('Return max order of "%s" set (specials!): %d', $type, $order)); return $order; @@ -513,12 +520,13 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac { /** @var null|TransactionJournal $first */ $first = $account->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'ASC') - ->orderBy('transaction_journals.order', 'DESC') - ->where('transaction_journals.user_id', $this->user->id) - ->orderBy('transaction_journals.id', 'ASC') - ->first(['transaction_journals.id']); + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'ASC') + ->orderBy('transaction_journals.order', 'DESC') + ->where('transaction_journals.user_id', $this->user->id) + ->orderBy('transaction_journals.id', 'ASC') + ->first(['transaction_journals.id']) + ; if (null !== $first) { /** @var null|TransactionJournal */ return TransactionJournal::find($first->id); @@ -554,10 +562,11 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac } } // reset the rest to zero. - $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; + $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; $this->user->accounts()->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->whereNotIn('account_types.type', $all) - ->update(['order' => 0]); + ->whereNotIn('account_types.type', $all) + ->update(['order' => 0]) + ; } /** @@ -574,11 +583,12 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function searchAccount(string $query, array $types, int $limit): Collection { $dbQuery = $this->user->accounts() - ->where('active', true) - ->orderBy('accounts.order', 'ASC') - ->orderBy('accounts.account_type_id', 'ASC') - ->orderBy('accounts.name', 'ASC') - ->with(['accountType']); + ->where('active', true) + ->orderBy('accounts.order', 'ASC') + ->orderBy('accounts.account_type_id', 'ASC') + ->orderBy('accounts.name', 'ASC') + ->with(['accountType']) + ; if ('' !== $query) { // split query on spaces just in case: $parts = explode(' ', $query); @@ -598,12 +608,13 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac public function searchAccountNr(string $query, array $types, int $limit): Collection { $dbQuery = $this->user->accounts()->distinct() - ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') - ->where('accounts.active', true) - ->orderBy('accounts.order', 'ASC') - ->orderBy('accounts.account_type_id', 'ASC') - ->orderBy('accounts.name', 'ASC') - ->with(['accountType', 'accountMeta']); + ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') + ->where('accounts.active', true) + ->orderBy('accounts.order', 'ASC') + ->orderBy('accounts.account_type_id', 'ASC') + ->orderBy('accounts.name', 'ASC') + ->with(['accountType', 'accountMeta']) + ; if ('' !== $query) { // split query on spaces just in case: $parts = explode(' ', $query); @@ -642,15 +653,16 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac return $factory->create($data); } - #[\Override] public function periodCollection(Account $account, Carbon $start, Carbon $end): array + #[\Override] + public function periodCollection(Account $account, Carbon $start, Carbon $end): array { return $account->transactions() - ->leftJoin('transaction_journals','transaction_journals.id','=','transactions.transaction_journal_id') - ->leftJoin('transaction_types','transaction_types.id','=','transaction_journals.transaction_type_id') - ->leftJoin('transaction_currencies','transaction_currencies.id','=','transactions.transaction_currency_id') - ->leftJoin('transaction_currencies as foreign_currencies','foreign_currencies.id','=','transactions.foreign_currency_id') - ->where('transaction_journals.date','>=',$start) - ->where('transaction_journals.date','<=',$end) + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') + ->leftJoin('transaction_currencies', 'transaction_currencies.id', '=', 'transactions.transaction_currency_id') + ->leftJoin('transaction_currencies as foreign_currencies', 'foreign_currencies.id', '=', 'transactions.foreign_currency_id') + ->where('transaction_journals.date', '>=', $start) + ->where('transaction_journals.date', '<=', $end) ->get([ // currencies 'transaction_currencies.id as currency_id', @@ -667,7 +679,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac 'foreign_currencies.decimal_places as foreign_decimal_places', // fields - 'transaction_journals.date', 'transaction_types.type', 'transaction_journals.transaction_currency_id', 'transactions.amount']) + 'transaction_journals.date', 'transaction_types.type', 'transaction_journals.transaction_currency_id', 'transactions.amount']) ->toArray(); } diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php index c314a6a59b..2447de9f43 100644 --- a/app/Repositories/Account/AccountTasker.php +++ b/app/Repositories/Account/AccountTasker.php @@ -47,28 +47,28 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface */ public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array { - $yesterday = clone $start; + $yesterday = clone $start; $yesterday->subDay()->endOfDay(); // exactly up until $start but NOT including. $end->endOfDay(); // needs to be end of day to be correct. Log::debug(sprintf('getAccountReport: finalAccountsBalance("%s")', $yesterday->format('Y-m-d H:i:s'))); Log::debug(sprintf('getAccountReport: finalAccountsBalance("%s")', $end->format('Y-m-d H:i:s'))); - $startSet = Steam::finalAccountsBalance($accounts, $yesterday); - $endSet = Steam::finalAccountsBalance($accounts, $end); + $startSet = Steam::finalAccountsBalance($accounts, $yesterday); + $endSet = Steam::finalAccountsBalance($accounts, $end); Log::debug('Start of accountreport'); /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); - $return = [ + $return = [ 'accounts' => [], 'sums' => [], ]; /** @var Account $account */ foreach ($accounts as $account) { - $id = $account->id; - $currency = $repository->getAccountCurrency($account) ?? $defaultCurrency; + $id = $account->id; + $currency = $repository->getAccountCurrency($account) ?? $defaultCurrency; $return['sums'][$currency->id] ??= [ 'start' => '0', 'end' => '0', @@ -79,7 +79,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface 'currency_name' => $currency->name, 'currency_decimal_places' => $currency->decimal_places, ]; - $entry = [ + $entry = [ 'name' => $account->name, 'id' => $account->id, 'currency_id' => $currency->id, @@ -90,9 +90,9 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface ]; // get first journal date: - $first = $repository->oldestJournal($account); - $entry['start_balance'] = $startSet[$account->id]['balance'] ?? '0'; - $entry['end_balance'] = $endSet[$account->id]['balance'] ?? '0'; + $first = $repository->oldestJournal($account); + $entry['start_balance'] = $startSet[$account->id]['balance'] ?? '0'; + $entry['end_balance'] = $endSet[$account->id]['balance'] ?? '0'; // first journal exists, and is on start, then this is the actual opening balance: if (null !== $first && $first->date->isSameDay($yesterday) && TransactionTypeEnum::OPENING_BALANCE->value === $first->transactionType->type) { @@ -127,13 +127,13 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $collector->setSourceAccounts($accounts)->setRange($start, $end); $collector->excludeDestinationAccounts($accounts); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::TRANSFER->value])->withAccountInformation(); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); - $report = $this->groupExpenseByDestination($journals); + $report = $this->groupExpenseByDestination($journals); // sort the result // Obtain a list of columns - $sum = []; + $sum = []; foreach ($report['accounts'] as $accountId => $row) { $sum[$accountId] = (float) $row['sum']; // intentional float } @@ -151,9 +151,9 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ - $currencyRepos = app(CurrencyRepositoryInterface::class); - $currencies = [$defaultCurrency->id => $defaultCurrency]; - $report = [ + $currencyRepos = app(CurrencyRepositoryInterface::class); + $currencies = [$defaultCurrency->id => $defaultCurrency]; + $report = [ 'accounts' => [], 'sums' => [], ]; @@ -163,8 +163,8 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $sourceId = (int) $journal['destination_account_id']; $currencyId = (int) $journal['currency_id']; $key = sprintf('%s-%s', $sourceId, $currencyId); - $currencies[$currencyId] ??= $currencyRepos->find($currencyId); - $report['accounts'][$key] ??= [ + $currencies[$currencyId] ??= $currencyRepos->find($currencyId); + $report['accounts'][$key] ??= [ 'id' => $sourceId, 'name' => $journal['destination_account_name'], 'sum' => '0', @@ -189,7 +189,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string) $report['accounts'][$key]['count']); } $currencyId = $report['accounts'][$key]['currency_id']; - $report['sums'][$currencyId] ??= [ + $report['sums'][$currencyId] ??= [ 'sum' => '0', 'currency_id' => $report['accounts'][$key]['currency_id'], 'currency_name' => $report['accounts'][$key]['currency_name'], @@ -217,11 +217,11 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $collector->setDestinationAccounts($accounts)->setRange($start, $end); $collector->excludeSourceAccounts($accounts); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value])->withAccountInformation(); - $report = $this->groupIncomeBySource($collector->getExtractedJournals()); + $report = $this->groupIncomeBySource($collector->getExtractedJournals()); // sort the result // Obtain a list of columns - $sum = []; + $sum = []; foreach ($report['accounts'] as $accountId => $row) { $sum[$accountId] = (float) $row['sum']; // intentional float } @@ -239,20 +239,20 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); /** @var CurrencyRepositoryInterface $currencyRepos */ - $currencyRepos = app(CurrencyRepositoryInterface::class); - $currencies = [$defaultCurrency->id => $defaultCurrency]; - $report = [ + $currencyRepos = app(CurrencyRepositoryInterface::class); + $currencies = [$defaultCurrency->id => $defaultCurrency]; + $report = [ 'accounts' => [], 'sums' => [], ]; /** @var array $journal */ foreach ($array as $journal) { - $sourceId = (int) $journal['source_account_id']; - $currencyId = (int) $journal['currency_id']; - $key = sprintf('%s-%s', $sourceId, $currencyId); + $sourceId = (int) $journal['source_account_id']; + $currencyId = (int) $journal['currency_id']; + $key = sprintf('%s-%s', $sourceId, $currencyId); if (!array_key_exists($key, $report['accounts'])) { - $currencies[$currencyId] ??= $currencyRepos->find($currencyId); + $currencies[$currencyId] ??= $currencyRepos->find($currencyId); $report['accounts'][$key] = [ 'id' => $sourceId, 'name' => $journal['source_account_name'], @@ -276,7 +276,7 @@ class AccountTasker implements AccountTaskerInterface, UserGroupInterface $report['accounts'][$key]['average'] = bcdiv($report['accounts'][$key]['sum'], (string) $report['accounts'][$key]['count']); } $currencyId = $report['accounts'][$key]['currency_id']; - $report['sums'][$currencyId] ??= [ + $report['sums'][$currencyId] ??= [ 'sum' => '0', 'currency_id' => $report['accounts'][$key]['currency_id'], 'currency_name' => $report['accounts'][$key]['currency_name'], diff --git a/app/Repositories/Account/OperationsRepository.php b/app/Repositories/Account/OperationsRepository.php index 67639f8a51..fb71bb7235 100644 --- a/app/Repositories/Account/OperationsRepository.php +++ b/app/Repositories/Account/OperationsRepository.php @@ -70,8 +70,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn { $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $journalId = (int) $journal['transaction_journal_id']; + $currencyId = (int) $journal['currency_id']; + $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId] ??= [ 'currency_id' => $journal['currency_id'], 'currency_name' => $journal['currency_name'], @@ -123,8 +123,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $expense = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); return $this->groupByCurrency($journals, 'negative'); @@ -141,8 +140,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $opposing = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $start->startOfDay(); $end->endOfDay(); @@ -175,14 +173,15 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn if (null !== $currency) { $collector->setCurrency($currency); } - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); // same but for foreign currencies: if (null !== $currency) { /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([$type])->withAccountInformation() - ->setForeignCurrency($currency); + ->setForeignCurrency($currency) + ; if (TransactionTypeEnum::WITHDRAWAL->value === $type) { if (null !== $accounts) { $collector->setSourceAccounts($accounts); @@ -200,10 +199,10 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } } - $result = $collector->getExtractedJournals(); + $result = $collector->getExtractedJournals(); // do not use array_merge because you want keys to overwrite (otherwise you get double results): - $journals = $result + $journals; + $journals = $result + $journals; } return $journals; @@ -225,8 +224,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $expense = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); return $this->groupByDirection($journals, 'destination', 'negative'); @@ -248,8 +246,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $expense = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); return $this->groupByDirection($journals, 'source', 'negative'); @@ -264,8 +261,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $revenue = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); return $this->groupByCurrency($journals, 'positive'); @@ -280,8 +276,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $revenue = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); return $this->groupByDirection($journals, 'destination', 'positive'); @@ -296,8 +291,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $revenue = null, ?TransactionCurrency $currency = null - ): array - { + ): array { $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); return $this->groupByDirection($journals, 'source', 'positive'); @@ -318,7 +312,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn foreach ($journals as $journal) { $return = $this->groupByEitherJournal($return, $journal); } - $final = []; + $final = []; foreach ($return as $array) { $array['difference_float'] = (float) $array['difference']; $array['in_float'] = (float) $array['in']; @@ -331,12 +325,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn private function groupByEitherJournal(array $return, array $journal): array { - $sourceId = $journal['source_account_id']; - $destinationId = $journal['destination_account_id']; - $currencyId = $journal['currency_id']; - $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); - $destKey = sprintf('%d-%d', $currencyId, $destinationId); - $amount = app('steam')->positive($journal['amount']); + $sourceId = $journal['source_account_id']; + $destinationId = $journal['destination_account_id']; + $currencyId = $journal['currency_id']; + $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); + $destKey = sprintf('%d-%d', $currencyId, $destinationId); + $amount = app('steam')->positive($journal['amount']); // source first $return[$sourceKey] ??= [ @@ -353,7 +347,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; // dest next: - $return[$destKey] ??= [ + $return[$destKey] ??= [ 'id' => (string) $destinationId, 'name' => $journal['destination_account_name'], 'difference' => '0', @@ -371,15 +365,15 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], $return[$sourceKey]['in']); // destination account? money comes in: - $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); - $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); + $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); + $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); // foreign currency if (null !== $journal['foreign_currency_id'] && null !== $journal['foreign_amount']) { - $currencyId = $journal['foreign_currency_id']; - $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); - $destKey = sprintf('%d-%d', $currencyId, $destinationId); - $amount = app('steam')->positive($journal['foreign_amount']); + $currencyId = $journal['foreign_currency_id']; + $sourceKey = sprintf('%d-%d', $currencyId, $sourceId); + $destKey = sprintf('%d-%d', $currencyId, $destinationId); + $amount = app('steam')->positive($journal['foreign_amount']); // same as above: // source first @@ -397,7 +391,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ]; // dest next: - $return[$destKey] ??= [ + $return[$destKey] ??= [ 'id' => (string) $destinationId, 'name' => $journal['destination_account_name'], 'difference' => '0', @@ -414,8 +408,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $return[$sourceKey]['difference'] = bcadd($return[$sourceKey]['out'], $return[$sourceKey]['in']); // destination account? money comes in: - $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); - $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); + $return[$destKey]['in'] = bcadd($return[$destKey]['in'], $amount); + $return[$destKey]['difference'] = bcadd($return[$destKey]['out'], $return[$destKey]['in']); } return $return; diff --git a/app/Repositories/Attachment/AttachmentRepository.php b/app/Repositories/Attachment/AttachmentRepository.php index df62a9d0b2..17ec138917 100644 --- a/app/Repositories/Attachment/AttachmentRepository.php +++ b/app/Repositories/Attachment/AttachmentRepository.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Attachment; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\AttachmentFactory; use FireflyIII\Helpers\Attachments\AttachmentHelperInterface; @@ -36,7 +35,6 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\Storage; use League\Flysystem\UnableToDeleteFile; -use LogicException; /** * Class AttachmentRepository. @@ -46,14 +44,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn use UserGroupTrait; /** - * @throws Exception + * @throws \Exception */ public function destroy(Attachment $attachment): bool { /** @var AttachmentHelperInterface $helper */ $helper = app(AttachmentHelperInterface::class); - $path = $helper->getAttachmentLocation($attachment); + $path = $helper->getAttachmentLocation($attachment); try { Storage::disk('upload')->delete($path); @@ -120,7 +118,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn /** @var AttachmentFactory $factory */ $factory = app(AttachmentFactory::class); $factory->setUser($this->user); - $result = $factory->create($data); + $result = $factory->create($data); if (null === $result) { throw new FireflyException('Could not store attachment.'); } @@ -160,14 +158,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn if (null !== $dbNote) { try { $dbNote->delete(); - } catch (LogicException $e) { + } catch (\LogicException $e) { app('log')->error($e->getMessage()); } } return true; } - $dbNote = $attachment->notes()->first(); + $dbNote = $attachment->notes()->first(); if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($attachment); diff --git a/app/Repositories/AuditLogEntry/ALERepository.php b/app/Repositories/AuditLogEntry/ALERepository.php index 42faf9f02c..02f60db94e 100644 --- a/app/Repositories/AuditLogEntry/ALERepository.php +++ b/app/Repositories/AuditLogEntry/ALERepository.php @@ -41,7 +41,7 @@ class ALERepository implements ALERepositoryInterface public function store(array $data): AuditLogEntry { - $auditLogEntry = new AuditLogEntry(); + $auditLogEntry = new AuditLogEntry(); $auditLogEntry->auditable()->associate($data['auditable']); $auditLogEntry->changer()->associate($data['changer']); diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index faf89f6a72..9d067a5c3a 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -62,7 +62,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%%%s', $query)); } $search->orderBy('name', 'ASC') - ->where('active', true); + ->where('active', true) + ; return $search->take($limit)->get(); } @@ -74,7 +75,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%s%%', $query)); } $search->orderBy('name', 'ASC') - ->where('active', true); + ->where('active', true) + ; return $search->take($limit)->get(); } @@ -176,9 +178,10 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getBills(): Collection { return $this->user->bills() - ->orderBy('order', 'ASC') - ->orderBy('active', 'DESC') - ->orderBy('name', 'ASC')->get(); + ->orderBy('order', 'ASC') + ->orderBy('active', 'DESC') + ->orderBy('name', 'ASC')->get() + ; } public function getBillsForAccounts(Collection $accounts): Collection @@ -202,24 +205,25 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $ids = $accounts->pluck('id')->toArray(); return $this->user->bills() - ->leftJoin( - 'transaction_journals', - static function (JoinClause $join): void { - $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); - } - ) - ->leftJoin( - 'transactions', - static function (JoinClause $join): void { - $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); - } - ) - ->whereIn('transactions.account_id', $ids) - ->whereNull('transaction_journals.deleted_at') - ->orderBy('bills.active', 'DESC') - ->orderBy('bills.name', 'ASC') - ->groupBy($fields) - ->get($fields); + ->leftJoin( + 'transaction_journals', + static function (JoinClause $join): void { + $join->on('transaction_journals.bill_id', '=', 'bills.id')->whereNull('transaction_journals.deleted_at'); + } + ) + ->leftJoin( + 'transactions', + static function (JoinClause $join): void { + $join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', '<', 0); + } + ) + ->whereIn('transactions.account_id', $ids) + ->whereNull('transaction_journals.deleted_at') + ->orderBy('bills.active', 'DESC') + ->orderBy('bills.name', 'ASC') + ->groupBy($fields) + ->get($fields) + ; } /** @@ -244,7 +248,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getOverallAverage(Bill $bill): array { /** @var JournalRepositoryInterface $repos */ - $repos = app(JournalRepositoryInterface::class); + $repos = app(JournalRepositoryInterface::class); $repos->setUser($this->user); // get and sort on currency @@ -257,7 +261,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $transaction = $journal->transactions()->where('amount', '<', 0)->first(); $currencyId = (int) $journal->transaction_currency_id; $currency = $journal->transactionCurrency; - $result[$currencyId] ??= [ + $result[$currencyId] ??= [ 'sum' => '0', 'native_sum' => '0', 'count' => 0, @@ -292,8 +296,9 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getPaginator(int $size): LengthAwarePaginator { return $this->user->bills() - ->orderBy('active', 'DESC') - ->orderBy('name', 'ASC')->paginate($size); + ->orderBy('active', 'DESC') + ->orderBy('name', 'ASC')->paginate($size) + ; } /** @@ -306,13 +311,14 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface Log::debug(sprintf('Search for linked journals between %s and %s', $start->toW3cString(), $end->toW3cString())); return $bill->transactionJournals() - ->before($end)->after($start)->get( + ->before($end)->after($start)->get( [ 'transaction_journals.id', 'transaction_journals.date', 'transaction_journals.transaction_group_id', ] - ); + ) + ; } /** @@ -321,10 +327,11 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getRulesForBill(Bill $bill): Collection { return $this->user->rules() - ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') - ->where('rule_actions.action_type', 'link_to_bill') - ->where('rule_actions.action_value', $bill->name) - ->get(['rules.*']); + ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') + ->where('rule_actions.action_type', 'link_to_bill') + ->where('rule_actions.action_value', $bill->name) + ->get(['rules.*']) + ; } /** @@ -335,15 +342,16 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface */ public function getRulesForBills(Collection $collection): array { - $rules = $this->user->rules() - ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') - ->where('rule_actions.action_type', 'link_to_bill') - ->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active']); - $array = []; + $rules = $this->user->rules() + ->leftJoin('rule_actions', 'rule_actions.rule_id', '=', 'rules.id') + ->where('rule_actions.action_type', 'link_to_bill') + ->get(['rules.id', 'rules.title', 'rule_actions.action_value', 'rules.active']) + ; + $array = []; /** @var Rule $rule */ foreach ($rules as $rule) { - $array[$rule->action_value] ??= []; + $array[$rule->action_value] ??= []; $array[$rule->action_value][] = ['id' => $rule->id, 'title' => $rule->title, 'active' => $rule->active]; } $return = []; @@ -357,27 +365,28 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getYearAverage(Bill $bill, Carbon $date): array { /** @var JournalRepositoryInterface $repos */ - $repos = app(JournalRepositoryInterface::class); + $repos = app(JournalRepositoryInterface::class); $repos->setUser($this->user); // get and sort on currency - $result = []; + $result = []; $journals = $bill->transactionJournals() - ->where('date', '>=', $date->year . '-01-01 00:00:00') - ->where('date', '<=', $date->year . '-12-31 23:59:59') - ->get(); + ->where('date', '>=', $date->year.'-01-01 00:00:00') + ->where('date', '<=', $date->year.'-12-31 23:59:59') + ->get() + ; /** @var TransactionJournal $journal */ foreach ($journals as $journal) { /** @var null|Transaction $transaction */ - $transaction = $journal->transactions()->where('amount', '<', 0)->first(); + $transaction = $journal->transactions()->where('amount', '<', 0)->first(); if (null === $transaction) { continue; } $currencyId = (int) $journal->transaction_currency_id; $currency = $journal->transactionCurrency; - $result[$currencyId] ??= [ + $result[$currencyId] ??= [ 'sum' => '0', 'native_sum' => '0', 'count' => 0, @@ -427,7 +436,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface */ public function nextExpectedMatch(Bill $bill, Carbon $date): Carbon { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($bill->id); $cache->addProperty('nextExpectedMatch'); $cache->addProperty($date); @@ -435,17 +444,17 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface return $cache->get(); } // find the most recent date for this bill NOT in the future. Cache this date: - $start = clone $bill->date; + $start = clone $bill->date; $start->startOfDay(); - app('log')->debug('nextExpectedMatch: Start is ' . $start->format('Y-m-d')); + app('log')->debug('nextExpectedMatch: Start is '.$start->format('Y-m-d')); while ($start < $date) { app('log')->debug(sprintf('$start (%s) < $date (%s)', $start->format('Y-m-d H:i:s'), $date->format('Y-m-d H:i:s'))); $start = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); - app('log')->debug('Start is now ' . $start->format('Y-m-d H:i:s')); + app('log')->debug('Start is now '.$start->format('Y-m-d H:i:s')); } - $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); + $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); $end->endOfDay(); // see if the bill was paid in this period. @@ -457,8 +466,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface $start = clone $end; $end = app('navigation')->addPeriod($start, $bill->repeat_freq, $bill->skip); } - app('log')->debug('nextExpectedMatch: Final start is ' . $start->format('Y-m-d')); - app('log')->debug('nextExpectedMatch: Matching end is ' . $end->format('Y-m-d')); + app('log')->debug('nextExpectedMatch: Final start is '.$start->format('Y-m-d')); + app('log')->debug('nextExpectedMatch: Matching end is '.$end->format('Y-m-d')); $cache->store($start); @@ -519,8 +528,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface foreach ($bills as $bill) { /** @var Collection $set */ - $set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']); - $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; + $set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']); + $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; $return[(int) $currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, @@ -529,7 +538,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface 'decimal_places' => $currency->decimal_places, 'sum' => '0', ]; - $setAmount = '0'; + $setAmount = '0'; /** @var TransactionJournal $transactionJournal */ foreach ($set as $transactionJournal) { @@ -546,10 +555,10 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface public function getActiveBills(): Collection { return $this->user->bills() - ->where('active', true) - ->orderBy('bills.name', 'ASC') - ->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) // @phpstan-ignore-line - ; + ->where('active', true) + ->orderBy('bills.name', 'ASC') + ->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) // @phpstan-ignore-line + ; } public function sumUnpaidInRange(Carbon $start, Carbon $end): array @@ -563,9 +572,9 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface /** @var Bill $bill */ foreach ($bills as $bill) { // app('log')->debug(sprintf('Processing bill #%d ("%s")', $bill->id, $bill->name)); - $dates = $this->getPayDatesInRange($bill, $start, $end); - $count = $bill->transactionJournals()->after($start)->before($end)->count(); - $total = $dates->count() - $count; + $dates = $this->getPayDatesInRange($bill, $start, $end); + $count = $bill->transactionJournals()->after($start)->before($end)->count(); + $total = $dates->count() - $count; // app('log')->debug(sprintf('Pay dates: %d, count: %d, left: %d', $dates->count(), $count, $total)); // app('log')->debug('dates', $dates->toArray()); @@ -574,10 +583,10 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface // Log::debug(sprintf('min field is %s, max field is %s', $minField, $maxField)); if ($total > 0) { - $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; - $average = bcdiv(bcadd($bill->{$maxField} ?? '0', $bill->{$minField} ?? '0'), '2'); + $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; + $average = bcdiv(bcadd($bill->{$maxField} ?? '0', $bill->{$minField} ?? '0'), '2'); Log::debug(sprintf('Amount to pay is %s %s (%d times)', $currency->code, $average, $total)); - $return[$currency->id] ??= [ + $return[$currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, 'symbol' => $currency->symbol, @@ -615,7 +624,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface // app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d'))); - $currentStart = clone $nextExpectedMatch; + $currentStart = clone $nextExpectedMatch; } return $set; diff --git a/app/Repositories/Budget/AvailableBudgetRepository.php b/app/Repositories/Budget/AvailableBudgetRepository.php index 78d56290b3..fddb77e0ec 100644 --- a/app/Repositories/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/Budget/AvailableBudgetRepository.php @@ -48,9 +48,9 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { - $start = $availableBudget->start_date->format('Y-m-d'); - $end = $availableBudget->end_date->format('Y-m-d'); - $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end); + $start = $availableBudget->start_date->format('Y-m-d'); + $end = $availableBudget->end_date->format('Y-m-d'); + $key = sprintf('%s-%s-%s', $availableBudget->transaction_currency_id, $start, $end); if (array_key_exists($key, $exists)) { app('log')->debug(sprintf('Found duplicate AB: %s %s, %s-%s. Has been deleted', $availableBudget->transaction_currency_id, $availableBudget->amount, $start, $end)); $availableBudget->delete(); @@ -64,7 +64,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U */ public function get(?Carbon $start = null, ?Carbon $end = null): Collection { - $query = $this->user->availableBudgets()->with(['transactionCurrency']); + $query = $this->user->availableBudgets()->with(['transactionCurrency']); if (null !== $start && null !== $end) { $query->where( static function (Builder $q1) use ($start, $end): void { @@ -105,21 +105,23 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U { /** @var null|AvailableBudget */ return $this->user->availableBudgets() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d')) - ->first(); + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d')) + ->first() + ; } public function getAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end): string { - $amount = '0'; + $amount = '0'; /** @var null|AvailableBudget $availableBudget */ $availableBudget = $this->user->availableBudgets() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first(); + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->first() + ; if (null !== $availableBudget) { $amount = $availableBudget->amount; } @@ -132,14 +134,15 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U Log::debug(sprintf('Now in %s(%s, %s)', __METHOD__, $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s'))); $return = []; $availableBudgets = $this->user->availableBudgets() - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->get(); + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->get() + ; Log::debug(sprintf('Found %d available budgets', $availableBudgets->count())); // use native amount if necessary? - $convertToNative = Amount::convertToNative($this->user); - $default = Amount::getNativeCurrency(); + $convertToNative = Amount::convertToNative($this->user); + $default = Amount::getNativeCurrency(); /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { @@ -184,9 +187,10 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U public function getAvailableBudgetsByExactDate(Carbon $start, Carbon $end): Collection { return $this->user->availableBudgets() - ->where('start_date', '=', $start->format('Y-m-d')) - ->where('end_date', '=', $end->format('Y-m-d')) - ->get(); + ->where('start_date', '=', $start->format('Y-m-d')) + ->where('end_date', '=', $end->format('Y-m-d')) + ->get() + ; } public function getByCurrencyDate(Carbon $start, Carbon $end, TransactionCurrency $currency): ?AvailableBudget @@ -196,7 +200,8 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U ->availableBudgets() ->where('transaction_currency_id', $currency->id) ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first(); + ->where('end_date', $end->format('Y-m-d'))->first() + ; } /** @@ -205,12 +210,13 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): AvailableBudget { /** @var null|AvailableBudget */ - $availableBudget = $this->user->availableBudgets() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first(); + $availableBudget = $this->user->availableBudgets() + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->first() + ; if (null === $availableBudget) { - $availableBudget = new AvailableBudget(); + $availableBudget = new AvailableBudget(); $availableBudget->user()->associate($this->user); $availableBudget->transactionCurrency()->associate($currency); $availableBudget->start_date = $start->startOfDay(); @@ -230,7 +236,7 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U if ($start instanceof Carbon) { $start = $data['start']->startOfDay(); } - $end = $data['end']; + $end = $data['end']; if ($end instanceof Carbon) { $end = $data['end']->endOfDay(); } diff --git a/app/Repositories/Budget/BudgetLimitRepository.php b/app/Repositories/Budget/BudgetLimitRepository.php index faac33d84b..719073f94f 100644 --- a/app/Repositories/Budget/BudgetLimitRepository.php +++ b/app/Repositories/Budget/BudgetLimitRepository.php @@ -36,7 +36,6 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; -use Override; /** * Class BudgetLimitRepository @@ -51,10 +50,10 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup */ public function budgeted(Carbon $start, Carbon $end, TransactionCurrency $currency, ?Collection $budgets = null): string { - $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') + $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') // same complex where query as below. - ->where( + ->where( static function (Builder $q5) use ($start, $end): void { $q5->where( static function (Builder $q1) use ($start, $end): void { @@ -64,27 +63,30 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); } ) - ->orWhere( - static function (Builder $q3) use ($start, $end): void { - $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); - $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); - } - ); + ->orWhere( + static function (Builder $q3) use ($start, $end): void { + $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); + $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); + } + ) + ; } ) - ->orWhere( - static function (Builder $q4) use ($start, $end): void { - // or start is before start AND end is after end. - $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); - $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); - } - ); + ->orWhere( + static function (Builder $q4) use ($start, $end): void { + // or start is before start AND end is after end. + $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); + $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); + } + ) + ; } ) - ->where('budget_limits.transaction_currency_id', $currency->id) - ->whereNull('budgets.deleted_at') - ->where('budgets.active', true) - ->where('budgets.user_id', $this->user->id); + ->where('budget_limits.transaction_currency_id', $currency->id) + ->whereNull('budgets.deleted_at') + ->where('budgets.active', true) + ->where('budgets.user_id', $this->user->id) + ; if (null !== $budgets && $budgets->count() > 0) { $query->whereIn('budget_limits.budget_id', $budgets->pluck('id')->toArray()); } @@ -136,17 +138,19 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup // both are NULL: if (null === $start && null === $end) { return BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->with(['budget']) - ->where('budgets.user_id', $this->user->id) - ->whereNull('budgets.deleted_at') - ->get(['budget_limits.*']); + ->with(['budget']) + ->where('budgets.user_id', $this->user->id) + ->whereNull('budgets.deleted_at') + ->get(['budget_limits.*']) + ; } // one of the two is NULL. if (null === $start xor null === $end) { $query = BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->with(['budget']) - ->whereNull('budgets.deleted_at') - ->where('budgets.user_id', $this->user->id); + ->with(['budget']) + ->whereNull('budgets.deleted_at') + ->where('budgets.user_id', $this->user->id) + ; if (null !== $end) { // end date must be before $end. $query->where('end_date', '<=', $end->format('Y-m-d 00:00:00')); @@ -161,36 +165,39 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup // neither are NULL: return BudgetLimit::leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->with(['budget']) - ->where('budgets.user_id', $this->user->id) - ->whereNull('budgets.deleted_at') - ->where( - static function (Builder $q5) use ($start, $end): void { - $q5->where( - static function (Builder $q1) use ($start, $end): void { - $q1->where( - static function (Builder $q2) use ($start, $end): void { - $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d')); - $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); - } - ) - ->orWhere( - static function (Builder $q3) use ($start, $end): void { - $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); - $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); - } - ); - } - ) - ->orWhere( - static function (Builder $q4) use ($start, $end): void { - // or start is before start AND end is after end. - $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); - $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); - } - ); - } - )->get(['budget_limits.*']); + ->with(['budget']) + ->where('budgets.user_id', $this->user->id) + ->whereNull('budgets.deleted_at') + ->where( + static function (Builder $q5) use ($start, $end): void { + $q5->where( + static function (Builder $q1) use ($start, $end): void { + $q1->where( + static function (Builder $q2) use ($start, $end): void { + $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d')); + $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d')); + } + ) + ->orWhere( + static function (Builder $q3) use ($start, $end): void { + $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d')); + $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d')); + } + ) + ; + } + ) + ->orWhere( + static function (Builder $q4) use ($start, $end): void { + // or start is before start AND end is after end. + $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d')); + $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d')); + } + ) + ; + } + )->get(['budget_limits.*']) + ; } public function getBudgetLimits(Budget $budget, ?Carbon $start = null, ?Carbon $end = null): Collection @@ -215,38 +222,41 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup // when both dates are set: return $budget->budgetlimits() - ->where( - static function (Builder $q5) use ($start, $end): void { - $q5->where( - static function (Builder $q1) use ($start, $end): void { - // budget limit ends within period - $q1->where( - static function (Builder $q2) use ($start, $end): void { - $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d 00:00:00')); - $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d 23:59:59')); - } - ) - // budget limit start within period - ->orWhere( - static function (Builder $q3) use ($start, $end): void { - $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00')); - $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59')); - } - ); - } - ) - ->orWhere( - static function (Builder $q4) use ($start, $end): void { - // or start is before start AND end is after end. - $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d 23:59:59')); - $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d 00:00:00')); - } - ); - } - )->orderBy('budget_limits.start_date', 'DESC')->get(['budget_limits.*']); + ->where( + static function (Builder $q5) use ($start, $end): void { + $q5->where( + static function (Builder $q1) use ($start, $end): void { + // budget limit ends within period + $q1->where( + static function (Builder $q2) use ($start, $end): void { + $q2->where('budget_limits.end_date', '>=', $start->format('Y-m-d 00:00:00')); + $q2->where('budget_limits.end_date', '<=', $end->format('Y-m-d 23:59:59')); + } + ) + // budget limit start within period + ->orWhere( + static function (Builder $q3) use ($start, $end): void { + $q3->where('budget_limits.start_date', '>=', $start->format('Y-m-d 00:00:00')); + $q3->where('budget_limits.start_date', '<=', $end->format('Y-m-d 23:59:59')); + } + ) + ; + } + ) + ->orWhere( + static function (Builder $q4) use ($start, $end): void { + // or start is before start AND end is after end. + $q4->where('budget_limits.start_date', '<=', $start->format('Y-m-d 23:59:59')); + $q4->where('budget_limits.end_date', '>=', $end->format('Y-m-d 00:00:00')); + } + ) + ; + } + )->orderBy('budget_limits.start_date', 'DESC')->get(['budget_limits.*']) + ; } - #[Override] + #[\Override] public function getNoteText(BudgetLimit $budgetLimit): string { return (string) $budgetLimit->notes()->first()?->text; @@ -259,34 +269,35 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup { // if no currency has been provided, use the user's default currency: /** @var TransactionCurrencyFactory $factory */ - $factory = app(TransactionCurrencyFactory::class); - $currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null); + $factory = app(TransactionCurrencyFactory::class); + $currency = $factory->find($data['currency_id'] ?? null, $data['currency_code'] ?? null); if (null === $currency) { $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); } - $currency->enabled = true; + $currency->enabled = true; $currency->save(); // find the budget: /** @var null|Budget $budget */ - $budget = $this->user->budgets()->find((int) $data['budget_id']); + $budget = $this->user->budgets()->find((int) $data['budget_id']); if (null === $budget) { throw new FireflyException('200004: Budget does not exist.'); } // find limit with same date range and currency. - $limit = $budget->budgetlimits() - ->where('budget_limits.start_date', $data['start_date']->format('Y-m-d')) - ->where('budget_limits.end_date', $data['end_date']->format('Y-m-d')) - ->where('budget_limits.transaction_currency_id', $currency->id) - ->first(['budget_limits.*']); + $limit = $budget->budgetlimits() + ->where('budget_limits.start_date', $data['start_date']->format('Y-m-d')) + ->where('budget_limits.end_date', $data['end_date']->format('Y-m-d')) + ->where('budget_limits.transaction_currency_id', $currency->id) + ->first(['budget_limits.*']) + ; if (null !== $limit) { throw new FireflyException('200027: Budget limit already exists.'); } app('log')->debug('No existing budget limit, create a new one'); // or create one and return it. - $limit = new BudgetLimit(); + $limit = new BudgetLimit(); $limit->budget()->associate($budget); $limit->start_date = $data['start_date']->format('Y-m-d'); $limit->end_date = $data['end_date']->format('Y-m-d'); @@ -294,7 +305,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup $limit->transaction_currency_id = $currency->id; $limit->save(); - $noteText = (string) ($data['notes'] ?? ''); + $noteText = (string) ($data['notes'] ?? ''); if ('' !== $noteText) { $this->setNoteText($limit, $noteText); } @@ -308,12 +319,13 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup { /** @var null|BudgetLimit */ return $budget->budgetlimits() - ->where('transaction_currency_id', $currency->id) - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->first(); + ->where('transaction_currency_id', $currency->id) + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->first() + ; } - #[Override] + #[\Override] public function setNoteText(BudgetLimit $budgetLimit, string $text): void { $dbNote = $budgetLimit->notes()->first(); @@ -335,8 +347,8 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup */ public function update(BudgetLimit $budgetLimit, array $data): BudgetLimit { - $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount; - $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id; + $budgetLimit->amount = array_key_exists('amount', $data) ? $data['amount'] : $budgetLimit->amount; + $budgetLimit->budget_id = array_key_exists('budget_id', $data) ? $data['budget_id'] : $budgetLimit->budget_id; if (array_key_exists('start', $data)) { $budgetLimit->start_date = $data['start']->startOfDay(); @@ -348,7 +360,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup } // if no currency has been provided, use the user's default currency: - $currency = null; + $currency = null; // update if relevant: if (array_key_exists('currency_id', $data) || array_key_exists('currency_code', $data)) { @@ -360,7 +372,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup if (null === $currency) { $currency = $budgetLimit->transactionCurrency ?? app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); } - $currency->enabled = true; + $currency->enabled = true; $currency->save(); $budgetLimit->transaction_currency_id = $currency->id; @@ -377,26 +389,29 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup public function updateLimitAmount(Budget $budget, Carbon $start, Carbon $end, string $amount): ?BudgetLimit { // count the limits: - $limits = $budget->budgetlimits() - ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) - ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) - ->count('budget_limits.*'); + $limits = $budget->budgetlimits() + ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) + ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) + ->count('budget_limits.*') + ; app('log')->debug(sprintf('Found %d budget limits.', $limits)); // there might be a budget limit for these dates: /** @var null|BudgetLimit $limit */ - $limit = $budget->budgetlimits() - ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) - ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) - ->first(['budget_limits.*']); + $limit = $budget->budgetlimits() + ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) + ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) + ->first(['budget_limits.*']) + ; // if more than 1 limit found, delete the others: if ($limits > 1 && null !== $limit) { app('log')->debug(sprintf('Found more than 1, delete all except #%d', $limit->id)); $budget->budgetlimits() - ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) - ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) - ->where('budget_limits.id', '!=', $limit->id)->delete(); + ->where('budget_limits.start_date', $start->format('Y-m-d 00:00:00')) + ->where('budget_limits.end_date', $end->format('Y-m-d 00:00:00')) + ->where('budget_limits.id', '!=', $limit->id)->delete() + ; } // delete if amount is zero. @@ -418,7 +433,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup } app('log')->debug('No existing budget limit, create a new one'); // or create one and return it. - $limit = new BudgetLimit(); + $limit = new BudgetLimit(); $limit->budget()->associate($budget); $limit->start_date = $start->startOfDay(); $limit->start_date_tz = $start->format('e'); diff --git a/app/Repositories/Budget/BudgetRepository.php b/app/Repositories/Budget/BudgetRepository.php index a7ae5c923e..858f48f417 100644 --- a/app/Repositories/Budget/BudgetRepository.php +++ b/app/Repositories/Budget/BudgetRepository.php @@ -63,7 +63,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%%%s', $query)); } $search->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', true); + ->orderBy('name', 'ASC')->where('active', true) + ; return $search->take($limit)->get(); } @@ -75,7 +76,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%s%%', $query)); } $search->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', true); + ->orderBy('name', 'ASC')->where('active', true) + ; return $search->take($limit)->get(); } @@ -83,7 +85,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function budgetedInPeriod(Carbon $start, Carbon $end): array { app('log')->debug(sprintf('Now in budgetedInPeriod("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d'))); - $return = []; + $return = []; /** @var BudgetLimitRepository $limitRepository */ $limitRepository = app(BudgetLimitRepository::class); @@ -100,9 +102,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface /** @var BudgetLimit $limit */ foreach ($limits as $limit) { app('log')->debug(sprintf('Budget limit #%d', $limit->id)); - $currency = $limit->transactionCurrency; - $rate = $converter->getCurrencyRate($currency, $defaultCurrency, $end); - $currencyCode = $currency->code; + $currency = $limit->transactionCurrency; + $rate = $converter->getCurrencyRate($currency, $defaultCurrency, $end); + $currencyCode = $currency->code; $return[$currencyCode] ??= [ 'currency_id' => (string) $currency->id, 'currency_name' => $currency->name, @@ -157,9 +159,10 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getActiveBudgets(): Collection { return $this->user->budgets()->where('active', true) - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC') - ->get(); + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get() + ; } /** @@ -199,19 +202,19 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array { app('log')->debug(sprintf('Now in budgetedInPeriod(#%d, "%s", "%s")', $budget->id, $start->format('Y-m-d'), $end->format('Y-m-d'))); - $return = []; + $return = []; /** @var BudgetLimitRepository $limitRepository */ $limitRepository = app(BudgetLimitRepository::class); $limitRepository->setUser($this->user); app('log')->debug(sprintf('Budget #%d: "%s"', $budget->id, $budget->name)); - $limits = $limitRepository->getBudgetLimits($budget, $start, $end); + $limits = $limitRepository->getBudgetLimits($budget, $start, $end); /** @var BudgetLimit $limit */ foreach ($limits as $limit) { app('log')->debug(sprintf('Budget limit #%d', $limit->id)); - $currency = $limit->transactionCurrency; + $currency = $limit->transactionCurrency; $return[$currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, @@ -280,7 +283,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { app('log')->debug('Now in update()'); - $oldName = $budget->name; + $oldName = $budget->name; if (array_key_exists('name', $data)) { $budget->name = $data['name']; $this->updateRuleActions($oldName, $budget->name); @@ -295,7 +298,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $budget->save(); // update or create auto-budget: - $autoBudget = $this->getAutoBudget($budget); + $autoBudget = $this->getAutoBudget($budget); // first things first: delete when no longer required: $autoBudgetType = array_key_exists('auto_budget_type', $data) ? $data['auto_budget_type'] : null; @@ -321,10 +324,11 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { $types = ['set_budget']; $actions = RuleAction::leftJoin('rules', 'rules.id', '=', 'rule_actions.rule_id') - ->where('rules.user_id', $this->user->id) - ->whereIn('rule_actions.action_type', $types) - ->where('rule_actions.action_value', $oldName) - ->get(['rule_actions.*']); + ->where('rules.user_id', $this->user->id) + ->whereIn('rule_actions.action_type', $types) + ->where('rule_actions.action_value', $oldName) + ->get(['rule_actions.*']) + ; app('log')->debug(sprintf('Found %d actions to update.', $actions->count())); /** @var RuleAction $action */ @@ -339,10 +343,11 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface { $types = ['budget_is']; $triggers = RuleTrigger::leftJoin('rules', 'rules.id', '=', 'rule_triggers.rule_id') - ->where('rules.user_id', $this->user->id) - ->whereIn('rule_triggers.trigger_type', $types) - ->where('rule_triggers.trigger_value', $oldName) - ->get(['rule_triggers.*']); + ->where('rules.user_id', $this->user->id) + ->whereIn('rule_triggers.trigger_type', $types) + ->where('rule_triggers.trigger_value', $oldName) + ->get(['rule_triggers.*']) + ; app('log')->debug(sprintf('Found %d triggers to update.', $triggers->count())); /** @var RuleTrigger $trigger */ @@ -386,7 +391,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $autoBudget = $this->getAutoBudget($budget); // grab default currency: - $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); if (null === $autoBudget) { // at this point it's a blind assumption auto_budget_type is 1 or 2. @@ -466,7 +471,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getBudgets(): Collection { return $this->user->budgets()->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->get(); + ->orderBy('name', 'ASC')->get() + ; } public function destroyAutoBudget(Budget $budget): void @@ -524,7 +530,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getAttachments(Budget $budget): Collection { - $set = $budget->attachments()->get(); + $set = $budget->attachments()->get(); $disk = Storage::disk('upload'); @@ -550,8 +556,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface public function getInactiveBudgets(): Collection { return $this->user->budgets() - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', 0)->get(); + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC')->where('active', 0)->get() + ; } public function getNoteText(Budget $budget): ?string @@ -571,7 +578,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $search->whereLike('name', sprintf('%%%s%%', $query)); } $search->orderBy('order', 'ASC') - ->orderBy('name', 'ASC')->where('active', true); + ->orderBy('name', 'ASC')->where('active', true) + ; return $search->take($limit)->get(); } @@ -591,8 +599,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // exclude specific liabilities $repository = app(AccountRepositoryInterface::class); $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); /** @var Account $account */ foreach ($subset as $account) { @@ -603,19 +611,20 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // start collecting: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user) - ->setRange($start, $end) - ->excludeDestinationAccounts($selection) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) - ->setBudgets($this->getActiveBudgets()); + ->setRange($start, $end) + ->excludeDestinationAccounts($selection) + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) + ->setBudgets($this->getActiveBudgets()) + ; - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'id' => (string) $currencyId, 'name' => $journal['currency_name'], 'symbol' => $journal['currency_symbol'], @@ -626,9 +635,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); // also do foreign amount: - $foreignId = (int) $journal['foreign_currency_id']; + $foreignId = (int) $journal['foreign_currency_id']; if (0 !== $foreignId) { - $array[$foreignId] ??= [ + $array[$foreignId] ??= [ 'id' => (string) $foreignId, 'name' => $journal['foreign_currency_name'], 'symbol' => $journal['foreign_currency_symbol'], @@ -652,8 +661,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // exclude specific liabilities $repository = app(AccountRepositoryInterface::class); $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); /** @var Account $account */ foreach ($subset as $account) { @@ -664,19 +673,20 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface // start collecting: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user) - ->setRange($start, $end) - ->excludeDestinationAccounts($selection) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) - ->setBudget($budget); + ->setRange($start, $end) + ->excludeDestinationAccounts($selection) + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) + ->setBudget($budget) + ; - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'id' => (string) $currencyId, 'name' => $journal['currency_name'], 'symbol' => $journal['currency_symbol'], @@ -687,9 +697,9 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->negative($journal['amount'])); // also do foreign amount: - $foreignId = (int) $journal['foreign_currency_id']; + $foreignId = (int) $journal['foreign_currency_id']; if (0 !== $foreignId) { - $array[$foreignId] ??= [ + $array[$foreignId] ??= [ 'id' => (string) $foreignId, 'name' => $journal['foreign_currency_name'], 'symbol' => $journal['foreign_currency_symbol'], @@ -711,7 +721,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface */ public function store(array $data): Budget { - $order = $this->getMaxOrder(); + $order = $this->getMaxOrder(); try { $newBudget = Budget::create( @@ -738,7 +748,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface if (!array_key_exists('auto_budget_type', $data) || !array_key_exists('auto_budget_amount', $data) || !array_key_exists('auto_budget_period', $data)) { return $newBudget; } - $type = $data['auto_budget_type']; + $type = $data['auto_budget_type']; if ('none' === $type) { return $newBudget; } @@ -757,8 +767,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface } /** @var CurrencyRepositoryInterface $repos */ - $repos = app(CurrencyRepositoryInterface::class); - $currency = null; + $repos = app(CurrencyRepositoryInterface::class); + $currency = null; if (array_key_exists('currency_id', $data)) { $currency = $repos->find((int) $data['currency_id']); } @@ -769,7 +779,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); } - $autoBudget = new AutoBudget(); + $autoBudget = new AutoBudget(); $autoBudget->budget()->associate($newBudget); $autoBudget->transaction_currency_id = $currency->id; $autoBudget->auto_budget_type = $type; @@ -778,11 +788,11 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface $autoBudget->save(); // create initial budget limit. - $today = today(config('app.timezone')); - $start = app('navigation')->startOfPeriod($today, $autoBudget->period); - $end = app('navigation')->endOfPeriod($start, $autoBudget->period); + $today = today(config('app.timezone')); + $start = app('navigation')->startOfPeriod($today, $autoBudget->period); + $end = app('navigation')->endOfPeriod($start, $autoBudget->period); - $limitRepos = app(BudgetLimitRepositoryInterface::class); + $limitRepos = app(BudgetLimitRepositoryInterface::class); $limitRepos->setUser($this->user); $limitRepos->store( [ diff --git a/app/Repositories/Budget/BudgetRepositoryInterface.php b/app/Repositories/Budget/BudgetRepositoryInterface.php index 70b65e2245..b12aed2796 100644 --- a/app/Repositories/Budget/BudgetRepositoryInterface.php +++ b/app/Repositories/Budget/BudgetRepositoryInterface.php @@ -42,7 +42,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface BudgetRepositoryInterface { diff --git a/app/Repositories/Budget/NoBudgetRepository.php b/app/Repositories/Budget/NoBudgetRepository.php index b4c67ba329..fa9d367d8a 100644 --- a/app/Repositories/Budget/NoBudgetRepository.php +++ b/app/Repositories/Budget/NoBudgetRepository.php @@ -45,17 +45,17 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf $carbonFormat = app('navigation')->preferredCarbonFormat($start, $end); /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts($accounts)->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); $collector->withoutBudget(); - $journals = $collector->getExtractedJournals(); - $data = []; + $journals = $collector->getExtractedJournals(); + $data = []; /** @var array $journal */ foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $data[$currencyId] ??= [ 'id' => 0, @@ -68,7 +68,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf 'currency_decimal_places' => $journal['currency_decimal_places'], 'entries' => [], ]; - $date = $journal['date']->format($carbonFormat); + $date = $journal['date']->format($carbonFormat); if (!array_key_exists($date, $data[$currencyId]['entries'])) { $data[$currencyId]['entries'][$date] = '0'; @@ -82,7 +82,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?TransactionCurrency $currency = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); if (null !== $accounts && $accounts->count() > 0) { diff --git a/app/Repositories/Budget/NoBudgetRepositoryInterface.php b/app/Repositories/Budget/NoBudgetRepositoryInterface.php index b9d42d769d..efa8d9e24d 100644 --- a/app/Repositories/Budget/NoBudgetRepositoryInterface.php +++ b/app/Repositories/Budget/NoBudgetRepositoryInterface.php @@ -41,7 +41,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface NoBudgetRepositoryInterface { diff --git a/app/Repositories/Budget/OperationsRepository.php b/app/Repositories/Budget/OperationsRepository.php index 10ae195108..eb6c70a52d 100644 --- a/app/Repositories/Budget/OperationsRepository.php +++ b/app/Repositories/Budget/OperationsRepository.php @@ -62,7 +62,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ++$count; app('log')->debug(sprintf('Found %d budget limits. Per day is %s, total is %s', $count, $perDay, $total)); } - $avg = $total; + $avg = $total; if ($count > 0) { $avg = bcdiv($total, (string) $count); } @@ -84,21 +84,21 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // get all transactions: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setAccounts($accounts)->setRange($start, $end); $collector->setBudgets($budgets); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); // loop transactions: /** @var array $journal */ foreach ($journals as $journal) { // prep data array for currency: - $budgetId = (int) $journal['budget_id']; - $budgetName = $journal['budget_name']; - $currencyId = (int) $journal['currency_id']; - $key = sprintf('%d-%d', $budgetId, $currencyId); + $budgetId = (int) $journal['budget_id']; + $budgetName = $journal['budget_name']; + $currencyId = (int) $journal['currency_id']; + $key = sprintf('%d-%d', $budgetId, $currencyId); - $data[$key] ??= [ + $data[$key] ??= [ 'id' => $budgetId, 'name' => sprintf('%s (%s)', $budgetName, $journal['currency_name']), 'sum' => '0', @@ -136,13 +136,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setBudgets($this->getBudgets()); } $collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $budgetId = (int) $journal['budget_id']; - $budgetName = (string) $journal['budget_name']; + $currencyId = (int) $journal['currency_id']; + $budgetId = (int) $journal['budget_id']; + $budgetName = (string) $journal['budget_name']; // catch "no category" entries. if (0 === $budgetId) { @@ -150,7 +150,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'budgets' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -202,8 +202,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn ?Collection $accounts = null, ?Collection $budgets = null, ?TransactionCurrency $currency = null - ): array - { + ): array { Log::debug(sprintf('Start of %s.', __METHOD__)); // this collector excludes all transfers TO liabilities (which are also withdrawals) // because those expenses only become expenses once they move from the liability to the friend. @@ -211,8 +210,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $repository = app(AccountRepositoryInterface::class); $repository->setUser($this->user); - $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); - $selection = new Collection(); + $subset = $repository->getAccountsByType(config('firefly.valid_liabilities')); + $selection = new Collection(); /** @var Account $account */ foreach ($subset as $account) { @@ -222,11 +221,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user) - ->setRange($start, $end) + ->setRange($start, $end) // ->excludeDestinationAccounts($selection) - ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); + ->setTypes([TransactionTypeEnum::WITHDRAWAL->value]) + ; if (null !== $accounts) { $collector->setAccounts($accounts); @@ -239,7 +239,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCurrency($currency); } $collector->setBudgets($budgets); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); // same but for transactions in the foreign currency: if (null !== $currency) { diff --git a/app/Repositories/Budget/OperationsRepositoryInterface.php b/app/Repositories/Budget/OperationsRepositoryInterface.php index decf5de365..5def0c5c88 100644 --- a/app/Repositories/Budget/OperationsRepositoryInterface.php +++ b/app/Repositories/Budget/OperationsRepositoryInterface.php @@ -42,7 +42,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Category/CategoryRepository.php b/app/Repositories/Category/CategoryRepository.php index 195d163494..19d1447857 100644 --- a/app/Repositories/Category/CategoryRepository.php +++ b/app/Repositories/Category/CategoryRepository.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Category; use Carbon\Carbon; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\CategoryFactory; use FireflyIII\Models\Attachment; @@ -151,7 +150,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf public function store(array $data): Category { /** @var CategoryFactory $factory */ - $factory = app(CategoryFactory::class); + $factory = app(CategoryFactory::class); $factory->setUser($this->user); $category = $factory->findOrCreate(null, $data['name']); @@ -177,7 +176,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf public function updateNotes(Category $category, string $notes): void { - $dbNote = $category->notes()->first(); + $dbNote = $category->notes()->first(); if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($category); @@ -223,9 +222,10 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf private function getFirstTransactionDate(Category $category): ?Carbon { // check transactions: - $query = $category->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'ASC'); + $query = $category->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'ASC') + ; $lastTransaction = $query->first(['transaction_journals.*']); if (null !== $lastTransaction) { @@ -237,7 +237,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf public function getAttachments(Category $category): Collection { - $set = $category->attachments()->get(); + $set = $category->attachments()->get(); $disk = Storage::disk('upload'); @@ -271,7 +271,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws Exception + * @throws \Exception */ public function lastUseDate(Category $category, Collection $accounts): ?Carbon { @@ -297,7 +297,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf private function getLastJournalDate(Category $category, Collection $accounts): ?Carbon { - $query = $category->transactionJournals()->orderBy('date', 'DESC'); + $query = $category->transactionJournals()->orderBy('date', 'DESC'); if ($accounts->count() > 0) { $query->leftJoin('transactions as t', 't.transaction_journal_id', '=', 'transaction_journals.id'); @@ -314,14 +314,15 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws Exception + * @throws \Exception */ private function getLastTransactionDate(Category $category, Collection $accounts): ?Carbon { // check transactions: - $query = $category->transactions() - ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->orderBy('transaction_journals.date', 'DESC'); + $query = $category->transactions() + ->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') + ->orderBy('transaction_journals.date', 'DESC') + ; if ($accounts->count() > 0) { // filter journals: $query->whereIn('transactions.account_id', $accounts->pluck('id')->toArray()); @@ -346,7 +347,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf } /** - * @throws Exception + * @throws \Exception */ public function update(Category $category, array $data): Category { diff --git a/app/Repositories/Category/CategoryRepositoryInterface.php b/app/Repositories/Category/CategoryRepositoryInterface.php index 3500bf632e..263c11c716 100644 --- a/app/Repositories/Category/CategoryRepositoryInterface.php +++ b/app/Repositories/Category/CategoryRepositoryInterface.php @@ -41,7 +41,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface CategoryRepositoryInterface { diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index 866f3b464f..d8ea7ce007 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -52,12 +52,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $currencyId = (int) $journal['currency_id']; + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -74,12 +74,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn // add journal to array: // only a subset of the fields. - $journalId = (int) $journal['transaction_journal_id']; + $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] - = [ - 'amount' => app('steam')->negative($journal['amount']), - 'date' => $journal['date'], - ]; + = [ + 'amount' => app('steam')->negative($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; @@ -98,12 +98,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $currencyId = (int) $journal['currency_id']; + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -120,12 +120,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn ]; // add journal to array: // only a subset of the fields. - $journalId = (int) $journal['transaction_journal_id']; + $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] - = [ - 'amount' => app('steam')->positive($journal['amount']), - 'date' => $journal['date'], - ]; + = [ + 'amount' => app('steam')->positive($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; @@ -137,7 +137,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->withoutCategory(); if (null !== $accounts && $accounts->count() > 0) { @@ -161,12 +161,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -189,12 +189,12 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], diff --git a/app/Repositories/Category/NoCategoryRepositoryInterface.php b/app/Repositories/Category/NoCategoryRepositoryInterface.php index 5ebcc50d28..58b25504f8 100644 --- a/app/Repositories/Category/NoCategoryRepositoryInterface.php +++ b/app/Repositories/Category/NoCategoryRepositoryInterface.php @@ -40,7 +40,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface NoCategoryRepositoryInterface { diff --git a/app/Repositories/Category/OperationsRepository.php b/app/Repositories/Category/OperationsRepository.php index e7e4043cdd..deb6148de1 100644 --- a/app/Repositories/Category/OperationsRepository.php +++ b/app/Repositories/Category/OperationsRepository.php @@ -63,13 +63,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -77,7 +77,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -140,13 +140,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -154,7 +154,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -193,7 +193,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::TRANSFER->value]) - ->setDestinationAccounts($accounts)->excludeSourceAccounts($accounts); + ->setDestinationAccounts($accounts)->excludeSourceAccounts($accounts) + ; if (null !== $categories && $categories->count() > 0) { $collector->setCategories($categories); } @@ -201,13 +202,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -215,7 +216,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -255,7 +256,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::TRANSFER->value]) - ->setSourceAccounts($accounts)->excludeDestinationAccounts($accounts); + ->setSourceAccounts($accounts)->excludeDestinationAccounts($accounts) + ; if (null !== $categories && $categories->count() > 0) { $collector->setCategories($categories); } @@ -263,13 +265,13 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $collector->setCategories($this->getCategories()); } $collector->withCategoryInformation()->withAccountInformation()->withBudgetInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $categoryId = (int) $journal['category_id']; - $categoryName = (string) $journal['category_name']; + $currencyId = (int) $journal['currency_id']; + $categoryId = (int) $journal['category_id']; + $categoryName = (string) $journal['category_name']; // catch "no category" entries. if (0 === $categoryId) { @@ -277,7 +279,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'categories' => [], 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], @@ -318,7 +320,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function sumExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $categories = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); if (null !== $accounts && $accounts->count() > 0) { @@ -341,9 +343,10 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function sumIncome(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $categories = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end) - ->setTypes([TransactionTypeEnum::DEPOSIT->value]); + ->setTypes([TransactionTypeEnum::DEPOSIT->value]) + ; if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); @@ -359,12 +362,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn foreach ($journals as $journal) { // Almost the same as in \FireflyIII\Repositories\Budget\OperationsRepository::sumExpenses - $amount = '0'; - $currencyId = (int) $journal['currency_id']; - $currencyName = $journal['currency_name']; - $currencySymbol = $journal['currency_symbol']; - $currencyCode = $journal['currency_code']; - $currencyDecimalPlaces = $journal['currency_decimal_places']; + $amount = '0'; + $currencyId = (int) $journal['currency_id']; + $currencyName = $journal['currency_name']; + $currencySymbol = $journal['currency_symbol']; + $currencyCode = $journal['currency_code']; + $currencyDecimalPlaces = $journal['currency_decimal_places']; if ($convertToNative) { $amount = Amount::getAmountFromJournal($journal); if ($default->id !== (int) $journal['currency_id'] && $default->id !== (int) $journal['foreign_currency_id']) { @@ -389,7 +392,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $amount = $journal['amount']; } - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => (string) $currencyId, 'currency_name' => $currencyName, @@ -411,7 +414,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn /** @var GroupCollectorInterface $collector */ $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end) - ->setTypes([TransactionTypeEnum::TRANSFER->value]); + ->setTypes([TransactionTypeEnum::TRANSFER->value]) + ; if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); @@ -420,12 +424,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $categories = $this->getCategories(); } $collector->setCategories($categories); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { $currencyId = (int) $journal['currency_id']; - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'sum' => '0', 'currency_id' => (string) $currencyId, 'currency_name' => $journal['currency_name'], diff --git a/app/Repositories/Category/OperationsRepositoryInterface.php b/app/Repositories/Category/OperationsRepositoryInterface.php index c7ecc886eb..6ff6d9bf78 100644 --- a/app/Repositories/Category/OperationsRepositoryInterface.php +++ b/app/Repositories/Category/OperationsRepositoryInterface.php @@ -40,7 +40,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Currency/CurrencyRepository.php b/app/Repositories/Currency/CurrencyRepository.php index 902b333a41..3100f2d809 100644 --- a/app/Repositories/Currency/CurrencyRepository.php +++ b/app/Repositories/Currency/CurrencyRepository.php @@ -42,7 +42,6 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; -use Override; /** * Class CurrencyRepository. @@ -67,7 +66,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf public function currencyInUseAt(TransactionCurrency $currency): ?string { app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); - $countJournals = $this->countJournals($currency); + $countJournals = $this->countJournals($currency); if ($countJournals > 0) { app('log')->info(sprintf('Count journals is %d, return true.', $countJournals)); @@ -82,7 +81,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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -90,7 +89,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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -98,7 +97,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) { app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills)); @@ -116,9 +115,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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -134,7 +134,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) { app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); @@ -142,7 +142,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) { app('log')->info('Is the default currency of the user, return true.'); @@ -150,7 +150,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) { app('log')->info('Is the default currency of the user group, return true.'); @@ -275,7 +275,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf return $result; } - #[Override] + #[\Override] public function find(int $currencyId): ?TransactionCurrency { return TransactionCurrency::find($currencyId); @@ -320,9 +320,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) { app('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/Repositories/Currency/CurrencyRepositoryInterface.php b/app/Repositories/Currency/CurrencyRepositoryInterface.php index 95dc252f46..f45f5642d2 100644 --- a/app/Repositories/Currency/CurrencyRepositoryInterface.php +++ b/app/Repositories/Currency/CurrencyRepositoryInterface.php @@ -42,7 +42,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface CurrencyRepositoryInterface { diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/ExchangeRate/ExchangeRateRepository.php index e086f53ecc..cce27ba123 100644 --- a/app/Repositories/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/ExchangeRate/ExchangeRateRepository.php @@ -1,4 +1,5 @@ userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); } - #[Override] + #[\Override] public function getAll(): Collection { return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); } - #[Override] + #[\Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { // orderBy('date', 'DESC')->toRawSql(); return $this->userGroup->currencyExchangeRates() - ->where(function (Builder $q1) use ($from, $to): void { - $q1->where(function (Builder $q) use ($from, $to): void { - $q->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id); - })->orWhere(function (Builder $q) use ($from, $to): void { - $q->where('from_currency_id', $to->id) - ->where('to_currency_id', $from->id); - }); - }) - ->orderBy('date', 'DESC') - ->get(['currency_exchange_rates.*']); + ->where(function (Builder $q1) use ($from, $to): void { + $q1->where(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ; + })->orWhere(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $to->id) + ->where('to_currency_id', $from->id) + ; + }); + }) + ->orderBy('date', 'DESC') + ->get(['currency_exchange_rates.*']) + ; } - #[Override] + #[\Override] public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate { /** @var null|CurrencyExchangeRate */ return $this->userGroup->currencyExchangeRates() - ->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id) - ->where('date', $date->format('Y-m-d')) - ->first(); + ->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ->where('date', $date->format('Y-m-d')) + ->first() + ; } - #[Override] + #[\Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { $object = new CurrencyExchangeRate(); @@ -96,7 +100,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro return $object; } - #[Override] + #[\Override] public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { $object->rate = $rate; @@ -107,5 +111,4 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface, UserGro return $object; } - } diff --git a/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php b/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php index 21d3ee030f..4d2d024e01 100644 --- a/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php +++ b/app/Repositories/ExchangeRate/ExchangeRateRepositoryInterface.php @@ -1,4 +1,5 @@ where('transaction_journals.user_id', $this->user->id) - ->where('transactions.id', $transactionId) - ->first(['transactions.*']); + ->where('transaction_journals.user_id', $this->user->id) + ->where('transactions.id', $transactionId) + ->first(['transactions.*']) + ; } /** @@ -59,7 +60,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn */ public function getAttachments(TransactionJournal $journal): Collection { - $set = $journal->attachments; + $set = $journal->attachments; $disk = Storage::disk('upload'); diff --git a/app/Repositories/Journal/JournalAPIRepositoryInterface.php b/app/Repositories/Journal/JournalAPIRepositoryInterface.php index fe85b3c481..454250c8e4 100644 --- a/app/Repositories/Journal/JournalAPIRepositoryInterface.php +++ b/app/Repositories/Journal/JournalAPIRepositoryInterface.php @@ -41,7 +41,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface JournalAPIRepositoryInterface { diff --git a/app/Repositories/Journal/JournalCLIRepository.php b/app/Repositories/Journal/JournalCLIRepository.php index 220f4833b0..c3b51cd860 100644 --- a/app/Repositories/Journal/JournalCLIRepository.php +++ b/app/Repositories/Journal/JournalCLIRepository.php @@ -32,7 +32,6 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; -use stdClass; /** * Class JournalCLIRepository @@ -47,9 +46,10 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn public function getAllJournals(array $types): Collection { return TransactionJournal::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->whereIn('transaction_types.type', $types) - ->with(['user', 'transactionType', 'transactionCurrency', 'transactions', 'transactions.account']) - ->get(['transaction_journals.*']); + ->whereIn('transaction_types.type', $types) + ->with(['user', 'transactionType', 'transactionCurrency', 'transactions', 'transactions.account']) + ->get(['transaction_journals.*']) + ; } /** @@ -57,7 +57,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn */ public function getJournalBudgetId(TransactionJournal $journal): int { - $budget = $journal->budgets()->first(); + $budget = $journal->budgets()->first(); if (null !== $budget) { return $budget->id; } @@ -77,7 +77,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn */ public function getJournalCategoryId(TransactionJournal $journal): int { - $category = $journal->categories()->first(); + $category = $journal->categories()->first(); if (null !== $category) { return $category->id; } @@ -129,7 +129,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn */ public function getMetaField(TransactionJournal $journal, string $field): ?string { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty('journal-meta-updated'); $cache->addProperty($journal->id); $cache->addProperty($field); @@ -138,12 +138,12 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn return $cache->get(); } - $entry = $journal->transactionJournalMeta()->where('name', $field)->first(); + $entry = $journal->transactionJournalMeta()->where('name', $field)->first(); if (null === $entry) { return null; } - $value = $entry->data; + $value = $entry->data; if (is_array($value)) { $return = implode(',', $value); @@ -179,11 +179,12 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn public function getSplitJournals(): Collection { $query = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') - ->groupBy('transaction_journals.id'); + ->groupBy('transaction_journals.id') + ; $result = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line $journalIds = []; - /** @var stdClass $row */ + /** @var \stdClass $row */ foreach ($result as $row) { if ((int) $row->transaction_count > 2) { $journalIds[] = (int) $row->id; @@ -192,7 +193,8 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn $journalIds = array_unique($journalIds); return TransactionJournal::with(['transactions']) - ->whereIn('id', $journalIds)->get(); + ->whereIn('id', $journalIds)->get() + ; } /** diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 19936aa599..7ef358d137 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -67,7 +67,8 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac ->transactionJournals() ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') ->whereIn('transaction_types.type', $types) - ->get(['transaction_journals.*']); + ->get(['transaction_journals.*']) + ; } /** @@ -101,7 +102,7 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac */ public function getJournalTotal(TransactionJournal $journal): string { - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($journal->id); $cache->addProperty('amount-positive'); if ($cache->has()) { @@ -150,7 +151,8 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac return new Carbon($cache->get()); } $entry = TransactionJournalMeta::where('transaction_journal_id', $journalId) - ->where('name', $field)->first(); + ->where('name', $field)->first() + ; if (null === $entry) { return null; } @@ -193,7 +195,8 @@ class JournalRepository implements JournalRepositoryInterface, UserGroupInterfac public function searchJournalDescriptions(string $search, int $limit): Collection { $query = $this->user->transactionJournals() - ->orderBy('date', 'DESC'); + ->orderBy('date', 'DESC') + ; if ('' !== $search) { $query->whereLike('description', sprintf('%%%s%%', $search)); } diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 91023da448..8971bf9234 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -44,7 +44,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface JournalRepositoryInterface { diff --git a/app/Repositories/LinkType/LinkTypeRepository.php b/app/Repositories/LinkType/LinkTypeRepository.php index 401c9dc023..024e097959 100644 --- a/app/Repositories/LinkType/LinkTypeRepository.php +++ b/app/Repositories/LinkType/LinkTypeRepository.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\LinkType; -use Exception; use FireflyIII\Events\DestroyedTransactionLink; use FireflyIII\Models\LinkType; use FireflyIII\Models\Note; @@ -72,7 +71,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf } /** - * @throws Exception + * @throws \Exception */ public function destroyLink(TransactionJournalLink $link): bool { @@ -117,12 +116,13 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf public function getJournalLinks(?LinkType $linkType = null): Collection { $query = TransactionJournalLink::with(['source', 'destination']) - ->leftJoin('transaction_journals as source_journals', 'journal_links.source_id', '=', 'source_journals.id') - ->leftJoin('transaction_journals as dest_journals', 'journal_links.destination_id', '=', 'dest_journals.id') - ->where('source_journals.user_id', $this->user->id) - ->where('dest_journals.user_id', $this->user->id) - ->whereNull('source_journals.deleted_at') - ->whereNull('dest_journals.deleted_at'); + ->leftJoin('transaction_journals as source_journals', 'journal_links.source_id', '=', 'source_journals.id') + ->leftJoin('transaction_journals as dest_journals', 'journal_links.destination_id', '=', 'dest_journals.id') + ->where('source_journals.user_id', $this->user->id) + ->where('dest_journals.user_id', $this->user->id) + ->whereNull('source_journals.deleted_at') + ->whereNull('dest_journals.deleted_at') + ; if (null !== $linkType) { $query->where('journal_links.link_type_id', $linkType->id); @@ -172,7 +172,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf /** * Store link between two journals. * - * @throws Exception + * @throws \Exception */ public function storeLink(array $information, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink { @@ -192,7 +192,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf return $existing; } - $link = new TransactionJournalLink(); + $link = new TransactionJournalLink(); $link->linkType()->associate($linkType); if ('inward' === $information['direction']) { app('log')->debug(sprintf('Link type is inwards ("%s"), so %d is source and %d is destination.', $linkType->inward, $inward->id, $outward->id)); @@ -233,12 +233,13 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf public function findSpecificLink(LinkType $linkType, TransactionJournal $inward, TransactionJournal $outward): ?TransactionJournalLink { return TransactionJournalLink::where('link_type_id', $linkType->id) - ->where('source_id', $inward->id) - ->where('destination_id', $outward->id)->first(); + ->where('source_id', $inward->id) + ->where('destination_id', $outward->id)->first() + ; } /** - * @throws Exception + * @throws \Exception */ private function setNoteText(TransactionJournalLink $link, string $text): void { @@ -280,7 +281,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf /** * Update an existing transaction journal link. * - * @throws Exception + * @throws \Exception */ public function updateLink(TransactionJournalLink $journalLink, array $data): TransactionJournalLink { @@ -296,7 +297,7 @@ class LinkTypeRepository implements LinkTypeRepositoryInterface, UserGroupInterf $journalLink->refresh(); } - $journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id']; + $journalLink->link_type_id = null === $data['link_type_id'] ? $journalLink->link_type_id : $data['link_type_id']; $journalLink->save(); if (array_key_exists('notes', $data) && null !== $data['notes']) { $this->setNoteText($journalLink, $data['notes']); diff --git a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php index 86608faef4..23cdeca825 100644 --- a/app/Repositories/LinkType/LinkTypeRepositoryInterface.php +++ b/app/Repositories/LinkType/LinkTypeRepositoryInterface.php @@ -41,7 +41,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface LinkTypeRepositoryInterface { diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepository.php b/app/Repositories/ObjectGroup/ObjectGroupRepository.php index 66559e3ee8..4299155670 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepository.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepository.php @@ -53,9 +53,10 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup public function get(): Collection { return $this->user->objectGroups() - ->with(['piggyBanks', 'bills']) - ->orderBy('order', 'ASC') - ->orderBy('title', 'ASC')->get(); + ->with(['piggyBanks', 'bills']) + ->orderBy('order', 'ASC') + ->orderBy('title', 'ASC')->get() + ; } public function deleteEmpty(): void @@ -148,16 +149,18 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup if ($newOrder > $oldOrder) { $this->user->objectGroups()->where('object_groups.order', '<=', $newOrder)->where('object_groups.order', '>', $oldOrder) - ->where('object_groups.id', '!=', $objectGroup->id) - ->decrement('object_groups.order'); + ->where('object_groups.id', '!=', $objectGroup->id) + ->decrement('object_groups.order') + ; $objectGroup->order = $newOrder; $objectGroup->save(); } if ($newOrder < $oldOrder) { $this->user->objectGroups()->where('object_groups.order', '>=', $newOrder)->where('object_groups.order', '<', $oldOrder) - ->where('object_groups.id', '!=', $objectGroup->id) - ->increment('object_groups.order'); + ->where('object_groups.id', '!=', $objectGroup->id) + ->increment('object_groups.order') + ; $objectGroup->order = $newOrder; $objectGroup->save(); diff --git a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php index dc6944becd..5798b7ce2f 100644 --- a/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php +++ b/app/Repositories/ObjectGroup/ObjectGroupRepositoryInterface.php @@ -40,7 +40,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface ObjectGroupRepositoryInterface { diff --git a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php index af0e803881..568e37895d 100644 --- a/app/Repositories/PiggyBank/ModifiesPiggyBanks.php +++ b/app/Repositories/PiggyBank/ModifiesPiggyBanks.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\PiggyBank; -use Exception; use FireflyIII\Events\Model\PiggyBank\ChangedAmount; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Factory\PiggyBankFactory; @@ -69,9 +68,9 @@ trait ModifiesPiggyBanks $pivot->native_current_amount = null; // also update native_current_amount. - $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); if ($userCurrency->id !== $piggyBank->transaction_currency_id) { - $converter = new ExchangeRateConverter(); + $converter = new ExchangeRateConverter(); $converter->setIgnoreSettings(true); $pivot->native_current_amount = $converter->convert($piggyBank->transactionCurrency, $userCurrency, today(), $pivot->current_amount); } @@ -92,9 +91,9 @@ trait ModifiesPiggyBanks $pivot->native_current_amount = null; // also update native_current_amount. - $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); + $userCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); if ($userCurrency->id !== $piggyBank->transaction_currency_id) { - $converter = new ExchangeRateConverter(); + $converter = new ExchangeRateConverter(); $converter->setIgnoreSettings(true); $pivot->native_current_amount = $converter->convert($piggyBank->transactionCurrency, $userCurrency, today(), $pivot->current_amount); } @@ -126,8 +125,8 @@ trait ModifiesPiggyBanks Log::debug(sprintf('Maximum amount: %s', $maxAmount)); } - $compare = bccomp($amount, $maxAmount); - $result = $compare <= 0; + $compare = bccomp($amount, $maxAmount); + $result = $compare <= 0; Log::debug(sprintf('Compare <= 0? %d, so canAddAmount is %s', $compare, var_export($result, true))); @@ -142,7 +141,7 @@ trait ModifiesPiggyBanks } /** - * @throws Exception + * @throws \Exception */ public function destroy(PiggyBank $piggyBank): bool { @@ -161,11 +160,11 @@ trait ModifiesPiggyBanks public function setCurrentAmount(PiggyBank $piggyBank, string $amount): PiggyBank { - $repetition = $this->getRepetition($piggyBank); + $repetition = $this->getRepetition($piggyBank); if (null === $repetition) { return $piggyBank; } - $max = $piggyBank->target_amount; + $max = $piggyBank->target_amount; if (1 === bccomp($amount, $max) && 0 !== bccomp($piggyBank->target_amount, '0')) { $amount = $max; } @@ -208,14 +207,14 @@ trait ModifiesPiggyBanks public function update(PiggyBank $piggyBank, array $data): PiggyBank { - $piggyBank = $this->updateProperties($piggyBank, $data); + $piggyBank = $this->updateProperties($piggyBank, $data); if (array_key_exists('notes', $data)) { $this->updateNote($piggyBank, (string) $data['notes']); } // update the order of the piggy bank: - $oldOrder = $piggyBank->order; - $newOrder = (int) ($data['order'] ?? $oldOrder); + $oldOrder = $piggyBank->order; + $newOrder = (int) ($data['order'] ?? $oldOrder); if ($oldOrder !== $newOrder) { $this->setOrder($piggyBank, $newOrder); } @@ -308,7 +307,7 @@ trait ModifiesPiggyBanks return; } - $dbNote = $piggyBank->notes()->first(); + $dbNote = $piggyBank->notes()->first(); if (null === $dbNote) { $dbNote = new Note(); $dbNote->noteable()->associate($piggyBank); @@ -319,15 +318,16 @@ trait ModifiesPiggyBanks public function setOrder(PiggyBank $piggyBank, int $newOrder): bool { - $oldOrder = $piggyBank->order; + $oldOrder = $piggyBank->order; // Log::debug(sprintf('Will move piggy bank #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder)); if ($newOrder > $oldOrder) { PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder) - ->where('piggy_banks.id', '!=', $piggyBank->id) - ->distinct()->decrement('piggy_banks.order'); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.order', '<=', $newOrder)->where('piggy_banks.order', '>', $oldOrder) + ->where('piggy_banks.id', '!=', $piggyBank->id) + ->distinct()->decrement('piggy_banks.order') + ; $piggyBank->order = $newOrder; Log::debug(sprintf('[1] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder)); @@ -336,11 +336,12 @@ trait ModifiesPiggyBanks return true; } PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.order', '>=', $newOrder)->where('piggy_banks.order', '<', $oldOrder) - ->where('piggy_banks.id', '!=', $piggyBank->id) - ->distinct()->increment('piggy_banks.order'); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.order', '>=', $newOrder)->where('piggy_banks.order', '<', $oldOrder) + ->where('piggy_banks.id', '!=', $piggyBank->id) + ->distinct()->increment('piggy_banks.order') + ; $piggyBank->order = $newOrder; Log::debug(sprintf('[2] Order of piggy #%d ("%s") from %d to %d', $piggyBank->id, $piggyBank->name, $oldOrder, $newOrder)); @@ -361,7 +362,7 @@ trait ModifiesPiggyBanks } // if this account contains less than the amount, remove the current amount, update the amount and continue. $this->removeAmount($piggyBank, $account, $current); - $amount = bcsub($amount, $current); + $amount = bcsub($amount, $current); } } } diff --git a/app/Repositories/PiggyBank/PiggyBankRepository.php b/app/Repositories/PiggyBank/PiggyBankRepository.php index e99fa16363..5b093fda89 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/PiggyBank/PiggyBankRepository.php @@ -41,7 +41,6 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Storage; -use Override; /** * Class PiggyBankRepository. @@ -57,9 +56,10 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte Log::channel('audit')->info('Delete all piggy banks through destroyAll'); PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->delete(); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->delete() + ; } public function findPiggyBank(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank @@ -90,9 +90,10 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function find(int $piggyBankId): ?PiggyBank { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']) + ; } /** @@ -101,14 +102,15 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function findByName(string $name): ?PiggyBank { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->where('piggy_banks.name', $name)->first(['piggy_banks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->where('piggy_banks.name', $name)->first(['piggy_banks.*']) + ; } public function getAttachments(PiggyBank $piggyBank): Collection { - $set = $piggyBank->attachments()->get(); + $set = $piggyBank->attachments()->get(); $disk = Storage::disk('upload'); @@ -155,15 +157,15 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte { app('log')->debug(sprintf('Now in getExactAmount(%d, %d)', $piggyBank->id, $journal->id)); - $operator = null; - $currency = null; + $operator = null; + $currency = null; /** @var JournalRepositoryInterface $journalRepost */ - $journalRepost = app(JournalRepositoryInterface::class); + $journalRepost = app(JournalRepositoryInterface::class); $journalRepost->setUser($this->user); /** @var AccountRepositoryInterface $accountRepos */ - $accountRepos = app(AccountRepositoryInterface::class); + $accountRepos = app(AccountRepositoryInterface::class); $accountRepos->setUser($this->user); $defaultCurrency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); @@ -171,11 +173,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte app('log')->debug(sprintf('Piggy bank #%d currency is %s', $piggyBank->id, $piggyBank->transactionCurrency->code)); /** @var Transaction $source */ - $source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first(); + $source = $journal->transactions()->with(['account'])->where('amount', '<', 0)->first(); /** @var Transaction $destination */ - $destination = $journal->transactions()->with(['account'])->where('amount', '>', 0)->first(); - $hits = 0; + $destination = $journal->transactions()->with(['account'])->where('amount', '>', 0)->first(); + $hits = 0; foreach ($piggyBank->accounts as $account) { // matches source, which means amount will be removed from piggy: @@ -207,7 +209,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte } // currency of the account + the piggy bank currency are almost the same. // which amount from the transaction matches? - $amount = null; + $amount = null; if ((int) $source->transaction_currency_id === $currency->id) { app('log')->debug('Use normal amount'); $amount = app('steam')->{$operator}($source->amount); // @phpstan-ignore-line @@ -223,9 +225,9 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte } app('log')->debug(sprintf('The currency is %s and the amount is %s', $currency->code, $amount)); - $currentAmount = $this->getCurrentAmount($piggyBank); - $room = bcsub($piggyBank->target_amount, $currentAmount); - $compare = bcmul($currentAmount, '-1'); + $currentAmount = $this->getCurrentAmount($piggyBank); + $room = bcsub($piggyBank->target_amount, $currentAmount); + $compare = bcmul($currentAmount, '-1'); if (0 === bccomp($piggyBank->target_amount, '0')) { // amount is zero? then the "room" is positive amount of we wish to add or remove. @@ -306,20 +308,23 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function getPiggyBanks(): Collection { $query = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id'); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ; if (null === $this->user) { $query->where('accounts.user_group_id', $this->userGroup->id); } if (null !== $this->user) { $query->where('accounts.user_id', $this->user->id); } + return $query ->with( [ 'objectGroups', ] ) - ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']); + ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']) + ; } public function getRepetition(PiggyBank $piggyBank, bool $overrule = false): ?PiggyBankRepetition @@ -385,23 +390,24 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte return $balance; } - #[Override] + #[\Override] public function purgeAll(): void { PiggyBank::withTrashed() - ->whereNotNull('piggy_banks.deleted_at') - ->leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->delete(); + ->whereNotNull('piggy_banks.deleted_at') + ->leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->delete() + ; } - #[Override] + #[\Override] public function resetOrder(): void { $factory = new PiggyBankFactory(); @@ -412,19 +418,21 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte public function searchPiggyBank(string $query, int $limit): Collection { $search = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_id', $this->user->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->distinct(); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_id', $this->user->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->distinct() + ; if ('' !== $query) { $search->whereLike('piggy_banks.name', sprintf('%%%s%%', $query)); } $search->orderBy('piggy_banks.order', 'ASC') - ->orderBy('piggy_banks.name', 'ASC'); + ->orderBy('piggy_banks.name', 'ASC') + ; return $search->take($limit)->get(['piggy_banks.*']); } diff --git a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php index af418b2c0b..a6eff5b1b4 100644 --- a/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php +++ b/app/Repositories/PiggyBank/PiggyBankRepositoryInterface.php @@ -44,7 +44,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface PiggyBankRepositoryInterface { diff --git a/app/Repositories/Recurring/RecurringRepository.php b/app/Repositories/Recurring/RecurringRepository.php index 539dcf799b..bbbac73933 100644 --- a/app/Repositories/Recurring/RecurringRepository.php +++ b/app/Repositories/Recurring/RecurringRepository.php @@ -67,9 +67,9 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte // if not, loop set and try to read the recurrence_date. If it matches start or end, return it as well. $set = TransactionJournalMeta::where(static function (Builder $q1) use ($recurrence): void { - $q1->where('name', 'recurrence_id'); - $q1->where('data', json_encode((string) $recurrence->id)); - })->get(['journal_meta.transaction_journal_id']); + $q1->where('name', 'recurrence_id'); + $q1->where('data', json_encode((string) $recurrence->id)); + })->get(['journal_meta.transaction_journal_id']); // there are X journals made for this recurrence. Any of them meant for today? foreach ($set as $journalMeta) { @@ -79,8 +79,9 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $q2->where('name', 'recurrence_date'); $q2->where('data', json_encode($string)); }) - ->where('transaction_journal_id', $journalMeta->transaction_journal_id) - ->count(); + ->where('transaction_journal_id', $journalMeta->transaction_journal_id) + ->count() + ; if ($count > 0) { app('log')->debug(sprintf('Looks like journal #%d was already created', $journalMeta->transaction_journal_id)); @@ -97,11 +98,12 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function get(): Collection { return $this->user->recurrences() - ->with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) - ->orderBy('active', 'DESC') - ->orderBy('transaction_type_id', 'ASC') - ->orderBy('title', 'ASC') - ->get(); + ->with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) + ->orderBy('active', 'DESC') + ->orderBy('transaction_type_id', 'ASC') + ->orderBy('title', 'ASC') + ->get() + ; } /** @@ -127,9 +129,10 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte { // grab ALL recurring transactions: return Recurrence::with(['TransactionCurrency', 'TransactionType', 'RecurrenceRepetitions', 'RecurrenceTransactions']) - ->orderBy('active', 'DESC') - ->orderBy('title', 'ASC') - ->get(); + ->orderBy('active', 'DESC') + ->orderBy('title', 'ASC') + ->get() + ; } public function getBillId(RecurrenceTransaction $recTransaction): ?int @@ -204,10 +207,11 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte { Log::debug(sprintf('Now in getJournalCount(#%d, "%s", "%s")', $recurrence->id, $start?->format('Y-m-d H:i:s'), $end?->format('Y-m-d H:i:s'))); $query = TransactionJournal::leftJoin('journal_meta', 'journal_meta.transaction_journal_id', '=', 'transaction_journals.id') - ->where('transaction_journals.user_id', $recurrence->user_id) - ->whereNull('transaction_journals.deleted_at') - ->where('journal_meta.name', 'recurrence_id') - ->where('journal_meta.data', '"' . $recurrence->id . '"'); + ->where('transaction_journals.user_id', $recurrence->user_id) + ->whereNull('transaction_journals.deleted_at') + ->where('journal_meta.name', 'recurrence_id') + ->where('journal_meta.data', '"'.$recurrence->id.'"') + ; if (null !== $start) { $query->where('transaction_journals.date', '>=', $start->format('Y-m-d 00:00:00')); } @@ -226,10 +230,11 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function getJournalIds(Recurrence $recurrence): array { return TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') - ->where('transaction_journals.user_id', $this->user->id) - ->where('journal_meta.name', '=', 'recurrence_id') - ->where('journal_meta.data', '=', json_encode((string) $recurrence->id)) - ->get(['journal_meta.transaction_journal_id'])->pluck('transaction_journal_id')->toArray(); + ->where('transaction_journals.user_id', $this->user->id) + ->where('journal_meta.name', '=', 'recurrence_id') + ->where('journal_meta.data', '=', json_encode((string) $recurrence->id)) + ->get(['journal_meta.transaction_journal_id'])->pluck('transaction_journal_id')->toArray() + ; } /** @@ -277,22 +282,24 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function getTransactionPaginator(Recurrence $recurrence, int $page, int $pageSize): LengthAwarePaginator { $journalMeta = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') - ->whereNull('transaction_journals.deleted_at') - ->where('transaction_journals.user_id', $this->user->id) - ->where('name', 'recurrence_id') - ->where('data', json_encode((string) $recurrence->id)) - ->get()->pluck('transaction_journal_id')->toArray(); + ->whereNull('transaction_journals.deleted_at') + ->where('transaction_journals.user_id', $this->user->id) + ->where('name', 'recurrence_id') + ->where('data', json_encode((string) $recurrence->id)) + ->get()->pluck('transaction_journal_id')->toArray() + ; $search = []; foreach ($journalMeta as $journalId) { $search[] = (int) $journalId; } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($recurrence->user); $collector->withCategoryInformation()->withBudgetInformation()->setLimit($pageSize)->setPage($page) - ->withAccountInformation(); + ->withAccountInformation() + ; $collector->setJournalIds($search); return $collector->getPaginatedGroups(); @@ -301,11 +308,12 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte public function getTransactions(Recurrence $recurrence): Collection { $journalMeta = TransactionJournalMeta::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'journal_meta.transaction_journal_id') - ->whereNull('transaction_journals.deleted_at') - ->where('transaction_journals.user_id', $this->user->id) - ->where('name', 'recurrence_id') - ->where('data', json_encode((string) $recurrence->id)) - ->get()->pluck('transaction_journal_id')->toArray(); + ->whereNull('transaction_journals.deleted_at') + ->where('transaction_journals.user_id', $this->user->id) + ->where('name', 'recurrence_id') + ->where('data', json_encode((string) $recurrence->id)) + ->get()->pluck('transaction_journal_id')->toArray() + ; $search = []; foreach ($journalMeta as $journalId) { @@ -316,7 +324,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte } /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($recurrence->user); $collector->withCategoryInformation()->withBudgetInformation()->withAccountInformation(); @@ -459,21 +467,21 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte ); } if ('ndom' === $repetition->repetition_type) { - $parts = explode(',', $repetition->repetition_moment); + $parts = explode(',', $repetition->repetition_moment); // first part is number of week, second is weekday. $dayOfWeek = trans(sprintf('config.dow_%s', $parts[1]), [], $language); return (string) trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $parts[0]], $language); } if ('yearly' === $repetition->repetition_type) { - $today = today(config('app.timezone'))->endOfYear(); - $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment); + $today = today(config('app.timezone'))->endOfYear(); + $repDate = Carbon::createFromFormat('Y-m-d', $repetition->repetition_moment); if (null === $repDate) { $repDate = clone $today; } $diffInYears = (int) $today->diffInYears($repDate, true); $repDate->addYears($diffInYears); // technically not necessary. - $string = $repDate->isoFormat((string) trans('config.month_and_day_no_year_js')); + $string = $repDate->isoFormat((string) trans('config.month_and_day_no_year_js')); return (string) trans('firefly.recurring_yearly', ['date' => $string], $language); } @@ -488,7 +496,8 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $search->whereLike('recurrences.title', sprintf('%%%s%%', $query)); } $search - ->orderBy('recurrences.title', 'ASC'); + ->orderBy('recurrences.title', 'ASC') + ; return $search->take($limit)->get(['id', 'title', 'description']); } @@ -534,7 +543,7 @@ class RecurringRepository implements RecurringRepositoryInterface, UserGroupInte $occurrences = []; $mutator = clone $start; $mutator->startOfDay(); - $skipMod = $repetition->repetition_skip + 1; + $skipMod = $repetition->repetition_skip + 1; app('log')->debug(sprintf('Calculating occurrences for rep type "%s"', $repetition->repetition_type)); app('log')->debug(sprintf('Mutator is now: %s', $mutator->format('Y-m-d'))); diff --git a/app/Repositories/Recurring/RecurringRepositoryInterface.php b/app/Repositories/Recurring/RecurringRepositoryInterface.php index 3db8ffe890..b59548b9de 100644 --- a/app/Repositories/Recurring/RecurringRepositoryInterface.php +++ b/app/Repositories/Recurring/RecurringRepositoryInterface.php @@ -45,7 +45,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface RecurringRepositoryInterface { diff --git a/app/Repositories/Rule/RuleRepository.php b/app/Repositories/Rule/RuleRepository.php index 07698ce7f5..ca214c6edd 100644 --- a/app/Repositories/Rule/RuleRepository.php +++ b/app/Repositories/Rule/RuleRepository.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Rule; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; @@ -43,7 +42,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface use UserGroupTrait; /** - * @throws Exception + * @throws \Exception */ public function destroy(Rule $rule): bool { @@ -112,7 +111,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface { $count = $rule->ruleTriggers()->count(); if (0 === $count) { - throw new FireflyException('Rules should have more than zero triggers, rule #' . $rule->id . ' has none!'); + throw new FireflyException('Rules should have more than zero triggers, rule #'.$rule->id.' has none!'); } return $rule->ruleTriggers()->where('trigger_type', 'user_action')->first()->trigger_value; @@ -142,7 +141,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface if ('user_action' === $trigger->trigger_type) { continue; } - $triggerType = $trigger->trigger_type; + $triggerType = $trigger->trigger_type; if (str_starts_with($trigger->trigger_type, '-')) { $triggerType = substr($trigger->trigger_type, 1); } @@ -161,13 +160,14 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function getStoreRules(): Collection { $collection = $this->user->rules() - ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') - ->where('rules.active', true) - ->where('rule_groups.active', true) - ->orderBy('rule_groups.order', 'ASC') - ->orderBy('rules.order', 'ASC') - ->orderBy('rules.id', 'ASC') - ->with(['ruleGroup', 'ruleTriggers'])->get(['rules.*']); + ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') + ->where('rules.active', true) + ->where('rule_groups.active', true) + ->orderBy('rule_groups.order', 'ASC') + ->orderBy('rules.order', 'ASC') + ->orderBy('rules.id', 'ASC') + ->with(['ruleGroup', 'ruleTriggers'])->get(['rules.*']) + ; $filtered = new Collection(); /** @var Rule $rule */ @@ -186,13 +186,14 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function getUpdateRules(): Collection { $collection = $this->user->rules() - ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') - ->where('rules.active', true) - ->where('rule_groups.active', true) - ->orderBy('rule_groups.order', 'ASC') - ->orderBy('rules.order', 'ASC') - ->orderBy('rules.id', 'ASC') - ->with(['ruleGroup', 'ruleTriggers'])->get(); + ->leftJoin('rule_groups', 'rule_groups.id', '=', 'rules.rule_group_id') + ->where('rules.active', true) + ->where('rule_groups.active', true) + ->orderBy('rule_groups.order', 'ASC') + ->orderBy('rules.order', 'ASC') + ->orderBy('rules.id', 'ASC') + ->with(['ruleGroup', 'ruleTriggers'])->get() + ; $filtered = new Collection(); /** @var Rule $rule */ @@ -215,7 +216,8 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface $search->whereLike('rules.title', sprintf('%%%s%%', $query)); } $search->orderBy('rules.order', 'ASC') - ->orderBy('rules.title', 'ASC'); + ->orderBy('rules.title', 'ASC') + ; return $search->take($limit)->get(['id', 'title', 'description']); } @@ -225,7 +227,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface */ public function store(array $data): Rule { - $ruleGroup = null; + $ruleGroup = null; if (array_key_exists('rule_group_id', $data)) { $ruleGroup = $this->user->ruleGroups()->find($data['rule_group_id']); } @@ -239,7 +241,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface /** @var RuleGroup $ruleGroup */ // start by creating a new rule: - $rule = new Rule(); + $rule = new Rule(); $rule->user()->associate($this->user); $rule->userGroup()->associate($this->user->userGroup); @@ -283,7 +285,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface private function setRuleTrigger(string $moment, Rule $rule): void { /** @var null|RuleTrigger $trigger */ - $trigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first(); + $trigger = $rule->ruleTriggers()->where('trigger_type', 'user_action')->first(); if (null !== $trigger) { $trigger->trigger_value = $moment; $trigger->save(); @@ -311,19 +313,20 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function setOrder(Rule $rule, int $newOrder): void { - $oldOrder = $rule->order; - $groupId = $rule->rule_group_id; - $maxOrder = $this->maxOrder($rule->ruleGroup); - $newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder; + $oldOrder = $rule->order; + $groupId = $rule->rule_group_id; + $maxOrder = $this->maxOrder($rule->ruleGroup); + $newOrder = $newOrder > $maxOrder ? $maxOrder + 1 : $newOrder; app('log')->debug(sprintf('New order will be %d', $newOrder)); if ($newOrder > $oldOrder) { $this->user->rules() - ->where('rules.rule_group_id', $groupId) - ->where('rules.order', '<=', $newOrder) - ->where('rules.order', '>', $oldOrder) - ->where('rules.id', '!=', $rule->id) - ->decrement('rules.order'); + ->where('rules.rule_group_id', $groupId) + ->where('rules.order', '<=', $newOrder) + ->where('rules.order', '>', $oldOrder) + ->where('rules.id', '!=', $rule->id) + ->decrement('rules.order') + ; $rule->order = $newOrder; app('log')->debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder)); $rule->save(); @@ -332,11 +335,12 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface } $this->user->rules() - ->where('rules.rule_group_id', $groupId) - ->where('rules.order', '>=', $newOrder) - ->where('rules.order', '<', $oldOrder) - ->where('rules.id', '!=', $rule->id) - ->increment('rules.order'); + ->where('rules.rule_group_id', $groupId) + ->where('rules.order', '>=', $newOrder) + ->where('rules.order', '<', $oldOrder) + ->where('rules.id', '!=', $rule->id) + ->increment('rules.order') + ; $rule->order = $newOrder; app('log')->debug(sprintf('Order of rule #%d ("%s") is now %d', $rule->id, $rule->title, $newOrder)); $rule->save(); @@ -361,7 +365,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface // empty the value in case the rule needs no context // TODO create a helper to automatically return these. - $needTrue = [ + $needTrue = [ 'reconciled', 'has_attachments', 'has_any_category', @@ -388,7 +392,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface $value = ''; } - $triggerValues = [ + $triggerValues = [ 'action' => $type, 'value' => $value, 'stop_processing' => $stopProcessing, @@ -402,7 +406,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function storeTrigger(Rule $rule, array $values): RuleTrigger { - $ruleTrigger = new RuleTrigger(); + $ruleTrigger = new RuleTrigger(); $ruleTrigger->rule()->associate($rule); $ruleTrigger->order = $values['order']; $ruleTrigger->active = $values['active']; @@ -435,7 +439,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface public function storeAction(Rule $rule, array $values): RuleAction { - $ruleAction = new RuleAction(); + $ruleAction = new RuleAction(); $ruleAction->rule()->associate($rule); $ruleAction->order = $values['order']; $ruleAction->active = $values['active']; @@ -465,7 +469,7 @@ class RuleRepository implements RuleRepositoryInterface, UserGroupInterface } $rule->save(); $rule->refresh(); - $group = $rule->ruleGroup; + $group = $rule->ruleGroup; // update the order: $this->resetRuleOrder($group); if (array_key_exists('order', $data)) { diff --git a/app/Repositories/Rule/RuleRepositoryInterface.php b/app/Repositories/Rule/RuleRepositoryInterface.php index 6748b33d89..e4d8e53394 100644 --- a/app/Repositories/Rule/RuleRepositoryInterface.php +++ b/app/Repositories/Rule/RuleRepositoryInterface.php @@ -42,7 +42,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface RuleRepositoryInterface { diff --git a/app/Repositories/RuleGroup/RuleGroupRepository.php b/app/Repositories/RuleGroup/RuleGroupRepository.php index f065c377f6..8615e346ec 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepository.php +++ b/app/Repositories/RuleGroup/RuleGroupRepository.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\RuleGroup; -use Exception; use FireflyIII\Models\Rule; use FireflyIII\Models\RuleAction; use FireflyIII\Models\RuleGroup; @@ -48,7 +47,8 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte ->orderBy('order', 'ASC') ->orderBy('active', 'DESC') ->orderBy('title', 'ASC') - ->get(['rule_groups.id']); + ->get(['rule_groups.id']) + ; $index = 1; /** @var RuleGroup $ruleGroup */ @@ -72,7 +72,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } /** - * @throws Exception + * @throws \Exception */ public function destroy(RuleGroup $ruleGroup, ?RuleGroup $moveTo): bool { @@ -105,7 +105,8 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte ->whereNull('deleted_at') ->orderBy('order', 'ASC') ->orderBy('title', 'DESC') - ->get(); + ->get() + ; $count = 1; /** @var RuleGroup $entry */ @@ -127,10 +128,11 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function resetRuleOrder(RuleGroup $ruleGroup): bool { $set = $ruleGroup->rules() - ->orderBy('order', 'ASC') - ->orderBy('title', 'DESC') - ->orderBy('updated_at', 'DESC') - ->get(['rules.*']); + ->orderBy('order', 'ASC') + ->orderBy('title', 'DESC') + ->orderBy('updated_at', 'DESC') + ->get(['rules.*']) + ; $count = 1; /** @var Rule $entry */ @@ -152,10 +154,11 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte private function resetRuleActionOrder(Rule $rule): void { $actions = $rule->ruleActions() - ->orderBy('order', 'ASC') - ->orderBy('active', 'DESC') - ->orderBy('action_type', 'ASC') - ->get(); + ->orderBy('order', 'ASC') + ->orderBy('active', 'DESC') + ->orderBy('action_type', 'ASC') + ->get() + ; $index = 1; /** @var RuleAction $action */ @@ -172,10 +175,11 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte private function resetRuleTriggerOrder(Rule $rule): void { $triggers = $rule->ruleTriggers() - ->orderBy('order', 'ASC') - ->orderBy('active', 'DESC') - ->orderBy('trigger_type', 'ASC') - ->get(); + ->orderBy('order', 'ASC') + ->orderBy('active', 'DESC') + ->orderBy('trigger_type', 'ASC') + ->get() + ; $index = 1; /** @var RuleTrigger $trigger */ @@ -222,47 +226,51 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function getActiveRules(RuleGroup $group): Collection { return $group->rules() - ->where('rules.active', true) - ->get(['rules.*']); + ->where('rules.active', true) + ->get(['rules.*']) + ; } public function getActiveStoreRules(RuleGroup $group): Collection { return $group->rules() - ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') - ->where('rule_triggers.trigger_type', 'user_action') - ->where('rule_triggers.trigger_value', 'store-journal') - ->where('rules.active', true) - ->get(['rules.*']); + ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') + ->where('rule_triggers.trigger_type', 'user_action') + ->where('rule_triggers.trigger_value', 'store-journal') + ->where('rules.active', true) + ->get(['rules.*']) + ; } public function getActiveUpdateRules(RuleGroup $group): Collection { return $group->rules() - ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') - ->where('rule_triggers.trigger_type', 'user_action') - ->where('rule_triggers.trigger_value', 'update-journal') - ->where('rules.active', true) - ->get(['rules.*']); + ->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id') + ->where('rule_triggers.trigger_type', 'user_action') + ->where('rule_triggers.trigger_value', 'update-journal') + ->where('rules.active', true) + ->get(['rules.*']) + ; } public function getAllRuleGroupsWithRules(?string $filter): Collection { $groups = $this->user->ruleGroups() - ->orderBy('order', 'ASC') - ->with( - [ // @phpstan-ignore-line - 'rules' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleTriggers' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleActions' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - ] - )->get(); + ->orderBy('order', 'ASC') + ->with( + [ // @phpstan-ignore-line + 'rules' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleTriggers' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleActions' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + ] + )->get() + ; if (null === $filter) { return $groups; } @@ -303,21 +311,22 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function getRuleGroupsWithRules(?string $filter): Collection { $groups = $this->user->ruleGroups() - ->orderBy('order', 'ASC') - ->where('active', true) - ->with( - [ // @phpstan-ignore-line - 'rules' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleTriggers' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - 'rules.ruleActions' => static function (HasMany $query): void { - $query->orderBy('order', 'ASC'); - }, - ] - )->get(); + ->orderBy('order', 'ASC') + ->where('active', true) + ->with( + [ // @phpstan-ignore-line + 'rules' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleTriggers' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + 'rules.ruleActions' => static function (HasMany $query): void { + $query->orderBy('order', 'ASC'); + }, + ] + )->get() + ; if (null === $filter) { return $groups; } @@ -351,7 +360,8 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function getRules(RuleGroup $group): Collection { return $group->rules() - ->get(['rules.*']); + ->get(['rules.*']) + ; } public function maxOrder(): int @@ -366,7 +376,8 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte $search->whereLike('rule_groups.title', sprintf('%%%s%%', $query)); } $search->orderBy('rule_groups.order', 'ASC') - ->orderBy('rule_groups.title', 'ASC'); + ->orderBy('rule_groups.title', 'ASC') + ; return $search->take($limit)->get(['id', 'title', 'description']); } @@ -394,12 +405,13 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte public function setOrder(RuleGroup $ruleGroup, int $newOrder): void { - $oldOrder = $ruleGroup->order; + $oldOrder = $ruleGroup->order; if ($newOrder > $oldOrder) { $this->user->ruleGroups()->where('rule_groups.order', '<=', $newOrder)->where('rule_groups.order', '>', $oldOrder) - ->where('rule_groups.id', '!=', $ruleGroup->id) - ->decrement('order'); + ->where('rule_groups.id', '!=', $ruleGroup->id) + ->decrement('order') + ; $ruleGroup->order = $newOrder; app('log')->debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder)); $ruleGroup->save(); @@ -408,8 +420,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte } $this->user->ruleGroups()->where('rule_groups.order', '>=', $newOrder)->where('rule_groups.order', '<', $oldOrder) - ->where('rule_groups.id', '!=', $ruleGroup->id) - ->increment('order'); + ->where('rule_groups.id', '!=', $ruleGroup->id) + ->increment('order') + ; $ruleGroup->order = $newOrder; app('log')->debug(sprintf('Order of group #%d ("%s") is now %d', $ruleGroup->id, $ruleGroup->title, $newOrder)); $ruleGroup->save(); diff --git a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php index b488ef25c3..54b24c1adb 100644 --- a/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php +++ b/app/Repositories/RuleGroup/RuleGroupRepositoryInterface.php @@ -39,7 +39,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface RuleGroupRepositoryInterface { diff --git a/app/Repositories/Tag/OperationsRepository.php b/app/Repositories/Tag/OperationsRepository.php index d15dd83b6a..9fe781fd00 100644 --- a/app/Repositories/Tag/OperationsRepository.php +++ b/app/Repositories/Tag/OperationsRepository.php @@ -47,9 +47,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function listExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $tagIds = []; + $tagIds = []; if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } @@ -66,7 +66,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $array = []; $listedJournals = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $array[$currencyId] ??= [ 'tags' => [], 'currency_id' => $currencyId, @@ -78,9 +78,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // may have multiple tags: foreach ($journal['tags'] as $tag) { - $tagId = (int) $tag['id']; - $tagName = (string) $tag['name']; - $journalId = (int) $journal['transaction_journal_id']; + $tagId = (int) $tag['id']; + $tagName = (string) $tag['name']; + $journalId = (int) $journal['transaction_journal_id']; if (!in_array($tagId, $tagIds, true)) { continue; } @@ -89,7 +89,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn if (in_array($journalId, $listedJournals, true)) { continue; } - $listedJournals[] = $journalId; + $listedJournals[] = $journalId; $array[$currencyId]['tags'][$tagId] ??= [ 'id' => $tagId, 'name' => $tagName, @@ -130,9 +130,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn public function listIncome(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $tags = null): array { /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setUser($this->user)->setRange($start, $end)->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $tagIds = []; + $tagIds = []; if (null !== $accounts && $accounts->count() > 0) { $collector->setAccounts($accounts); } @@ -150,7 +150,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn $listedJournals = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $array[$currencyId] ??= [ 'tags' => [], 'currency_id' => $currencyId, @@ -162,9 +162,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn // may have multiple tags: foreach ($journal['tags'] as $tag) { - $tagId = (int) $tag['id']; - $tagName = (string) $tag['name']; - $journalId = (int) $journal['transaction_journal_id']; + $tagId = (int) $tag['id']; + $tagName = (string) $tag['name']; + $journalId = (int) $journal['transaction_journal_id']; if (!in_array($tagId, $tagIds, true)) { continue; @@ -173,9 +173,9 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn if (in_array($journalId, $listedJournals, true)) { continue; } - $listedJournals[] = $journalId; + $listedJournals[] = $journalId; - $array[$currencyId]['tags'][$tagId] ??= [ + $array[$currencyId]['tags'][$tagId] ??= [ 'id' => $tagId, 'name' => $tagName, 'transaction_journals' => [], diff --git a/app/Repositories/Tag/OperationsRepositoryInterface.php b/app/Repositories/Tag/OperationsRepositoryInterface.php index 04ed347f7c..b7cd50c57c 100644 --- a/app/Repositories/Tag/OperationsRepositoryInterface.php +++ b/app/Repositories/Tag/OperationsRepositoryInterface.php @@ -40,7 +40,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface OperationsRepositoryInterface { diff --git a/app/Repositories/Tag/TagRepository.php b/app/Repositories/Tag/TagRepository.php index 7a4039869e..3e74489477 100644 --- a/app/Repositories/Tag/TagRepository.php +++ b/app/Repositories/Tag/TagRepository.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\Tag; use Carbon\Carbon; -use Exception; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Factory\TagFactory; use FireflyIII\Helpers\Collector\GroupCollectorInterface; @@ -52,7 +51,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface } /** - * @throws Exception + * @throws \Exception */ public function destroy(Tag $tag): bool { @@ -120,7 +119,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface return $set->each( static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line /** @var null|Note $note */ - $note = $attachment->notes()->first(); + $note = $attachment->notes()->first(); // only used in v1 view of tags $attachment->file_exists = $disk->exists($attachment->fileName()); $attachment->notes_text = null === $note ? '' : $note->text; @@ -131,7 +130,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface public function getTagsInYear(?int $year): array { // get all tags in the year (if present): - $tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag'); + $tagQuery = $this->user->tags()->with(['locations', 'attachments'])->orderBy('tags.tag'); // add date range (or not): if (null === $year) { @@ -141,7 +140,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface if (null !== $year) { app('log')->debug(sprintf('Get tags with year %s.', $year)); - $tagQuery->where('tags.date', '>=', $year . '-01-01 00:00:00')->where('tags.date', '<=', $year . '-12-31 23:59:59'); + $tagQuery->where('tags.date', '>=', $year.'-01-01 00:00:00')->where('tags.date', '<=', $year.'-12-31 23:59:59'); } $collection = $tagQuery->get(); $return = []; @@ -236,13 +235,13 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface } $collector->setTag($tag)->withAccountInformation(); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); - $sums = []; + $sums = []; /** @var array $journal */ foreach ($journals as $journal) { - $found = false; + $found = false; /** @var array $localTag */ foreach ($journal['tags'] as $localTag) { @@ -253,7 +252,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface if (false === $found) { continue; } - $currencyId = (int) $journal['currency_id']; + $currencyId = (int) $journal['currency_id']; $sums[$currencyId] ??= [ 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -267,14 +266,14 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface ]; // add amount to correct type: - $amount = app('steam')->positive((string) $journal['amount']); - $type = $journal['transaction_type_type']; + $amount = app('steam')->positive((string) $journal['amount']); + $type = $journal['transaction_type_type']; if (TransactionTypeEnum::WITHDRAWAL->value === $type) { $amount = bcmul($amount, '-1'); } $sums[$currencyId][$type] = bcadd($sums[$currencyId][$type], $amount); - $foreignCurrencyId = $journal['foreign_currency_id']; + $foreignCurrencyId = $journal['foreign_currency_id']; if (null !== $foreignCurrencyId && 0 !== $foreignCurrencyId) { $sums[$foreignCurrencyId] ??= [ 'currency_id' => $foreignCurrencyId, @@ -288,7 +287,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface TransactionTypeEnum::OPENING_BALANCE->value => '0', ]; // add foreign amount to correct type: - $amount = app('steam')->positive((string) $journal['foreign_amount']); + $amount = app('steam')->positive((string) $journal['foreign_amount']); if (TransactionTypeEnum::WITHDRAWAL->value === $type) { $amount = bcmul($amount, '-1'); } @@ -353,7 +352,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface // otherwise, update or create. if (!(null === $data['latitude'] && null === $data['longitude'] && null === $data['zoom_level'])) { - $location = $this->getLocation($tag); + $location = $this->getLocation($tag); if (null === $location) { $location = new Location(); $location->locatable()->associate($tag); diff --git a/app/Repositories/Tag/TagRepositoryInterface.php b/app/Repositories/Tag/TagRepositoryInterface.php index 18d7cc0681..2052dff88c 100644 --- a/app/Repositories/Tag/TagRepositoryInterface.php +++ b/app/Repositories/Tag/TagRepositoryInterface.php @@ -41,7 +41,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface TagRepositoryInterface { diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepository.php b/app/Repositories/TransactionGroup/TransactionGroupRepository.php index 4e8085fb7a..97a5b7f48c 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepository.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepository.php @@ -25,7 +25,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\TransactionGroup; use Carbon\Carbon; -use Exception; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\DuplicateTransactionException; use FireflyIII\Exceptions\FireflyException; @@ -141,21 +140,22 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, { $repository = app(AttachmentRepositoryInterface::class); $repository->setUser($this->user); - $journals = $group->transactionJournals->pluck('id')->toArray(); - $set = Attachment::whereIn('attachable_id', $journals) - ->where('attachable_type', TransactionJournal::class) - ->where('uploaded', true) - ->whereNull('deleted_at')->get(); + $journals = $group->transactionJournals->pluck('id')->toArray(); + $set = Attachment::whereIn('attachable_id', $journals) + ->where('attachable_type', TransactionJournal::class) + ->where('uploaded', true) + ->whereNull('deleted_at')->get() + ; - $result = []; + $result = []; /** @var Attachment $attachment */ foreach ($set as $attachment) { - $journalId = $attachment->attachable_id; - $result[$journalId] ??= []; - $current = $attachment->toArray(); - $current['file_exists'] = true; - $current['notes'] = $repository->getNoteText($attachment); + $journalId = $attachment->attachable_id; + $result[$journalId] ??= []; + $current = $attachment->toArray(); + $current['file_exists'] = true; + $current['notes'] = $repository->getNoteText($attachment); // already determined that this attachable is a TransactionJournal. $current['journal_title'] = $attachment->attachable->description; $result[$journalId][] = $current; @@ -171,8 +171,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, { /** @var null|Note $note */ $note = Note::where('noteable_id', $journalId) - ->where('noteable_type', TransactionJournal::class) - ->first(); + ->where('noteable_type', TransactionJournal::class) + ->first() + ; if (null === $note) { return null; } @@ -193,13 +194,14 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $q->orWhereIn('destination_id', $journals); } ) - ->with(['source', 'destination', 'source.transactions']) - ->leftJoin('link_types', 'link_types.id', '=', 'journal_links.link_type_id') - ->get(['journal_links.*', 'link_types.inward', 'link_types.outward', 'link_types.editable']); + ->with(['source', 'destination', 'source.transactions']) + ->leftJoin('link_types', 'link_types.id', '=', 'journal_links.link_type_id') + ->get(['journal_links.*', 'link_types.inward', 'link_types.outward', 'link_types.editable']) + ; /** @var TransactionJournalLink $entry */ foreach ($set as $entry) { - $journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id; + $journalId = in_array($entry->source_id, $journals, true) ? $entry->source_id : $entry->destination_id; $return[$journalId] ??= []; // phpstan: the editable field is provided by the query. @@ -263,10 +265,10 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, if (0 === bccomp('0', $transaction->foreign_amount)) { return ''; } - $currency = $transaction->foreignCurrency; - $type = $journal->transactionType->type; - $amount = app('steam')->positive($transaction->foreign_amount); - $return = ''; + $currency = $transaction->foreignCurrency; + $type = $journal->transactionType->type; + $amount = app('steam')->positive($transaction->foreign_amount); + $return = ''; if (TransactionTypeEnum::WITHDRAWAL->value === $type) { $return = app('amount')->formatAnything($currency, app('steam')->negative($amount)); } @@ -289,15 +291,16 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, /** * Return object with all found meta field things as Carbon objects. * - * @throws Exception + * @throws \Exception */ public function getMetaDateFields(int $journalId, array $fields): NullArrayObject { $query = DB::table('journal_meta') - ->where('transaction_journal_id', $journalId) - ->whereIn('name', $fields) - ->whereNull('deleted_at') - ->get(['name', 'data']); + ->where('transaction_journal_id', $journalId) + ->whereIn('name', $fields) + ->whereNull('deleted_at') + ->get(['name', 'data']) + ; $return = []; foreach ($query as $row) { @@ -313,10 +316,11 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, public function getMetaFields(int $journalId, array $fields): NullArrayObject { $query = DB::table('journal_meta') - ->where('transaction_journal_id', $journalId) - ->whereIn('name', $fields) - ->whereNull('deleted_at') - ->get(['name', 'data']); + ->where('transaction_journal_id', $journalId) + ->whereIn('name', $fields) + ->whereNull('deleted_at') + ->get(['name', 'data']) + ; $return = []; foreach ($query as $row) { @@ -337,8 +341,9 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, $journals = $group->transactionJournals->pluck('id')->toArray(); $currency = app('amount')->getNativeCurrencyByUserGroup($this->user->userGroup); $data = PiggyBankEvent::whereIn('transaction_journal_id', $journals) - ->with('piggyBank', 'piggyBank.account') - ->get(['piggy_bank_events.*']); + ->with('piggyBank', 'piggyBank.account') + ->get(['piggy_bank_events.*']) + ; /** @var PiggyBankEvent $row */ foreach ($data as $row) { @@ -346,13 +351,14 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, continue; } // get currency preference. - $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id) - ->where('name', 'currency_id') - ->first(); + $currencyPreference = AccountMeta::where('account_id', $row->piggyBank->account_id) + ->where('name', 'currency_id') + ->first() + ; if (null !== $currencyPreference) { $currency = TransactionCurrency::where('id', $currencyPreference->data)->first(); } - $journalId = $row->transaction_journal_id; + $journalId = $row->transaction_journal_id; $return[$journalId] ??= []; $return[$journalId][] = [ @@ -379,10 +385,11 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, public function getTags(int $journalId): array { $result = DB::table('tag_transaction_journal') - ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') - ->where('tag_transaction_journal.transaction_journal_id', $journalId) - ->orderBy('tags.tag', 'ASC') - ->get(['tags.tag']); + ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') + ->where('tag_transaction_journal.transaction_journal_id', $journalId) + ->orderBy('tags.tag', 'ASC') + ->get(['tags.tag']) + ; return $result->pluck('tag')->toArray(); } diff --git a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php index a1d903e4a2..8a77aa7f33 100644 --- a/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php +++ b/app/Repositories/TransactionGroup/TransactionGroupRepositoryInterface.php @@ -44,7 +44,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface TransactionGroupRepositoryInterface { diff --git a/app/Repositories/TransactionType/TransactionTypeRepository.php b/app/Repositories/TransactionType/TransactionTypeRepository.php index 79a4b38557..0576e9018c 100644 --- a/app/Repositories/TransactionType/TransactionTypeRepository.php +++ b/app/Repositories/TransactionType/TransactionTypeRepository.php @@ -42,7 +42,7 @@ class TransactionTypeRepository implements TransactionTypeRepositoryInterface return $type; } $typeString ??= TransactionTypeEnum::WITHDRAWAL->value; - $search = $this->findByType($typeString); + $search = $this->findByType($typeString); if (null === $search) { $search = $this->findByType(TransactionTypeEnum::WITHDRAWAL->value); } diff --git a/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php b/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php index 753624e8db..dfc8681fba 100644 --- a/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php +++ b/app/Repositories/TransactionType/TransactionTypeRepositoryInterface.php @@ -40,7 +40,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface TransactionTypeRepositoryInterface { diff --git a/app/Repositories/User/UserRepository.php b/app/Repositories/User/UserRepository.php index 8b28036de3..9abc8554a3 100644 --- a/app/Repositories/User/UserRepository.php +++ b/app/Repositories/User/UserRepository.php @@ -23,7 +23,6 @@ declare(strict_types=1); namespace FireflyIII\Repositories\User; -use Exception; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\BudgetLimit; use FireflyIII\Models\GroupMembership; @@ -35,7 +34,6 @@ use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Database\QueryException; use Illuminate\Support\Collection; use Illuminate\Support\Str; -use Override; /** * Class UserRepository. @@ -46,17 +44,17 @@ class UserRepository implements UserRepositoryInterface * This updates the users email address and records some things so it can be confirmed or undone later. * The user is blocked until the change is confirmed. * - * @throws Exception + * @throws \Exception * * @see updateEmail */ public function changeEmail(User $user, string $newEmail): bool { - $oldEmail = $user->email; + $oldEmail = $user->email; // save old email as pref app('preferences')->setForUser($user, 'previous_email_latest', $oldEmail); - app('preferences')->setForUser($user, 'previous_email_' . date('Y-m-d-H-i-s'), $oldEmail); + app('preferences')->setForUser($user, 'previous_email_'.date('Y-m-d-H-i-s'), $oldEmail); // set undo and confirm token: app('preferences')->setForUser($user, 'email_change_undo_token', bin2hex(random_bytes(16))); @@ -101,7 +99,7 @@ class UserRepository implements UserRepositoryInterface } /** - * @throws Exception + * @throws \Exception */ public function destroy(User $user): bool { @@ -173,7 +171,7 @@ class UserRepository implements UserRepositoryInterface public function getRolesInGroup(User $user, int $groupId): array { /** @var null|UserGroup $group */ - $group = UserGroup::find($groupId); + $group = UserGroup::find($groupId); if (null === $group) { throw new FireflyException(sprintf('Could not find group #%d', $groupId)); } @@ -199,7 +197,7 @@ class UserRepository implements UserRepositoryInterface */ public function getUserData(User $user): array { - $return = []; + $return = []; // two factor: $return['has_2fa'] = null !== $user->mfa_secret; @@ -215,11 +213,12 @@ class UserRepository implements UserRepositoryInterface $return['categories'] = $user->categories()->count(); $return['budgets'] = $user->budgets()->count(); $return['budgets_with_limits'] = BudgetLimit::distinct() - ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') - ->where('amount', '>', 0) - ->whereNull('budgets.deleted_at') - ->where('budgets.user_id', $user->id) - ->count('budget_limits.budget_id'); + ->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id') + ->where('amount', '>', 0) + ->whereNull('budgets.deleted_at') + ->where('budgets.user_id', $user->id) + ->count('budget_limits.budget_id') + ; $return['rule_groups'] = $user->ruleGroups()->count(); $return['rules'] = $user->rules()->count(); $return['tags'] = $user->tags()->count(); @@ -227,7 +226,7 @@ class UserRepository implements UserRepositoryInterface return $return; } - public function hasRole(null | Authenticatable | User $user, string $role): bool + public function hasRole(null|Authenticatable|User $user, string $role): bool { if (null === $user) { return false; @@ -244,7 +243,7 @@ class UserRepository implements UserRepositoryInterface return false; } - #[Override] + #[\Override] public function getUserGroups(User $user): Collection { $memberships = $user->groupMemberships()->get(); @@ -256,7 +255,7 @@ class UserRepository implements UserRepositoryInterface /** @var null|UserGroup $group */ $group = $membership->userGroup()->first(); if (null !== $group) { - $groupId = $group->id; + $groupId = $group->id; if (in_array($groupId, array_keys($set), true)) { continue; } @@ -268,14 +267,14 @@ class UserRepository implements UserRepositoryInterface return $collection; } - public function inviteUser(null | Authenticatable | User $user, string $email): InvitedUser + public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser { if (!$user instanceof User) { throw new FireflyException('User is not a User object.'); } - $now = today(config('app.timezone')); + $now = today(config('app.timezone')); $now->addDays(2); - $invitee = new InvitedUser(); + $invitee = new InvitedUser(); $invitee->user()->associate($user); $invitee->invite_code = Str::random(64); $invitee->email = $email; @@ -386,11 +385,11 @@ class UserRepository implements UserRepositoryInterface if ('' === $newEmail) { return true; } - $oldEmail = $user->email; + $oldEmail = $user->email; // save old email as pref app('preferences')->setForUser($user, 'admin_previous_email_latest', $oldEmail); - app('preferences')->setForUser($user, 'admin_previous_email_' . date('Y-m-d-H-i-s'), $oldEmail); + app('preferences')->setForUser($user, 'admin_previous_email_'.date('Y-m-d-H-i-s'), $oldEmail); $user->email = $newEmail; $user->save(); diff --git a/app/Repositories/User/UserRepositoryInterface.php b/app/Repositories/User/UserRepositoryInterface.php index feb490ef96..9c9da4e7e3 100644 --- a/app/Repositories/User/UserRepositoryInterface.php +++ b/app/Repositories/User/UserRepositoryInterface.php @@ -40,7 +40,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface UserRepositoryInterface { @@ -106,9 +105,9 @@ interface UserRepositoryInterface public function getUserGroups(User $user): Collection; - public function hasRole(null | Authenticatable | User $user, string $role): bool; + public function hasRole(null|Authenticatable|User $user, string $role): bool; - public function inviteUser(null | Authenticatable | User $user, string $email): InvitedUser; + public function inviteUser(null|Authenticatable|User $user, string $email): InvitedUser; public function redeemCode(string $code): void; diff --git a/app/Repositories/UserGroup/UserGroupRepository.php b/app/Repositories/UserGroup/UserGroupRepository.php index 553013b943..e75221c4e3 100644 --- a/app/Repositories/UserGroup/UserGroupRepository.php +++ b/app/Repositories/UserGroup/UserGroupRepository.php @@ -35,8 +35,6 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use FireflyIII\User; use Illuminate\Support\Collection; -use Override; -use ValueError; /** * Class UserGroupRepository @@ -53,7 +51,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte /** @var GroupMembership $membership */ foreach ($memberships as $membership) { /** @var null|User $user */ - $user = $membership->user()->first(); + $user = $membership->user()->first(); if (null === $user) { continue; } @@ -82,8 +80,8 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte // all users are now moved away from user group. // time to DESTROY all objects. // we have to do this one by one to trigger the necessary observers :( - $objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups', - 'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks', + $objects = ['availableBudgets', 'bills', 'budgets', 'categories', 'currencyExchangeRates', 'objectGroups', + 'recurrences', 'rules', 'ruleGroups', 'tags', 'transactionGroups', 'transactionJournals', 'piggyBanks', 'accounts', 'webhooks', ]; foreach ($objects as $object) { foreach ($userGroup->{$object}()->get() as $item) { // @phpstan-ignore-line @@ -110,7 +108,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte /** @var null|UserGroup $group */ $group = $membership->userGroup()->first(); if (null !== $group) { - $groupId = $group->id; + $groupId = $group->id; if (in_array($groupId, array_keys($set), true)) { continue; } @@ -135,14 +133,14 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte while ($exists && $loop < 10) { $existingGroup = $this->findByName($groupName); if (null === $existingGroup) { - $exists = false; + $exists = false; /** @var null|UserGroup $existingGroup */ $existingGroup = $this->store(['user' => $user, 'title' => $groupName]); } if (null !== $existingGroup) { // group already exists - $groupName = sprintf('%s-%s', $user->email, substr(sha1(rand(1000, 9999) . microtime()), 0, 4)); + $groupName = sprintf('%s-%s', $user->email, substr(sha1(rand(1000, 9999).microtime()), 0, 4)); } ++$loop; } @@ -163,7 +161,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte $data['user'] = $this->user; /** @var UserGroupFactory $factory */ - $factory = app(UserGroupFactory::class); + $factory = app(UserGroupFactory::class); return $factory->create($data); } @@ -178,13 +176,13 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte return UserGroup::all(); } - #[Override] + #[\Override] public function getById(int $id): ?UserGroup { return UserGroup::find($id); } - #[Override] + #[\Override] public function getMembershipsFromGroupId(int $groupId): Collection { return $this->user->groupMemberships()->where('user_group_id', $groupId)->get(); @@ -194,10 +192,10 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte { $userGroup->title = $data['title']; $userGroup->save(); - $currency = null; + $currency = null; /** @var CurrencyRepositoryInterface $repository */ - $repository = app(CurrencyRepositoryInterface::class); + $repository = app(CurrencyRepositoryInterface::class); if (array_key_exists('native_currency_code', $data)) { $repository->setUser($this->user); @@ -223,11 +221,11 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte */ public function updateMembership(UserGroup $userGroup, array $data): UserGroup { - $owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first(); + $owner = UserRole::whereTitle(UserRoleEnum::OWNER)->first(); app('log')->debug('in update membership'); /** @var null|User $user */ - $user = null; + $user = null; if (array_key_exists('id', $data)) { /** @var null|User $user */ $user = User::find($data['id']); @@ -266,8 +264,9 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte if ($membershipCount > 1) { // group has multiple members. How many are owner, except the user we're editing now? $ownerCount = $userGroup->groupMemberships() - ->where('user_role_id', $owner->id) - ->where('user_id', '!=', $user->id)->count(); + ->where('user_role_id', $owner->id) + ->where('user_id', '!=', $user->id)->count() + ; // if there are no other owners and the current users does not get or keep the owner role, refuse. if ( 0 === $ownerCount @@ -287,7 +286,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte foreach ($rolesSimplified as $role) { try { $enum = UserRoleEnum::from($role); - } catch (ValueError $e) { + } catch (\ValueError $e) { // TODO error message continue; } @@ -314,7 +313,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte return $roles; } - #[Override] + #[\Override] public function useUserGroup(UserGroup $userGroup): void { $this->user->user_group_id = $userGroup->id; diff --git a/app/Repositories/UserGroup/UserGroupRepositoryInterface.php b/app/Repositories/UserGroup/UserGroupRepositoryInterface.php index 5b2e72685a..c1a6152ab0 100644 --- a/app/Repositories/UserGroup/UserGroupRepositoryInterface.php +++ b/app/Repositories/UserGroup/UserGroupRepositoryInterface.php @@ -39,7 +39,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface UserGroupRepositoryInterface { diff --git a/app/Repositories/UserGroups/Account/AccountRepository.php b/app/Repositories/UserGroups/Account/AccountRepository.php index a82c50d8b1..97877aeb3e 100644 --- a/app/Repositories/UserGroups/Account/AccountRepository.php +++ b/app/Repositories/UserGroups/Account/AccountRepository.php @@ -37,8 +37,6 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder as EloquentBuilder; use Illuminate\Support\Collection; use Illuminate\Support\Facades\DB; -use Override; -use stdClass; /** * Class AccountRepository @@ -49,7 +47,7 @@ class AccountRepository implements AccountRepositoryInterface { use UserGroupTrait; - #[Override] + #[\Override] public function countAccounts(array $types): int { $query = $this->userGroup->accounts(); @@ -72,7 +70,8 @@ class AccountRepository implements AccountRepositoryInterface $q1->where('account_meta.name', '=', 'account_number'); $q1->where('account_meta.data', '=', $json); } - ); + ) + ; if (0 !== count($types)) { $dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -99,7 +98,7 @@ class AccountRepository implements AccountRepositoryInterface public function findByName(string $name, array $types): ?Account { - $query = $this->userGroup->accounts(); + $query = $this->userGroup->accounts(); if (0 !== count($types)) { $query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id'); @@ -121,7 +120,7 @@ class AccountRepository implements AccountRepositoryInterface return $account; } - #[Override] + #[\Override] public function getAccountBalances(Account $account): Collection { return $account->accountBalances; @@ -129,8 +128,8 @@ class AccountRepository implements AccountRepositoryInterface 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)) { @@ -175,12 +174,13 @@ class AccountRepository implements AccountRepositoryInterface return $account; } - #[Override] + #[\Override] public function getAccountTypes(Collection $accounts): Collection { return AccountType::leftJoin('accounts', 'accounts.account_type_id', '=', 'account_types.id') - ->whereIn('accounts.id', $accounts->pluck('id')->toArray()) - ->get(['accounts.id', 'account_types.type']); + ->whereIn('accounts.id', $accounts->pluck('id')->toArray()) + ->get(['accounts.id', 'account_types.type']) + ; } public function getAccountsById(array $accountIds): Collection @@ -197,7 +197,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[Override] + #[\Override] public function getAccountsInOrder(array $types, array $sort, int $startRow, int $endRow): Collection { $query = $this->userGroup->accounts(); @@ -237,17 +237,17 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[Override] + #[\Override] public function getLastActivity(Collection $accounts): array { return Transaction::whereIn('account_id', $accounts->pluck('id')->toArray()) - ->leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id') - ->groupBy('transactions.account_id') - ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) as date_max')])->toArray() // @phpstan-ignore-line - ; + ->leftJoin('transaction_journals', 'transaction_journals.id', 'transactions.transaction_journal_id') + ->groupBy('transactions.account_id') + ->get(['transactions.account_id', DB::raw('MAX(transaction_journals.date) as date_max')])->toArray() // @phpstan-ignore-line + ; } - #[Override] + #[\Override] public function getMetaValues(Collection $accounts, array $fields): Collection { $query = AccountMeta::whereIn('account_id', $accounts->pluck('id')->toArray()); @@ -258,22 +258,23 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data']); } - #[Override] + #[\Override] public function getObjectGroups(Collection $accounts): array { $groupIds = []; $return = []; $set = DB::table('object_groupables')->where('object_groupable_type', Account::class) - ->whereIn('object_groupable_id', $accounts->pluck('id')->toArray())->get(); + ->whereIn('object_groupable_id', $accounts->pluck('id')->toArray())->get() + ; - /** @var stdClass $row */ + /** @var \stdClass $row */ foreach ($set as $row) { $groupIds[] = $row->object_group_id; } $groupIds = array_unique($groupIds); $groups = ObjectGroup::whereIn('id', $groupIds)->get(); - /** @var stdClass $row */ + /** @var \stdClass $row */ foreach ($set as $row) { if (!array_key_exists($row->object_groupable_id, $return)) { /** @var null|ObjectGroup $group */ @@ -311,17 +312,18 @@ class AccountRepository implements AccountRepositoryInterface } } // reset the rest to zero. - $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; + $all = [AccountTypeEnum::DEFAULT->value, AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::MORTGAGE->value]; $this->user->accounts()->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') - ->whereNotIn('account_types.type', $all) - ->update(['order' => 0]); + ->whereNotIn('account_types.type', $all) + ->update(['order' => 0]) + ; } public function getAccountsByType(array $types, ?array $sort = [], ?array $filters = []): Collection { - $sortable = ['name', 'active']; // TODO yes this is a duplicate array. - $res = array_intersect([AccountTypeEnum::ASSET->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value], $types); - $query = $this->userGroup->accounts(); + $sortable = ['name', 'active']; // TODO yes this is a duplicate array. + $res = array_intersect([AccountTypeEnum::ASSET->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value], $types); + $query = $this->userGroup->accounts(); if (0 !== count($types)) { $query->accountTypeIn($types); } @@ -368,7 +370,7 @@ class AccountRepository implements AccountRepositoryInterface return $query->get(['accounts.*']); } - #[Override] + #[\Override] public function update(Account $account, array $data): Account { /** @var AccountUpdateService $service */ @@ -381,12 +383,13 @@ class AccountRepository implements AccountRepositoryInterface { // search by group, not by user $dbQuery = $this->userGroup->accounts() - ->where('active', true) - ->orderBy('accounts.updated_at', 'ASC') - ->orderBy('accounts.order', 'ASC') - ->orderBy('accounts.account_type_id', 'ASC') - ->orderBy('accounts.name', 'ASC') - ->with(['accountType']); + ->where('active', true) + ->orderBy('accounts.updated_at', 'ASC') + ->orderBy('accounts.order', 'ASC') + ->orderBy('accounts.account_type_id', 'ASC') + ->orderBy('accounts.name', 'ASC') + ->with(['accountType']) + ; // split query on spaces just in case: if ('' !== trim($query)) { diff --git a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php index 247dfdb0bd..6ea484133c 100644 --- a/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php +++ b/app/Repositories/UserGroups/Account/AccountRepositoryInterface.php @@ -73,7 +73,6 @@ interface AccountRepositoryInterface public function getObjectGroups(Collection $accounts): array; - /** * Reset order types of the mentioned accounts. */ diff --git a/app/Repositories/UserGroups/Bill/BillRepository.php b/app/Repositories/UserGroups/Bill/BillRepository.php index 25d0748772..ad2558a70f 100644 --- a/app/Repositories/UserGroups/Bill/BillRepository.php +++ b/app/Repositories/UserGroups/Bill/BillRepository.php @@ -62,8 +62,9 @@ class BillRepository implements BillRepositoryInterface public function getBills(): Collection { return $this->userGroup->bills() - ->orderBy('bills.name', 'ASC') - ->get(['bills.*']); + ->orderBy('bills.name', 'ASC') + ->get(['bills.*']) + ; } public function sumPaidInRange(Carbon $start, Carbon $end): array @@ -101,13 +102,13 @@ class BillRepository implements BillRepositoryInterface /** @var null|Transaction $sourceTransaction */ $sourceTransaction = $transactionJournal->transactions()->where('amount', '<', 0)->first(); if (null !== $sourceTransaction) { - $amount = $sourceTransaction->amount; + $amount = $sourceTransaction->amount; if ((int) $sourceTransaction->foreign_currency_id === $currency->id) { // use foreign amount instead! $amount = (string) $sourceTransaction->foreign_amount; } // convert to native currency - $nativeAmount = $amount; + $nativeAmount = $amount; if ($currencyId !== $default->id) { // get rate and convert. $nativeAmount = $converter->convert($currency, $default, $transactionJournal->date, $amount); @@ -129,9 +130,10 @@ class BillRepository implements BillRepositoryInterface public function getActiveBills(): Collection { return $this->userGroup->bills() - ->where('active', true) - ->orderBy('bills.name', 'ASC') - ->get(['bills.*']); + ->where('active', true) + ->orderBy('bills.name', 'ASC') + ->get(['bills.*']) + ; } public function sumUnpaidInRange(Carbon $start, Carbon $end): array @@ -153,7 +155,7 @@ class BillRepository implements BillRepositoryInterface $currencyId = $bill->transaction_currency_id; $average = bcdiv(bcadd($bill->amount_max, $bill->amount_min), '2'); $nativeAverage = $converter->convert($currency, $default, $start, $average); - $return[$currencyId] ??= [ + $return[$currencyId] ??= [ 'currency_id' => (string) $currency->id, 'currency_name' => $currency->name, 'currency_symbol' => $currency->symbol, @@ -200,7 +202,7 @@ class BillRepository implements BillRepositoryInterface // app('log')->debug(sprintf('Currentstart (%s) has become %s.', $currentStart->format('Y-m-d'), $nextExpectedMatch->format('Y-m-d'))); - $currentStart = clone $nextExpectedMatch; + $currentStart = clone $nextExpectedMatch; } return $set; diff --git a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php index 7d1fee23b6..e6118cb938 100644 --- a/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php +++ b/app/Repositories/UserGroups/Budget/AvailableBudgetRepository.php @@ -46,13 +46,14 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface $converter = new ExchangeRateConverter(); $default = app('amount')->getNativeCurrency(); $availableBudgets = $this->userGroup->availableBudgets() - ->where('start_date', $start->format('Y-m-d')) - ->where('end_date', $end->format('Y-m-d'))->get(); + ->where('start_date', $start->format('Y-m-d')) + ->where('end_date', $end->format('Y-m-d'))->get() + ; /** @var AvailableBudget $availableBudget */ foreach ($availableBudgets as $availableBudget) { $currencyId = $availableBudget->transaction_currency_id; - $return[$currencyId] ??= [ + $return[$currencyId] ??= [ 'currency_id' => $currencyId, 'currency_code' => $availableBudget->transactionCurrency->code, 'currency_symbol' => $availableBudget->transactionCurrency->symbol, diff --git a/app/Repositories/UserGroups/Budget/BudgetRepository.php b/app/Repositories/UserGroups/Budget/BudgetRepository.php index 6aa36ca1f5..cb43479b71 100644 --- a/app/Repositories/UserGroups/Budget/BudgetRepository.php +++ b/app/Repositories/UserGroups/Budget/BudgetRepository.php @@ -39,16 +39,18 @@ class BudgetRepository implements BudgetRepositoryInterface public function getActiveBudgets(): Collection { return $this->userGroup->budgets()->where('active', true) - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC') - ->get(); + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get() + ; } public function getBudgets(): Collection { return $this->userGroup->budgets() - ->orderBy('order', 'ASC') - ->orderBy('name', 'ASC') - ->get(); + ->orderBy('order', 'ASC') + ->orderBy('name', 'ASC') + ->get() + ; } } diff --git a/app/Repositories/UserGroups/Budget/OperationsRepository.php b/app/Repositories/UserGroups/Budget/OperationsRepository.php index e23c69bac3..c5775be29e 100644 --- a/app/Repositories/UserGroups/Budget/OperationsRepository.php +++ b/app/Repositories/UserGroups/Budget/OperationsRepository.php @@ -59,13 +59,13 @@ class OperationsRepository implements OperationsRepositoryInterface $collector->setBudgets($this->getBudgets()); } $collector->withBudgetInformation()->withAccountInformation()->withCategoryInformation(); - $journals = $collector->getExtractedJournals(); - $array = []; + $journals = $collector->getExtractedJournals(); + $array = []; foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $budgetId = (int) $journal['budget_id']; - $budgetName = (string) $journal['budget_name']; + $currencyId = (int) $journal['currency_id']; + $budgetId = (int) $journal['budget_id']; + $budgetName = (string) $journal['budget_name']; // catch "no budget" entries. if (0 === $budgetId) { @@ -73,7 +73,7 @@ class OperationsRepository implements OperationsRepositoryInterface } // info about the currency: - $array[$currencyId] ??= [ + $array[$currencyId] ??= [ 'budgets' => [], 'currency_id' => $currencyId, 'currency_name' => $journal['currency_name'], @@ -91,8 +91,8 @@ class OperationsRepository implements OperationsRepositoryInterface // add journal to array: // only a subset of the fields. - $journalId = (int) $journal['transaction_journal_id']; - $final = [ + $journalId = (int) $journal['transaction_journal_id']; + $final = [ 'amount' => app('steam')->negative($journal['amount']), 'currency_id' => $journal['currency_id'], 'foreign_amount' => null, diff --git a/app/Repositories/UserGroups/Currency/CurrencyRepository.php b/app/Repositories/UserGroups/Currency/CurrencyRepository.php index ece6df1bec..73bce5a06b 100644 --- a/app/Repositories/UserGroups/Currency/CurrencyRepository.php +++ b/app/Repositories/UserGroups/Currency/CurrencyRepository.php @@ -66,7 +66,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface public function currencyInUseAt(TransactionCurrency $currency): ?string { app('log')->debug(sprintf('Now in currencyInUse() for #%d ("%s")', $currency->id, $currency->code)); - $countJournals = $this->countJournals($currency); + $countJournals = $this->countJournals($currency); if ($countJournals > 0) { app('log')->info(sprintf('Count journals is %d, return true.', $countJournals)); @@ -81,7 +81,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -89,7 +89,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -97,7 +97,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d bills as currency, return true. ', $bills)); @@ -115,9 +115,10 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d accounts as currency_id, return true. ', $meta)); @@ -133,7 +134,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info(sprintf('Used in %d budget limits as currency, return true. ', $budgetLimit)); @@ -141,7 +142,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info('Is the default currency of the user, return true.'); @@ -149,7 +150,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface } // 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) { app('log')->info('Is the default currency of the user group, return true.'); diff --git a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php index a25682decc..2460d7d572 100644 --- a/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php +++ b/app/Repositories/UserGroups/ExchangeRate/ExchangeRateRepository.php @@ -30,7 +30,6 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; use Illuminate\Database\Eloquent\Builder; use Illuminate\Support\Collection; -use Override; /** * Class ExchangeRateRepository @@ -41,51 +40,55 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface { use UserGroupTrait; - #[Override] + #[\Override] public function deleteRate(CurrencyExchangeRate $rate): void { $this->userGroup->currencyExchangeRates()->where('id', $rate->id)->delete(); } - #[Override] + #[\Override] public function getAll(): Collection { return $this->userGroup->currencyExchangeRates()->orderBy('date', 'ASC')->get(); } - #[Override] + #[\Override] public function getRates(TransactionCurrency $from, TransactionCurrency $to): Collection { // orderBy('date', 'DESC')->toRawSql(); return $this->userGroup->currencyExchangeRates() - ->where(function (Builder $q1) use ($from, $to): void { - $q1->where(function (Builder $q) use ($from, $to): void { - $q->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id); - })->orWhere(function (Builder $q) use ($from, $to): void { - $q->where('from_currency_id', $to->id) - ->where('to_currency_id', $from->id); - }); - }) - ->orderBy('date', 'DESC') - ->get(['currency_exchange_rates.*']); + ->where(function (Builder $q1) use ($from, $to): void { + $q1->where(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ; + })->orWhere(function (Builder $q) use ($from, $to): void { + $q->where('from_currency_id', $to->id) + ->where('to_currency_id', $from->id) + ; + }); + }) + ->orderBy('date', 'DESC') + ->get(['currency_exchange_rates.*']) + ; } - #[Override] + #[\Override] public function getSpecificRateOnDate(TransactionCurrency $from, TransactionCurrency $to, Carbon $date): ?CurrencyExchangeRate { /** @var null|CurrencyExchangeRate */ return $this->userGroup->currencyExchangeRates() - ->where('from_currency_id', $from->id) - ->where('to_currency_id', $to->id) - ->where('date', $date->format('Y-m-d')) - ->first(); + ->where('from_currency_id', $from->id) + ->where('to_currency_id', $to->id) + ->where('date', $date->format('Y-m-d')) + ->first() + ; } - #[Override] + #[\Override] public function storeExchangeRate(TransactionCurrency $from, TransactionCurrency $to, string $rate, Carbon $date): CurrencyExchangeRate { $object = new CurrencyExchangeRate(); @@ -101,7 +104,7 @@ class ExchangeRateRepository implements ExchangeRateRepositoryInterface return $object; } - #[Override] + #[\Override] public function updateExchangeRate(CurrencyExchangeRate $object, string $rate, ?Carbon $date = null): CurrencyExchangeRate { $object->rate = $rate; diff --git a/app/Repositories/UserGroups/Journal/JournalRepository.php b/app/Repositories/UserGroups/Journal/JournalRepository.php index d3070d7f0a..8926573acd 100644 --- a/app/Repositories/UserGroups/Journal/JournalRepository.php +++ b/app/Repositories/UserGroups/Journal/JournalRepository.php @@ -40,7 +40,8 @@ class JournalRepository implements JournalRepositoryInterface public function searchJournalDescriptions(array $query, int $limit): Collection { $search = $this->userGroup->transactionJournals() - ->orderBy('date', 'DESC'); + ->orderBy('date', 'DESC') + ; if (count($query) > 0) { // split query on spaces just in case: $search->where(function (EloquentBuilder $q) use ($query): void { diff --git a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php index 33816f8a97..c1312306f7 100644 --- a/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php +++ b/app/Repositories/UserGroups/PiggyBank/PiggyBankRepository.php @@ -40,13 +40,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface public function getPiggyBanks(): Collection { return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id') - ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') - ->where('accounts.user_group_id', $this->userGroup->id) - ->with( - [ - 'objectGroups', - ] - ) - ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']); + ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') + ->where('accounts.user_group_id', $this->userGroup->id) + ->with( + [ + 'objectGroups', + ] + ) + ->orderBy('piggy_banks.order', 'ASC')->distinct()->get(['piggy_banks.*']) + ; } } diff --git a/app/Repositories/Webhook/WebhookRepository.php b/app/Repositories/Webhook/WebhookRepository.php index 5f40b2c718..0cc7dee0e2 100644 --- a/app/Repositories/Webhook/WebhookRepository.php +++ b/app/Repositories/Webhook/WebhookRepository.php @@ -67,21 +67,23 @@ class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterfac public function getMessages(Webhook $webhook): Collection { return $webhook->webhookMessages() - ->orderBy('created_at', 'DESC') - ->get(['webhook_messages.*']); + ->orderBy('created_at', 'DESC') + ->get(['webhook_messages.*']) + ; } public function getReadyMessages(Webhook $webhook): Collection { return $webhook->webhookMessages() - ->where('webhook_messages.sent', 0) - ->where('webhook_messages.errored', 0) - ->get(['webhook_messages.*']) - ->filter( - static function (WebhookMessage $message) { // @phpstan-ignore-line - return $message->webhookAttempts()->count() <= 2; - } - )->splice(0, 3); + ->where('webhook_messages.sent', 0) + ->where('webhook_messages.errored', 0) + ->get(['webhook_messages.*']) + ->filter( + static function (WebhookMessage $message) { // @phpstan-ignore-line + return $message->webhookAttempts()->count() <= 2; + } + )->splice(0, 3) + ; } public function store(array $data): Webhook diff --git a/app/Repositories/Webhook/WebhookRepositoryInterface.php b/app/Repositories/Webhook/WebhookRepositoryInterface.php index c1b8073b05..ae7e91d5ca 100644 --- a/app/Repositories/Webhook/WebhookRepositoryInterface.php +++ b/app/Repositories/Webhook/WebhookRepositoryInterface.php @@ -42,7 +42,6 @@ use Illuminate\Support\Collection; * @method checkUserGroupAccess(UserRoleEnum $role) * @method setUser(null|Authenticatable|User $user) * @method setUserGroupById(int $userGroupId) - * */ interface WebhookRepositoryInterface { diff --git a/app/Rules/IsValidZeroOrMoreAmount.php b/app/Rules/IsValidZeroOrMoreAmount.php index 91f08dad04..03df93bc00 100644 --- a/app/Rules/IsValidZeroOrMoreAmount.php +++ b/app/Rules/IsValidZeroOrMoreAmount.php @@ -31,6 +31,7 @@ use Illuminate\Support\Facades\Log; class IsValidZeroOrMoreAmount implements ValidationRule { + use ValidatesAmountsTrait; private bool $nullable = false; public function __construct(bool $nullable = false) @@ -38,9 +39,6 @@ class IsValidZeroOrMoreAmount implements ValidationRule $this->nullable = $nullable; } - - use ValidatesAmountsTrait; - /** * @SuppressWarnings("PHPMD.UnusedFormalParameter") */ diff --git a/app/Support/Debug/Timer.php b/app/Support/Debug/Timer.php index f1930e2c75..dc9caca357 100644 --- a/app/Support/Debug/Timer.php +++ b/app/Support/Debug/Timer.php @@ -1,4 +1,5 @@ accountRepository = app(AccountRepositoryInterface::class); $range = app('navigation')->getViewRange(true); - [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; + [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('account-show-period-entries'); @@ -95,38 +94,40 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // run a custom query because doing this with the collector is MEGA slow. - $transactions = $this->accountRepository->periodCollection($account, $start, $end); + $transactions = $this->accountRepository->periodCollection($account, $start, $end); // loop dates foreach ($dates as $currentDate) { - $title = app('navigation')->periodShow($currentDate['start'], $currentDate['period']); - [$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']); - [$transactions, $earned] = $this->filterTransactionsByType(TransactionTypeEnum::DEPOSIT, $transactions, $currentDate['start'], $currentDate['end']); - [$transactions, $transferredAway] = $this->filterTransfers('away',$transactions, $currentDate['start'], $currentDate['end']); - [$transactions, $transferredIn] = $this->filterTransfers('in',$transactions, $currentDate['start'], $currentDate['end']); + $title = app('navigation')->periodShow($currentDate['start'], $currentDate['period']); + [$transactions, $spent] = $this->filterTransactionsByType(TransactionTypeEnum::WITHDRAWAL, $transactions, $currentDate['start'], $currentDate['end']); + [$transactions, $earned] = $this->filterTransactionsByType(TransactionTypeEnum::DEPOSIT, $transactions, $currentDate['start'], $currentDate['end']); + [$transactions, $transferredAway] = $this->filterTransfers('away', $transactions, $currentDate['start'], $currentDate['end']); + [$transactions, $transferredIn] = $this->filterTransfers('in', $transactions, $currentDate['start'], $currentDate['end']); $entries[] - = [ - 'title' => $title, - 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred_away' => $this->groupByCurrency($transferredAway), - 'transferred_in' => $this->groupByCurrency($transferredIn), - ]; + = [ + 'title' => $title, + 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred_away' => $this->groupByCurrency($transferredAway), + 'transferred_in' => $this->groupByCurrency($transferredIn), + ]; } $cache->store($entries); Timer::stop('account-period-total'); return $entries; } - private function filterTransfers(string $direction, array $transactions, Carbon $start, Carbon $end): array + + private function filterTransfers(string $direction, array $transactions, Carbon $start, Carbon $end): array { $result = []; + /** * @var int $index * @var array $item @@ -134,29 +135,31 @@ trait PeriodOverview foreach ($transactions as $index => $item) { $date = Carbon::parse($item['date']); if ($date >= $start && $date <= $end) { - if ($direction === 'away' && bccomp($item['amount'], '0') === -1) { + if ('away' === $direction && -1 === bccomp($item['amount'], '0')) { $result[] = $item; unset($transactions[$index]); } - if ($direction === 'in' && bccomp($item['amount'], '0') === 1) { + if ('in' === $direction && 1 === bccomp($item['amount'], '0')) { $result[] = $item; unset($transactions[$index]); } } } + return [$transactions, $result]; } private function filterTransactionsByType(TransactionTypeEnum $type, array $transactions, Carbon $start, Carbon $end): array { $result = []; + /** * @var int $index * @var array $item */ foreach ($transactions as $index => $item) { $date = Carbon::parse($item['date']); - if($item['type'] === $type->value && $date >= $start && $date <= $end) { + if ($item['type'] === $type->value && $date >= $start && $date <= $end) { $result[] = $item; unset($transactions[$index]); } @@ -222,13 +225,13 @@ trait PeriodOverview /** @var array $journal */ foreach ($journals as $journal) { - $currencyId = (int) $journal['currency_id']; - $currencyCode = $journal['currency_code']; - $currencyName = $journal['currency_name']; - $currencySymbol = $journal['currency_symbol']; - $currencyDecimalPlaces = $journal['currency_decimal_places']; - $foreignCurrencyId = $journal['foreign_currency_id']; - $amount = $journal['amount'] ?? '0'; + $currencyId = (int) $journal['currency_id']; + $currencyCode = $journal['currency_code']; + $currencyName = $journal['currency_name']; + $currencySymbol = $journal['currency_symbol']; + $currencyDecimalPlaces = $journal['currency_decimal_places']; + $foreignCurrencyId = $journal['foreign_currency_id']; + $amount = $journal['amount'] ?? '0'; if ($this->convertToNative && $currencyId !== $this->defaultCurrency->id && $foreignCurrencyId !== $this->defaultCurrency->id) { $amount = $journal['native_amount'] ?? '0'; @@ -271,11 +274,11 @@ trait PeriodOverview */ protected function getCategoryPeriodOverview(Category $category, Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for entries with their amounts. - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty($range); @@ -287,32 +290,32 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all expenses in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setCategory($category); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); + $earnedSet = $collector->getExtractedJournals(); // collect all income in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setCategory($category); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); + $spentSet = $collector->getExtractedJournals(); // collect all transfers in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setCategory($category); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); - $transferSet = $collector->getExtractedJournals(); + $transferSet = $collector->getExtractedJournals(); foreach ($dates as $currentDate) { $spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']); $earned = $this->filterJournalsByDate($earnedSet, $currentDate['start'], $currentDate['end']); @@ -320,17 +323,17 @@ trait PeriodOverview $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'transactions' => 0, - 'title' => $title, - 'route' => route( - 'categories.show', - [$category->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] - ), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'transactions' => 0, + 'title' => $title, + 'route' => route( + 'categories.show', + [$category->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] + ), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } $cache->store($entries); @@ -346,11 +349,11 @@ trait PeriodOverview */ protected function getNoBudgetPeriodOverview(Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty($this->convertToNative); @@ -361,28 +364,28 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // get all expenses without a budget. /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setRange($start, $end)->withoutBudget()->withAccountInformation()->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $journals = $collector->getExtractedJournals(); + $journals = $collector->getExtractedJournals(); foreach ($dates as $currentDate) { $set = $this->filterJournalsByDate($journals, $currentDate['start'], $currentDate['end']); $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'title' => $title, - 'route' => route('budgets.no-budget', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($set), - 'spent' => $this->groupByCurrency($set), - 'earned' => [], - 'transferred_away' => [], - 'transferred_in' => [], - ]; + 'title' => $title, + 'route' => route('budgets.no-budget', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($set), + 'spent' => $this->groupByCurrency($set), + 'earned' => [], + 'transferred_away' => [], + 'transferred_in' => [], + ]; } $cache->store($entries); @@ -399,38 +402,38 @@ trait PeriodOverview protected function getNoCategoryPeriodOverview(Carbon $theDate): array { app('log')->debug(sprintf('Now in getNoCategoryPeriodOverview(%s)', $theDate->format('Y-m-d'))); - $range = app('navigation')->getViewRange(true); - $first = $this->journalRepos->firstNull(); - $start = null === $first ? new Carbon() : $first->date; - $end = clone $theDate; - $end = app('navigation')->endOfPeriod($end, $range); + $range = app('navigation')->getViewRange(true); + $first = $this->journalRepos->firstNull(); + $start = null === $first ? new Carbon() : $first->date; + $end = clone $theDate; + $end = app('navigation')->endOfPeriod($end, $range); app('log')->debug(sprintf('Start for getNoCategoryPeriodOverview() is %s', $start->format('Y-m-d'))); app('log')->debug(sprintf('End for getNoCategoryPeriodOverview() is %s', $end->format('Y-m-d'))); // properties for cache - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all expenses in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->withoutCategory(); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); + $earnedSet = $collector->getExtractedJournals(); // collect all income in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->withoutCategory(); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); + $spentSet = $collector->getExtractedJournals(); // collect all transfers in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->withoutCategory(); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); @@ -444,13 +447,13 @@ trait PeriodOverview $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'title' => $title, - 'route' => route('categories.no-category', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'title' => $title, + 'route' => route('categories.no-category', [$currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } app('log')->debug('End of loops'); @@ -464,11 +467,11 @@ trait PeriodOverview */ protected function getTagPeriodOverview(Tag $tag, Carbon $start, Carbon $end): array // period overview for tags. { - $range = app('navigation')->getViewRange(true); + $range = app('navigation')->getViewRange(true); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('tag-period-entries'); @@ -478,37 +481,37 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all expenses in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTag($tag); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::DEPOSIT->value]); - $earnedSet = $collector->getExtractedJournals(); + $earnedSet = $collector->getExtractedJournals(); // collect all income in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTag($tag); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value]); - $spentSet = $collector->getExtractedJournals(); + $spentSet = $collector->getExtractedJournals(); // collect all transfers in this period: /** @var GroupCollectorInterface $collector */ - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTag($tag); $collector->setRange($start, $end); $collector->setTypes([TransactionTypeEnum::TRANSFER->value]); - $transferSet = $collector->getExtractedJournals(); + $transferSet = $collector->getExtractedJournals(); // filer all of them: - $earnedSet = $this->filterJournalsByTag($earnedSet, $tag); - $spentSet = $this->filterJournalsByTag($spentSet, $tag); - $transferSet = $this->filterJournalsByTag($transferSet, $tag); + $earnedSet = $this->filterJournalsByTag($earnedSet, $tag); + $spentSet = $this->filterJournalsByTag($spentSet, $tag); + $transferSet = $this->filterJournalsByTag($transferSet, $tag); foreach ($dates as $currentDate) { $spent = $this->filterJournalsByDate($spentSet, $currentDate['start'], $currentDate['end']); @@ -517,17 +520,17 @@ trait PeriodOverview $title = app('navigation')->periodShow($currentDate['end'], $currentDate['period']); $entries[] = [ - 'transactions' => 0, - 'title' => $title, - 'route' => route( - 'tags.show', - [$tag->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] - ), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'transactions' => 0, + 'title' => $title, + 'route' => route( + 'tags.show', + [$tag->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')] + ), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } return $entries; @@ -537,7 +540,7 @@ trait PeriodOverview { $return = []; foreach ($set as $entry) { - $found = false; + $found = false; /** @var array $localTag */ foreach ($entry['tags'] as $localTag) { @@ -559,12 +562,12 @@ trait PeriodOverview */ protected function getTransactionPeriodOverview(string $transactionType, Carbon $start, Carbon $end): array { - $range = app('navigation')->getViewRange(true); - $types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType)); + $range = app('navigation')->getViewRange(true); + $types = config(sprintf('firefly.transactionTypesByType.%s', $transactionType)); [$start, $end] = $end < $start ? [$end, $start] : [$start, $end]; // properties for cache - $cache = new CacheProperties(); + $cache = new CacheProperties(); $cache->addProperty($start); $cache->addProperty($end); $cache->addProperty('transactions-period-entries'); @@ -574,13 +577,13 @@ trait PeriodOverview } /** @var array $dates */ - $dates = app('navigation')->blockPeriods($start, $end, $range); - $entries = []; + $dates = app('navigation')->blockPeriods($start, $end, $range); + $entries = []; // collect all journals in this period (regardless of type) - $collector = app(GroupCollectorInterface::class); + $collector = app(GroupCollectorInterface::class); $collector->setTypes($types)->setRange($start, $end); - $genericSet = $collector->getExtractedJournals(); + $genericSet = $collector->getExtractedJournals(); foreach ($dates as $currentDate) { $spent = []; @@ -599,14 +602,14 @@ trait PeriodOverview $transferred = $this->filterJournalsByDate($genericSet, $currentDate['start'], $currentDate['end']); } $entries[] - = [ - 'title' => $title, - 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + = [ + 'title' => $title, + 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } return $entries; diff --git a/app/Support/JsonApi/Enrichments/AccountEnrichment.php b/app/Support/JsonApi/Enrichments/AccountEnrichment.php index be8a179503..bab93a794d 100644 --- a/app/Support/JsonApi/Enrichments/AccountEnrichment.php +++ b/app/Support/JsonApi/Enrichments/AccountEnrichment.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Support\JsonApi\Enrichments; -use Carbon\Carbon; use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; @@ -49,7 +48,6 @@ use Illuminate\Support\Facades\Log; */ class AccountEnrichment implements EnrichmentInterface { - private Collection $collection; private User $user; diff --git a/app/Support/Preferences.php b/app/Support/Preferences.php index 7f71f7835d..e6b084e388 100644 --- a/app/Support/Preferences.php +++ b/app/Support/Preferences.php @@ -72,7 +72,7 @@ class Preferences public function getForUser(User $user, string $name, null|array|bool|int|string $default = null): ?Preference { - //Log::debug(sprintf('getForUser(#%d, "%s")', $user->id, $name)); + // Log::debug(sprintf('getForUser(#%d, "%s")', $user->id, $name)); // don't care about user group ID, except for some specific preferences. $userGroupId = $this->getUserGroupId($user, $name); $query = Preference::where('user_id', $user->id)->where('name', $name); @@ -90,7 +90,7 @@ class Preferences } if (null !== $preference) { - //Log::debug(sprintf('Found preference #%d for user #%d: %s', $preference->id, $user->id, $name)); + // Log::debug(sprintf('Found preference #%d for user #%d: %s', $preference->id, $user->id, $name)); return $preference; } diff --git a/app/Support/Request/ConvertsDataTypes.php b/app/Support/Request/ConvertsDataTypes.php index c281289549..fd776c1e60 100644 --- a/app/Support/Request/ConvertsDataTypes.php +++ b/app/Support/Request/ConvertsDataTypes.php @@ -400,14 +400,14 @@ trait ConvertsDataTypes if (!is_array($entry)) { continue; } - $amount = null; - if(array_key_exists('current_amount',$entry)) { + $amount = null; + if (array_key_exists('current_amount', $entry)) { $amount = $this->clearString((string) ($entry['current_amount'] ?? '0')); - if(null === $entry['current_amount']) { + if (null === $entry['current_amount']) { $amount = null; } } - if(!array_key_exists('current_amount',$entry)) { + if (!array_key_exists('current_amount', $entry)) { $amount = null; } $return[] = [ diff --git a/app/Validation/AccountValidator.php b/app/Validation/AccountValidator.php index 073f7aba39..d927f67903 100644 --- a/app/Validation/AccountValidator.php +++ b/app/Validation/AccountValidator.php @@ -63,13 +63,13 @@ class AccountValidator */ public function __construct() { - $this->createMode = false; - $this->destError = 'No error yet.'; - $this->sourceError = 'No error yet.'; - $this->combinations = config('firefly.source_dests'); - $this->source = null; - $this->destination = null; - $this->accountRepository = app(AccountRepositoryInterface::class); + $this->createMode = false; + $this->destError = 'No error yet.'; + $this->sourceError = 'No error yet.'; + $this->combinations = config('firefly.source_dests'); + $this->source = null; + $this->destination = null; + $this->accountRepository = app(AccountRepositoryInterface::class); } public function getSource(): ?Account diff --git a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php index 6dd7501261..876d4269be 100644 --- a/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php +++ b/app/Validation/Api/Data/Bulk/ValidatesBulkTransactionQuery.php @@ -31,15 +31,15 @@ trait ValidatesBulkTransactionQuery { protected function validateTransactionQuery(Validator $validator): void { - $data = $validator->getData(); + $data = $validator->getData(); // assumption is all validation has already taken place and the query key exists. - $query =$data['query'] ?? '[]'; - $json = json_decode($query, true, 8, JSON_THROW_ON_ERROR); + $query = $data['query'] ?? '[]'; + $json = json_decode($query, true, 8, JSON_THROW_ON_ERROR); if ( - array_key_exists('where', $json) && - array_key_exists('update', $json) && - array_key_exists('account_id', $json['where']) && array_key_exists('account_id', $json['update']) + array_key_exists('where', $json) + && array_key_exists('update', $json) + && array_key_exists('account_id', $json['where']) && array_key_exists('account_id', $json['update']) ) { // find both accounts, must be same type. // already validated: belongs to this user. diff --git a/composer.lock b/composer.lock index 6a458c839c..7dbf932b0f 100644 --- a/composer.lock +++ b/composer.lock @@ -1878,16 +1878,16 @@ }, { "name": "laravel/framework", - "version": "v11.44.1", + "version": "v11.44.2", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "0883d4175f4e2b5c299e7087ad3c74f2ce195c6d" + "reference": "f85216c82cbd38b66d67ebd20ea762cb3751a4b4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/0883d4175f4e2b5c299e7087ad3c74f2ce195c6d", - "reference": "0883d4175f4e2b5c299e7087ad3c74f2ce195c6d", + "url": "https://api.github.com/repos/laravel/framework/zipball/f85216c82cbd38b66d67ebd20ea762cb3751a4b4", + "reference": "f85216c82cbd38b66d67ebd20ea762cb3751a4b4", "shasum": "" }, "require": { @@ -2089,7 +2089,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-03-05T15:34:10+00:00" + "time": "2025-03-12T14:34:30+00:00" }, { "name": "laravel/passport", @@ -12876,7 +12876,7 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { @@ -12897,6 +12897,6 @@ "ext-xml": "*", "ext-xmlwriter": "*" }, - "platform-dev": [], - "plugin-api-version": "2.3.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/config/firefly.php b/config/firefly.php index 21b6339de2..52a0f46326 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-03-05', + 'version' => 'develop/2025-03-14', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/config/search.php b/config/search.php index 9d6a323a66..ea7a39cdcb 100644 --- a/config/search.php +++ b/config/search.php @@ -24,241 +24,241 @@ declare(strict_types=1); return [ 'operators' => [ - 'user_action' => ['alias' => false, 'needs_context' => true], - 'account_id' => ['alias' => false, 'needs_context' => true], - 'reconciled' => ['alias' => false, 'needs_context' => false], - 'source_account_id' => ['alias' => false, 'needs_context' => true], - 'destination_account_id' => ['alias' => false, 'needs_context' => true], - 'transaction_type' => ['alias' => false, 'needs_context' => true], - 'type' => ['alias' => true, 'alias_for' => 'transaction_type', 'needs_context' => true], - 'tag_is' => ['alias' => false, 'needs_context' => true], - 'tag_is_not' => ['alias' => false, 'needs_context' => true], - 'tag' => ['alias' => true, 'alias_for' => 'tag_is', 'needs_context' => true], - 'tag_contains' => ['alias' => false, 'needs_context' => true], - 'tag_ends' => ['alias' => false, 'needs_context' => true], - 'tag_starts' => ['alias' => false, 'needs_context' => true], - 'description_is' => ['alias' => false, 'needs_context' => true], - 'description' => ['alias' => true, 'alias_for' => 'description_is', 'needs_context' => true], - 'description_contains' => ['alias' => false, 'needs_context' => true], - 'description_ends' => ['alias' => false, 'needs_context' => true], - 'description_starts' => ['alias' => false, 'needs_context' => true], - 'notes_is' => ['alias' => false, 'needs_context' => true], - 'notes_are' => ['alias' => true, 'alias_for' => 'notes_is', 'needs_context' => true], - 'notes_contains' => ['alias' => false, 'needs_context' => true], - 'notes_contain' => ['alias' => true, 'alias_for' => 'notes_contains', 'needs_context' => true], - 'notes' => ['alias' => true, 'alias_for' => 'notes_contains', 'needs_context' => true], - 'notes_ends' => ['alias' => false, 'needs_context' => true], - 'notes_end' => ['alias' => true, 'alias_for' => 'notes_ends', 'needs_context' => true], - 'notes_starts' => ['alias' => false, 'needs_context' => true], - 'notes_start' => ['alias' => true, 'alias_for' => 'notes_starts', 'needs_context' => true], - 'source_account_is' => ['alias' => false, 'needs_context' => true], - 'from_account_is' => ['alias' => true, 'alias_for' => 'source_account_is', 'needs_context' => true], - 'source_account_contains' => ['alias' => false, 'needs_context' => true], - 'source' => ['alias' => true, 'alias_for' => 'source_account_contains', 'needs_context' => true], - 'from' => ['alias' => true, 'alias_for' => 'source_account_contains', 'needs_context' => true], - 'from_account_contains' => ['alias' => true, 'alias_for' => 'source_account_contains', 'needs_context' => true], - 'source_account_ends' => ['alias' => false, 'needs_context' => true], - 'from_account_ends' => ['alias' => true, 'alias_for' => 'source_account_ends', 'needs_context' => true], - 'source_account_starts' => ['alias' => false, 'needs_context' => true], - 'from_account_starts' => ['alias' => true, 'alias_for' => 'source_account_starts', 'needs_context' => true], - 'source_account_nr_is' => ['alias' => false, 'needs_context' => true], - 'from_account_nr_is' => ['alias' => true, 'alias_for' => 'source_account_nr_is', 'needs_context' => true], - 'source_account_nr_contains' => ['alias' => false, 'needs_context' => true], - 'from_account_nr_contains' => ['alias' => true, 'alias_for' => 'source_account_nr_contains', 'needs_context' => true], - 'source_account_nr_ends' => ['alias' => false, 'needs_context' => true], - 'from_account_nr_ends' => ['alias' => true, 'alias_for' => 'source_account_nr_ends', 'needs_context' => true], - 'source_account_nr_starts' => ['alias' => false, 'needs_context' => true], - 'from_account_nr_starts' => ['alias' => true, 'alias_for' => 'source_account_nr_starts', 'needs_context' => true], - 'destination_account_is' => ['alias' => false, 'needs_context' => true], - 'to_account_is' => ['alias' => true, 'alias_for' => 'destination_account_is', 'needs_context' => true], - 'destination_account_contains' => ['alias' => false, 'needs_context' => true], - 'destination' => ['alias' => true, 'alias_for' => 'destination_account_contains', 'needs_context' => true], - 'to' => ['alias' => true, 'alias_for' => 'destination_account_contains', 'needs_context' => true], - 'to_account_contains' => ['alias' => true, 'alias_for' => 'destination_account_contains', 'needs_context' => true], - 'destination_account_ends' => ['alias' => false, 'needs_context' => true], - 'to_account_ends' => ['alias' => true, 'alias_for' => 'destination_account_ends', 'needs_context' => true], - 'destination_account_starts' => ['alias' => false, 'needs_context' => true], - 'to_account_starts' => ['alias' => true, 'alias_for' => 'destination_account_starts', 'needs_context' => true], - 'destination_account_nr_is' => ['alias' => false, 'needs_context' => true], - 'to_account_nr_is' => ['alias' => true, 'alias_for' => 'destination_account_nr_is', 'needs_context' => true], - 'destination_account_nr_contains' => ['alias' => false, 'needs_context' => true], - 'to_account_nr_contains' => ['alias' => true, 'alias_for' => 'destination_account_nr_contains', 'needs_context' => true], - 'destination_account_nr_ends' => ['alias' => false, 'needs_context' => true], - 'to_account_nr_ends' => ['alias' => true, 'alias_for' => 'destination_account_nr_ends', 'needs_context' => true], - 'destination_account_nr_starts' => ['alias' => false, 'needs_context' => true], - 'to_account_nr_starts' => ['alias' => true, 'alias_for' => 'destination_account_nr_starts', 'needs_context' => true], - 'account_is' => ['alias' => false, 'needs_context' => true], - 'account_contains' => ['alias' => false, 'needs_context' => true], - 'account_ends' => ['alias' => false, 'needs_context' => true], - 'account_starts' => ['alias' => false, 'needs_context' => true], - 'account_nr_is' => ['alias' => false, 'needs_context' => true], - 'account_nr_contains' => ['alias' => false, 'needs_context' => true], - 'account_nr_ends' => ['alias' => false, 'needs_context' => true], - 'account_nr_starts' => ['alias' => false, 'needs_context' => true], - 'category_is' => ['alias' => false, 'needs_context' => true], - 'category_contains' => ['alias' => false, 'needs_context' => true], - 'category' => ['alias' => true, 'alias_for' => 'category_contains', 'needs_context' => true], - 'category_ends' => ['alias' => false, 'needs_context' => true], - 'category_starts' => ['alias' => false, 'needs_context' => true], - 'budget_is' => ['alias' => false, 'needs_context' => true], - 'budget_contains' => ['alias' => false, 'needs_context' => true], - 'budget' => ['alias' => true, 'alias_for' => 'budget_contains', 'needs_context' => true], - 'budget_ends' => ['alias' => false, 'needs_context' => true], - 'budget_starts' => ['alias' => false, 'needs_context' => true], - 'bill_is' => ['alias' => false, 'needs_context' => true], - 'bill_contains' => ['alias' => false, 'needs_context' => true], - 'bill' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true], - 'bill_ends' => ['alias' => false, 'needs_context' => true], - 'bill_starts' => ['alias' => false, 'needs_context' => true], - 'subscription_is' => ['alias' => true, 'alias_for' => 'bill_is', 'needs_context' => true], - 'subscription_contains' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true], - 'subscription' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true], - 'subscription_ends' => ['alias' => true, 'alias_for' => 'bill_ends', 'needs_context' => true], - 'subscription_starts' => ['alias' => true, 'alias_for' => 'bill_starts', 'needs_context' => true], - 'external_id_is' => ['alias' => false, 'needs_context' => true], - 'external_id_contains' => ['alias' => false, 'needs_context' => true], - 'external_id' => ['alias' => true, 'alias_for' => 'external_id_contains', 'needs_context' => true], - 'external_id_ends' => ['alias' => false, 'needs_context' => true], - 'external_id_starts' => ['alias' => false, 'needs_context' => true], - 'internal_reference_is' => ['alias' => false, 'needs_context' => true], - 'internal_reference_contains' => ['alias' => false, 'needs_context' => true], - 'internal_reference' => ['alias' => true, 'alias_for' => 'internal_reference_contains', 'needs_context' => true], - 'internal_reference_ends' => ['alias' => false, 'needs_context' => true], - 'internal_reference_starts' => ['alias' => false, 'needs_context' => true], - 'external_url_is' => ['alias' => false, 'needs_context' => true], - 'external_url_contains' => ['alias' => false, 'needs_context' => true], - 'external_url' => ['alias' => true, 'alias_for' => 'external_url_contains', 'needs_context' => true], - 'external_url_ends' => ['alias' => false, 'needs_context' => true], - 'external_url_starts' => ['alias' => false, 'needs_context' => true], - 'has_attachments' => ['alias' => false, 'needs_context' => false], - 'has_any_category' => ['alias' => false, 'needs_context' => false], - 'has_any_budget' => ['alias' => false, 'needs_context' => false], - 'has_any_bill' => ['alias' => false, 'needs_context' => false], + 'user_action' => ['alias' => false, 'needs_context' => true], + 'account_id' => ['alias' => false, 'needs_context' => true], + 'reconciled' => ['alias' => false, 'needs_context' => false], + 'source_account_id' => ['alias' => false, 'needs_context' => true], + 'destination_account_id' => ['alias' => false, 'needs_context' => true], + 'transaction_type' => ['alias' => false, 'needs_context' => true], + 'type' => ['alias' => true, 'alias_for' => 'transaction_type', 'needs_context' => true], + 'tag_is' => ['alias' => false, 'needs_context' => true], + 'tag_is_not' => ['alias' => false, 'needs_context' => true], + 'tag' => ['alias' => true, 'alias_for' => 'tag_is', 'needs_context' => true], + 'tag_contains' => ['alias' => false, 'needs_context' => true], + 'tag_ends' => ['alias' => false, 'needs_context' => true], + 'tag_starts' => ['alias' => false, 'needs_context' => true], + 'description_is' => ['alias' => false, 'needs_context' => true], + 'description' => ['alias' => true, 'alias_for' => 'description_is', 'needs_context' => true], + 'description_contains' => ['alias' => false, 'needs_context' => true], + 'description_ends' => ['alias' => false, 'needs_context' => true], + 'description_starts' => ['alias' => false, 'needs_context' => true], + 'notes_is' => ['alias' => false, 'needs_context' => true], + 'notes_are' => ['alias' => true, 'alias_for' => 'notes_is', 'needs_context' => true], + 'notes_contains' => ['alias' => false, 'needs_context' => true], + 'notes_contain' => ['alias' => true, 'alias_for' => 'notes_contains', 'needs_context' => true], + 'notes' => ['alias' => true, 'alias_for' => 'notes_contains', 'needs_context' => true], + 'notes_ends' => ['alias' => false, 'needs_context' => true], + 'notes_end' => ['alias' => true, 'alias_for' => 'notes_ends', 'needs_context' => true], + 'notes_starts' => ['alias' => false, 'needs_context' => true], + 'notes_start' => ['alias' => true, 'alias_for' => 'notes_starts', 'needs_context' => true], + 'source_account_is' => ['alias' => false, 'needs_context' => true], + 'from_account_is' => ['alias' => true, 'alias_for' => 'source_account_is', 'needs_context' => true], + 'source_account_contains' => ['alias' => false, 'needs_context' => true], + 'source' => ['alias' => true, 'alias_for' => 'source_account_contains', 'needs_context' => true], + 'from' => ['alias' => true, 'alias_for' => 'source_account_contains', 'needs_context' => true], + 'from_account_contains' => ['alias' => true, 'alias_for' => 'source_account_contains', 'needs_context' => true], + 'source_account_ends' => ['alias' => false, 'needs_context' => true], + 'from_account_ends' => ['alias' => true, 'alias_for' => 'source_account_ends', 'needs_context' => true], + 'source_account_starts' => ['alias' => false, 'needs_context' => true], + 'from_account_starts' => ['alias' => true, 'alias_for' => 'source_account_starts', 'needs_context' => true], + 'source_account_nr_is' => ['alias' => false, 'needs_context' => true], + 'from_account_nr_is' => ['alias' => true, 'alias_for' => 'source_account_nr_is', 'needs_context' => true], + 'source_account_nr_contains' => ['alias' => false, 'needs_context' => true], + 'from_account_nr_contains' => ['alias' => true, 'alias_for' => 'source_account_nr_contains', 'needs_context' => true], + 'source_account_nr_ends' => ['alias' => false, 'needs_context' => true], + 'from_account_nr_ends' => ['alias' => true, 'alias_for' => 'source_account_nr_ends', 'needs_context' => true], + 'source_account_nr_starts' => ['alias' => false, 'needs_context' => true], + 'from_account_nr_starts' => ['alias' => true, 'alias_for' => 'source_account_nr_starts', 'needs_context' => true], + 'destination_account_is' => ['alias' => false, 'needs_context' => true], + 'to_account_is' => ['alias' => true, 'alias_for' => 'destination_account_is', 'needs_context' => true], + 'destination_account_contains' => ['alias' => false, 'needs_context' => true], + 'destination' => ['alias' => true, 'alias_for' => 'destination_account_contains', 'needs_context' => true], + 'to' => ['alias' => true, 'alias_for' => 'destination_account_contains', 'needs_context' => true], + 'to_account_contains' => ['alias' => true, 'alias_for' => 'destination_account_contains', 'needs_context' => true], + 'destination_account_ends' => ['alias' => false, 'needs_context' => true], + 'to_account_ends' => ['alias' => true, 'alias_for' => 'destination_account_ends', 'needs_context' => true], + 'destination_account_starts' => ['alias' => false, 'needs_context' => true], + 'to_account_starts' => ['alias' => true, 'alias_for' => 'destination_account_starts', 'needs_context' => true], + 'destination_account_nr_is' => ['alias' => false, 'needs_context' => true], + 'to_account_nr_is' => ['alias' => true, 'alias_for' => 'destination_account_nr_is', 'needs_context' => true], + 'destination_account_nr_contains' => ['alias' => false, 'needs_context' => true], + 'to_account_nr_contains' => ['alias' => true, 'alias_for' => 'destination_account_nr_contains', 'needs_context' => true], + 'destination_account_nr_ends' => ['alias' => false, 'needs_context' => true], + 'to_account_nr_ends' => ['alias' => true, 'alias_for' => 'destination_account_nr_ends', 'needs_context' => true], + 'destination_account_nr_starts' => ['alias' => false, 'needs_context' => true], + 'to_account_nr_starts' => ['alias' => true, 'alias_for' => 'destination_account_nr_starts', 'needs_context' => true], + 'account_is' => ['alias' => false, 'needs_context' => true], + 'account_contains' => ['alias' => false, 'needs_context' => true], + 'account_ends' => ['alias' => false, 'needs_context' => true], + 'account_starts' => ['alias' => false, 'needs_context' => true], + 'account_nr_is' => ['alias' => false, 'needs_context' => true], + 'account_nr_contains' => ['alias' => false, 'needs_context' => true], + 'account_nr_ends' => ['alias' => false, 'needs_context' => true], + 'account_nr_starts' => ['alias' => false, 'needs_context' => true], + 'category_is' => ['alias' => false, 'needs_context' => true], + 'category_contains' => ['alias' => false, 'needs_context' => true], + 'category' => ['alias' => true, 'alias_for' => 'category_contains', 'needs_context' => true], + 'category_ends' => ['alias' => false, 'needs_context' => true], + 'category_starts' => ['alias' => false, 'needs_context' => true], + 'budget_is' => ['alias' => false, 'needs_context' => true], + 'budget_contains' => ['alias' => false, 'needs_context' => true], + 'budget' => ['alias' => true, 'alias_for' => 'budget_contains', 'needs_context' => true], + 'budget_ends' => ['alias' => false, 'needs_context' => true], + 'budget_starts' => ['alias' => false, 'needs_context' => true], + 'bill_is' => ['alias' => false, 'needs_context' => true], + 'bill_contains' => ['alias' => false, 'needs_context' => true], + 'bill' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true], + 'bill_ends' => ['alias' => false, 'needs_context' => true], + 'bill_starts' => ['alias' => false, 'needs_context' => true], + 'subscription_is' => ['alias' => true, 'alias_for' => 'bill_is', 'needs_context' => true], + 'subscription_contains' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true], + 'subscription' => ['alias' => true, 'alias_for' => 'bill_contains', 'needs_context' => true], + 'subscription_ends' => ['alias' => true, 'alias_for' => 'bill_ends', 'needs_context' => true], + 'subscription_starts' => ['alias' => true, 'alias_for' => 'bill_starts', 'needs_context' => true], + 'external_id_is' => ['alias' => false, 'needs_context' => true], + 'external_id_contains' => ['alias' => false, 'needs_context' => true], + 'external_id' => ['alias' => true, 'alias_for' => 'external_id_contains', 'needs_context' => true], + 'external_id_ends' => ['alias' => false, 'needs_context' => true], + 'external_id_starts' => ['alias' => false, 'needs_context' => true], + 'internal_reference_is' => ['alias' => false, 'needs_context' => true], + 'internal_reference_contains' => ['alias' => false, 'needs_context' => true], + 'internal_reference' => ['alias' => true, 'alias_for' => 'internal_reference_contains', 'needs_context' => true], + 'internal_reference_ends' => ['alias' => false, 'needs_context' => true], + 'internal_reference_starts' => ['alias' => false, 'needs_context' => true], + 'external_url_is' => ['alias' => false, 'needs_context' => true], + 'external_url_contains' => ['alias' => false, 'needs_context' => true], + 'external_url' => ['alias' => true, 'alias_for' => 'external_url_contains', 'needs_context' => true], + 'external_url_ends' => ['alias' => false, 'needs_context' => true], + 'external_url_starts' => ['alias' => false, 'needs_context' => true], + 'has_attachments' => ['alias' => false, 'needs_context' => false], + 'has_any_category' => ['alias' => false, 'needs_context' => false], + 'has_any_budget' => ['alias' => false, 'needs_context' => false], + 'has_any_bill' => ['alias' => false, 'needs_context' => false], 'has_any_subscription' => ['alias' => true, 'needs_context' => false, 'alias_for' => 'has_any_bill'], - 'has_any_tag' => ['alias' => false, 'needs_context' => false], - 'any_notes' => ['alias' => false, 'needs_context' => false], - 'has_any_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false], - 'has_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false], - 'any_external_url' => ['alias' => false, 'needs_context' => false], - 'has_any_external_url' => ['alias' => true, 'alias_for' => 'any_external_url', 'needs_context' => false], - 'has_no_attachments' => ['alias' => false, 'needs_context' => false], - 'has_no_category' => ['alias' => false, 'needs_context' => false], - 'has_no_budget' => ['alias' => false, 'needs_context' => false], - 'has_no_bill' => ['alias' => false, 'needs_context' => false], + 'has_any_tag' => ['alias' => false, 'needs_context' => false], + 'any_notes' => ['alias' => false, 'needs_context' => false], + 'has_any_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false], + 'has_notes' => ['alias' => true, 'alias_for' => 'any_notes', 'needs_context' => false], + 'any_external_url' => ['alias' => false, 'needs_context' => false], + 'has_any_external_url' => ['alias' => true, 'alias_for' => 'any_external_url', 'needs_context' => false], + 'has_no_attachments' => ['alias' => false, 'needs_context' => false], + 'has_no_category' => ['alias' => false, 'needs_context' => false], + 'has_no_budget' => ['alias' => false, 'needs_context' => false], + 'has_no_bill' => ['alias' => false, 'needs_context' => false], 'has_no_subscription' => ['alias' => true, 'needs_context' => false, 'alias_for' => 'has_no_bill'], - 'has_no_tag' => ['alias' => false, 'needs_context' => false], - 'no_notes' => ['alias' => false, 'needs_context' => false], - 'no_external_url' => ['alias' => false, 'needs_context' => false], - 'source_is_cash' => ['alias' => false, 'needs_context' => false], - 'destination_is_cash' => ['alias' => false, 'needs_context' => false], - 'account_is_cash' => ['alias' => false, 'needs_context' => false], - 'currency_is' => ['alias' => false, 'needs_context' => true], - 'foreign_currency_is' => ['alias' => false, 'needs_context' => true], - 'id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true], - 'journal_id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true], - 'recurrence_id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true], - 'date_on' => ['alias' => false, 'needs_context' => true], - 'date' => ['alias' => true, 'alias_for' => 'date_on', 'needs_context' => true], - 'date_is' => ['alias' => true, 'alias_for' => 'date_on', 'needs_context' => true], - 'on' => ['alias' => true, 'alias_for' => 'date_on', 'needs_context' => true], - 'date_before' => ['alias' => false, 'needs_context' => true], - 'before' => ['alias' => true, 'alias_for' => 'date_before', 'needs_context' => true], - 'date_after' => ['alias' => false, 'needs_context' => true], - 'after' => ['alias' => true, 'alias_for' => 'date_after', 'needs_context' => true], - 'interest_date_on' => ['alias' => false, 'needs_context' => true], - 'interest_date' => ['alias' => true, 'alias_for' => 'interest_date_on', 'needs_context' => true], - 'interest_date_is' => ['alias' => true, 'alias_for' => 'interest_date_on', 'needs_context' => true], - 'interest_date_before' => ['alias' => false, 'needs_context' => true], - 'interest_date_after' => ['alias' => false, 'needs_context' => true], - 'book_date_on' => ['alias' => false, 'needs_context' => true], - 'book_date' => ['alias' => true, 'alias_for' => 'book_date_on', 'needs_context' => true], - 'book_date_is' => ['alias' => true, 'alias_for' => 'book_date_on', 'needs_context' => true], - 'book_date_before' => ['alias' => false, 'needs_context' => true], - 'book_date_after' => ['alias' => false, 'needs_context' => true], - 'process_date_on' => ['alias' => false, 'needs_context' => true], - 'process_date' => ['alias' => true, 'alias_for' => 'process_date_on', 'needs_context' => true], - 'process_date_is' => ['alias' => true, 'alias_for' => 'process_date_on', 'needs_context' => true], - 'process_date_before' => ['alias' => false, 'needs_context' => true], - 'process_date_after' => ['alias' => false, 'needs_context' => true], - 'due_date_on' => ['alias' => false, 'needs_context' => true], - 'due_date' => ['alias' => true, 'alias_for' => 'due_date_on', 'needs_context' => true], - 'due_date_is' => ['alias' => true, 'alias_for' => 'due_date_on', 'needs_context' => true], - 'due_date_before' => ['alias' => false, 'needs_context' => true], - 'due_date_after' => ['alias' => false, 'needs_context' => true], - 'payment_date_on' => ['alias' => false, 'needs_context' => true], - 'payment_date' => ['alias' => true, 'alias_for' => 'payment_date_on', 'needs_context' => true], - 'payment_date_is' => ['alias' => true, 'alias_for' => 'payment_date_on', 'needs_context' => true], - 'payment_date_before' => ['alias' => false, 'needs_context' => true], - 'payment_date_after' => ['alias' => false, 'needs_context' => true], - 'invoice_date_on' => ['alias' => false, 'needs_context' => true], - 'invoice_date' => ['alias' => true, 'alias_for' => 'invoice_date_on', 'needs_context' => true], - 'invoice_date_is' => ['alias' => true, 'alias_for' => 'invoice_date_on', 'needs_context' => true], - 'invoice_date_before' => ['alias' => false, 'needs_context' => true], - 'invoice_date_after' => ['alias' => false, 'needs_context' => true], - 'created_at_on' => ['alias' => false, 'needs_context' => true], - 'created_at' => ['alias' => true, 'alias_for' => 'created_at_on', 'needs_context' => true], - 'created_at_is' => ['alias' => true, 'alias_for' => 'created_at_on', 'needs_context' => true], - 'created_at_before' => ['alias' => false, 'needs_context' => true], - 'created_at_after' => ['alias' => false, 'needs_context' => true], - 'updated_at_on' => ['alias' => false, 'needs_context' => true], - 'updated_at' => ['alias' => true, 'alias_for' => 'updated_at_on', 'needs_context' => true], - 'updated_at_is' => ['alias' => true, 'alias_for' => 'updated_at_on', 'needs_context' => true], - 'updated_at_before' => ['alias' => false, 'needs_context' => true], - 'updated_at_after' => ['alias' => false, 'needs_context' => true], - 'created_on_on' => ['alias' => true, 'alias_for' => 'created_at_on', 'needs_context' => true], - 'created_on' => ['alias' => true, 'alias_for' => 'created_at', 'needs_context' => true], - 'created_on_before' => ['alias' => true, 'alias_for' => 'created_at_before', 'needs_context' => true], - 'created_on_after' => ['alias' => true, 'alias_for' => 'created_at_after', 'needs_context' => true], - 'updated_on_on' => ['alias' => true, 'alias_for' => 'updated_at_on', 'needs_context' => true], - 'updated_on' => ['alias' => true, 'alias_for' => 'updated_at', 'needs_context' => true], - 'updated_on_before' => ['alias' => true, 'alias_for' => 'updated_at_before', 'needs_context' => true], - 'updated_on_after' => ['alias' => true, 'alias_for' => 'updated_at_after', 'needs_context' => true], - 'amount_is' => ['alias' => false, 'needs_context' => true], - 'amount' => ['alias' => true, 'alias_for' => 'amount_is', 'needs_context' => true], - 'amount_exactly' => ['alias' => true, 'alias_for' => 'amount_is', 'needs_context' => true], - 'amount_less' => ['alias' => false, 'needs_context' => true], - 'amount_max' => ['alias' => true, 'alias_for' => 'amount_less', 'needs_context' => true], - 'less' => ['alias' => true, 'alias_for' => 'amount_less', 'needs_context' => true], - 'amount_more' => ['alias' => false, 'needs_context' => true], - 'amount_min' => ['alias' => true, 'alias_for' => 'amount_more', 'needs_context' => true], - 'more' => ['alias' => true, 'alias_for' => 'amount_more', 'needs_context' => true], - 'foreign_amount_is' => ['alias' => false, 'needs_context' => true], - 'foreign_amount' => ['alias' => true, 'alias_for' => 'foreign_amount_is', 'needs_context' => true], - 'foreign_amount_less' => ['alias' => false, 'needs_context' => true], - 'foreign_amount_max' => ['alias' => true, 'alias_for' => 'foreign_amount_less', 'needs_context' => true], - 'foreign_amount_more' => ['alias' => false, 'needs_context' => true], - 'foreign_amount_min' => ['alias' => true, 'alias_for' => 'foreign_amount_more', 'needs_context' => true], - 'attachment_name_is' => ['alias' => false, 'needs_context' => true], - 'attachment' => ['alias' => true, 'alias_for' => 'attachment_name_is', 'needs_context' => true], - 'attachment_is' => ['alias' => true, 'alias_for' => 'attachment_name_is', 'needs_context' => true], - 'attachment_name' => ['alias' => true, 'alias_for' => 'attachment_name_is', 'needs_context' => true], - 'attachment_name_contains' => ['alias' => false, 'needs_context' => true], - 'attachment_name_starts' => ['alias' => false, 'needs_context' => true], - 'attachment_name_ends' => ['alias' => false, 'needs_context' => true], - 'attachment_notes' => ['alias' => true, 'alias_for' => 'attachment_notes_are', 'needs_context' => true], - 'attachment_notes_are' => ['alias' => false, 'needs_context' => true], - 'attachment_notes_contains' => ['alias' => false, 'needs_context' => true], - 'attachment_notes_contain' => ['alias' => true, 'alias_for' => 'attachment_notes_contains', 'needs_context' => true], - 'attachment_notes_starts' => ['alias' => false, 'needs_context' => true], - 'attachment_notes_start' => ['alias' => true, 'alias_for' => 'attachment_notes_starts', 'needs_context' => true], - 'attachment_notes_ends' => ['alias' => false, 'needs_context' => true], - 'attachment_notes_end' => ['alias' => true, 'alias_for' => 'attachment_notes_ends', 'needs_context' => true], - 'exists' => ['alias' => false, 'needs_context' => false], - 'sepa_ct_is' => ['alias' => false, 'needs_context' => true], - 'no_external_id' => ['alias' => false, 'needs_context' => false], - 'any_external_id' => ['alias' => false, 'needs_context' => false], + 'has_no_tag' => ['alias' => false, 'needs_context' => false], + 'no_notes' => ['alias' => false, 'needs_context' => false], + 'no_external_url' => ['alias' => false, 'needs_context' => false], + 'source_is_cash' => ['alias' => false, 'needs_context' => false], + 'destination_is_cash' => ['alias' => false, 'needs_context' => false], + 'account_is_cash' => ['alias' => false, 'needs_context' => false], + 'currency_is' => ['alias' => false, 'needs_context' => true], + 'foreign_currency_is' => ['alias' => false, 'needs_context' => true], + 'id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true], + 'journal_id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true], + 'recurrence_id' => ['alias' => false, 'trigger_class' => '', 'needs_context' => true], + 'date_on' => ['alias' => false, 'needs_context' => true], + 'date' => ['alias' => true, 'alias_for' => 'date_on', 'needs_context' => true], + 'date_is' => ['alias' => true, 'alias_for' => 'date_on', 'needs_context' => true], + 'on' => ['alias' => true, 'alias_for' => 'date_on', 'needs_context' => true], + 'date_before' => ['alias' => false, 'needs_context' => true], + 'before' => ['alias' => true, 'alias_for' => 'date_before', 'needs_context' => true], + 'date_after' => ['alias' => false, 'needs_context' => true], + 'after' => ['alias' => true, 'alias_for' => 'date_after', 'needs_context' => true], + 'interest_date_on' => ['alias' => false, 'needs_context' => true], + 'interest_date' => ['alias' => true, 'alias_for' => 'interest_date_on', 'needs_context' => true], + 'interest_date_is' => ['alias' => true, 'alias_for' => 'interest_date_on', 'needs_context' => true], + 'interest_date_before' => ['alias' => false, 'needs_context' => true], + 'interest_date_after' => ['alias' => false, 'needs_context' => true], + 'book_date_on' => ['alias' => false, 'needs_context' => true], + 'book_date' => ['alias' => true, 'alias_for' => 'book_date_on', 'needs_context' => true], + 'book_date_is' => ['alias' => true, 'alias_for' => 'book_date_on', 'needs_context' => true], + 'book_date_before' => ['alias' => false, 'needs_context' => true], + 'book_date_after' => ['alias' => false, 'needs_context' => true], + 'process_date_on' => ['alias' => false, 'needs_context' => true], + 'process_date' => ['alias' => true, 'alias_for' => 'process_date_on', 'needs_context' => true], + 'process_date_is' => ['alias' => true, 'alias_for' => 'process_date_on', 'needs_context' => true], + 'process_date_before' => ['alias' => false, 'needs_context' => true], + 'process_date_after' => ['alias' => false, 'needs_context' => true], + 'due_date_on' => ['alias' => false, 'needs_context' => true], + 'due_date' => ['alias' => true, 'alias_for' => 'due_date_on', 'needs_context' => true], + 'due_date_is' => ['alias' => true, 'alias_for' => 'due_date_on', 'needs_context' => true], + 'due_date_before' => ['alias' => false, 'needs_context' => true], + 'due_date_after' => ['alias' => false, 'needs_context' => true], + 'payment_date_on' => ['alias' => false, 'needs_context' => true], + 'payment_date' => ['alias' => true, 'alias_for' => 'payment_date_on', 'needs_context' => true], + 'payment_date_is' => ['alias' => true, 'alias_for' => 'payment_date_on', 'needs_context' => true], + 'payment_date_before' => ['alias' => false, 'needs_context' => true], + 'payment_date_after' => ['alias' => false, 'needs_context' => true], + 'invoice_date_on' => ['alias' => false, 'needs_context' => true], + 'invoice_date' => ['alias' => true, 'alias_for' => 'invoice_date_on', 'needs_context' => true], + 'invoice_date_is' => ['alias' => true, 'alias_for' => 'invoice_date_on', 'needs_context' => true], + 'invoice_date_before' => ['alias' => false, 'needs_context' => true], + 'invoice_date_after' => ['alias' => false, 'needs_context' => true], + 'created_at_on' => ['alias' => false, 'needs_context' => true], + 'created_at' => ['alias' => true, 'alias_for' => 'created_at_on', 'needs_context' => true], + 'created_at_is' => ['alias' => true, 'alias_for' => 'created_at_on', 'needs_context' => true], + 'created_at_before' => ['alias' => false, 'needs_context' => true], + 'created_at_after' => ['alias' => false, 'needs_context' => true], + 'updated_at_on' => ['alias' => false, 'needs_context' => true], + 'updated_at' => ['alias' => true, 'alias_for' => 'updated_at_on', 'needs_context' => true], + 'updated_at_is' => ['alias' => true, 'alias_for' => 'updated_at_on', 'needs_context' => true], + 'updated_at_before' => ['alias' => false, 'needs_context' => true], + 'updated_at_after' => ['alias' => false, 'needs_context' => true], + 'created_on_on' => ['alias' => true, 'alias_for' => 'created_at_on', 'needs_context' => true], + 'created_on' => ['alias' => true, 'alias_for' => 'created_at', 'needs_context' => true], + 'created_on_before' => ['alias' => true, 'alias_for' => 'created_at_before', 'needs_context' => true], + 'created_on_after' => ['alias' => true, 'alias_for' => 'created_at_after', 'needs_context' => true], + 'updated_on_on' => ['alias' => true, 'alias_for' => 'updated_at_on', 'needs_context' => true], + 'updated_on' => ['alias' => true, 'alias_for' => 'updated_at', 'needs_context' => true], + 'updated_on_before' => ['alias' => true, 'alias_for' => 'updated_at_before', 'needs_context' => true], + 'updated_on_after' => ['alias' => true, 'alias_for' => 'updated_at_after', 'needs_context' => true], + 'amount_is' => ['alias' => false, 'needs_context' => true], + 'amount' => ['alias' => true, 'alias_for' => 'amount_is', 'needs_context' => true], + 'amount_exactly' => ['alias' => true, 'alias_for' => 'amount_is', 'needs_context' => true], + 'amount_less' => ['alias' => false, 'needs_context' => true], + 'amount_max' => ['alias' => true, 'alias_for' => 'amount_less', 'needs_context' => true], + 'less' => ['alias' => true, 'alias_for' => 'amount_less', 'needs_context' => true], + 'amount_more' => ['alias' => false, 'needs_context' => true], + 'amount_min' => ['alias' => true, 'alias_for' => 'amount_more', 'needs_context' => true], + 'more' => ['alias' => true, 'alias_for' => 'amount_more', 'needs_context' => true], + 'foreign_amount_is' => ['alias' => false, 'needs_context' => true], + 'foreign_amount' => ['alias' => true, 'alias_for' => 'foreign_amount_is', 'needs_context' => true], + 'foreign_amount_less' => ['alias' => false, 'needs_context' => true], + 'foreign_amount_max' => ['alias' => true, 'alias_for' => 'foreign_amount_less', 'needs_context' => true], + 'foreign_amount_more' => ['alias' => false, 'needs_context' => true], + 'foreign_amount_min' => ['alias' => true, 'alias_for' => 'foreign_amount_more', 'needs_context' => true], + 'attachment_name_is' => ['alias' => false, 'needs_context' => true], + 'attachment' => ['alias' => true, 'alias_for' => 'attachment_name_is', 'needs_context' => true], + 'attachment_is' => ['alias' => true, 'alias_for' => 'attachment_name_is', 'needs_context' => true], + 'attachment_name' => ['alias' => true, 'alias_for' => 'attachment_name_is', 'needs_context' => true], + 'attachment_name_contains' => ['alias' => false, 'needs_context' => true], + 'attachment_name_starts' => ['alias' => false, 'needs_context' => true], + 'attachment_name_ends' => ['alias' => false, 'needs_context' => true], + 'attachment_notes' => ['alias' => true, 'alias_for' => 'attachment_notes_are', 'needs_context' => true], + 'attachment_notes_are' => ['alias' => false, 'needs_context' => true], + 'attachment_notes_contains' => ['alias' => false, 'needs_context' => true], + 'attachment_notes_contain' => ['alias' => true, 'alias_for' => 'attachment_notes_contains', 'needs_context' => true], + 'attachment_notes_starts' => ['alias' => false, 'needs_context' => true], + 'attachment_notes_start' => ['alias' => true, 'alias_for' => 'attachment_notes_starts', 'needs_context' => true], + 'attachment_notes_ends' => ['alias' => false, 'needs_context' => true], + 'attachment_notes_end' => ['alias' => true, 'alias_for' => 'attachment_notes_ends', 'needs_context' => true], + 'exists' => ['alias' => false, 'needs_context' => false], + 'sepa_ct_is' => ['alias' => false, 'needs_context' => true], + 'no_external_id' => ['alias' => false, 'needs_context' => false], + 'any_external_id' => ['alias' => false, 'needs_context' => false], // based on source or destination balance. Very heavy search. - 'source_balance_gte' => ['alias' => false, 'needs_context' => true], - 'source_balance_gt' => ['alias' => false, 'needs_context' => true], - 'source_balance_lte' => ['alias' => false, 'needs_context' => true], - 'source_balance_lt' => ['alias' => false, 'needs_context' => true], - 'source_balance_is' => ['alias' => false, 'needs_context' => true], - 'destination_balance_gte' => ['alias' => false, 'needs_context' => true], - 'destination_balance_gt' => ['alias' => false, 'needs_context' => true], - 'destination_balance_lte' => ['alias' => false, 'needs_context' => true], - 'destination_balance_lt' => ['alias' => false, 'needs_context' => true], - 'destination_balance_is' => ['alias' => false, 'needs_context' => true], + 'source_balance_gte' => ['alias' => false, 'needs_context' => true], + 'source_balance_gt' => ['alias' => false, 'needs_context' => true], + 'source_balance_lte' => ['alias' => false, 'needs_context' => true], + 'source_balance_lt' => ['alias' => false, 'needs_context' => true], + 'source_balance_is' => ['alias' => false, 'needs_context' => true], + 'destination_balance_gte' => ['alias' => false, 'needs_context' => true], + 'destination_balance_gt' => ['alias' => false, 'needs_context' => true], + 'destination_balance_lte' => ['alias' => false, 'needs_context' => true], + 'destination_balance_lt' => ['alias' => false, 'needs_context' => true], + 'destination_balance_is' => ['alias' => false, 'needs_context' => true], ], /** * Which query parser to use - 'new' or 'legacy' diff --git a/package-lock.json b/package-lock.json index c1e76a6ac7..4f34f4a72d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,32 +14,32 @@ } }, "node_modules/@ag-grid-community/client-side-row-model": { - "version": "32.3.3", - "resolved": "https://registry.npmjs.org/@ag-grid-community/client-side-row-model/-/client-side-row-model-32.3.3.tgz", - "integrity": "sha512-/6OFltj9qax/xfOcYMOKGFQRFTrPX8hrELfS2jChWwpo/+rpnnFqN2iUlIiAB1tDJZsi2ryl8S4UoFSTcEv/VA==", + "version": "32.3.4", + "resolved": "https://registry.npmjs.org/@ag-grid-community/client-side-row-model/-/client-side-row-model-32.3.4.tgz", + "integrity": "sha512-AZyLSemPyaCJi8wPJ/wvwow6v4MZKMkg9152TameKvaEf+m+N+gWJNKb1dQoqjgWCgEByqvM6SO8dJtYRrdr/A==", "license": "MIT", "dependencies": { - "@ag-grid-community/core": "32.3.3", + "@ag-grid-community/core": "32.3.4", "tslib": "^2.3.0" } }, "node_modules/@ag-grid-community/core": { - "version": "32.3.3", - "resolved": "https://registry.npmjs.org/@ag-grid-community/core/-/core-32.3.3.tgz", - "integrity": "sha512-JMr5ahDjjl+pvQbBM1/VrfVFlioCVnMl1PKWc6MC1ENhpXT1+CPQdfhUEUw2VytOulQeQ4eeP0pFKPuBZ5Jn2g==", + "version": "32.3.4", + "resolved": "https://registry.npmjs.org/@ag-grid-community/core/-/core-32.3.4.tgz", + "integrity": "sha512-g1CJOQuA4uRx1U3VP9SZLnTJBYdMwCTM348FsubdI6anaqxnHv3X0kridq9v1v26qXbl7yytm5X3v1hPcV8wVA==", "license": "MIT", "dependencies": { - "ag-charts-types": "10.3.3", + "ag-charts-types": "10.3.4", "tslib": "^2.3.0" } }, "node_modules/@ag-grid-community/infinite-row-model": { - "version": "32.3.3", - "resolved": "https://registry.npmjs.org/@ag-grid-community/infinite-row-model/-/infinite-row-model-32.3.3.tgz", - "integrity": "sha512-q1R8gW/JhyjctiMzQcQWed0at8JHHCckoeT1XuD3KSEEKk1+x6fiRLbio05maHkIKYpSaXLLr2w7xEhSgiyk6g==", + "version": "32.3.4", + "resolved": "https://registry.npmjs.org/@ag-grid-community/infinite-row-model/-/infinite-row-model-32.3.4.tgz", + "integrity": "sha512-GWlUoU9UPGp0ZYdBCiV8R+A/mwdYweoB3HsVOEeQiNZYDC1TQJxiCSKBCCg9qk3KDY+VbJ/6ebV/BUN7cLwIuQ==", "license": "MIT", "dependencies": { - "@ag-grid-community/core": "32.3.3", + "@ag-grid-community/core": "32.3.4", "tslib": "^2.3.0" } }, @@ -89,22 +89,22 @@ } }, "node_modules/@babel/core": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.9.tgz", - "integrity": "sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.9", + "@babel/generator": "^7.26.10", "@babel/helper-compilation-targets": "^7.26.5", "@babel/helper-module-transforms": "^7.26.0", - "@babel/helpers": "^7.26.9", - "@babel/parser": "^7.26.9", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", "@babel/template": "^7.26.9", - "@babel/traverse": "^7.26.9", - "@babel/types": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -130,14 +130,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.9.tgz", - "integrity": "sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.10.tgz", + "integrity": "sha512-rRHT8siFIXQrAYOYqZQVsAr8vJ+cBNqcVAY6m5V8/4QqzaPl+zDBe6cLEPRDuNOUf3ww8RfJVlOyQMoSI+5Ang==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.26.9", - "@babel/types": "^7.26.9", + "@babel/parser": "^7.26.10", + "@babel/types": "^7.26.10", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -428,27 +428,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz", - "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.26.9", - "@babel/types": "^7.26.9" + "@babel/types": "^7.26.10" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", - "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.26.9" + "@babel/types": "^7.26.10" }, "bin": { "parser": "bin/babel-parser.js" @@ -1340,16 +1340,16 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.26.9.tgz", - "integrity": "sha512-Jf+8y9wXQbbxvVYTM8gO5oEF2POdNji0NMltEkG7FtmzD9PVz7/lxpqSdTvwsjTMU5HIHuDVNf2SOxLkWi+wPQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.26.10.tgz", + "integrity": "sha512-NWaL2qG6HRpONTnj4JvDU6th4jYeZOJgu3QhmFTCihib0ermtOJqktA5BduGm3suhhVe9EMP9c9+mfJ/I9slqw==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "babel-plugin-polyfill-corejs2": "^0.4.10", - "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-corejs3": "^0.11.0", "babel-plugin-polyfill-regenerator": "^0.6.1", "semver": "^6.3.1" }, @@ -1602,20 +1602,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/preset-env/node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.11.1.tgz", - "integrity": "sha512-yGCqvBT4rwMczo28xkH/noxJ6MZ4nJfkVYdoDaC/utLtWrXxv27HVrzAeSbqR8SxDsp46n0YF47EbHoixy6rXQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.3", - "core-js-compat": "^3.40.0" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/@babel/preset-env/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1642,9 +1628,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz", - "integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", + "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1669,17 +1655,17 @@ } }, "node_modules/@babel/traverse": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.9.tgz", - "integrity": "sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.10.tgz", + "integrity": "sha512-k8NuDrxr0WrPH5Aupqb2LCVURP/S0vBEn5mK6iH+GIYob66U5EtoZvcdudR2jQ4cmTwhEwW1DLB+Yyas9zjF6A==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.9", - "@babel/parser": "^7.26.9", + "@babel/generator": "^7.26.10", + "@babel/parser": "^7.26.10", "@babel/template": "^7.26.9", - "@babel/types": "^7.26.9", + "@babel/types": "^7.26.10", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1688,9 +1674,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", - "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1723,9 +1709,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.0.tgz", - "integrity": "sha512-O7vun9Sf8DFjH2UtqK8Ku3LkquL9SZL8OLY1T5NZkA34+wG3OQF7cl4Ql8vdNzM6fzBbYfLaiRLIOZ+2FOCgBQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", + "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", "cpu": [ "ppc64" ], @@ -1740,9 +1726,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.0.tgz", - "integrity": "sha512-PTyWCYYiU0+1eJKmw21lWtC+d08JDZPQ5g+kFyxP0V+es6VPPSUhM6zk8iImp2jbV6GwjX4pap0JFbUQN65X1g==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", + "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", "cpu": [ "arm" ], @@ -1757,9 +1743,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.0.tgz", - "integrity": "sha512-grvv8WncGjDSyUBjN9yHXNt+cq0snxXbDxy5pJtzMKGmmpPxeAmAhWxXI+01lU5rwZomDgD3kJwulEnhTRUd6g==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", + "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", "cpu": [ "arm64" ], @@ -1774,9 +1760,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.0.tgz", - "integrity": "sha512-m/ix7SfKG5buCnxasr52+LI78SQ+wgdENi9CqyCXwjVR2X4Jkz+BpC3le3AoBPYTC9NHklwngVXvbJ9/Akhrfg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", + "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", "cpu": [ "x64" ], @@ -1791,9 +1777,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.0.tgz", - "integrity": "sha512-mVwdUb5SRkPayVadIOI78K7aAnPamoeFR2bT5nszFUZ9P8UpK4ratOdYbZZXYSqPKMHfS1wdHCJk1P1EZpRdvw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", + "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", "cpu": [ "arm64" ], @@ -1808,9 +1794,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.0.tgz", - "integrity": "sha512-DgDaYsPWFTS4S3nWpFcMn/33ZZwAAeAFKNHNa1QN0rI4pUjgqf0f7ONmXf6d22tqTY+H9FNdgeaAa+YIFUn2Rg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", + "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", "cpu": [ "x64" ], @@ -1825,9 +1811,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.0.tgz", - "integrity": "sha512-VN4ocxy6dxefN1MepBx/iD1dH5K8qNtNe227I0mnTRjry8tj5MRk4zprLEdG8WPyAPb93/e4pSgi1SoHdgOa4w==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", + "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", "cpu": [ "arm64" ], @@ -1842,9 +1828,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.0.tgz", - "integrity": "sha512-mrSgt7lCh07FY+hDD1TxiTyIHyttn6vnjesnPoVDNmDfOmggTLXRv8Id5fNZey1gl/V2dyVK1VXXqVsQIiAk+A==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", + "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", "cpu": [ "x64" ], @@ -1859,9 +1845,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.0.tgz", - "integrity": "sha512-vkB3IYj2IDo3g9xX7HqhPYxVkNQe8qTK55fraQyTzTX/fxaDtXiEnavv9geOsonh2Fd2RMB+i5cbhu2zMNWJwg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", + "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", "cpu": [ "arm" ], @@ -1876,9 +1862,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.0.tgz", - "integrity": "sha512-9QAQjTWNDM/Vk2bgBl17yWuZxZNQIF0OUUuPZRKoDtqF2k4EtYbpyiG5/Dk7nqeK6kIJWPYldkOcBqjXjrUlmg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", + "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", "cpu": [ "arm64" ], @@ -1893,9 +1879,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.0.tgz", - "integrity": "sha512-43ET5bHbphBegyeqLb7I1eYn2P/JYGNmzzdidq/w0T8E2SsYL1U6un2NFROFRg1JZLTzdCoRomg8Rvf9M6W6Gg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", + "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", "cpu": [ "ia32" ], @@ -1910,9 +1896,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.0.tgz", - "integrity": "sha512-fC95c/xyNFueMhClxJmeRIj2yrSMdDfmqJnyOY4ZqsALkDrrKJfIg5NTMSzVBr5YW1jf+l7/cndBfP3MSDpoHw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", + "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", "cpu": [ "loong64" ], @@ -1927,9 +1913,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.0.tgz", - "integrity": "sha512-nkAMFju7KDW73T1DdH7glcyIptm95a7Le8irTQNO/qtkoyypZAnjchQgooFUDQhNAy4iu08N79W4T4pMBwhPwQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", + "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", "cpu": [ "mips64el" ], @@ -1944,9 +1930,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.0.tgz", - "integrity": "sha512-NhyOejdhRGS8Iwv+KKR2zTq2PpysF9XqY+Zk77vQHqNbo/PwZCzB5/h7VGuREZm1fixhs4Q/qWRSi5zmAiO4Fw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", + "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", "cpu": [ "ppc64" ], @@ -1961,9 +1947,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.0.tgz", - "integrity": "sha512-5S/rbP5OY+GHLC5qXp1y/Mx//e92L1YDqkiBbO9TQOvuFXM+iDqUNG5XopAnXoRH3FjIUDkeGcY1cgNvnXp/kA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", + "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", "cpu": [ "riscv64" ], @@ -1978,9 +1964,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.0.tgz", - "integrity": "sha512-XM2BFsEBz0Fw37V0zU4CXfcfuACMrppsMFKdYY2WuTS3yi8O1nFOhil/xhKTmE1nPmVyvQJjJivgDT+xh8pXJA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", + "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", "cpu": [ "s390x" ], @@ -1995,9 +1981,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.0.tgz", - "integrity": "sha512-9yl91rHw/cpwMCNytUDxwj2XjFpxML0y9HAOH9pNVQDpQrBxHy01Dx+vaMu0N1CKa/RzBD2hB4u//nfc+Sd3Cw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", + "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", "cpu": [ "x64" ], @@ -2012,9 +1998,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.0.tgz", - "integrity": "sha512-RuG4PSMPFfrkH6UwCAqBzauBWTygTvb1nxWasEJooGSJ/NwRw7b2HOwyRTQIU97Hq37l3npXoZGYMy3b3xYvPw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", + "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", "cpu": [ "arm64" ], @@ -2029,9 +2015,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.0.tgz", - "integrity": "sha512-jl+qisSB5jk01N5f7sPCsBENCOlPiS/xptD5yxOx2oqQfyourJwIKLRA2yqWdifj3owQZCL2sn6o08dBzZGQzA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", + "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", "cpu": [ "x64" ], @@ -2046,9 +2032,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.0.tgz", - "integrity": "sha512-21sUNbq2r84YE+SJDfaQRvdgznTD8Xc0oc3p3iW/a1EVWeNj/SdUCbm5U0itZPQYRuRTW20fPMWMpcrciH2EJw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", + "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", "cpu": [ "arm64" ], @@ -2063,9 +2049,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.0.tgz", - "integrity": "sha512-2gwwriSMPcCFRlPlKx3zLQhfN/2WjJ2NSlg5TKLQOJdV0mSxIcYNTMhk3H3ulL/cak+Xj0lY1Ym9ysDV1igceg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", + "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", "cpu": [ "x64" ], @@ -2080,9 +2066,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.0.tgz", - "integrity": "sha512-bxI7ThgLzPrPz484/S9jLlvUAHYMzy6I0XiU1ZMeAEOBcS0VePBFxh1JjTQt3Xiat5b6Oh4x7UC7IwKQKIJRIg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", + "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", "cpu": [ "x64" ], @@ -2097,9 +2083,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.0.tgz", - "integrity": "sha512-ZUAc2YK6JW89xTbXvftxdnYy3m4iHIkDtK3CLce8wg8M2L+YZhIvO1DKpxrd0Yr59AeNNkTiic9YLf6FTtXWMw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", + "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", "cpu": [ "arm64" ], @@ -2114,9 +2100,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.0.tgz", - "integrity": "sha512-eSNxISBu8XweVEWG31/JzjkIGbGIJN/TrRoiSVZwZ6pkC6VX4Im/WV2cz559/TXLcYbcrDN8JtKgd9DJVIo8GA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", + "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", "cpu": [ "ia32" ], @@ -2131,9 +2117,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.0.tgz", - "integrity": "sha512-ZENoHJBxA20C2zFzh6AI4fT6RraMzjYw4xKWemRTRmRVtN9c5DcH9r/f2ihEkMjOW5eGgrwCslG/+Y/3bL+DHQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", + "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", "cpu": [ "x64" ], @@ -2605,9 +2591,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.9.tgz", - "integrity": "sha512-qZdlImWXur0CFakn2BJ2znJOdqYZKiedEPEVNTBrpfPjc/YuTGcaYZcdmNFTkUj3DU0ZM/AElcM8Ybww3xVLzA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.35.0.tgz", + "integrity": "sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==", "cpu": [ "arm" ], @@ -2619,9 +2605,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.9.tgz", - "integrity": "sha512-4KW7P53h6HtJf5Y608T1ISKvNIYLWRKMvfnG0c44M6In4DQVU58HZFEVhWINDZKp7FZps98G3gxwC1sb0wXUUg==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.35.0.tgz", + "integrity": "sha512-FtKddj9XZudurLhdJnBl9fl6BwCJ3ky8riCXjEw3/UIbjmIY58ppWwPEvU3fNu+W7FUsAsB1CdH+7EQE6CXAPA==", "cpu": [ "arm64" ], @@ -2633,9 +2619,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.9.tgz", - "integrity": "sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.35.0.tgz", + "integrity": "sha512-Uk+GjOJR6CY844/q6r5DR/6lkPFOw0hjfOIzVx22THJXMxktXG6CbejseJFznU8vHcEBLpiXKY3/6xc+cBm65Q==", "cpu": [ "arm64" ], @@ -2647,9 +2633,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.9.tgz", - "integrity": "sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.35.0.tgz", + "integrity": "sha512-3IrHjfAS6Vkp+5bISNQnPogRAW5GAV1n+bNCrDwXmfMHbPl5EhTmWtfmwlJxFRUCBZ+tZ/OxDyU08aF6NI/N5Q==", "cpu": [ "x64" ], @@ -2661,9 +2647,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.9.tgz", - "integrity": "sha512-2lzjQPJbN5UnHm7bHIUKFMulGTQwdvOkouJDpPysJS+QFBGDJqcfh+CxxtG23Ik/9tEvnebQiylYoazFMAgrYw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.35.0.tgz", + "integrity": "sha512-sxjoD/6F9cDLSELuLNnY0fOrM9WA0KrM0vWm57XhrIMf5FGiN8D0l7fn+bpUeBSU7dCgPV2oX4zHAsAXyHFGcQ==", "cpu": [ "arm64" ], @@ -2675,9 +2661,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.9.tgz", - "integrity": "sha512-SLl0hi2Ah2H7xQYd6Qaiu01kFPzQ+hqvdYSoOtHYg/zCIFs6t8sV95kaoqjzjFwuYQLtOI0RZre/Ke0nPaQV+g==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.35.0.tgz", + "integrity": "sha512-2mpHCeRuD1u/2kruUiHSsnjWtHjqVbzhBkNVQ1aVD63CcexKVcQGwJ2g5VphOd84GvxfSvnnlEyBtQCE5hxVVw==", "cpu": [ "x64" ], @@ -2689,9 +2675,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.9.tgz", - "integrity": "sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.35.0.tgz", + "integrity": "sha512-mrA0v3QMy6ZSvEuLs0dMxcO2LnaCONs1Z73GUDBHWbY8tFFocM6yl7YyMu7rz4zS81NDSqhrUuolyZXGi8TEqg==", "cpu": [ "arm" ], @@ -2703,9 +2689,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.9.tgz", - "integrity": "sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.35.0.tgz", + "integrity": "sha512-DnYhhzcvTAKNexIql8pFajr0PiDGrIsBYPRvCKlA5ixSS3uwo/CWNZxB09jhIapEIg945KOzcYEAGGSmTSpk7A==", "cpu": [ "arm" ], @@ -2717,9 +2703,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.9.tgz", - "integrity": "sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.35.0.tgz", + "integrity": "sha512-uagpnH2M2g2b5iLsCTZ35CL1FgyuzzJQ8L9VtlJ+FckBXroTwNOaD0z0/UF+k5K3aNQjbm8LIVpxykUOQt1m/A==", "cpu": [ "arm64" ], @@ -2731,9 +2717,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.9.tgz", - "integrity": "sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.35.0.tgz", + "integrity": "sha512-XQxVOCd6VJeHQA/7YcqyV0/88N6ysSVzRjJ9I9UA/xXpEsjvAgDTgH3wQYz5bmr7SPtVK2TsP2fQ2N9L4ukoUg==", "cpu": [ "arm64" ], @@ -2745,9 +2731,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.9.tgz", - "integrity": "sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.35.0.tgz", + "integrity": "sha512-5pMT5PzfgwcXEwOaSrqVsz/LvjDZt+vQ8RT/70yhPU06PTuq8WaHhfT1LW+cdD7mW6i/J5/XIkX/1tCAkh1W6g==", "cpu": [ "loong64" ], @@ -2759,9 +2745,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.9.tgz", - "integrity": "sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.35.0.tgz", + "integrity": "sha512-c+zkcvbhbXF98f4CtEIP1EBA/lCic5xB0lToneZYvMeKu5Kamq3O8gqrxiYYLzlZH6E3Aq+TSW86E4ay8iD8EA==", "cpu": [ "ppc64" ], @@ -2773,9 +2759,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.9.tgz", - "integrity": "sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.35.0.tgz", + "integrity": "sha512-s91fuAHdOwH/Tad2tzTtPX7UZyytHIRR6V4+2IGlV0Cej5rkG0R61SX4l4y9sh0JBibMiploZx3oHKPnQBKe4g==", "cpu": [ "riscv64" ], @@ -2787,9 +2773,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.9.tgz", - "integrity": "sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.35.0.tgz", + "integrity": "sha512-hQRkPQPLYJZYGP+Hj4fR9dDBMIM7zrzJDWFEMPdTnTy95Ljnv0/4w/ixFw3pTBMEuuEuoqtBINYND4M7ujcuQw==", "cpu": [ "s390x" ], @@ -2801,9 +2787,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.9.tgz", - "integrity": "sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.35.0.tgz", + "integrity": "sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==", "cpu": [ "x64" ], @@ -2815,9 +2801,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.9.tgz", - "integrity": "sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.35.0.tgz", + "integrity": "sha512-QysqXzYiDvQWfUiTm8XmJNO2zm9yC9P/2Gkrwg2dH9cxotQzunBHYr6jk4SujCTqnfGxduOmQcI7c2ryuW8XVg==", "cpu": [ "x64" ], @@ -2829,9 +2815,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.9.tgz", - "integrity": "sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.35.0.tgz", + "integrity": "sha512-OUOlGqPkVJCdJETKOCEf1mw848ZyJ5w50/rZ/3IBQVdLfR5jk/6Sr5m3iO2tdPgwo0x7VcncYuOvMhBWZq8ayg==", "cpu": [ "arm64" ], @@ -2843,9 +2829,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.9.tgz", - "integrity": "sha512-KB48mPtaoHy1AwDNkAJfHXvHp24H0ryZog28spEs0V48l3H1fr4i37tiyHsgKZJnCmvxsbATdZGBpbmxTE3a9w==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.35.0.tgz", + "integrity": "sha512-2/lsgejMrtwQe44glq7AFFHLfJBPafpsTa6JvP2NGef/ifOa4KBoglVf7AKN7EV9o32evBPRqfg96fEHzWo5kw==", "cpu": [ "ia32" ], @@ -2857,9 +2843,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.9.tgz", - "integrity": "sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.35.0.tgz", + "integrity": "sha512-PIQeY5XDkrOysbQblSW7v3l1MDZzkTEzAfTPkj5VAu3FW8fS4ynyLg2sINp0fp3SjZ8xkRYpLqoKcYqAkhU1dw==", "cpu": [ "x64" ], @@ -3147,9 +3133,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.13.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.9.tgz", - "integrity": "sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==", + "version": "22.13.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz", + "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", "dev": true, "license": "MIT", "dependencies": { @@ -3658,9 +3644,9 @@ "license": "MIT" }, "node_modules/ag-charts-types": { - "version": "10.3.3", - "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.3.3.tgz", - "integrity": "sha512-8rmyquaTkwfP4Lzei/W/cbkq9wwEl8+grIo3z97mtxrMIXh9sHJK1oJipd/u08MmBZrca5Jjtn5F1+UNPu/4fQ==", + "version": "10.3.4", + "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.3.4.tgz", + "integrity": "sha512-MU+3gvKn1jEyLlMHS0Vu0nHmIQxiVJAnA6ftUatLZvV0c7hOWap4VWghqZ0cVZUJsCdMI59Iuq1u3xquKv4LOQ==", "license": "MIT" }, "node_modules/ajv": { @@ -3733,9 +3719,9 @@ } }, "node_modules/alpinejs": { - "version": "3.14.8", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.14.8.tgz", - "integrity": "sha512-wT2fuP2DXpGk/jKaglwy7S/IJpm1FD+b7U6zUrhwErjoq5h27S4dxkJEXVvhbdwyPv9U+3OkUuNLkZT4h2Kfrg==", + "version": "3.14.9", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.14.9.tgz", + "integrity": "sha512-gqSOhTEyryU9FhviNqiHBHzgjkvtukq9tevew29fTj+ofZtfsYriw4zPirHHOAy9bw8QoL3WGhyk7QqCh5AYlw==", "license": "MIT", "dependencies": { "@vue/reactivity": "~3.1.1" @@ -3876,9 +3862,9 @@ } }, "node_modules/autoprefixer": { - "version": "10.4.20", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz", - "integrity": "sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==", + "version": "10.4.21", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz", + "integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==", "dev": true, "funding": [ { @@ -3896,11 +3882,11 @@ ], "license": "MIT", "dependencies": { - "browserslist": "^4.23.3", - "caniuse-lite": "^1.0.30001646", + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001702", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", - "picocolors": "^1.0.1", + "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "bin": { @@ -3914,9 +3900,9 @@ } }, "node_modules/axios": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", - "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.3.tgz", + "integrity": "sha512-iP4DebzoNlP/YN2dpwCgb8zoCmhtkajzS48JvwmkSkXvPI3DHc7m+XYL5tGnSlJtR6nImXZmdCuN5aP8dh1d8A==", "dev": true, "license": "MIT", "dependencies": { @@ -3971,14 +3957,14 @@ } }, "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.10.6", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", - "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.11.1.tgz", + "integrity": "sha512-yGCqvBT4rwMczo28xkH/noxJ6MZ4nJfkVYdoDaC/utLtWrXxv27HVrzAeSbqR8SxDsp46n0YF47EbHoixy6rXQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.2", - "core-js-compat": "^3.38.0" + "@babel/helper-define-polyfill-provider": "^0.6.3", + "core-js-compat": "^3.40.0" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" @@ -4172,9 +4158,9 @@ "license": "MIT" }, "node_modules/bootstrap5-autocomplete": { - "version": "1.1.37", - "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.37.tgz", - "integrity": "sha512-6y18ztqYoAaS3zsbJDymHY+zTK1OUly2etxZH9FnkeQ79C+H3k1LfRlIJsFFBErSF7u88ZEFj77IIBedqTPEyg==", + "version": "1.1.38", + "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.38.tgz", + "integrity": "sha512-gw/66uyiKL+XioGxnIdzFwyvma/KlbD/hNIwnIAhzb1TNTWSFURPqOzMXaDuw2vD0DCtASjsJm4uydAzlaDaZQ==", "license": "MIT" }, "node_modules/bootstrap5-tags": { @@ -4462,9 +4448,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001702", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001702.tgz", - "integrity": "sha512-LoPe/D7zioC0REI5W73PeR1e1MLCipRGq/VkovJnd6Df+QVqT+vT33OXCp8QUd7kA7RZrHWxb1B36OQKI/0gOA==", + "version": "1.0.30001704", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001704.tgz", + "integrity": "sha512-+L2IgBbV6gXB4ETf0keSvLr7JUrRVbIaB/lrQ1+z8mRcQiisG5k+lG6O4n6Y5q6f5EuNfaYXKgymucphlEXQew==", "dev": true, "funding": [ { @@ -5677,9 +5663,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.112", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.112.tgz", - "integrity": "sha512-oen93kVyqSb3l+ziUgzIOlWt/oOuy4zRmpwestMn4rhFWAoFJeFuCVte9F2fASjeZZo7l/Cif9TiyrdW4CwEMA==", + "version": "1.5.118", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.118.tgz", + "integrity": "sha512-yNDUus0iultYyVoEFLnQeei7LOQkL8wg8GQpkPCRrOlJXlcCwa6eGKZkxQ9ciHsqZyYbj8Jd94X1CTPzGm+uIA==", "dev": true, "license": "ISC" }, @@ -5840,9 +5826,9 @@ } }, "node_modules/esbuild": { - "version": "0.25.0", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.0.tgz", - "integrity": "sha512-BXq5mqc8ltbaN34cDqWuYKyNhX8D/Z0J1xdtdQ8UcIIIyJyz+ZMKUt58tF3SrZ85jcfN/PZYhjR5uDQAYNVbuw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", + "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5853,31 +5839,31 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.25.0", - "@esbuild/android-arm": "0.25.0", - "@esbuild/android-arm64": "0.25.0", - "@esbuild/android-x64": "0.25.0", - "@esbuild/darwin-arm64": "0.25.0", - "@esbuild/darwin-x64": "0.25.0", - "@esbuild/freebsd-arm64": "0.25.0", - "@esbuild/freebsd-x64": "0.25.0", - "@esbuild/linux-arm": "0.25.0", - "@esbuild/linux-arm64": "0.25.0", - "@esbuild/linux-ia32": "0.25.0", - "@esbuild/linux-loong64": "0.25.0", - "@esbuild/linux-mips64el": "0.25.0", - "@esbuild/linux-ppc64": "0.25.0", - "@esbuild/linux-riscv64": "0.25.0", - "@esbuild/linux-s390x": "0.25.0", - "@esbuild/linux-x64": "0.25.0", - "@esbuild/netbsd-arm64": "0.25.0", - "@esbuild/netbsd-x64": "0.25.0", - "@esbuild/openbsd-arm64": "0.25.0", - "@esbuild/openbsd-x64": "0.25.0", - "@esbuild/sunos-x64": "0.25.0", - "@esbuild/win32-arm64": "0.25.0", - "@esbuild/win32-ia32": "0.25.0", - "@esbuild/win32-x64": "0.25.0" + "@esbuild/aix-ppc64": "0.25.1", + "@esbuild/android-arm": "0.25.1", + "@esbuild/android-arm64": "0.25.1", + "@esbuild/android-x64": "0.25.1", + "@esbuild/darwin-arm64": "0.25.1", + "@esbuild/darwin-x64": "0.25.1", + "@esbuild/freebsd-arm64": "0.25.1", + "@esbuild/freebsd-x64": "0.25.1", + "@esbuild/linux-arm": "0.25.1", + "@esbuild/linux-arm64": "0.25.1", + "@esbuild/linux-ia32": "0.25.1", + "@esbuild/linux-loong64": "0.25.1", + "@esbuild/linux-mips64el": "0.25.1", + "@esbuild/linux-ppc64": "0.25.1", + "@esbuild/linux-riscv64": "0.25.1", + "@esbuild/linux-s390x": "0.25.1", + "@esbuild/linux-x64": "0.25.1", + "@esbuild/netbsd-arm64": "0.25.1", + "@esbuild/netbsd-x64": "0.25.1", + "@esbuild/openbsd-arm64": "0.25.1", + "@esbuild/openbsd-x64": "0.25.1", + "@esbuild/sunos-x64": "0.25.1", + "@esbuild/win32-arm64": "0.25.1", + "@esbuild/win32-ia32": "0.25.1", + "@esbuild/win32-x64": "0.25.1" } }, "node_modules/escalade": { @@ -7021,9 +7007,9 @@ } }, "node_modules/i18next": { - "version": "24.2.2", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.2.tgz", - "integrity": "sha512-NE6i86lBCKRYZa5TaUDkU5S4HFgLIEJRLr3Whf2psgaxBleQ2LC1YW1Vc+SCgkAW7VEzndT6al6+CzegSUHcTQ==", + "version": "24.2.3", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.3.tgz", + "integrity": "sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A==", "funding": [ { "type": "individual", @@ -7040,7 +7026,7 @@ ], "license": "MIT", "dependencies": { - "@babel/runtime": "^7.23.2" + "@babel/runtime": "^7.26.10" }, "peerDependencies": { "typescript": "^5" @@ -8225,9 +8211,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "version": "3.3.9", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.9.tgz", + "integrity": "sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==", "dev": true, "funding": [ { @@ -10034,9 +10020,9 @@ } }, "node_modules/rollup": { - "version": "4.34.9", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.9.tgz", - "integrity": "sha512-nF5XYqWWp9hx/LrpC8sZvvvmq0TeTjQgaZHYmAgwysT9nh8sWnZhBnM8ZyVbbJFIQBLwHDNoMqsBZBbUo4U8sQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.35.0.tgz", + "integrity": "sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==", "dev": true, "license": "MIT", "dependencies": { @@ -10050,25 +10036,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.34.9", - "@rollup/rollup-android-arm64": "4.34.9", - "@rollup/rollup-darwin-arm64": "4.34.9", - "@rollup/rollup-darwin-x64": "4.34.9", - "@rollup/rollup-freebsd-arm64": "4.34.9", - "@rollup/rollup-freebsd-x64": "4.34.9", - "@rollup/rollup-linux-arm-gnueabihf": "4.34.9", - "@rollup/rollup-linux-arm-musleabihf": "4.34.9", - "@rollup/rollup-linux-arm64-gnu": "4.34.9", - "@rollup/rollup-linux-arm64-musl": "4.34.9", - "@rollup/rollup-linux-loongarch64-gnu": "4.34.9", - "@rollup/rollup-linux-powerpc64le-gnu": "4.34.9", - "@rollup/rollup-linux-riscv64-gnu": "4.34.9", - "@rollup/rollup-linux-s390x-gnu": "4.34.9", - "@rollup/rollup-linux-x64-gnu": "4.34.9", - "@rollup/rollup-linux-x64-musl": "4.34.9", - "@rollup/rollup-win32-arm64-msvc": "4.34.9", - "@rollup/rollup-win32-ia32-msvc": "4.34.9", - "@rollup/rollup-win32-x64-msvc": "4.34.9", + "@rollup/rollup-android-arm-eabi": "4.35.0", + "@rollup/rollup-android-arm64": "4.35.0", + "@rollup/rollup-darwin-arm64": "4.35.0", + "@rollup/rollup-darwin-x64": "4.35.0", + "@rollup/rollup-freebsd-arm64": "4.35.0", + "@rollup/rollup-freebsd-x64": "4.35.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.35.0", + "@rollup/rollup-linux-arm-musleabihf": "4.35.0", + "@rollup/rollup-linux-arm64-gnu": "4.35.0", + "@rollup/rollup-linux-arm64-musl": "4.35.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.35.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.35.0", + "@rollup/rollup-linux-riscv64-gnu": "4.35.0", + "@rollup/rollup-linux-s390x-gnu": "4.35.0", + "@rollup/rollup-linux-x64-gnu": "4.35.0", + "@rollup/rollup-linux-x64-musl": "4.35.0", + "@rollup/rollup-win32-arm64-msvc": "4.35.0", + "@rollup/rollup-win32-ia32-msvc": "4.35.0", + "@rollup/rollup-win32-x64-msvc": "4.35.0", "fsevents": "~2.3.2" } }, @@ -10937,9 +10923,9 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.12", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.12.tgz", - "integrity": "sha512-jDLYqo7oF8tJIttjXO6jBY5Hk8p3A8W4ttih7cCEq64fQFWmgJ4VqAQjKr7WwIDlmXKEc6QeoRb5ecjZ+2afcg==", + "version": "5.3.14", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", + "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", "dev": true, "license": "MIT", "dependencies": { @@ -11344,9 +11330,9 @@ } }, "node_modules/vite": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.1.tgz", - "integrity": "sha512-n2GnqDb6XPhlt9B8olZPrgMD/es/Nd1RdChF6CBD/fHW6pUyUTt2sQW2fPRX5GiD9XEa6+8A6A4f2vT6pSsE7Q==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.2.tgz", + "integrity": "sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==", "dev": true, "license": "MIT", "dependencies": { diff --git a/resources/assets/v1/src/locales/cs.json b/resources/assets/v1/src/locales/cs.json index 6f6c0926fd..e89c71d5b7 100644 --- a/resources/assets/v1/src/locales/cs.json +++ b/resources/assets/v1/src/locales/cs.json @@ -80,18 +80,18 @@ "profile_oauth_create_new_client": "Vytvo\u0159it nov\u00e9ho klienta", "profile_oauth_create_client": "Vytvo\u0159it klienta", "profile_oauth_edit_client": "Upravit klienta", - "profile_oauth_name_help": "Something your users will recognize and trust.", + "profile_oauth_name_help": "N\u011bco \u010demu va\u0161i u\u017eivatel\u00e9 budou d\u016fv\u011b\u0159ovat.", "profile_oauth_redirect_url": "P\u0159esm\u011brovat URL adresu", - "profile_oauth_clients_external_auth": "If you're using an external authentication provider like Authelia, OAuth Clients will not work. You can use Personal Access Tokens only.", - "profile_oauth_redirect_url_help": "Your application's authorization callback URL.", + "profile_oauth_clients_external_auth": "Pokud pro ov\u011b\u0159ov\u00e1n\u00ed pou\u017e\u00edv\u00e1te extern\u00ed slu\u017ebu, nap\u0159\u00edklad Authelia, OAuth klienti nemus\u00ed fungovat spr\u00e1vn\u011b. M\u00edsto toho m\u016f\u017eete pou\u017e\u00edt Personal Access Token.", + "profile_oauth_redirect_url_help": "Callback URL va\u0161\u00ed aplikace.", "profile_authorized_apps": "Authorized applications", "profile_authorized_clients": "Autorizovan\u00ed klienti", "profile_scopes": "Scopes", "profile_revoke": "Revoke", - "profile_personal_access_tokens": "Personal Access Tokens", + "profile_personal_access_tokens": "Personal Access Token", "profile_personal_access_token": "Personal Access Token", - "profile_personal_access_token_explanation": "Here is your new personal access token. This is the only time it will be shown so don't lose it! You may now use this token to make API requests.", - "profile_no_personal_access_token": "You have not created any personal access tokens.", + "profile_personal_access_token_explanation": "Tohle je v\u00e1\u0161 nov\u00fd p\u0159\u00edstupov\u00fd token. Tohle je naposled kdy ho vid\u00edte, tak\u017ee ho neztra\u0165te! M\u016f\u017eete ho pou\u017e\u00edt pro vol\u00e1n\u00ed API.", + "profile_no_personal_access_token": "Je\u0161t\u011b jste nevytvo\u0159ili \u017e\u00e1dn\u00e9 p\u0159\u00edstupov\u00e9 tokeny.", "profile_create_new_token": "Vytvo\u0159it nov\u00fd token", "profile_create_token": "Vytvo\u0159it token", "profile_create": "Vytvo\u0159it", @@ -100,8 +100,8 @@ "piggy_bank": "Pokladni\u010dka", "profile_oauth_client_secret_title": "Client Secret", "profile_oauth_client_secret_expl": "Here is your new client secret. This is the only time it will be shown so don't lose it! You may now use this secret to make API requests.", - "profile_oauth_confidential": "Confidential", - "profile_oauth_confidential_help": "Require the client to authenticate with a secret. Confidential clients can hold credentials in a secure way without exposing them to unauthorized parties. Public applications, such as native desktop or JavaScript SPA applications, are unable to hold secrets securely.", + "profile_oauth_confidential": "Soukrom\u00e1 aplikace", + "profile_oauth_confidential_help": "Po\u017eadovat aby se klienti autorizovali. Soukrom\u00e9 aplikace mohou bezpe\u010dn\u011b pracovat s p\u0159\u00edstupov\u00fdmi \u00fadaji bez toho aby je zve\u0159ejnily. Ve\u0159ejn\u00e9 aplikace, nativn\u00ed nebo JavaScriptov\u00e9 SPA, toho schopn\u00e9 nejsou.", "multi_account_warning_unknown": "Depending on the type of transaction you create, the source and\/or destination account of subsequent splits may be overruled by whatever is defined in the first split of the transaction.", "multi_account_warning_withdrawal": "Zdrojov\u00fd \u00fa\u010del v\u0161ech n\u00e1sleduj\u00edc\u00edch rozd\u011blen\u00ed je ovl\u00e1dan\u00fd zdrojov\u00fdm \u00fa\u010dtem prvn\u00edho rozd\u011blen\u00ed transakce.", "multi_account_warning_deposit": "C\u00edlov\u00fd \u00fa\u010del v\u0161ech n\u00e1sleduj\u00edc\u00edch rozd\u011blen\u00ed je ovl\u00e1dan\u00fd c\u00edlov\u00fdm \u00fa\u010dtem prvn\u00edho rozd\u011blen\u00ed transakce.", @@ -134,7 +134,7 @@ "attempt_content_title": "Pokusy webhooku", "attempt_content_help": "To v\u0161e jsou ne\u00fasp\u011b\u0161n\u00e9 pokusy t\u00e9to zpravy webhooku o odesl\u00e1n\u00ed na nakonfigurovanou URL. Po n\u011bjak\u00e9 dob\u011b, Firefly III p\u0159estane zkou\u0161et odes\u00edlat zpr\u00e1vu.", "no_attempts": "Nebyly nalezeny \u017e\u00e1dn\u00e9 ne\u00fasp\u011b\u0161n\u00e9 pokusy. To je dobr\u00e1 v\u011bc!", - "webhook_attempt_at": "Attempt at {moment}", + "webhook_attempt_at": "Pokus v {moment}", "logs": "Logy", "response": "Odpov\u011b\u010f", "visit_webhook_url": "Nav\u0161t\u00edvit URL webhooku", diff --git a/resources/assets/v1/src/locales/es.json b/resources/assets/v1/src/locales/es.json index 5ccca2ba81..d11c4a0f90 100644 --- a/resources/assets/v1/src/locales/es.json +++ b/resources/assets/v1/src/locales/es.json @@ -153,7 +153,7 @@ "url": "URL", "active": "Activo", "interest_date": "Fecha de inter\u00e9s", - "administration_currency": "Native currency", + "administration_currency": "Moneda nativa", "title": "T\u00edtulo", "date": "Fecha", "book_date": "Fecha de registro", diff --git a/resources/assets/v1/src/locales/zh-cn.json b/resources/assets/v1/src/locales/zh-cn.json index 2d98265295..6df0fc5bfa 100644 --- a/resources/assets/v1/src/locales/zh-cn.json +++ b/resources/assets/v1/src/locales/zh-cn.json @@ -18,7 +18,7 @@ "is_reconciled": "\u5df2\u6838\u9500", "split": "\u62c6\u5206", "single_split": "\u62c6\u5206", - "not_enough_currencies": "Not enough currencies", + "not_enough_currencies": "\u6ca1\u6709\u8db3\u591f\u7684\u8d27\u5e01", "not_enough_currencies_enabled": "\u5982\u679c\u60a8\u53ea\u542f\u7528\u4e86\u4e00\u79cd\u8d27\u5e01\uff0c\u5c31\u4e0d\u9700\u8981\u6dfb\u52a0\u6c47\u7387\u3002", "transaction_stored_link": "\u4ea4\u6613 #{ID} (\u201c{title}\u201d)<\/a> \u5df2\u4fdd\u5b58\u3002", "webhook_stored_link": "\u63a8\u9001 #{ID} (\"{title}\")<\/a> \u5df2\u4fdd\u5b58.", @@ -153,7 +153,7 @@ "url": "\u7f51\u5740", "active": "\u542f\u7528", "interest_date": "\u5229\u606f\u65e5\u671f", - "administration_currency": "Native currency", + "administration_currency": "\u672c\u5730\u8d27\u5e01", "title": "\u6807\u9898", "date": "\u65e5\u671f", "book_date": "\u767b\u8bb0\u65e5\u671f", @@ -166,14 +166,14 @@ "webhook_response": "\u54cd\u5e94\u5185\u5bb9", "webhook_trigger": "\u89e6\u53d1\u6761\u4ef6", "webhook_delivery": "\u53d1\u9001\u683c\u5f0f", - "from_currency_to_currency": "{from} → {to}", - "to_currency_from_currency": "{to} → {from}", - "rate": "Rate" + "from_currency_to_currency": "{from}→{to}", + "to_currency_from_currency": "{to}→{from}", + "rate": "\u8bc4\u7ea7" }, "list": { "title": "\u6807\u9898", "active": "\u662f\u5426\u542f\u7528\uff1f", - "native_currency": "Native currency", + "native_currency": "\u672c\u5730\u8d27\u5e01", "trigger": "\u89e6\u53d1\u6761\u4ef6", "response": "\u7b54\u590d", "delivery": "\u4ea4\u4ed8", From b55b565ee520c2c175e143655ce78b77da273233 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 14 Mar 2025 19:18:17 +0100 Subject: [PATCH 41/52] Remove references to old transformers. --- app/Api/V1/Controllers/Controller.php | 2 +- .../CurrencyExchangeRate/IndexController.php | 2 +- .../CurrencyExchangeRate/ShowController.php | 2 +- .../CurrencyExchangeRate/StoreController.php | 2 +- .../CurrencyExchangeRate/UpdateController.php | 2 +- app/Api/V2/Controllers/Controller.php | 6 +- .../Model/Account/IndexController.php | 2 +- .../Model/Account/ShowController.php | 2 +- .../Model/Account/UpdateController.php | 2 +- .../Model/Bill/IndexController.php | 2 +- .../Controllers/Model/Bill/ShowController.php | 2 +- .../Model/Budget/IndexController.php | 2 +- .../Model/Budget/ShowController.php | 2 +- .../Model/BudgetLimit/IndexController.php | 2 +- .../Model/Currency/IndexController.php | 2 +- .../Model/PiggyBank/IndexController.php | 2 +- .../Model/Transaction/ShowController.php | 2 +- .../Model/Transaction/StoreController.php | 2 +- .../Model/Transaction/UpdateController.php | 2 +- .../TransactionCurrency/IndexController.php | 2 +- .../TransactionCurrency/ShowController.php | 2 +- .../System/PreferencesController.php | 2 +- .../Transaction/List/AccountController.php | 2 +- .../List/TransactionController.php | 2 +- .../Controllers/UserGroup/IndexController.php | 2 +- .../Controllers/UserGroup/ShowController.php | 2 +- .../Controllers/UserGroup/StoreController.php | 2 +- .../UserGroup/UpdateController.php | 2 +- app/Transformers/ExchangeRateTransformer.php | 69 +++++++++++++++++++ app/Transformers/UserGroupTransformer.php | 2 +- app/Transformers/V2/AbstractTransformer.php | 1 + app/Transformers/V2/AccountTransformer.php | 1 + app/Transformers/V2/BillTransformer.php | 1 + .../V2/BudgetLimitTransformer.php | 1 + app/Transformers/V2/BudgetTransformer.php | 1 + app/Transformers/V2/CurrencyTransformer.php | 1 + .../V2/ExchangeRateTransformer.php | 1 + app/Transformers/V2/PiggyBankTransformer.php | 1 + app/Transformers/V2/PreferenceTransformer.php | 1 + .../V2/TransactionGroupTransformer.php | 1 + app/Transformers/V2/UserGroupTransformer.php | 1 + 41 files changed, 111 insertions(+), 31 deletions(-) create mode 100644 app/Transformers/ExchangeRateTransformer.php diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 17f665f824..64156a4cf3 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -32,7 +32,7 @@ use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\AbstractTransformer; +use FireflyIII\Transformers\AbstractTransformer; use FireflyIII\User; use Illuminate\Database\Eloquent\Model; use Illuminate\Foundation\Auth\Access\AuthorizesRequests; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php index ef88c982b3..019cda34b3 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\ExchangeRateTransformer; +use FireflyIII\Transformers\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php index d06132370d..0b3efa9ce6 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/ShowController.php @@ -29,7 +29,7 @@ use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\ExchangeRateTransformer; +use FireflyIII\Transformers\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php index e0114242fc..fcfb36ab6a 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/StoreController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreRequest; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\ExchangeRateTransformer; +use FireflyIII\Transformers\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; class StoreController extends Controller diff --git a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php index ffde6543f7..f8e21942e6 100644 --- a/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php +++ b/app/Api/V1/Controllers/Models/CurrencyExchangeRate/UpdateController.php @@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\CurrencyExchangeRate; use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\ExchangeRateTransformer; +use FireflyIII\Transformers\ExchangeRateTransformer; use Illuminate\Http\JsonResponse; class UpdateController extends Controller diff --git a/app/Api/V2/Controllers/Controller.php b/app/Api/V2/Controllers/Controller.php index 3891b7659e..66569e2a34 100644 --- a/app/Api/V2/Controllers/Controller.php +++ b/app/Api/V2/Controllers/Controller.php @@ -29,7 +29,7 @@ use Carbon\Exceptions\InvalidDateException; use Carbon\Exceptions\InvalidFormatException; use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\AbstractTransformer; +use FireflyIII\Transformers\AbstractTransformer; use Illuminate\Database\Eloquent\Model; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Routing\Controller as BaseController; @@ -167,7 +167,7 @@ class Controller extends BaseController // the transformer, at this point, needs to collect information that ALL items in the collection // require, like meta-data and stuff like that, and save it for later. - $objects = $transformer->collectMetaData($objects); + //$objects = $transformer->collectMetaData($objects); $paginator->setCollection($objects); $resource = new FractalCollection($objects, $transformer, $key); @@ -188,7 +188,7 @@ class Controller extends BaseController $baseUrl = request()->getSchemeAndHttpHost().'/api/v2'; $manager->setSerializer(new JsonApiSerializer($baseUrl)); - $transformer->collectMetaData(new Collection([$object])); + //$transformer->collectMetaData(new Collection([$object])); $resource = new Item($object, $transformer, $key); diff --git a/app/Api/V2/Controllers/Model/Account/IndexController.php b/app/Api/V2/Controllers/Model/Account/IndexController.php index 5ee6adfc02..a2960e6673 100644 --- a/app/Api/V2/Controllers/Model/Account/IndexController.php +++ b/app/Api/V2/Controllers/Model/Account/IndexController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\Account\IndexRequest; use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Transformers\V2\AccountTransformer; +use FireflyIII\Transformers\AccountTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Facades\Log; diff --git a/app/Api/V2/Controllers/Model/Account/ShowController.php b/app/Api/V2/Controllers/Model/Account/ShowController.php index 9849d3b3c0..13d1f0cd8e 100644 --- a/app/Api/V2/Controllers/Model/Account/ShowController.php +++ b/app/Api/V2/Controllers/Model/Account/ShowController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Transformers\V2\AccountTransformer; +use FireflyIII\Transformers\AccountTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Model/Account/UpdateController.php b/app/Api/V2/Controllers/Model/Account/UpdateController.php index 8246b74cd2..49c0f8d5b9 100644 --- a/app/Api/V2/Controllers/Model/Account/UpdateController.php +++ b/app/Api/V2/Controllers/Model/Account/UpdateController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\Account\UpdateRequest; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; -use FireflyIII\Transformers\V2\AccountTransformer; +use FireflyIII\Transformers\AccountTransformer; use Illuminate\Http\JsonResponse; class UpdateController extends Controller diff --git a/app/Api/V2/Controllers/Model/Bill/IndexController.php b/app/Api/V2/Controllers/Model/Bill/IndexController.php index 4a311a6e20..bf09a6360b 100644 --- a/app/Api/V2/Controllers/Model/Bill/IndexController.php +++ b/app/Api/V2/Controllers/Model/Bill/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Bill; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\BillTransformer; +use FireflyIII\Transformers\BillTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/Bill/ShowController.php b/app/Api/V2/Controllers/Model/Bill/ShowController.php index 4b5387e022..16327e3f02 100644 --- a/app/Api/V2/Controllers/Model/Bill/ShowController.php +++ b/app/Api/V2/Controllers/Model/Bill/ShowController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\Bill; use FireflyIII\Repositories\Bill\BillRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\BillTransformer; +use FireflyIII\Transformers\BillTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Model/Budget/IndexController.php b/app/Api/V2/Controllers/Model/Budget/IndexController.php index a1b7ab41c6..d2a8eb6e6e 100644 --- a/app/Api/V2/Controllers/Model/Budget/IndexController.php +++ b/app/Api/V2/Controllers/Model/Budget/IndexController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Budget; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; -use FireflyIII\Transformers\V2\BudgetTransformer; +use FireflyIII\Transformers\BudgetTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/Budget/ShowController.php b/app/Api/V2/Controllers/Model/Budget/ShowController.php index 6e5f9499c1..566cc992f9 100644 --- a/app/Api/V2/Controllers/Model/Budget/ShowController.php +++ b/app/Api/V2/Controllers/Model/Budget/ShowController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Generic\DateRequest; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetRepositoryInterface; -use FireflyIII\Transformers\V2\BudgetTransformer; +use FireflyIII\Transformers\BudgetTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Model/BudgetLimit/IndexController.php b/app/Api/V2/Controllers/Model/BudgetLimit/IndexController.php index 8148aff6b9..1a54aa4ef9 100644 --- a/app/Api/V2/Controllers/Model/BudgetLimit/IndexController.php +++ b/app/Api/V2/Controllers/Model/BudgetLimit/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\BudgetLimit; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\Budget; use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface; -use FireflyIII\Transformers\V2\BudgetLimitTransformer; +use FireflyIII\Transformers\BudgetLimitTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/Currency/IndexController.php b/app/Api/V2/Controllers/Model/Currency/IndexController.php index aa0418e43d..80657188b4 100644 --- a/app/Api/V2/Controllers/Model/Currency/IndexController.php +++ b/app/Api/V2/Controllers/Model/Currency/IndexController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Currency; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use FireflyIII\Transformers\V2\CurrencyTransformer; +use FireflyIII\Transformers\CurrencyTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php b/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php index 7d6027597c..7577edf95a 100644 --- a/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php +++ b/app/Api/V2/Controllers/Model/PiggyBank/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\PiggyBank; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; -use FireflyIII\Transformers\V2\PiggyBankTransformer; +use FireflyIII\Transformers\PiggyBankTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/Transaction/ShowController.php b/app/Api/V2/Controllers/Model/Transaction/ShowController.php index 19cd0fab3d..185bd41774 100644 --- a/app/Api/V2/Controllers/Model/Transaction/ShowController.php +++ b/app/Api/V2/Controllers/Model/Transaction/ShowController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\Model\Transaction; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\TransactionGroup; -use FireflyIII\Transformers\V2\TransactionGroupTransformer; +use FireflyIII\Transformers\TransactionGroupTransformer; use Illuminate\Http\JsonResponse; class ShowController extends Controller diff --git a/app/Api/V2/Controllers/Model/Transaction/StoreController.php b/app/Api/V2/Controllers/Model/Transaction/StoreController.php index 570313010c..9c9d61592b 100644 --- a/app/Api/V2/Controllers/Model/Transaction/StoreController.php +++ b/app/Api/V2/Controllers/Model/Transaction/StoreController.php @@ -32,7 +32,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; use FireflyIII\Rules\IsDuplicateTransaction; -use FireflyIII\Transformers\V2\TransactionGroupTransformer; +use FireflyIII\Transformers\TransactionGroupTransformer; use FireflyIII\User; use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Validator; diff --git a/app/Api/V2/Controllers/Model/Transaction/UpdateController.php b/app/Api/V2/Controllers/Model/Transaction/UpdateController.php index 7af67d836b..2304fcf93b 100644 --- a/app/Api/V2/Controllers/Model/Transaction/UpdateController.php +++ b/app/Api/V2/Controllers/Model/Transaction/UpdateController.php @@ -31,7 +31,7 @@ use FireflyIII\Exceptions\FireflyException; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\TransactionGroup; use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface; -use FireflyIII\Transformers\V2\TransactionGroupTransformer; +use FireflyIII\Transformers\TransactionGroupTransformer; use FireflyIII\User; use Illuminate\Http\JsonResponse; diff --git a/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php b/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php index e0c4d7db58..aad0662430 100644 --- a/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php +++ b/app/Api/V2/Controllers/Model/TransactionCurrency/IndexController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\TransactionCurrency\IndexRequest; use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use FireflyIII\Transformers\V2\CurrencyTransformer; +use FireflyIII\Transformers\CurrencyTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php b/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php index c27ce06389..7486f17cee 100644 --- a/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php +++ b/app/Api/V2/Controllers/Model/TransactionCurrency/ShowController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; -use FireflyIII\Transformers\V2\CurrencyTransformer; +use FireflyIII\Transformers\CurrencyTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/System/PreferencesController.php b/app/Api/V2/Controllers/System/PreferencesController.php index 5cc40ea225..ad7ee52a27 100644 --- a/app/Api/V2/Controllers/System/PreferencesController.php +++ b/app/Api/V2/Controllers/System/PreferencesController.php @@ -26,7 +26,7 @@ namespace FireflyIII\Api\V2\Controllers\System; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\Preference; -use FireflyIII\Transformers\V2\PreferenceTransformer; +use FireflyIII\Transformers\PreferenceTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/Transaction/List/AccountController.php b/app/Api/V2/Controllers/Transaction/List/AccountController.php index 56f9c612e1..1ab79af7a9 100644 --- a/app/Api/V2/Controllers/Transaction/List/AccountController.php +++ b/app/Api/V2/Controllers/Transaction/List/AccountController.php @@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest; use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Models\Account; use FireflyIII\Support\Http\Api\TransactionFilter; -use FireflyIII\Transformers\V2\TransactionGroupTransformer; +use FireflyIII\Transformers\TransactionGroupTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Support\Collection; diff --git a/app/Api/V2/Controllers/Transaction/List/TransactionController.php b/app/Api/V2/Controllers/Transaction/List/TransactionController.php index 09960a2251..0e630d7444 100644 --- a/app/Api/V2/Controllers/Transaction/List/TransactionController.php +++ b/app/Api/V2/Controllers/Transaction/List/TransactionController.php @@ -28,7 +28,7 @@ use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\Transaction\InfiniteListRequest; use FireflyIII\Api\V2\Request\Model\Transaction\ListRequest; use FireflyIII\Helpers\Collector\GroupCollectorInterface; -use FireflyIII\Transformers\V2\TransactionGroupTransformer; +use FireflyIII\Transformers\TransactionGroupTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/UserGroup/IndexController.php b/app/Api/V2/Controllers/UserGroup/IndexController.php index ab30a818bd..5aabec109a 100644 --- a/app/Api/V2/Controllers/UserGroup/IndexController.php +++ b/app/Api/V2/Controllers/UserGroup/IndexController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\UserGroup; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\Model\Account\IndexRequest; use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface; -use FireflyIII\Transformers\V2\UserGroupTransformer; +use FireflyIII\Transformers\UserGroupTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; diff --git a/app/Api/V2/Controllers/UserGroup/ShowController.php b/app/Api/V2/Controllers/UserGroup/ShowController.php index 3701ab81b4..9b535aaf10 100644 --- a/app/Api/V2/Controllers/UserGroup/ShowController.php +++ b/app/Api/V2/Controllers/UserGroup/ShowController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\UserGroup; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface; -use FireflyIII\Transformers\V2\UserGroupTransformer; +use FireflyIII\Transformers\UserGroupTransformer; use Illuminate\Http\JsonResponse; use Illuminate\Pagination\LengthAwarePaginator; use Illuminate\Support\Collection; diff --git a/app/Api/V2/Controllers/UserGroup/StoreController.php b/app/Api/V2/Controllers/UserGroup/StoreController.php index 9b094cb3b9..a84add787d 100644 --- a/app/Api/V2/Controllers/UserGroup/StoreController.php +++ b/app/Api/V2/Controllers/UserGroup/StoreController.php @@ -27,7 +27,7 @@ namespace FireflyIII\Api\V2\Controllers\UserGroup; use FireflyIII\Api\V2\Controllers\Controller; use FireflyIII\Api\V2\Request\UserGroup\StoreRequest; use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface; -use FireflyIII\Transformers\V2\UserGroupTransformer; +use FireflyIII\Transformers\UserGroupTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Api/V2/Controllers/UserGroup/UpdateController.php b/app/Api/V2/Controllers/UserGroup/UpdateController.php index 27b240604a..c881eeb887 100644 --- a/app/Api/V2/Controllers/UserGroup/UpdateController.php +++ b/app/Api/V2/Controllers/UserGroup/UpdateController.php @@ -29,7 +29,7 @@ use FireflyIII\Api\V2\Request\UserGroup\UpdateMembershipRequest; use FireflyIII\Api\V2\Request\UserGroup\UpdateRequest; use FireflyIII\Models\UserGroup; use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface; -use FireflyIII\Transformers\V2\UserGroupTransformer; +use FireflyIII\Transformers\UserGroupTransformer; use Illuminate\Http\JsonResponse; /** diff --git a/app/Transformers/ExchangeRateTransformer.php b/app/Transformers/ExchangeRateTransformer.php new file mode 100644 index 0000000000..08080aa24e --- /dev/null +++ b/app/Transformers/ExchangeRateTransformer.php @@ -0,0 +1,69 @@ + (string) $rate->id, + 'created_at' => $rate->created_at->toAtomString(), + 'updated_at' => $rate->updated_at->toAtomString(), + + 'from_currency_id' => (string) $rate->fromCurrency->id, + 'from_currency_code' => $rate->fromCurrency->code, + 'from_currency_symbol' => $rate->fromCurrency->symbol, + 'from_currency_decimal_places' => $rate->fromCurrency->decimal_places, + + 'to_currency_id' => (string) $rate->toCurrency->id, + 'to_currency_code' => $rate->toCurrency->code, + 'to_currency_symbol' => $rate->toCurrency->symbol, + 'to_currency_decimal_places' => $rate->toCurrency->decimal_places, + + 'rate' => $rate->rate, + 'date' => $rate->date->toAtomString(), + 'links' => [ + [ + 'rel' => 'self', + 'uri' => sprintf('/exchange-rates/%s', $rate->id), + ], + ], + ]; + } +} diff --git a/app/Transformers/UserGroupTransformer.php b/app/Transformers/UserGroupTransformer.php index 95f8a39613..c9aec36a3c 100644 --- a/app/Transformers/UserGroupTransformer.php +++ b/app/Transformers/UserGroupTransformer.php @@ -28,7 +28,7 @@ use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Models\GroupMembership; use FireflyIII\Models\UserGroup; use FireflyIII\Support\Facades\Amount; -use FireflyIII\Transformers\V2\AbstractTransformer; +use FireflyIII\Transformers\AbstractTransformer; use FireflyIII\User; use Illuminate\Support\Collection; diff --git a/app/Transformers/V2/AbstractTransformer.php b/app/Transformers/V2/AbstractTransformer.php index 04d7a4efc6..f016c3b6c1 100644 --- a/app/Transformers/V2/AbstractTransformer.php +++ b/app/Transformers/V2/AbstractTransformer.php @@ -30,6 +30,7 @@ use Symfony\Component\HttpFoundation\ParameterBag; /** * Class AbstractTransformer + * @deprecated */ abstract class AbstractTransformer extends TransformerAbstract { diff --git a/app/Transformers/V2/AccountTransformer.php b/app/Transformers/V2/AccountTransformer.php index 9dbe23813e..9d933880f0 100644 --- a/app/Transformers/V2/AccountTransformer.php +++ b/app/Transformers/V2/AccountTransformer.php @@ -36,6 +36,7 @@ use Illuminate\Support\Facades\Log; /** * Class AccountTransformer + * @deprecated */ class AccountTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/BillTransformer.php b/app/Transformers/V2/BillTransformer.php index 42f3cbc64d..8b1c248598 100644 --- a/app/Transformers/V2/BillTransformer.php +++ b/app/Transformers/V2/BillTransformer.php @@ -40,6 +40,7 @@ use Illuminate\Support\Facades\Log; /** * Class BillTransformer + * @deprecated */ class BillTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/BudgetLimitTransformer.php b/app/Transformers/V2/BudgetLimitTransformer.php index 192d095c04..ad99074cca 100644 --- a/app/Transformers/V2/BudgetLimitTransformer.php +++ b/app/Transformers/V2/BudgetLimitTransformer.php @@ -30,6 +30,7 @@ use League\Fractal\Resource\Item; /** * Class BudgetLimitTransformer + * @deprecated */ class BudgetLimitTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/BudgetTransformer.php b/app/Transformers/V2/BudgetTransformer.php index aca7ed8758..dd4a529b84 100644 --- a/app/Transformers/V2/BudgetTransformer.php +++ b/app/Transformers/V2/BudgetTransformer.php @@ -30,6 +30,7 @@ use Symfony\Component\HttpFoundation\ParameterBag; /** * Class BudgetTransformer + * @deprecated */ class BudgetTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/CurrencyTransformer.php b/app/Transformers/V2/CurrencyTransformer.php index 27480ba6fc..359022cd15 100644 --- a/app/Transformers/V2/CurrencyTransformer.php +++ b/app/Transformers/V2/CurrencyTransformer.php @@ -29,6 +29,7 @@ use Illuminate\Support\Collection; /** * Class CurrencyTransformer + * @deprecated */ class CurrencyTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/ExchangeRateTransformer.php b/app/Transformers/V2/ExchangeRateTransformer.php index 045f8f3a28..9ccc7457ce 100644 --- a/app/Transformers/V2/ExchangeRateTransformer.php +++ b/app/Transformers/V2/ExchangeRateTransformer.php @@ -29,6 +29,7 @@ use Illuminate\Support\Collection; /** * Class AccountTransformer + * @deprecated */ class ExchangeRateTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/PiggyBankTransformer.php b/app/Transformers/V2/PiggyBankTransformer.php index 431181c696..7c5b7c0d60 100644 --- a/app/Transformers/V2/PiggyBankTransformer.php +++ b/app/Transformers/V2/PiggyBankTransformer.php @@ -41,6 +41,7 @@ use Illuminate\Support\Facades\Log; /** * Class PiggyBankTransformer + * @deprecated */ class PiggyBankTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/PreferenceTransformer.php b/app/Transformers/V2/PreferenceTransformer.php index 07c1a37017..9a9972918d 100644 --- a/app/Transformers/V2/PreferenceTransformer.php +++ b/app/Transformers/V2/PreferenceTransformer.php @@ -29,6 +29,7 @@ use Illuminate\Support\Collection; /** * Class PreferenceTransformer + * @deprecated */ class PreferenceTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/TransactionGroupTransformer.php b/app/Transformers/V2/TransactionGroupTransformer.php index b4eba64da7..b48ab0b09c 100644 --- a/app/Transformers/V2/TransactionGroupTransformer.php +++ b/app/Transformers/V2/TransactionGroupTransformer.php @@ -43,6 +43,7 @@ use Illuminate\Support\Facades\DB; /** * Class TransactionGroupTransformer + * @deprecated */ class TransactionGroupTransformer extends AbstractTransformer { diff --git a/app/Transformers/V2/UserGroupTransformer.php b/app/Transformers/V2/UserGroupTransformer.php index 2a33edd6b9..968b91eeb4 100644 --- a/app/Transformers/V2/UserGroupTransformer.php +++ b/app/Transformers/V2/UserGroupTransformer.php @@ -32,6 +32,7 @@ use Illuminate\Support\Collection; /** * Class UserGroupTransformer + * @deprecated */ class UserGroupTransformer extends AbstractTransformer { From 05d82b6c052914bc2e4ca319a4b069f8f3a91b1a Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 14 Mar 2025 19:19:33 +0100 Subject: [PATCH 42/52] Fix missing method. --- app/Api/V1/Controllers/Controller.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 64156a4cf3..6a7fce570b 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -263,7 +263,7 @@ abstract class Controller extends BaseController // the transformer, at this point, needs to collect information that ALL items in the collection // require, like meta-data and stuff like that, and save it for later. - $objects = $transformer->collectMetaData($objects); + //$objects = $transformer->collectMetaData($objects); $paginator->setCollection($objects); $resource = new FractalCollection($objects, $transformer, $key); @@ -284,7 +284,7 @@ abstract class Controller extends BaseController $baseUrl = sprintf('%s/api/v1', request()->getSchemeAndHttpHost()); $manager->setSerializer(new JsonApiSerializer($baseUrl)); - $transformer->collectMetaData(new Collection([$object])); + //$transformer->collectMetaData(new Collection([$object])); $resource = new Item($object, $transformer, $key); From a369e61f1869c21437e347efb8c745cb030852ea Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 14 Mar 2025 19:24:54 +0100 Subject: [PATCH 43/52] Add changelog. --- changelog.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/changelog.md b/changelog.md index 423bd82c92..4327debd81 100644 --- a/changelog.md +++ b/changelog.md @@ -3,6 +3,35 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## 6.2.10 - 2025-03-15 + +### Added + +- #9903 + +### Changed + +- #9972 +- Greatly improved speed of account overview +- Better validation of environment variables + +### Fixed + +- #9895 +- #9906 +- #9908 +- #9914 +- #9941 +- #9948 +- #9954 +- #9970 +- #9876 + +### API + +- #9902 + + ## 6.2.9 - 2025-02-22 ### Fixed From c28005f649944d87d2a350321d2b71cb1b1d50a4 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 14 Mar 2025 19:28:44 +0100 Subject: [PATCH 44/52] Auto commit for release 'develop' on 2025-03-14 --- app/Api/V1/Controllers/Controller.php | 4 +-- app/Api/V2/Controllers/Controller.php | 4 +-- .../Account/AccountRepository.php | 3 +- .../Category/NoCategoryRepository.php | 12 ++++---- .../Http/Controllers/PeriodOverview.php | 30 +++++++++---------- app/Transformers/ExchangeRateTransformer.php | 1 + app/Transformers/UserGroupTransformer.php | 1 - app/Transformers/V2/AbstractTransformer.php | 1 + app/Transformers/V2/AccountTransformer.php | 1 + app/Transformers/V2/BillTransformer.php | 1 + .../V2/BudgetLimitTransformer.php | 1 + app/Transformers/V2/BudgetTransformer.php | 1 + app/Transformers/V2/CurrencyTransformer.php | 1 + .../V2/ExchangeRateTransformer.php | 1 + app/Transformers/V2/PiggyBankTransformer.php | 1 + app/Transformers/V2/PreferenceTransformer.php | 1 + .../V2/TransactionGroupTransformer.php | 1 + app/Transformers/V2/UserGroupTransformer.php | 1 + changelog.md | 24 +++++++-------- 19 files changed, 51 insertions(+), 39 deletions(-) diff --git a/app/Api/V1/Controllers/Controller.php b/app/Api/V1/Controllers/Controller.php index 6a7fce570b..a4b9bd297f 100644 --- a/app/Api/V1/Controllers/Controller.php +++ b/app/Api/V1/Controllers/Controller.php @@ -263,7 +263,7 @@ abstract class Controller extends BaseController // the transformer, at this point, needs to collect information that ALL items in the collection // require, like meta-data and stuff like that, and save it for later. - //$objects = $transformer->collectMetaData($objects); + // $objects = $transformer->collectMetaData($objects); $paginator->setCollection($objects); $resource = new FractalCollection($objects, $transformer, $key); @@ -284,7 +284,7 @@ abstract class Controller extends BaseController $baseUrl = sprintf('%s/api/v1', request()->getSchemeAndHttpHost()); $manager->setSerializer(new JsonApiSerializer($baseUrl)); - //$transformer->collectMetaData(new Collection([$object])); + // $transformer->collectMetaData(new Collection([$object])); $resource = new Item($object, $transformer, $key); diff --git a/app/Api/V2/Controllers/Controller.php b/app/Api/V2/Controllers/Controller.php index 66569e2a34..5431e1af50 100644 --- a/app/Api/V2/Controllers/Controller.php +++ b/app/Api/V2/Controllers/Controller.php @@ -167,7 +167,7 @@ class Controller extends BaseController // the transformer, at this point, needs to collect information that ALL items in the collection // require, like meta-data and stuff like that, and save it for later. - //$objects = $transformer->collectMetaData($objects); + // $objects = $transformer->collectMetaData($objects); $paginator->setCollection($objects); $resource = new FractalCollection($objects, $transformer, $key); @@ -188,7 +188,7 @@ class Controller extends BaseController $baseUrl = request()->getSchemeAndHttpHost().'/api/v2'; $manager->setSerializer(new JsonApiSerializer($baseUrl)); - //$transformer->collectMetaData(new Collection([$object])); + // $transformer->collectMetaData(new Collection([$object])); $resource = new Item($object, $transformer, $key); diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index be01bb7268..55112edf19 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -680,7 +680,8 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac // fields 'transaction_journals.date', 'transaction_types.type', 'transaction_journals.transaction_currency_id', 'transactions.amount']) - ->toArray(); + ->toArray() + ; } } diff --git a/app/Repositories/Category/NoCategoryRepository.php b/app/Repositories/Category/NoCategoryRepository.php index d8ea7ce007..f674cc04d0 100644 --- a/app/Repositories/Category/NoCategoryRepository.php +++ b/app/Repositories/Category/NoCategoryRepository.php @@ -77,9 +77,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->negative($journal['amount']), - 'date' => $journal['date'], - ]; + 'amount' => app('steam')->negative($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; @@ -123,9 +123,9 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface, UserGroupIn $journalId = (int) $journal['transaction_journal_id']; $array[$currencyId]['categories'][0]['transaction_journals'][$journalId] = [ - 'amount' => app('steam')->positive($journal['amount']), - 'date' => $journal['date'], - ]; + 'amount' => app('steam')->positive($journal['amount']), + 'date' => $journal['date'], + ]; } return $array; diff --git a/app/Support/Http/Controllers/PeriodOverview.php b/app/Support/Http/Controllers/PeriodOverview.php index 8adc8e2fa7..79b4979029 100644 --- a/app/Support/Http/Controllers/PeriodOverview.php +++ b/app/Support/Http/Controllers/PeriodOverview.php @@ -109,14 +109,14 @@ trait PeriodOverview [$transactions, $transferredIn] = $this->filterTransfers('in', $transactions, $currentDate['start'], $currentDate['end']); $entries[] = [ - 'title' => $title, - 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred_away' => $this->groupByCurrency($transferredAway), - 'transferred_in' => $this->groupByCurrency($transferredIn), - ]; + 'title' => $title, + 'route' => route('accounts.show', [$account->id, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferredAway) + count($transferredIn), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred_away' => $this->groupByCurrency($transferredAway), + 'transferred_in' => $this->groupByCurrency($transferredIn), + ]; } $cache->store($entries); Timer::stop('account-period-total'); @@ -603,13 +603,13 @@ trait PeriodOverview } $entries[] = [ - 'title' => $title, - 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), - 'total_transactions' => count($spent) + count($earned) + count($transferred), - 'spent' => $this->groupByCurrency($spent), - 'earned' => $this->groupByCurrency($earned), - 'transferred' => $this->groupByCurrency($transferred), - ]; + 'title' => $title, + 'route' => route('transactions.index', [$transactionType, $currentDate['start']->format('Y-m-d'), $currentDate['end']->format('Y-m-d')]), + 'total_transactions' => count($spent) + count($earned) + count($transferred), + 'spent' => $this->groupByCurrency($spent), + 'earned' => $this->groupByCurrency($earned), + 'transferred' => $this->groupByCurrency($transferred), + ]; } return $entries; diff --git a/app/Transformers/ExchangeRateTransformer.php b/app/Transformers/ExchangeRateTransformer.php index 08080aa24e..6303fb0184 100644 --- a/app/Transformers/ExchangeRateTransformer.php +++ b/app/Transformers/ExchangeRateTransformer.php @@ -1,4 +1,5 @@ Date: Sun, 16 Mar 2025 17:50:22 +0100 Subject: [PATCH 45/52] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-03-16?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 218 ++++++++------------- config/firefly.php | 2 +- package-lock.json | 18 +- resources/assets/v1/src/locales/zh-cn.json | 2 +- temp-file.txt | 1 + 5 files changed, 97 insertions(+), 144 deletions(-) create mode 100644 temp-file.txt diff --git a/composer.lock b/composer.lock index 7dbf932b0f..f239fad03f 100644 --- a/composer.lock +++ b/composer.lock @@ -939,16 +939,16 @@ }, { "name": "filp/whoops", - "version": "2.17.0", + "version": "2.18.0", "source": { "type": "git", "url": "https://github.com/filp/whoops.git", - "reference": "075bc0c26631110584175de6523ab3f1652eb28e" + "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/filp/whoops/zipball/075bc0c26631110584175de6523ab3f1652eb28e", - "reference": "075bc0c26631110584175de6523ab3f1652eb28e", + "url": "https://api.github.com/repos/filp/whoops/zipball/a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", + "reference": "a7de6c3c6c3c022f5cfc337f8ede6a14460cf77e", "shasum": "" }, "require": { @@ -998,7 +998,7 @@ ], "support": { "issues": "https://github.com/filp/whoops/issues", - "source": "https://github.com/filp/whoops/tree/2.17.0" + "source": "https://github.com/filp/whoops/tree/2.18.0" }, "funding": [ { @@ -1006,7 +1006,7 @@ "type": "github" } ], - "time": "2025-01-25T12:00:00+00:00" + "time": "2025-03-15T12:00:00+00:00" }, { "name": "firebase/php-jwt", @@ -2898,20 +2898,20 @@ }, { "name": "league/event", - "version": "2.2.0", + "version": "2.3.0", "source": { "type": "git", "url": "https://github.com/thephpleague/event.git", - "reference": "d2cc124cf9a3fab2bb4ff963307f60361ce4d119" + "reference": "062ebb450efbe9a09bc2478e89b7c933875b0935" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/event/zipball/d2cc124cf9a3fab2bb4ff963307f60361ce4d119", - "reference": "d2cc124cf9a3fab2bb4ff963307f60361ce4d119", + "url": "https://api.github.com/repos/thephpleague/event/zipball/062ebb450efbe9a09bc2478e89b7c933875b0935", + "reference": "062ebb450efbe9a09bc2478e89b7c933875b0935", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.1.0" }, "require-dev": { "henrikbjorn/phpspec-code-coverage": "~1.0.1", @@ -2946,9 +2946,9 @@ ], "support": { "issues": "https://github.com/thephpleague/event/issues", - "source": "https://github.com/thephpleague/event/tree/master" + "source": "https://github.com/thephpleague/event/tree/2.3.0" }, - "time": "2018-11-26T11:52:41+00:00" + "time": "2025-03-14T19:51:10+00:00" }, { "name": "league/flysystem", @@ -3965,20 +3965,20 @@ }, { "name": "nunomaduro/collision", - "version": "v8.6.1", + "version": "v8.7.0", "source": { "type": "git", "url": "https://github.com/nunomaduro/collision.git", - "reference": "86f003c132143d5a2ab214e19933946409e0cae7" + "reference": "586cb8181a257a2152b6a855ca8d9598878a1a26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nunomaduro/collision/zipball/86f003c132143d5a2ab214e19933946409e0cae7", - "reference": "86f003c132143d5a2ab214e19933946409e0cae7", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/586cb8181a257a2152b6a855ca8d9598878a1a26", + "reference": "586cb8181a257a2152b6a855ca8d9598878a1a26", "shasum": "" }, "require": { - "filp/whoops": "^2.16.0", + "filp/whoops": "^2.17.0", "nunomaduro/termwind": "^2.3.0", "php": "^8.2.0", "symfony/console": "^7.2.1" @@ -3988,14 +3988,14 @@ "phpunit/phpunit": "<11.5.3 || >=12.0.0" }, "require-dev": { - "larastan/larastan": "^2.9.12", - "laravel/framework": "^11.39.1", - "laravel/pint": "^1.20.0", - "laravel/sail": "^1.40.0", - "laravel/sanctum": "^4.0.7", - "laravel/tinker": "^2.10.0", - "orchestra/testbench-core": "^9.9.2", - "pestphp/pest": "^3.7.3", + "larastan/larastan": "^2.10.0", + "laravel/framework": "^11.44.2", + "laravel/pint": "^1.21.2", + "laravel/sail": "^1.41.0", + "laravel/sanctum": "^4.0.8", + "laravel/tinker": "^2.10.1", + "orchestra/testbench-core": "^9.12.0", + "pestphp/pest": "^3.7.4", "sebastian/environment": "^6.1.0 || ^7.2.0" }, "type": "library", @@ -4059,7 +4059,7 @@ "type": "patreon" } ], - "time": "2025-01-23T13:41:43+00:00" + "time": "2025-03-14T22:37:40+00:00" }, { "name": "nunomaduro/termwind", @@ -10585,35 +10585,76 @@ "time": "2020-07-09T08:09:16+00:00" }, { - "name": "larastan/larastan", - "version": "v3.1.0", + "name": "iamcal/sql-parser", + "version": "v0.5", "source": { "type": "git", - "url": "https://github.com/larastan/larastan.git", - "reference": "dbb2dc20e5c8e1ed3ff289054e1955f269187312" + "url": "https://github.com/iamcal/SQLParser.git", + "reference": "644fd994de3b54e5d833aecf406150aa3b66ca88" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/larastan/larastan/zipball/dbb2dc20e5c8e1ed3ff289054e1955f269187312", - "reference": "dbb2dc20e5c8e1ed3ff289054e1955f269187312", + "url": "https://api.github.com/repos/iamcal/SQLParser/zipball/644fd994de3b54e5d833aecf406150aa3b66ca88", + "reference": "644fd994de3b54e5d833aecf406150aa3b66ca88", + "shasum": "" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^1.0", + "phpunit/phpunit": "^5|^6|^7|^8|^9" + }, + "type": "library", + "autoload": { + "psr-4": { + "iamcal\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Cal Henderson", + "email": "cal@iamcal.com" + } + ], + "description": "MySQL schema parser", + "support": { + "issues": "https://github.com/iamcal/SQLParser/issues", + "source": "https://github.com/iamcal/SQLParser/tree/v0.5" + }, + "time": "2024-03-22T22:46:32+00:00" + }, + { + "name": "larastan/larastan", + "version": "v3.2.0", + "source": { + "type": "git", + "url": "https://github.com/larastan/larastan.git", + "reference": "d84d5a3b6536a586899ad6855a3e098473703690" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/larastan/larastan/zipball/d84d5a3b6536a586899ad6855a3e098473703690", + "reference": "d84d5a3b6536a586899ad6855a3e098473703690", "shasum": "" }, "require": { "ext-json": "*", - "illuminate/console": "^11.15.0 || ^12.0", - "illuminate/container": "^11.15.0 || ^12.0", - "illuminate/contracts": "^11.15.0 || ^12.0", - "illuminate/database": "^11.15.0 || ^12.0", - "illuminate/http": "^11.15.0 || ^12.0", - "illuminate/pipeline": "^11.15.0 || ^12.0", - "illuminate/support": "^11.15.0 || ^12.0", + "iamcal/sql-parser": "^0.5.0", + "illuminate/console": "^11.41.3 || ^12.0", + "illuminate/container": "^11.41.3 || ^12.0", + "illuminate/contracts": "^11.41.3 || ^12.0", + "illuminate/database": "^11.41.3 || ^12.0", + "illuminate/http": "^11.41.3 || ^12.0", + "illuminate/pipeline": "^11.41.3 || ^12.0", + "illuminate/support": "^11.41.3 || ^12.0", "php": "^8.2", - "phpmyadmin/sql-parser": "^5.9.0", "phpstan/phpstan": "^2.1.3" }, "require-dev": { "doctrine/coding-standard": "^12.0", - "laravel/framework": "^11.15.0 || ^12.0", + "laravel/framework": "^11.41.3 || ^12.0", "mockery/mockery": "^1.6", "nikic/php-parser": "^5.3", "orchestra/canvas": "^v9.1.3 || ^10.0", @@ -10667,7 +10708,7 @@ ], "support": { "issues": "https://github.com/larastan/larastan/issues", - "source": "https://github.com/larastan/larastan/tree/v3.1.0" + "source": "https://github.com/larastan/larastan/tree/v3.2.0" }, "funding": [ { @@ -10675,7 +10716,7 @@ "type": "github" } ], - "time": "2025-02-20T15:25:15+00:00" + "time": "2025-03-14T21:54:26+00:00" }, { "name": "laravel-json-api/testing", @@ -11131,95 +11172,6 @@ }, "time": "2025-02-21T17:47:03+00:00" }, - { - "name": "phpmyadmin/sql-parser", - "version": "5.11.0", - "source": { - "type": "git", - "url": "https://github.com/phpmyadmin/sql-parser.git", - "reference": "07044bc8c13abd542756c3fd34dc66a5d6dee8e4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpmyadmin/sql-parser/zipball/07044bc8c13abd542756c3fd34dc66a5d6dee8e4", - "reference": "07044bc8c13abd542756c3fd34dc66a5d6dee8e4", - "shasum": "" - }, - "require": { - "php": "^7.2 || ^8.0", - "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php80": "^1.16" - }, - "conflict": { - "phpmyadmin/motranslator": "<3.0" - }, - "require-dev": { - "phpbench/phpbench": "^1.1", - "phpmyadmin/coding-standard": "^3.0", - "phpmyadmin/motranslator": "^4.0 || ^5.0", - "phpstan/extension-installer": "^1.4", - "phpstan/phpstan": "^1.12", - "phpstan/phpstan-deprecation-rules": "^1.2", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "^8.5 || ^9.6", - "psalm/plugin-phpunit": "^0.16.1", - "vimeo/psalm": "^4.11", - "zumba/json-serializer": "~3.0.2" - }, - "suggest": { - "ext-mbstring": "For best performance", - "phpmyadmin/motranslator": "Translate messages to your favorite locale" - }, - "bin": [ - "bin/highlight-query", - "bin/lint-query", - "bin/sql-parser", - "bin/tokenize-query" - ], - "type": "library", - "autoload": { - "psr-4": { - "PhpMyAdmin\\SqlParser\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0-or-later" - ], - "authors": [ - { - "name": "The phpMyAdmin Team", - "email": "developers@phpmyadmin.net", - "homepage": "https://www.phpmyadmin.net/team/" - } - ], - "description": "A validating SQL lexer and parser with a focus on MySQL dialect.", - "homepage": "https://github.com/phpmyadmin/sql-parser", - "keywords": [ - "analysis", - "lexer", - "parser", - "query linter", - "sql", - "sql lexer", - "sql linter", - "sql parser", - "sql syntax highlighter", - "sql tokenizer" - ], - "support": { - "issues": "https://github.com/phpmyadmin/sql-parser/issues", - "source": "https://github.com/phpmyadmin/sql-parser" - }, - "funding": [ - { - "url": "https://www.phpmyadmin.net/donate/", - "type": "other" - } - ], - "time": "2025-02-22T20:00:59+00:00" - }, { "name": "phpstan/extension-installer", "version": "1.4.3", diff --git a/config/firefly.php b/config/firefly.php index 52a0f46326..5e9537fcd1 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-03-14', + 'version' => 'develop/2025-03-16', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/package-lock.json b/package-lock.json index 4f34f4a72d..6dfd63fe6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4448,9 +4448,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001704", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001704.tgz", - "integrity": "sha512-+L2IgBbV6gXB4ETf0keSvLr7JUrRVbIaB/lrQ1+z8mRcQiisG5k+lG6O4n6Y5q6f5EuNfaYXKgymucphlEXQew==", + "version": "1.0.30001705", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001705.tgz", + "integrity": "sha512-S0uyMMiYvA7CxNgomYBwwwPUnWzFD83f3B1ce5jHUfHTH//QL6hHsreI8RVC5606R4ssqravelYO5TU6t8sEyg==", "dev": true, "funding": [ { @@ -5663,9 +5663,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.118", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.118.tgz", - "integrity": "sha512-yNDUus0iultYyVoEFLnQeei7LOQkL8wg8GQpkPCRrOlJXlcCwa6eGKZkxQ9ciHsqZyYbj8Jd94X1CTPzGm+uIA==", + "version": "1.5.119", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.119.tgz", + "integrity": "sha512-Ku4NMzUjz3e3Vweh7PhApPrZSS4fyiCIbcIrG9eKrriYVLmbMepETR/v6SU7xPm98QTqMSYiCwfO89QNjXLkbQ==", "dev": true, "license": "ISC" }, @@ -8211,9 +8211,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.9.tgz", - "integrity": "sha512-SppoicMGpZvbF1l3z4x7No3OlIjP7QJvC9XR7AhZr1kL133KHnKPztkKDc+Ir4aJ/1VhTySrtKhrsycmrMQfvg==", + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz", + "integrity": "sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==", "dev": true, "funding": [ { diff --git a/resources/assets/v1/src/locales/zh-cn.json b/resources/assets/v1/src/locales/zh-cn.json index 6df0fc5bfa..0fddaf8573 100644 --- a/resources/assets/v1/src/locales/zh-cn.json +++ b/resources/assets/v1/src/locales/zh-cn.json @@ -42,7 +42,7 @@ "submit": "\u63d0\u4ea4", "amount": "\u91d1\u989d", "date": "\u65e5\u671f", - "is_reconciled_fields_dropped": "Because this transaction is reconciled, you will not be able to update the accounts, nor the amount(s) unless you remove the reconciliation flag.", + "is_reconciled_fields_dropped": "\u56e0\u4e3a\u8fd9\u7b14\u4ea4\u6613\u5df2\u7ecf\u5bf9\u8d26\uff0c\u60a8\u5c06\u65e0\u6cd5\u66f4\u65b0\u5e10\u6237\uff0c\u4e5f\u65e0\u6cd5\u66f4\u65b0\u91d1\u989d\uff0c\u9664\u975e\u60a8\u79fb\u9664\u5bf9\u8d26\u6807\u8bb0\u3002", "tags": "\u6807\u7b7e", "no_budget": "(\u65e0\u9884\u7b97)", "no_bill": "(\u65e0\u8ba2\u9605)", diff --git a/temp-file.txt b/temp-file.txt new file mode 100644 index 0000000000..edd8488031 --- /dev/null +++ b/temp-file.txt @@ -0,0 +1 @@ +Sun Mar 16 16:48:09 UTC 2025 From 2d78bba6f4206d6b7ed71faad733d8a5697fcde3 Mon Sep 17 00:00:00 2001 From: JC5 Date: Mon, 17 Mar 2025 04:16:43 +0100 Subject: [PATCH 46/52] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-03-17?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/firefly.php | 2 +- package-lock.json | 642 ++++++++++++++++++++++----------------------- 2 files changed, 315 insertions(+), 329 deletions(-) diff --git a/config/firefly.php b/config/firefly.php index 5e9537fcd1..3bc77eac32 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-03-16', + 'version' => 'develop/2025-03-17', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/package-lock.json b/package-lock.json index e37ae4ffa4..6dfd63fe6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,32 +14,32 @@ } }, "node_modules/@ag-grid-community/client-side-row-model": { - "version": "32.3.3", - "resolved": "https://registry.npmjs.org/@ag-grid-community/client-side-row-model/-/client-side-row-model-32.3.3.tgz", - "integrity": "sha512-/6OFltj9qax/xfOcYMOKGFQRFTrPX8hrELfS2jChWwpo/+rpnnFqN2iUlIiAB1tDJZsi2ryl8S4UoFSTcEv/VA==", + "version": "32.3.4", + "resolved": "https://registry.npmjs.org/@ag-grid-community/client-side-row-model/-/client-side-row-model-32.3.4.tgz", + "integrity": "sha512-AZyLSemPyaCJi8wPJ/wvwow6v4MZKMkg9152TameKvaEf+m+N+gWJNKb1dQoqjgWCgEByqvM6SO8dJtYRrdr/A==", "license": "MIT", "dependencies": { - "@ag-grid-community/core": "32.3.3", + "@ag-grid-community/core": "32.3.4", "tslib": "^2.3.0" } }, "node_modules/@ag-grid-community/core": { - "version": "32.3.3", - "resolved": "https://registry.npmjs.org/@ag-grid-community/core/-/core-32.3.3.tgz", - "integrity": "sha512-JMr5ahDjjl+pvQbBM1/VrfVFlioCVnMl1PKWc6MC1ENhpXT1+CPQdfhUEUw2VytOulQeQ4eeP0pFKPuBZ5Jn2g==", + "version": "32.3.4", + "resolved": "https://registry.npmjs.org/@ag-grid-community/core/-/core-32.3.4.tgz", + "integrity": "sha512-g1CJOQuA4uRx1U3VP9SZLnTJBYdMwCTM348FsubdI6anaqxnHv3X0kridq9v1v26qXbl7yytm5X3v1hPcV8wVA==", "license": "MIT", "dependencies": { - "ag-charts-types": "10.3.3", + "ag-charts-types": "10.3.4", "tslib": "^2.3.0" } }, "node_modules/@ag-grid-community/infinite-row-model": { - "version": "32.3.3", - "resolved": "https://registry.npmjs.org/@ag-grid-community/infinite-row-model/-/infinite-row-model-32.3.3.tgz", - "integrity": "sha512-q1R8gW/JhyjctiMzQcQWed0at8JHHCckoeT1XuD3KSEEKk1+x6fiRLbio05maHkIKYpSaXLLr2w7xEhSgiyk6g==", + "version": "32.3.4", + "resolved": "https://registry.npmjs.org/@ag-grid-community/infinite-row-model/-/infinite-row-model-32.3.4.tgz", + "integrity": "sha512-GWlUoU9UPGp0ZYdBCiV8R+A/mwdYweoB3HsVOEeQiNZYDC1TQJxiCSKBCCg9qk3KDY+VbJ/6ebV/BUN7cLwIuQ==", "license": "MIT", "dependencies": { - "@ag-grid-community/core": "32.3.3", + "@ag-grid-community/core": "32.3.4", "tslib": "^2.3.0" } }, @@ -89,22 +89,22 @@ } }, "node_modules/@babel/core": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.9.tgz", - "integrity": "sha512-lWBYIrF7qK5+GjY5Uy+/hEgp8OJWOD/rpy74GplYRhEauvbHDeFB8t5hPOZxCZ0Oxf4Cc36tK51/l3ymJysrKw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.26.10.tgz", + "integrity": "sha512-vMqyb7XCDMPvJFFOaT9kxtiRh42GwlZEg1/uIgtZshS5a/8OaduUfCi7kynKgc3Tw/6Uo2D+db9qBttghhmxwQ==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.9", + "@babel/generator": "^7.26.10", "@babel/helper-compilation-targets": "^7.26.5", "@babel/helper-module-transforms": "^7.26.0", - "@babel/helpers": "^7.26.9", - "@babel/parser": "^7.26.9", + "@babel/helpers": "^7.26.10", + "@babel/parser": "^7.26.10", "@babel/template": "^7.26.9", - "@babel/traverse": "^7.26.9", - "@babel/types": "^7.26.9", + "@babel/traverse": "^7.26.10", + "@babel/types": "^7.26.10", "convert-source-map": "^2.0.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.2", @@ -130,14 +130,14 @@ } }, "node_modules/@babel/generator": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.9.tgz", - "integrity": "sha512-kEWdzjOAUMW4hAyrzJ0ZaTOu9OmpyDIQicIh0zg0EEcEkYXZb2TjtBhnHi2ViX7PKwZqF4xwqfAm299/QMP3lg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.26.10.tgz", + "integrity": "sha512-rRHT8siFIXQrAYOYqZQVsAr8vJ+cBNqcVAY6m5V8/4QqzaPl+zDBe6cLEPRDuNOUf3ww8RfJVlOyQMoSI+5Ang==", "dev": true, "license": "MIT", "dependencies": { - "@babel/parser": "^7.26.9", - "@babel/types": "^7.26.9", + "@babel/parser": "^7.26.10", + "@babel/types": "^7.26.10", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" @@ -428,27 +428,27 @@ } }, "node_modules/@babel/helpers": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.9.tgz", - "integrity": "sha512-Mz/4+y8udxBKdmzt/UjPACs4G3j5SshJJEFFKxlCGPydG4JAHXxjWjAwjd09tf6oINvl1VfMJo+nB7H2YKQ0dA==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.26.10.tgz", + "integrity": "sha512-UPYc3SauzZ3JGgj87GgZ89JVdC5dj0AoetR5Bw6wj4niittNyFh6+eOGonYvJ1ao6B8lEa3Q3klS7ADZ53bc5g==", "dev": true, "license": "MIT", "dependencies": { "@babel/template": "^7.26.9", - "@babel/types": "^7.26.9" + "@babel/types": "^7.26.10" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/parser": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.9.tgz", - "integrity": "sha512-81NWa1njQblgZbQHxWHpxxCzNsa3ZwvFqpUg7P+NNUU6f3UU2jBEg4OlF/J6rl8+PQGh1q6/zWScd001YwcA5A==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.26.10.tgz", + "integrity": "sha512-6aQR2zGE/QFi8JpDLjUZEPYOs7+mhKXm86VaKFiLP35JQwQb6bwUE+XbvkH0EptsYhbNBSUGaUBLKqxH1xSgsA==", "dev": true, "license": "MIT", "dependencies": { - "@babel/types": "^7.26.9" + "@babel/types": "^7.26.10" }, "bin": { "parser": "bin/babel-parser.js" @@ -1340,16 +1340,16 @@ } }, "node_modules/@babel/plugin-transform-runtime": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.26.9.tgz", - "integrity": "sha512-Jf+8y9wXQbbxvVYTM8gO5oEF2POdNji0NMltEkG7FtmzD9PVz7/lxpqSdTvwsjTMU5HIHuDVNf2SOxLkWi+wPQ==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.26.10.tgz", + "integrity": "sha512-NWaL2qG6HRpONTnj4JvDU6th4jYeZOJgu3QhmFTCihib0ermtOJqktA5BduGm3suhhVe9EMP9c9+mfJ/I9slqw==", "dev": true, "license": "MIT", "dependencies": { "@babel/helper-module-imports": "^7.25.9", "@babel/helper-plugin-utils": "^7.26.5", "babel-plugin-polyfill-corejs2": "^0.4.10", - "babel-plugin-polyfill-corejs3": "^0.10.6", + "babel-plugin-polyfill-corejs3": "^0.11.0", "babel-plugin-polyfill-regenerator": "^0.6.1", "semver": "^6.3.1" }, @@ -1602,20 +1602,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/preset-env/node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.11.1.tgz", - "integrity": "sha512-yGCqvBT4rwMczo28xkH/noxJ6MZ4nJfkVYdoDaC/utLtWrXxv27HVrzAeSbqR8SxDsp46n0YF47EbHoixy6rXQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.3", - "core-js-compat": "^3.40.0" - }, - "peerDependencies": { - "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" - } - }, "node_modules/@babel/preset-env/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -1642,9 +1628,9 @@ } }, "node_modules/@babel/runtime": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.9.tgz", - "integrity": "sha512-aA63XwOkcl4xxQa3HjPMqOP6LiK0ZDv3mUPYEFXkpHbaFjtGggE1A61FjFzJnB+p7/oy2gA8E+rcBNl/zC1tMg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.10.tgz", + "integrity": "sha512-2WJMeRQPHKSPemqk/awGrAiuFfzBmOIPXKizAsVhWH9YJqLZ0H+HS4c8loHGgW6utJ3E/ejXQUsiGaQy2NZ9Fw==", "license": "MIT", "dependencies": { "regenerator-runtime": "^0.14.0" @@ -1669,17 +1655,17 @@ } }, "node_modules/@babel/traverse": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.9.tgz", - "integrity": "sha512-ZYW7L+pL8ahU5fXmNbPF+iZFHCv5scFak7MZ9bwaRPLUhHh7QQEMjZUg0HevihoqCM5iSYHN61EyCoZvqC+bxg==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.26.10.tgz", + "integrity": "sha512-k8NuDrxr0WrPH5Aupqb2LCVURP/S0vBEn5mK6iH+GIYob66U5EtoZvcdudR2jQ4cmTwhEwW1DLB+Yyas9zjF6A==", "dev": true, "license": "MIT", "dependencies": { "@babel/code-frame": "^7.26.2", - "@babel/generator": "^7.26.9", - "@babel/parser": "^7.26.9", + "@babel/generator": "^7.26.10", + "@babel/parser": "^7.26.10", "@babel/template": "^7.26.9", - "@babel/types": "^7.26.9", + "@babel/types": "^7.26.10", "debug": "^4.3.1", "globals": "^11.1.0" }, @@ -1688,9 +1674,9 @@ } }, "node_modules/@babel/types": { - "version": "7.26.9", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.9.tgz", - "integrity": "sha512-Y3IR1cRnOxOCDvMmNiym7XpXQ93iGDDPHx+Zj+NM+rg0fBaShfQLkg+hKPaZCEvg5N/LeCo4+Rj/i3FuJsIQaw==", + "version": "7.26.10", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.26.10.tgz", + "integrity": "sha512-emqcG3vHrpxUKTrxcblR36dcrcoRDvKmnL/dCL6ZsHaShW80qxCAcNhzQZrpeM765VzEos+xOi4s+r4IXzTwdQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1723,9 +1709,9 @@ } }, "node_modules/@esbuild/aix-ppc64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.24.2.tgz", - "integrity": "sha512-thpVCb/rhxE/BnMLQ7GReQLLN8q9qbHmI55F4489/ByVg2aQaQ6kbcLb6FHkocZzQhxc4gx0sCk0tJkKBFzDhA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.1.tgz", + "integrity": "sha512-kfYGy8IdzTGy+z0vFGvExZtxkFlA4zAxgKEahG9KE1ScBjpQnFsNOX8KTU5ojNru5ed5CVoJYXFtoxaq5nFbjQ==", "cpu": [ "ppc64" ], @@ -1740,9 +1726,9 @@ } }, "node_modules/@esbuild/android-arm": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.24.2.tgz", - "integrity": "sha512-tmwl4hJkCfNHwFB3nBa8z1Uy3ypZpxqxfTQOcHX+xRByyYgunVbZ9MzUUfb0RxaHIMnbHagwAxuTL+tnNM+1/Q==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.1.tgz", + "integrity": "sha512-dp+MshLYux6j/JjdqVLnMglQlFu+MuVeNrmT5nk6q07wNhCdSnB7QZj+7G8VMUGh1q+vj2Bq8kRsuyA00I/k+Q==", "cpu": [ "arm" ], @@ -1757,9 +1743,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.24.2.tgz", - "integrity": "sha512-cNLgeqCqV8WxfcTIOeL4OAtSmL8JjcN6m09XIgro1Wi7cF4t/THaWEa7eL5CMoMBdjoHOTh/vwTO/o2TRXIyzg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.1.tgz", + "integrity": "sha512-50tM0zCJW5kGqgG7fQ7IHvQOcAn9TKiVRuQ/lN0xR+T2lzEFvAi1ZcS8DiksFcEpf1t/GYOeOfCAgDHFpkiSmA==", "cpu": [ "arm64" ], @@ -1774,9 +1760,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.24.2.tgz", - "integrity": "sha512-B6Q0YQDqMx9D7rvIcsXfmJfvUYLoP722bgfBlO5cGvNVb5V/+Y7nhBE3mHV9OpxBf4eAS2S68KZztiPaWq4XYw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.1.tgz", + "integrity": "sha512-GCj6WfUtNldqUzYkN/ITtlhwQqGWu9S45vUXs7EIYf+7rCiiqH9bCloatO9VhxsL0Pji+PF4Lz2XXCES+Q8hDw==", "cpu": [ "x64" ], @@ -1791,9 +1777,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.24.2.tgz", - "integrity": "sha512-kj3AnYWc+CekmZnS5IPu9D+HWtUI49hbnyqk0FLEJDbzCIQt7hg7ucF1SQAilhtYpIujfaHr6O0UHlzzSPdOeA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.1.tgz", + "integrity": "sha512-5hEZKPf+nQjYoSr/elb62U19/l1mZDdqidGfmFutVUjjUZrOazAtwK+Kr+3y0C/oeJfLlxo9fXb1w7L+P7E4FQ==", "cpu": [ "arm64" ], @@ -1808,9 +1794,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.24.2.tgz", - "integrity": "sha512-WeSrmwwHaPkNR5H3yYfowhZcbriGqooyu3zI/3GGpF8AyUdsrrP0X6KumITGA9WOyiJavnGZUwPGvxvwfWPHIA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.1.tgz", + "integrity": "sha512-hxVnwL2Dqs3fM1IWq8Iezh0cX7ZGdVhbTfnOy5uURtao5OIVCEyj9xIzemDi7sRvKsuSdtCAhMKarxqtlyVyfA==", "cpu": [ "x64" ], @@ -1825,9 +1811,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.24.2.tgz", - "integrity": "sha512-UN8HXjtJ0k/Mj6a9+5u6+2eZ2ERD7Edt1Q9IZiB5UZAIdPnVKDoG7mdTVGhHJIeEml60JteamR3qhsr1r8gXvg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.1.tgz", + "integrity": "sha512-1MrCZs0fZa2g8E+FUo2ipw6jw5qqQiH+tERoS5fAfKnRx6NXH31tXBKI3VpmLijLH6yriMZsxJtaXUyFt/8Y4A==", "cpu": [ "arm64" ], @@ -1842,9 +1828,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.24.2.tgz", - "integrity": "sha512-TvW7wE/89PYW+IevEJXZ5sF6gJRDY/14hyIGFXdIucxCsbRmLUcjseQu1SyTko+2idmCw94TgyaEZi9HUSOe3Q==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.1.tgz", + "integrity": "sha512-0IZWLiTyz7nm0xuIs0q1Y3QWJC52R8aSXxe40VUxm6BB1RNmkODtW6LHvWRrGiICulcX7ZvyH6h5fqdLu4gkww==", "cpu": [ "x64" ], @@ -1859,9 +1845,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.24.2.tgz", - "integrity": "sha512-n0WRM/gWIdU29J57hJyUdIsk0WarGd6To0s+Y+LwvlC55wt+GT/OgkwoXCXvIue1i1sSNWblHEig00GBWiJgfA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.1.tgz", + "integrity": "sha512-NdKOhS4u7JhDKw9G3cY6sWqFcnLITn6SqivVArbzIaf3cemShqfLGHYMx8Xlm/lBit3/5d7kXvriTUGa5YViuQ==", "cpu": [ "arm" ], @@ -1876,9 +1862,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.24.2.tgz", - "integrity": "sha512-7HnAD6074BW43YvvUmE/35Id9/NB7BeX5EoNkK9obndmZBUk8xmJJeU7DwmUeN7tkysslb2eSl6CTrYz6oEMQg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.1.tgz", + "integrity": "sha512-jaN3dHi0/DDPelk0nLcXRm1q7DNJpjXy7yWaWvbfkPvI+7XNSc/lDOnCLN7gzsyzgu6qSAmgSvP9oXAhP973uQ==", "cpu": [ "arm64" ], @@ -1893,9 +1879,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.24.2.tgz", - "integrity": "sha512-sfv0tGPQhcZOgTKO3oBE9xpHuUqguHvSo4jl+wjnKwFpapx+vUDcawbwPNuBIAYdRAvIDBfZVvXprIj3HA+Ugw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.1.tgz", + "integrity": "sha512-OJykPaF4v8JidKNGz8c/q1lBO44sQNUQtq1KktJXdBLn1hPod5rE/Hko5ugKKZd+D2+o1a9MFGUEIUwO2YfgkQ==", "cpu": [ "ia32" ], @@ -1910,9 +1896,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.24.2.tgz", - "integrity": "sha512-CN9AZr8kEndGooS35ntToZLTQLHEjtVB5n7dl8ZcTZMonJ7CCfStrYhrzF97eAecqVbVJ7APOEe18RPI4KLhwQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.1.tgz", + "integrity": "sha512-nGfornQj4dzcq5Vp835oM/o21UMlXzn79KobKlcs3Wz9smwiifknLy4xDCLUU0BWp7b/houtdrgUz7nOGnfIYg==", "cpu": [ "loong64" ], @@ -1927,9 +1913,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.24.2.tgz", - "integrity": "sha512-iMkk7qr/wl3exJATwkISxI7kTcmHKE+BlymIAbHO8xanq/TjHaaVThFF6ipWzPHryoFsesNQJPE/3wFJw4+huw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.1.tgz", + "integrity": "sha512-1osBbPEFYwIE5IVB/0g2X6i1qInZa1aIoj1TdL4AaAb55xIIgbg8Doq6a5BzYWgr+tEcDzYH67XVnTmUzL+nXg==", "cpu": [ "mips64el" ], @@ -1944,9 +1930,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.24.2.tgz", - "integrity": "sha512-shsVrgCZ57Vr2L8mm39kO5PPIb+843FStGt7sGGoqiiWYconSxwTiuswC1VJZLCjNiMLAMh34jg4VSEQb+iEbw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.1.tgz", + "integrity": "sha512-/6VBJOwUf3TdTvJZ82qF3tbLuWsscd7/1w+D9LH0W/SqUgM5/JJD0lrJ1fVIfZsqB6RFmLCe0Xz3fmZc3WtyVg==", "cpu": [ "ppc64" ], @@ -1961,9 +1947,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.24.2.tgz", - "integrity": "sha512-4eSFWnU9Hhd68fW16GD0TINewo1L6dRrB+oLNNbYyMUAeOD2yCK5KXGK1GH4qD/kT+bTEXjsyTCiJGHPZ3eM9Q==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.1.tgz", + "integrity": "sha512-nSut/Mx5gnilhcq2yIMLMe3Wl4FK5wx/o0QuuCLMtmJn+WeWYoEGDN1ipcN72g1WHsnIbxGXd4i/MF0gTcuAjQ==", "cpu": [ "riscv64" ], @@ -1978,9 +1964,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.24.2.tgz", - "integrity": "sha512-S0Bh0A53b0YHL2XEXC20bHLuGMOhFDO6GN4b3YjRLK//Ep3ql3erpNcPlEFed93hsQAjAQDNsvcK+hV90FubSw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.1.tgz", + "integrity": "sha512-cEECeLlJNfT8kZHqLarDBQso9a27o2Zd2AQ8USAEoGtejOrCYHNtKP8XQhMDJMtthdF4GBmjR2au3x1udADQQQ==", "cpu": [ "s390x" ], @@ -1995,9 +1981,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.24.2.tgz", - "integrity": "sha512-8Qi4nQcCTbLnK9WoMjdC9NiTG6/E38RNICU6sUNqK0QFxCYgoARqVqxdFmWkdonVsvGqWhmm7MO0jyTqLqwj0Q==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.1.tgz", + "integrity": "sha512-xbfUhu/gnvSEg+EGovRc+kjBAkrvtk38RlerAzQxvMzlB4fXpCFCeUAYzJvrnhFtdeyVCDANSjJvOvGYoeKzFA==", "cpu": [ "x64" ], @@ -2012,9 +1998,9 @@ } }, "node_modules/@esbuild/netbsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.24.2.tgz", - "integrity": "sha512-wuLK/VztRRpMt9zyHSazyCVdCXlpHkKm34WUyinD2lzK07FAHTq0KQvZZlXikNWkDGoT6x3TD51jKQ7gMVpopw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.1.tgz", + "integrity": "sha512-O96poM2XGhLtpTh+s4+nP7YCCAfb4tJNRVZHfIE7dgmax+yMP2WgMd2OecBuaATHKTHsLWHQeuaxMRnCsH8+5g==", "cpu": [ "arm64" ], @@ -2029,9 +2015,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.24.2.tgz", - "integrity": "sha512-VefFaQUc4FMmJuAxmIHgUmfNiLXY438XrL4GDNV1Y1H/RW3qow68xTwjZKfj/+Plp9NANmzbH5R40Meudu8mmw==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.1.tgz", + "integrity": "sha512-X53z6uXip6KFXBQ+Krbx25XHV/NCbzryM6ehOAeAil7X7oa4XIq+394PWGnwaSQ2WRA0KI6PUO6hTO5zeF5ijA==", "cpu": [ "x64" ], @@ -2046,9 +2032,9 @@ } }, "node_modules/@esbuild/openbsd-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.24.2.tgz", - "integrity": "sha512-YQbi46SBct6iKnszhSvdluqDmxCJA+Pu280Av9WICNwQmMxV7nLRHZfjQzwbPs3jeWnuAhE9Jy0NrnJ12Oz+0A==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.1.tgz", + "integrity": "sha512-Na9T3szbXezdzM/Kfs3GcRQNjHzM6GzFBeU1/6IV/npKP5ORtp9zbQjvkDJ47s6BCgaAZnnnu/cY1x342+MvZg==", "cpu": [ "arm64" ], @@ -2063,9 +2049,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.24.2.tgz", - "integrity": "sha512-+iDS6zpNM6EnJyWv0bMGLWSWeXGN/HTaF/LXHXHwejGsVi+ooqDfMCCTerNFxEkM3wYVcExkeGXNqshc9iMaOA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.1.tgz", + "integrity": "sha512-T3H78X2h1tszfRSf+txbt5aOp/e7TAz3ptVKu9Oyir3IAOFPGV6O9c2naym5TOriy1l0nNf6a4X5UXRZSGX/dw==", "cpu": [ "x64" ], @@ -2080,9 +2066,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.24.2.tgz", - "integrity": "sha512-hTdsW27jcktEvpwNHJU4ZwWFGkz2zRJUz8pvddmXPtXDzVKTTINmlmga3ZzwcuMpUvLw7JkLy9QLKyGpD2Yxig==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.1.tgz", + "integrity": "sha512-2H3RUvcmULO7dIE5EWJH8eubZAI4xw54H1ilJnRNZdeo8dTADEZ21w6J22XBkXqGJbe0+wnNJtw3UXRoLJnFEg==", "cpu": [ "x64" ], @@ -2097,9 +2083,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.24.2.tgz", - "integrity": "sha512-LihEQ2BBKVFLOC9ZItT9iFprsE9tqjDjnbulhHoFxYQtQfai7qfluVODIYxt1PgdoyQkz23+01rzwNwYfutxUQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.1.tgz", + "integrity": "sha512-GE7XvrdOzrb+yVKB9KsRMq+7a2U/K5Cf/8grVFRAGJmfADr/e/ODQ134RK2/eeHqYV5eQRFxb1hY7Nr15fv1NQ==", "cpu": [ "arm64" ], @@ -2114,9 +2100,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.24.2.tgz", - "integrity": "sha512-q+iGUwfs8tncmFC9pcnD5IvRHAzmbwQ3GPS5/ceCyHdjXubwQWI12MKWSNSMYLJMq23/IUCvJMS76PDqXe1fxA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.1.tgz", + "integrity": "sha512-uOxSJCIcavSiT6UnBhBzE8wy3n0hOkJsBOzy7HDAuTDE++1DJMRRVCPGisULScHL+a/ZwdXPpXD3IyFKjA7K8A==", "cpu": [ "ia32" ], @@ -2131,9 +2117,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.24.2.tgz", - "integrity": "sha512-7VTgWzgMGvup6aSqDPLiW5zHaxYJGTO4OokMjIlrCtf+VpEL+cXKtCvg723iguPYI5oaUNdS+/V7OU2gvXVWEg==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.1.tgz", + "integrity": "sha512-Y1EQdcfwMSeQN/ujR5VayLOJ1BHaK+ssyk0AEzPjC+t1lITgsnccPqFjb6V+LsTp/9Iov4ysfjxLaGJ9RPtkVg==", "cpu": [ "x64" ], @@ -2605,9 +2591,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.34.8.tgz", - "integrity": "sha512-q217OSE8DTp8AFHuNHXo0Y86e1wtlfVrXiAlwkIvGRQv9zbc6mE3sjIVfwI8sYUyNxwOg0j/Vm1RKM04JcWLJw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.35.0.tgz", + "integrity": "sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==", "cpu": [ "arm" ], @@ -2619,9 +2605,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.34.8.tgz", - "integrity": "sha512-Gigjz7mNWaOL9wCggvoK3jEIUUbGul656opstjaUSGC3eT0BM7PofdAJaBfPFWWkXNVAXbaQtC99OCg4sJv70Q==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.35.0.tgz", + "integrity": "sha512-FtKddj9XZudurLhdJnBl9fl6BwCJ3ky8riCXjEw3/UIbjmIY58ppWwPEvU3fNu+W7FUsAsB1CdH+7EQE6CXAPA==", "cpu": [ "arm64" ], @@ -2633,9 +2619,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.34.8.tgz", - "integrity": "sha512-02rVdZ5tgdUNRxIUrFdcMBZQoaPMrxtwSb+/hOfBdqkatYHR3lZ2A2EGyHq2sGOd0Owk80oV3snlDASC24He3Q==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.35.0.tgz", + "integrity": "sha512-Uk+GjOJR6CY844/q6r5DR/6lkPFOw0hjfOIzVx22THJXMxktXG6CbejseJFznU8vHcEBLpiXKY3/6xc+cBm65Q==", "cpu": [ "arm64" ], @@ -2647,9 +2633,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.34.8.tgz", - "integrity": "sha512-qIP/elwR/tq/dYRx3lgwK31jkZvMiD6qUtOycLhTzCvrjbZ3LjQnEM9rNhSGpbLXVJYQ3rq39A6Re0h9tU2ynw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.35.0.tgz", + "integrity": "sha512-3IrHjfAS6Vkp+5bISNQnPogRAW5GAV1n+bNCrDwXmfMHbPl5EhTmWtfmwlJxFRUCBZ+tZ/OxDyU08aF6NI/N5Q==", "cpu": [ "x64" ], @@ -2661,9 +2647,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.34.8.tgz", - "integrity": "sha512-IQNVXL9iY6NniYbTaOKdrlVP3XIqazBgJOVkddzJlqnCpRi/yAeSOa8PLcECFSQochzqApIOE1GHNu3pCz+BDA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.35.0.tgz", + "integrity": "sha512-sxjoD/6F9cDLSELuLNnY0fOrM9WA0KrM0vWm57XhrIMf5FGiN8D0l7fn+bpUeBSU7dCgPV2oX4zHAsAXyHFGcQ==", "cpu": [ "arm64" ], @@ -2675,9 +2661,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.34.8.tgz", - "integrity": "sha512-TYXcHghgnCqYFiE3FT5QwXtOZqDj5GmaFNTNt3jNC+vh22dc/ukG2cG+pi75QO4kACohZzidsq7yKTKwq/Jq7Q==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.35.0.tgz", + "integrity": "sha512-2mpHCeRuD1u/2kruUiHSsnjWtHjqVbzhBkNVQ1aVD63CcexKVcQGwJ2g5VphOd84GvxfSvnnlEyBtQCE5hxVVw==", "cpu": [ "x64" ], @@ -2689,9 +2675,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.34.8.tgz", - "integrity": "sha512-A4iphFGNkWRd+5m3VIGuqHnG3MVnqKe7Al57u9mwgbyZ2/xF9Jio72MaY7xxh+Y87VAHmGQr73qoKL9HPbXj1g==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.35.0.tgz", + "integrity": "sha512-mrA0v3QMy6ZSvEuLs0dMxcO2LnaCONs1Z73GUDBHWbY8tFFocM6yl7YyMu7rz4zS81NDSqhrUuolyZXGi8TEqg==", "cpu": [ "arm" ], @@ -2703,9 +2689,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.34.8.tgz", - "integrity": "sha512-S0lqKLfTm5u+QTxlFiAnb2J/2dgQqRy/XvziPtDd1rKZFXHTyYLoVL58M/XFwDI01AQCDIevGLbQrMAtdyanpA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.35.0.tgz", + "integrity": "sha512-DnYhhzcvTAKNexIql8pFajr0PiDGrIsBYPRvCKlA5ixSS3uwo/CWNZxB09jhIapEIg945KOzcYEAGGSmTSpk7A==", "cpu": [ "arm" ], @@ -2717,9 +2703,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.34.8.tgz", - "integrity": "sha512-jpz9YOuPiSkL4G4pqKrus0pn9aYwpImGkosRKwNi+sJSkz+WU3anZe6hi73StLOQdfXYXC7hUfsQlTnjMd3s1A==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.35.0.tgz", + "integrity": "sha512-uagpnH2M2g2b5iLsCTZ35CL1FgyuzzJQ8L9VtlJ+FckBXroTwNOaD0z0/UF+k5K3aNQjbm8LIVpxykUOQt1m/A==", "cpu": [ "arm64" ], @@ -2731,9 +2717,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.34.8.tgz", - "integrity": "sha512-KdSfaROOUJXgTVxJNAZ3KwkRc5nggDk+06P6lgi1HLv1hskgvxHUKZ4xtwHkVYJ1Rep4GNo+uEfycCRRxht7+Q==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.35.0.tgz", + "integrity": "sha512-XQxVOCd6VJeHQA/7YcqyV0/88N6ysSVzRjJ9I9UA/xXpEsjvAgDTgH3wQYz5bmr7SPtVK2TsP2fQ2N9L4ukoUg==", "cpu": [ "arm64" ], @@ -2745,9 +2731,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.34.8.tgz", - "integrity": "sha512-NyF4gcxwkMFRjgXBM6g2lkT58OWztZvw5KkV2K0qqSnUEqCVcqdh2jN4gQrTn/YUpAcNKyFHfoOZEer9nwo6uQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.35.0.tgz", + "integrity": "sha512-5pMT5PzfgwcXEwOaSrqVsz/LvjDZt+vQ8RT/70yhPU06PTuq8WaHhfT1LW+cdD7mW6i/J5/XIkX/1tCAkh1W6g==", "cpu": [ "loong64" ], @@ -2759,9 +2745,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.34.8.tgz", - "integrity": "sha512-LMJc999GkhGvktHU85zNTDImZVUCJ1z/MbAJTnviiWmmjyckP5aQsHtcujMjpNdMZPT2rQEDBlJfubhs3jsMfw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.35.0.tgz", + "integrity": "sha512-c+zkcvbhbXF98f4CtEIP1EBA/lCic5xB0lToneZYvMeKu5Kamq3O8gqrxiYYLzlZH6E3Aq+TSW86E4ay8iD8EA==", "cpu": [ "ppc64" ], @@ -2773,9 +2759,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.34.8.tgz", - "integrity": "sha512-xAQCAHPj8nJq1PI3z8CIZzXuXCstquz7cIOL73HHdXiRcKk8Ywwqtx2wrIy23EcTn4aZ2fLJNBB8d0tQENPCmw==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.35.0.tgz", + "integrity": "sha512-s91fuAHdOwH/Tad2tzTtPX7UZyytHIRR6V4+2IGlV0Cej5rkG0R61SX4l4y9sh0JBibMiploZx3oHKPnQBKe4g==", "cpu": [ "riscv64" ], @@ -2787,9 +2773,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.34.8.tgz", - "integrity": "sha512-DdePVk1NDEuc3fOe3dPPTb+rjMtuFw89gw6gVWxQFAuEqqSdDKnrwzZHrUYdac7A7dXl9Q2Vflxpme15gUWQFA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.35.0.tgz", + "integrity": "sha512-hQRkPQPLYJZYGP+Hj4fR9dDBMIM7zrzJDWFEMPdTnTy95Ljnv0/4w/ixFw3pTBMEuuEuoqtBINYND4M7ujcuQw==", "cpu": [ "s390x" ], @@ -2801,9 +2787,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.34.8.tgz", - "integrity": "sha512-8y7ED8gjxITUltTUEJLQdgpbPh1sUQ0kMTmufRF/Ns5tI9TNMNlhWtmPKKHCU0SilX+3MJkZ0zERYYGIVBYHIA==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.35.0.tgz", + "integrity": "sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==", "cpu": [ "x64" ], @@ -2815,9 +2801,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.34.8.tgz", - "integrity": "sha512-SCXcP0ZpGFIe7Ge+McxY5zKxiEI5ra+GT3QRxL0pMMtxPfpyLAKleZODi1zdRHkz5/BhueUrYtYVgubqe9JBNQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.35.0.tgz", + "integrity": "sha512-QysqXzYiDvQWfUiTm8XmJNO2zm9yC9P/2Gkrwg2dH9cxotQzunBHYr6jk4SujCTqnfGxduOmQcI7c2ryuW8XVg==", "cpu": [ "x64" ], @@ -2829,9 +2815,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.34.8.tgz", - "integrity": "sha512-YHYsgzZgFJzTRbth4h7Or0m5O74Yda+hLin0irAIobkLQFRQd1qWmnoVfwmKm9TXIZVAD0nZ+GEb2ICicLyCnQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.35.0.tgz", + "integrity": "sha512-OUOlGqPkVJCdJETKOCEf1mw848ZyJ5w50/rZ/3IBQVdLfR5jk/6Sr5m3iO2tdPgwo0x7VcncYuOvMhBWZq8ayg==", "cpu": [ "arm64" ], @@ -2843,9 +2829,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.34.8.tgz", - "integrity": "sha512-r3NRQrXkHr4uWy5TOjTpTYojR9XmF0j/RYgKCef+Ag46FWUTltm5ziticv8LdNsDMehjJ543x/+TJAek/xBA2w==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.35.0.tgz", + "integrity": "sha512-2/lsgejMrtwQe44glq7AFFHLfJBPafpsTa6JvP2NGef/ifOa4KBoglVf7AKN7EV9o32evBPRqfg96fEHzWo5kw==", "cpu": [ "ia32" ], @@ -2857,9 +2843,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.34.8.tgz", - "integrity": "sha512-U0FaE5O1BCpZSeE6gBl3c5ObhePQSfk9vDRToMmTkbhCOgW4jqvtS5LGyQ76L1fH8sM0keRp4uDTsbjiUyjk0g==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.35.0.tgz", + "integrity": "sha512-PIQeY5XDkrOysbQblSW7v3l1MDZzkTEzAfTPkj5VAu3FW8fS4ynyLg2sINp0fp3SjZ8xkRYpLqoKcYqAkhU1dw==", "cpu": [ "x64" ], @@ -3147,9 +3133,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.13.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.5.tgz", - "integrity": "sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==", + "version": "22.13.10", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz", + "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", "dev": true, "license": "MIT", "dependencies": { @@ -3245,9 +3231,9 @@ "license": "MIT" }, "node_modules/@types/ws": { - "version": "8.5.14", - "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.14.tgz", - "integrity": "sha512-bd/YFLW+URhBzMXurx7lWByOu+xzU9+kb3RboOteXYDfW+tr+JZa99OyNmPINEGB/ahzKrEuc8rcv4gnpJmxTw==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8svvI3hMyvN0kKCJMvTJP/x6Y/EoQbepff882wL+Sn5QsXb3etnamgrJq4isrBxSJj5L2AuXcI0+bgkoAXGUJw==", "dev": true, "license": "MIT", "dependencies": { @@ -3639,9 +3625,9 @@ } }, "node_modules/acorn": { - "version": "8.14.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", - "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", + "version": "8.14.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz", + "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==", "dev": true, "license": "MIT", "bin": { @@ -3658,9 +3644,9 @@ "license": "MIT" }, "node_modules/ag-charts-types": { - "version": "10.3.3", - "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.3.3.tgz", - "integrity": "sha512-8rmyquaTkwfP4Lzei/W/cbkq9wwEl8+grIo3z97mtxrMIXh9sHJK1oJipd/u08MmBZrca5Jjtn5F1+UNPu/4fQ==", + "version": "10.3.4", + "resolved": "https://registry.npmjs.org/ag-charts-types/-/ag-charts-types-10.3.4.tgz", + "integrity": "sha512-MU+3gvKn1jEyLlMHS0Vu0nHmIQxiVJAnA6ftUatLZvV0c7hOWap4VWghqZ0cVZUJsCdMI59Iuq1u3xquKv4LOQ==", "license": "MIT" }, "node_modules/ajv": { @@ -3733,9 +3719,9 @@ } }, "node_modules/alpinejs": { - "version": "3.14.8", - "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.14.8.tgz", - "integrity": "sha512-wT2fuP2DXpGk/jKaglwy7S/IJpm1FD+b7U6zUrhwErjoq5h27S4dxkJEXVvhbdwyPv9U+3OkUuNLkZT4h2Kfrg==", + "version": "3.14.9", + "resolved": "https://registry.npmjs.org/alpinejs/-/alpinejs-3.14.9.tgz", + "integrity": "sha512-gqSOhTEyryU9FhviNqiHBHzgjkvtukq9tevew29fTj+ofZtfsYriw4zPirHHOAy9bw8QoL3WGhyk7QqCh5AYlw==", "license": "MIT", "dependencies": { "@vue/reactivity": "~3.1.1" @@ -3876,9 +3862,9 @@ } }, "node_modules/autoprefixer": { - "version": "10.4.20", - "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.20.tgz", - "integrity": "sha512-XY25y5xSv/wEoqzDyXXME4AFfkZI0P23z6Fs3YgymDnKJkCGOnkL0iTxCa85UTqaSgfcqyf3UA6+c7wUvx/16g==", + "version": "10.4.21", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.21.tgz", + "integrity": "sha512-O+A6LWV5LDHSJD3LjHYoNi4VLsj/Whi7k6zG12xTYaU4cQ8oxQGckXNX8cRHK5yOZ/ppVHe0ZBXGzSV9jXdVbQ==", "dev": true, "funding": [ { @@ -3896,11 +3882,11 @@ ], "license": "MIT", "dependencies": { - "browserslist": "^4.23.3", - "caniuse-lite": "^1.0.30001646", + "browserslist": "^4.24.4", + "caniuse-lite": "^1.0.30001702", "fraction.js": "^4.3.7", "normalize-range": "^0.1.2", - "picocolors": "^1.0.1", + "picocolors": "^1.1.1", "postcss-value-parser": "^4.2.0" }, "bin": { @@ -3914,9 +3900,9 @@ } }, "node_modules/axios": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.2.tgz", - "integrity": "sha512-ls4GYBm5aig9vWx8AWDSGLpnpDQRtWAfrjU+EuytuODrFBkqesN2RkOQCBzrA1RQNHw1SmRMSDDDSwzNAYQ6Rg==", + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.3.tgz", + "integrity": "sha512-iP4DebzoNlP/YN2dpwCgb8zoCmhtkajzS48JvwmkSkXvPI3DHc7m+XYL5tGnSlJtR6nImXZmdCuN5aP8dh1d8A==", "dev": true, "license": "MIT", "dependencies": { @@ -3971,14 +3957,14 @@ } }, "node_modules/babel-plugin-polyfill-corejs3": { - "version": "0.10.6", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.10.6.tgz", - "integrity": "sha512-b37+KR2i/khY5sKmWNVQAnitvquQbNdWy6lJdsr0kmquCKEEUgMKK4SboVM3HtfnZilfjr4MMQ7vY58FVWDtIA==", + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.11.1.tgz", + "integrity": "sha512-yGCqvBT4rwMczo28xkH/noxJ6MZ4nJfkVYdoDaC/utLtWrXxv27HVrzAeSbqR8SxDsp46n0YF47EbHoixy6rXQ==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.2", - "core-js-compat": "^3.38.0" + "@babel/helper-define-polyfill-provider": "^0.6.3", + "core-js-compat": "^3.40.0" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" @@ -4172,9 +4158,9 @@ "license": "MIT" }, "node_modules/bootstrap5-autocomplete": { - "version": "1.1.36", - "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.36.tgz", - "integrity": "sha512-fZpklymmrwAls3n6YDMua2msnBB4pwmJgJgqMayHLfnvvc2dhKWwp/qu0pGJI99S8TwC+ZDjYtEsfl+4/FEZhg==", + "version": "1.1.38", + "resolved": "https://registry.npmjs.org/bootstrap5-autocomplete/-/bootstrap5-autocomplete-1.1.38.tgz", + "integrity": "sha512-gw/66uyiKL+XioGxnIdzFwyvma/KlbD/hNIwnIAhzb1TNTWSFURPqOzMXaDuw2vD0DCtASjsJm4uydAzlaDaZQ==", "license": "MIT" }, "node_modules/bootstrap5-tags": { @@ -4411,14 +4397,14 @@ } }, "node_modules/call-bound": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.3.tgz", - "integrity": "sha512-YTd+6wGlNlPxSuri7Y6X8tY2dmm12UMH66RpKMhiX6rsk5wXXnYgbUcOt8kiS31/AjfoTOvCsE+w8nZQLQnzHA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", - "get-intrinsic": "^1.2.6" + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" }, "engines": { "node": ">= 0.4" @@ -4462,9 +4448,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001700", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001700.tgz", - "integrity": "sha512-2S6XIXwaE7K7erT8dY+kLQcpa5ms63XlRkMkReXjle+kf6c5g38vyMl+Z5y8dSxOFDhcFe+nxnn261PLxBSQsQ==", + "version": "1.0.30001705", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001705.tgz", + "integrity": "sha512-S0uyMMiYvA7CxNgomYBwwwPUnWzFD83f3B1ce5jHUfHTH//QL6hHsreI8RVC5606R4ssqravelYO5TU6t8sEyg==", "dev": true, "funding": [ { @@ -4906,13 +4892,13 @@ "license": "MIT" }, "node_modules/core-js-compat": { - "version": "3.40.0", - "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.40.0.tgz", - "integrity": "sha512-0XEDpr5y5mijvw8Lbc6E5AkjrHfp7eEoPlu36SWeAbcL8fn1G1ANe8DBlo2XoNN89oVpxWwOjYIPVzR4ZvsKCQ==", + "version": "3.41.0", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.41.0.tgz", + "integrity": "sha512-RFsU9LySVue9RTwdDVX/T0e2Y6jRYWXERKElIjpuEOEnxaXffI0X7RUwVzfYLfzuLXSNJDYoRYUAmRUcyln20A==", "dev": true, "license": "MIT", "dependencies": { - "browserslist": "^4.24.3" + "browserslist": "^4.24.4" }, "funding": { "type": "opencollective", @@ -5677,9 +5663,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.103", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.103.tgz", - "integrity": "sha512-P6+XzIkfndgsrjROJWfSvVEgNHtPgbhVyTkwLjUM2HU/h7pZRORgaTlHqfAikqxKmdJMLW8fftrdGWbd/Ds0FA==", + "version": "1.5.119", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.119.tgz", + "integrity": "sha512-Ku4NMzUjz3e3Vweh7PhApPrZSS4fyiCIbcIrG9eKrriYVLmbMepETR/v6SU7xPm98QTqMSYiCwfO89QNjXLkbQ==", "dev": true, "license": "ISC" }, @@ -5840,9 +5826,9 @@ } }, "node_modules/esbuild": { - "version": "0.24.2", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.24.2.tgz", - "integrity": "sha512-+9egpBW8I3CD5XPe0n6BfT5fxLzxrlDzqydF3aviG+9ni1lDC/OvMHcxqEFV0+LANZG5R1bFMWfUrjVsdwxJvA==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.1.tgz", + "integrity": "sha512-BGO5LtrGC7vxnqucAe/rmvKdJllfGaYWdyABvyMoXQlfYMb2bbRuReWR5tEGE//4LcNJj9XrkovTqNYRFZHAMQ==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -5853,31 +5839,31 @@ "node": ">=18" }, "optionalDependencies": { - "@esbuild/aix-ppc64": "0.24.2", - "@esbuild/android-arm": "0.24.2", - "@esbuild/android-arm64": "0.24.2", - "@esbuild/android-x64": "0.24.2", - "@esbuild/darwin-arm64": "0.24.2", - "@esbuild/darwin-x64": "0.24.2", - "@esbuild/freebsd-arm64": "0.24.2", - "@esbuild/freebsd-x64": "0.24.2", - "@esbuild/linux-arm": "0.24.2", - "@esbuild/linux-arm64": "0.24.2", - "@esbuild/linux-ia32": "0.24.2", - "@esbuild/linux-loong64": "0.24.2", - "@esbuild/linux-mips64el": "0.24.2", - "@esbuild/linux-ppc64": "0.24.2", - "@esbuild/linux-riscv64": "0.24.2", - "@esbuild/linux-s390x": "0.24.2", - "@esbuild/linux-x64": "0.24.2", - "@esbuild/netbsd-arm64": "0.24.2", - "@esbuild/netbsd-x64": "0.24.2", - "@esbuild/openbsd-arm64": "0.24.2", - "@esbuild/openbsd-x64": "0.24.2", - "@esbuild/sunos-x64": "0.24.2", - "@esbuild/win32-arm64": "0.24.2", - "@esbuild/win32-ia32": "0.24.2", - "@esbuild/win32-x64": "0.24.2" + "@esbuild/aix-ppc64": "0.25.1", + "@esbuild/android-arm": "0.25.1", + "@esbuild/android-arm64": "0.25.1", + "@esbuild/android-x64": "0.25.1", + "@esbuild/darwin-arm64": "0.25.1", + "@esbuild/darwin-x64": "0.25.1", + "@esbuild/freebsd-arm64": "0.25.1", + "@esbuild/freebsd-x64": "0.25.1", + "@esbuild/linux-arm": "0.25.1", + "@esbuild/linux-arm64": "0.25.1", + "@esbuild/linux-ia32": "0.25.1", + "@esbuild/linux-loong64": "0.25.1", + "@esbuild/linux-mips64el": "0.25.1", + "@esbuild/linux-ppc64": "0.25.1", + "@esbuild/linux-riscv64": "0.25.1", + "@esbuild/linux-s390x": "0.25.1", + "@esbuild/linux-x64": "0.25.1", + "@esbuild/netbsd-arm64": "0.25.1", + "@esbuild/netbsd-x64": "0.25.1", + "@esbuild/openbsd-arm64": "0.25.1", + "@esbuild/openbsd-x64": "0.25.1", + "@esbuild/sunos-x64": "0.25.1", + "@esbuild/win32-arm64": "0.25.1", + "@esbuild/win32-ia32": "0.25.1", + "@esbuild/win32-x64": "0.25.1" } }, "node_modules/escalade": { @@ -6162,9 +6148,9 @@ } }, "node_modules/fastq": { - "version": "1.19.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.0.tgz", - "integrity": "sha512-7SFSRCNjBQIZH/xZR3iy5iQYR8aGBE0h3VG6/cwlbrpdciNYBMotQav8c1XI3HjHH+NikUpP53nPdlZSdWmFzA==", + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.19.1.tgz", + "integrity": "sha512-GwLTyxkCXjXbxqIhTsMI2Nui8huMPtnxg7krajPJAjnEG/iiOS7i+zCtWGZR9G0NBKbXKh6X9m9UIsYX/N6vvQ==", "dev": true, "license": "ISC", "dependencies": { @@ -6491,18 +6477,18 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.7.tgz", - "integrity": "sha512-VW6Pxhsrk0KAOqs3WEd0klDiF/+V7gQOpAvY1jVU/LHmaD/kQO4523aiJuikX/QAKYiW6x8Jh+RJej1almdtCA==", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, "license": "MIT", "dependencies": { - "call-bind-apply-helpers": "^1.0.1", + "call-bind-apply-helpers": "^1.0.2", "es-define-property": "^1.0.1", "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", + "es-object-atoms": "^1.1.1", "function-bind": "^1.1.2", - "get-proto": "^1.0.0", + "get-proto": "^1.0.1", "gopd": "^1.2.0", "has-symbols": "^1.1.0", "hasown": "^2.0.2", @@ -7021,9 +7007,9 @@ } }, "node_modules/i18next": { - "version": "24.2.2", - "resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.2.tgz", - "integrity": "sha512-NE6i86lBCKRYZa5TaUDkU5S4HFgLIEJRLr3Whf2psgaxBleQ2LC1YW1Vc+SCgkAW7VEzndT6al6+CzegSUHcTQ==", + "version": "24.2.3", + "resolved": "https://registry.npmjs.org/i18next/-/i18next-24.2.3.tgz", + "integrity": "sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A==", "funding": [ { "type": "individual", @@ -7040,7 +7026,7 @@ ], "license": "MIT", "dependencies": { - "@babel/runtime": "^7.23.2" + "@babel/runtime": "^7.26.10" }, "peerDependencies": { "typescript": "^5" @@ -8225,9 +8211,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.8", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", - "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "version": "3.3.10", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz", + "integrity": "sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==", "dev": true, "funding": [ { @@ -9998,9 +9984,9 @@ } }, "node_modules/reusify": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", "dev": true, "license": "MIT", "engines": { @@ -10034,9 +10020,9 @@ } }, "node_modules/rollup": { - "version": "4.34.8", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.34.8.tgz", - "integrity": "sha512-489gTVMzAYdiZHFVA/ig/iYFllCcWFHMvUHI1rpFmkoUtRlQxqh6/yiNqnYibjMZ2b/+FUQwldG+aLsEt6bglQ==", + "version": "4.35.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.35.0.tgz", + "integrity": "sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==", "dev": true, "license": "MIT", "dependencies": { @@ -10050,25 +10036,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.34.8", - "@rollup/rollup-android-arm64": "4.34.8", - "@rollup/rollup-darwin-arm64": "4.34.8", - "@rollup/rollup-darwin-x64": "4.34.8", - "@rollup/rollup-freebsd-arm64": "4.34.8", - "@rollup/rollup-freebsd-x64": "4.34.8", - "@rollup/rollup-linux-arm-gnueabihf": "4.34.8", - "@rollup/rollup-linux-arm-musleabihf": "4.34.8", - "@rollup/rollup-linux-arm64-gnu": "4.34.8", - "@rollup/rollup-linux-arm64-musl": "4.34.8", - "@rollup/rollup-linux-loongarch64-gnu": "4.34.8", - "@rollup/rollup-linux-powerpc64le-gnu": "4.34.8", - "@rollup/rollup-linux-riscv64-gnu": "4.34.8", - "@rollup/rollup-linux-s390x-gnu": "4.34.8", - "@rollup/rollup-linux-x64-gnu": "4.34.8", - "@rollup/rollup-linux-x64-musl": "4.34.8", - "@rollup/rollup-win32-arm64-msvc": "4.34.8", - "@rollup/rollup-win32-ia32-msvc": "4.34.8", - "@rollup/rollup-win32-x64-msvc": "4.34.8", + "@rollup/rollup-android-arm-eabi": "4.35.0", + "@rollup/rollup-android-arm64": "4.35.0", + "@rollup/rollup-darwin-arm64": "4.35.0", + "@rollup/rollup-darwin-x64": "4.35.0", + "@rollup/rollup-freebsd-arm64": "4.35.0", + "@rollup/rollup-freebsd-x64": "4.35.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.35.0", + "@rollup/rollup-linux-arm-musleabihf": "4.35.0", + "@rollup/rollup-linux-arm64-gnu": "4.35.0", + "@rollup/rollup-linux-arm64-musl": "4.35.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.35.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.35.0", + "@rollup/rollup-linux-riscv64-gnu": "4.35.0", + "@rollup/rollup-linux-s390x-gnu": "4.35.0", + "@rollup/rollup-linux-x64-gnu": "4.35.0", + "@rollup/rollup-linux-x64-musl": "4.35.0", + "@rollup/rollup-win32-arm64-msvc": "4.35.0", + "@rollup/rollup-win32-ia32-msvc": "4.35.0", + "@rollup/rollup-win32-x64-msvc": "4.35.0", "fsevents": "~2.3.2" } }, @@ -10124,9 +10110,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.85.0", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.85.0.tgz", - "integrity": "sha512-3ToiC1xZ1Y8aU7+CkgCI/tqyuPXEmYGJXO7H4uqp0xkLXUqp88rQQ4j1HmP37xSJLbCJPaIiv+cT1y+grssrww==", + "version": "1.85.1", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.85.1.tgz", + "integrity": "sha512-Uk8WpxM5v+0cMR0XjX9KfRIacmSG86RH4DCCZjLU2rFh5tyutt9siAXJ7G+YfxQ99Q6wrRMbMlVl6KqUms71ag==", "dev": true, "license": "MIT", "dependencies": { @@ -10702,9 +10688,9 @@ } }, "node_modules/std-env": { - "version": "3.8.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.0.tgz", - "integrity": "sha512-Bc3YwwCB+OzldMxOXJIIvC6cPRWr/LxOp48CdQTOkPyk/t4JWWJbrilwBd7RJzKV8QW7tJkcgAmeuLLJugl5/w==", + "version": "3.8.1", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.8.1.tgz", + "integrity": "sha512-vj5lIj3Mwf9D79hBkltk5qmkFI+biIKWS2IBxEyEU3AX1tUf7AoL8nSazCOiiqQsGKIq01SClsKEzweu34uwvA==", "dev": true, "license": "MIT" }, @@ -10937,9 +10923,9 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.3.11", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.11.tgz", - "integrity": "sha512-RVCsMfuD0+cTt3EwX8hSl2Ks56EbFHWmhluwcqoPKtBnfjiT6olaq7PRIRfhyU8nnC2MrnDrBLfrD/RGE+cVXQ==", + "version": "5.3.14", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.3.14.tgz", + "integrity": "sha512-vkZjpUjb6OMS7dhV+tILUW6BhpDR7P2L/aQSAv+Uwk+m8KATX9EccViHTJR2qDtACKPIYndLGCyl3FMo+r2LMw==", "dev": true, "license": "MIT", "dependencies": { @@ -11218,9 +11204,9 @@ } }, "node_modules/update-browserslist-db": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.2.tgz", - "integrity": "sha512-PPypAm5qvlD7XMZC3BujecnaOxwhrtoFR+Dqkk5Aa/6DssiH0ibKoketaj9w8LP7Bont1rYeoV5plxD7RTEPRg==", + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.3.tgz", + "integrity": "sha512-UxhIZQ+QInVdunkDAaiazvvT/+fXL5Osr0JZlJulepYu6Jd7qJtDZjlur0emRlT71EN3ScPoE7gvsuIKKNavKw==", "dev": true, "funding": [ { @@ -11344,14 +11330,14 @@ } }, "node_modules/vite": { - "version": "6.1.1", - "resolved": "https://registry.npmjs.org/vite/-/vite-6.1.1.tgz", - "integrity": "sha512-4GgM54XrwRfrOp297aIYspIti66k56v16ZnqHvrIM7mG+HjDlAwS7p+Srr7J6fGvEdOJ5JcQ/D9T7HhtdXDTzA==", + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.2.2.tgz", + "integrity": "sha512-yW7PeMM+LkDzc7CgJuRLMW2Jz0FxMOsVJ8Lv3gpgW9WLcb9cTW+121UEr1hvmfR7w3SegR5ItvYyzVz1vxNJgQ==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.24.2", - "postcss": "^8.5.2", + "esbuild": "^0.25.0", + "postcss": "^8.5.3", "rollup": "^4.30.1" }, "bin": { From d960cc6ad7bc8f67636e5c580d36c71e4be2cae9 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 21 Mar 2025 05:36:58 +0100 Subject: [PATCH 47/52] Fix missing initialisation --- app/Providers/CurrencyServiceProvider.php | 16 ++++++++++++++++ app/Providers/FireflyServiceProvider.php | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/app/Providers/CurrencyServiceProvider.php b/app/Providers/CurrencyServiceProvider.php index 5ba0966719..152b6985c6 100644 --- a/app/Providers/CurrencyServiceProvider.php +++ b/app/Providers/CurrencyServiceProvider.php @@ -27,6 +27,8 @@ use FireflyIII\Repositories\Currency\CurrencyRepository; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface; use FireflyIII\Repositories\Currency\CurrencyRepository as GroupCurrencyRepository; use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface as GroupCurrencyRepositoryInterface; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepository; +use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use Illuminate\Foundation\Application; use Illuminate\Support\ServiceProvider; @@ -72,5 +74,19 @@ class CurrencyServiceProvider extends ServiceProvider } ); + $this->app->bind( + ExchangeRateRepositoryInterface::class, + static function (Application $app) { + /** @var ExchangeRateRepository $repository */ + $repository = app(ExchangeRateRepository::class); + // phpstan does not get the reference to auth + if ($app->auth->check()) { // @phpstan-ignore-line + $repository->setUserGroup(auth()->user()->userGroup); + } + + return $repository; + } + ); + } } diff --git a/app/Providers/FireflyServiceProvider.php b/app/Providers/FireflyServiceProvider.php index e8283756c2..dac85566f3 100644 --- a/app/Providers/FireflyServiceProvider.php +++ b/app/Providers/FireflyServiceProvider.php @@ -73,6 +73,7 @@ use FireflyIII\TransactionRules\Engine\SearchRuleEngine; use FireflyIII\TransactionRules\Expressions\ActionExpressionLanguageProvider; use FireflyIII\Validation\FireflyValidator; use Illuminate\Foundation\Application; +use Illuminate\Support\Facades\Validator; use Illuminate\Support\ServiceProvider; use Symfony\Component\ExpressionLanguage\ExpressionLanguage; @@ -88,7 +89,7 @@ class FireflyServiceProvider extends ServiceProvider */ public function boot(): void { - \Validator::resolver( + Validator::resolver( static function ($translator, $data, $rules, $messages) { return new FireflyValidator($translator, $data, $rules, $messages); } From fba796fa841f647dcc3be71b6dbdebe705758495 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 21 Mar 2025 05:48:51 +0100 Subject: [PATCH 48/52] Fix #10007 --- app/Repositories/Bill/BillRepository.php | 27 +++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 9d067a5c3a..1f91daeea0 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -542,14 +542,35 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface /** @var TransactionJournal $transactionJournal */ foreach ($set as $transactionJournal) { - $setAmount = bcadd($setAmount, Amount::getAmountFromJournalObject($transactionJournal)); + // grab currency from transaction. + $transactionCurrency = $transactionJournal->transactionCurrency; + $return[(int) $transactionCurrency->id] ??= [ + 'id' => (string) $transactionCurrency->id, + 'name' => $transactionCurrency->name, + 'symbol' => $transactionCurrency->symbol, + 'code' => $transactionCurrency->code, + 'decimal_places' => $transactionCurrency->decimal_places, + 'sum' => '0', + ]; + + // get currency from transaction as well. + $return[(int) $transactionCurrency->id]['sum'] = bcadd($return[(int) $transactionCurrency->id]['sum'], Amount::getAmountFromJournalObject($transactionJournal)); + //$setAmount = bcadd($setAmount, Amount::getAmountFromJournalObject($transactionJournal)); } // Log::debug(sprintf('Bill #%d ("%s") with %d transaction(s) and sum %s %s', $bill->id, $bill->name, $set->count(), $currency->code, $setAmount)); - $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $setAmount); + //$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $setAmount); // Log::debug(sprintf('Total sum is now %s', $return[$currency->id]['sum'])); } + // remove empty sets + $final = []; + foreach($return as $entry) { + if(0 === bccomp($entry['sum'], '0')) { + continue; + } + $final[] = $entry; + } - return $return; + return $final; } public function getActiveBills(): Collection From 613dce51fb2fb10c3b540c024aab93af6fccb220 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 21 Mar 2025 05:51:24 +0100 Subject: [PATCH 49/52] Add debug for #10005 --- app/Api/V1/Controllers/Autocomplete/AccountController.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index 07434bf8c9..55dac2218c 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -30,6 +30,7 @@ use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Repositories\Account\AccountRepositoryInterface; +use FireflyIII\Support\Debug\Timer; use FireflyIII\Support\Facades\Steam; use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\User; @@ -82,6 +83,7 @@ class AccountController extends Controller $query = $data['query']; $date = $data['date'] ?? today(config('app.timezone')); $return = []; + Timer::start(sprintf('AC accounts "%s"', $query)); $result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit')); // set date to subday + end-of-day for account balance. so it is at $date 23:59:59 @@ -135,7 +137,7 @@ class AccountController extends Controller return $posA - $posB; } ); - + Timer::stop(sprintf('AC accounts "%s"', $query)); return response()->api($return); } } From 542b6f670dad42ccca74cf4c0cd411c257eb38c1 Mon Sep 17 00:00:00 2001 From: James Cole Date: Fri, 21 Mar 2025 20:15:10 +0100 Subject: [PATCH 50/52] Update changelog. --- changelog.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/changelog.md b/changelog.md index a311a76385..70f13e6792 100644 --- a/changelog.md +++ b/changelog.md @@ -3,7 +3,7 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## 6.2.10 - 2025-03-15 +## 6.2.10 - 2025-03-22 ### Added @@ -17,6 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed +- #9770 - [Issue 9895](https://github.com/firefly-iii/firefly-iii/issues/9895) (Account Balance not updating in Transaction tab) reported by @StoicaRemus - [Issue 9906](https://github.com/firefly-iii/firefly-iii/issues/9906) (404 Not Found when deleting rule group) reported by @EnochPrime - [Issue 9908](https://github.com/firefly-iii/firefly-iii/issues/9908) (HTTP 500 on tags) reported by @wuvs @@ -26,6 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - [Issue 9954](https://github.com/firefly-iii/firefly-iii/issues/9954) (Creating Bills via API is broken (optional fields are required)) reported by @jsegido - [Discussion 9970](https://github.com/orgs/firefly-iii/discussions/9970) (Category report with tags?) started by @luddeluddis - [Issue 9876](https://github.com/firefly-iii/firefly-iii/issues/9876) (data/bulkUpdateTransactions POST should not requires Content-Type header in request as request body must be empty) reported by @bouil +- #10007 ### API From 9423a28158f7399bb59c1ce9831d677ea3342886 Mon Sep 17 00:00:00 2001 From: JC5 Date: Fri, 21 Mar 2025 20:20:29 +0100 Subject: [PATCH 51/52] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'develop'=20on=202025-03-21?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ci/php-cs-fixer/composer.lock | 13 +- .../Autocomplete/AccountController.php | 1 + app/Repositories/Bill/BillRepository.php | 18 +- changelog.md | 4 +- composer.lock | 88 +++---- config/firefly.php | 2 +- package-lock.json | 217 +++++++++--------- resources/assets/v1/src/locales/cs.json | 2 +- 8 files changed, 174 insertions(+), 171 deletions(-) diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index c98a125350..a48a40b6c5 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -406,16 +406,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.72.0", + "version": "v3.73.1", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "900389362c43d116fee1ffc51f7878145fa61b57" + "reference": "ffcb8200a42045e65049af7910cfd022f631b064" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/900389362c43d116fee1ffc51f7878145fa61b57", - "reference": "900389362c43d116fee1ffc51f7878145fa61b57", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ffcb8200a42045e65049af7910cfd022f631b064", + "reference": "ffcb8200a42045e65049af7910cfd022f631b064", "shasum": "" }, "require": { @@ -423,6 +423,7 @@ "composer/semver": "^3.4", "composer/xdebug-handler": "^3.0.3", "ext-filter": "*", + "ext-hash": "*", "ext-json": "*", "ext-tokenizer": "*", "fidry/cpu-core-counter": "^1.2", @@ -497,7 +498,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.72.0" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.73.1" }, "funding": [ { @@ -505,7 +506,7 @@ "type": "github" } ], - "time": "2025-03-13T11:25:37+00:00" + "time": "2025-03-19T23:42:16+00:00" }, { "name": "psr/container", diff --git a/app/Api/V1/Controllers/Autocomplete/AccountController.php b/app/Api/V1/Controllers/Autocomplete/AccountController.php index 55dac2218c..86b2a6f362 100644 --- a/app/Api/V1/Controllers/Autocomplete/AccountController.php +++ b/app/Api/V1/Controllers/Autocomplete/AccountController.php @@ -138,6 +138,7 @@ class AccountController extends Controller } ); Timer::stop(sprintf('AC accounts "%s"', $query)); + return response()->api($return); } } diff --git a/app/Repositories/Bill/BillRepository.php b/app/Repositories/Bill/BillRepository.php index 1f91daeea0..8e1d113ab8 100644 --- a/app/Repositories/Bill/BillRepository.php +++ b/app/Repositories/Bill/BillRepository.php @@ -528,8 +528,8 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface foreach ($bills as $bill) { /** @var Collection $set */ - $set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']); - $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; + $set = $bill->transactionJournals()->after($start)->before($end)->get(['transaction_journals.*']); + $currency = $convertToNative && $bill->transactionCurrency->id !== $default->id ? $default : $bill->transactionCurrency; $return[(int) $currency->id] ??= [ 'id' => (string) $currency->id, 'name' => $currency->name, @@ -538,12 +538,12 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface 'decimal_places' => $currency->decimal_places, 'sum' => '0', ]; - $setAmount = '0'; + $setAmount = '0'; /** @var TransactionJournal $transactionJournal */ foreach ($set as $transactionJournal) { // grab currency from transaction. - $transactionCurrency = $transactionJournal->transactionCurrency; + $transactionCurrency = $transactionJournal->transactionCurrency; $return[(int) $transactionCurrency->id] ??= [ 'id' => (string) $transactionCurrency->id, 'name' => $transactionCurrency->name, @@ -555,16 +555,16 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface // get currency from transaction as well. $return[(int) $transactionCurrency->id]['sum'] = bcadd($return[(int) $transactionCurrency->id]['sum'], Amount::getAmountFromJournalObject($transactionJournal)); - //$setAmount = bcadd($setAmount, Amount::getAmountFromJournalObject($transactionJournal)); + // $setAmount = bcadd($setAmount, Amount::getAmountFromJournalObject($transactionJournal)); } // Log::debug(sprintf('Bill #%d ("%s") with %d transaction(s) and sum %s %s', $bill->id, $bill->name, $set->count(), $currency->code, $setAmount)); - //$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $setAmount); + // $return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $setAmount); // Log::debug(sprintf('Total sum is now %s', $return[$currency->id]['sum'])); } // remove empty sets - $final = []; - foreach($return as $entry) { - if(0 === bccomp($entry['sum'], '0')) { + $final = []; + foreach ($return as $entry) { + if (0 === bccomp($entry['sum'], '0')) { continue; } $final[] = $entry; diff --git a/changelog.md b/changelog.md index 70f13e6792..32cd78501e 100644 --- a/changelog.md +++ b/changelog.md @@ -17,7 +17,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Fixed -- #9770 +- [Issue 9770](https://github.com/firefly-iii/firefly-iii/issues/9770) (User ntfy notification forbidden 403) reported by @qck4fun - [Issue 9895](https://github.com/firefly-iii/firefly-iii/issues/9895) (Account Balance not updating in Transaction tab) reported by @StoicaRemus - [Issue 9906](https://github.com/firefly-iii/firefly-iii/issues/9906) (404 Not Found when deleting rule group) reported by @EnochPrime - [Issue 9908](https://github.com/firefly-iii/firefly-iii/issues/9908) (HTTP 500 on tags) reported by @wuvs @@ -27,7 +27,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). - [Issue 9954](https://github.com/firefly-iii/firefly-iii/issues/9954) (Creating Bills via API is broken (optional fields are required)) reported by @jsegido - [Discussion 9970](https://github.com/orgs/firefly-iii/discussions/9970) (Category report with tags?) started by @luddeluddis - [Issue 9876](https://github.com/firefly-iii/firefly-iii/issues/9876) (data/bulkUpdateTransactions POST should not requires Content-Type header in request as request body must be empty) reported by @bouil -- #10007 +- [Issue 10007](https://github.com/firefly-iii/firefly-iii/issues/10007) (Wrong currency showed in dashboard for "Subscriptions to pay" when subscription paid with different currency) reported by @Astro1247 ### API diff --git a/composer.lock b/composer.lock index f239fad03f..9b03a0e8f3 100644 --- a/composer.lock +++ b/composer.lock @@ -819,16 +819,16 @@ }, { "name": "egulias/email-validator", - "version": "4.0.3", + "version": "4.0.4", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "b115554301161fa21467629f1e1391c1936de517" + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/b115554301161fa21467629f1e1391c1936de517", - "reference": "b115554301161fa21467629f1e1391c1936de517", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", + "reference": "d42c8731f0624ad6bdc8d3e5e9a4524f68801cfa", "shasum": "" }, "require": { @@ -874,7 +874,7 @@ ], "support": { "issues": "https://github.com/egulias/EmailValidator/issues", - "source": "https://github.com/egulias/EmailValidator/tree/4.0.3" + "source": "https://github.com/egulias/EmailValidator/tree/4.0.4" }, "funding": [ { @@ -882,7 +882,7 @@ "type": "github" } ], - "time": "2024-12-27T00:36:43+00:00" + "time": "2025-03-06T22:45:56+00:00" }, { "name": "facade/ignition-contracts", @@ -6191,16 +6191,16 @@ }, { "name": "spatie/laravel-html", - "version": "3.11.3", + "version": "3.12.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-html.git", - "reference": "b1bb159bd9845b1ff02b8f945ecd583d93353d06" + "reference": "3655f335609d853f51e431698179ddfe05851126" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-html/zipball/b1bb159bd9845b1ff02b8f945ecd583d93353d06", - "reference": "b1bb159bd9845b1ff02b8f945ecd583d93353d06", + "url": "https://api.github.com/repos/spatie/laravel-html/zipball/3655f335609d853f51e431698179ddfe05851126", + "reference": "3655f335609d853f51e431698179ddfe05851126", "shasum": "" }, "require": { @@ -6257,7 +6257,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/laravel-html/tree/3.11.3" + "source": "https://github.com/spatie/laravel-html/tree/3.12.0" }, "funding": [ { @@ -6265,7 +6265,7 @@ "type": "custom" } ], - "time": "2025-02-17T09:59:20+00:00" + "time": "2025-03-21T08:58:06+00:00" }, { "name": "spatie/laravel-ignition", @@ -6360,16 +6360,16 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.19.0", + "version": "1.91.1", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa" + "reference": "b0b509b9b01d77caa431ce9af3a706bc678e09c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa", - "reference": "1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/b0b509b9b01d77caa431ce9af3a706bc678e09c9", + "reference": "b0b509b9b01d77caa431ce9af3a706bc678e09c9", "shasum": "" }, "require": { @@ -6408,7 +6408,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.19.0" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.91.1" }, "funding": [ { @@ -6416,7 +6416,7 @@ "type": "github" } ], - "time": "2025-02-06T14:58:20+00:00" + "time": "2025-03-21T09:50:49+00:00" }, { "name": "spatie/period", @@ -11327,16 +11327,16 @@ }, { "name": "phpstan/phpstan-strict-rules", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan-strict-rules.git", - "reference": "8b88b5f818bfa301e0c99154ab622dace071c3ba" + "reference": "3e139cbe67fafa3588e1dbe27ca50f31fdb6236a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/8b88b5f818bfa301e0c99154ab622dace071c3ba", - "reference": "8b88b5f818bfa301e0c99154ab622dace071c3ba", + "url": "https://api.github.com/repos/phpstan/phpstan-strict-rules/zipball/3e139cbe67fafa3588e1dbe27ca50f31fdb6236a", + "reference": "3e139cbe67fafa3588e1dbe27ca50f31fdb6236a", "shasum": "" }, "require": { @@ -11369,9 +11369,9 @@ "description": "Extra strict and opinionated rules for PHPStan", "support": { "issues": "https://github.com/phpstan/phpstan-strict-rules/issues", - "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.3" + "source": "https://github.com/phpstan/phpstan-strict-rules/tree/2.0.4" }, - "time": "2025-01-21T10:52:14+00:00" + "time": "2025-03-18T11:42:40+00:00" }, { "name": "phpunit/php-code-coverage", @@ -11698,16 +11698,16 @@ }, { "name": "phpunit/phpunit", - "version": "11.5.12", + "version": "11.5.14", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "d42785840519401ed2113292263795eb4c0f95da" + "reference": "9d6046153c2893b521784069e6b5249ce7d2acae" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d42785840519401ed2113292263795eb4c0f95da", - "reference": "d42785840519401ed2113292263795eb4c0f95da", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9d6046153c2893b521784069e6b5249ce7d2acae", + "reference": "9d6046153c2893b521784069e6b5249ce7d2acae", "shasum": "" }, "require": { @@ -11727,14 +11727,14 @@ "phpunit/php-text-template": "^4.0.1", "phpunit/php-timer": "^7.0.1", "sebastian/cli-parser": "^3.0.2", - "sebastian/code-unit": "^3.0.2", + "sebastian/code-unit": "^3.0.3", "sebastian/comparator": "^6.3.1", "sebastian/diff": "^6.0.2", "sebastian/environment": "^7.2.0", "sebastian/exporter": "^6.3.0", "sebastian/global-state": "^7.0.2", "sebastian/object-enumerator": "^6.0.1", - "sebastian/type": "^5.1.0", + "sebastian/type": "^5.1.2", "sebastian/version": "^5.0.2", "staabm/side-effects-detector": "^1.0.5" }, @@ -11779,7 +11779,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.12" + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.14" }, "funding": [ { @@ -11795,7 +11795,7 @@ "type": "tidelift" } ], - "time": "2025-03-07T07:31:03+00:00" + "time": "2025-03-19T13:45:48+00:00" }, { "name": "sebastian/cli-parser", @@ -11856,16 +11856,16 @@ }, { "name": "sebastian/code-unit", - "version": "3.0.2", + "version": "3.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit.git", - "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca" + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", - "reference": "ee88b0cdbe74cf8dd3b54940ff17643c0d6543ca", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", "shasum": "" }, "require": { @@ -11901,7 +11901,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/code-unit/issues", "security": "https://github.com/sebastianbergmann/code-unit/security/policy", - "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.2" + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" }, "funding": [ { @@ -11909,7 +11909,7 @@ "type": "github" } ], - "time": "2024-12-12T09:59:06+00:00" + "time": "2025-03-19T07:56:08+00:00" }, { "name": "sebastian/code-unit-reverse-lookup", @@ -12614,16 +12614,16 @@ }, { "name": "sebastian/type", - "version": "5.1.0", + "version": "5.1.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/type.git", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac" + "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/461b9c5da241511a2a0e8f240814fb23ce5c0aac", - "reference": "461b9c5da241511a2a0e8f240814fb23ce5c0aac", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/a8a7e30534b0eb0c77cd9d07e82de1a114389f5e", + "reference": "a8a7e30534b0eb0c77cd9d07e82de1a114389f5e", "shasum": "" }, "require": { @@ -12659,7 +12659,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/type/issues", "security": "https://github.com/sebastianbergmann/type/security/policy", - "source": "https://github.com/sebastianbergmann/type/tree/5.1.0" + "source": "https://github.com/sebastianbergmann/type/tree/5.1.2" }, "funding": [ { @@ -12667,7 +12667,7 @@ "type": "github" } ], - "time": "2024-09-17T13:12:04+00:00" + "time": "2025-03-18T13:35:50+00:00" }, { "name": "sebastian/version", diff --git a/config/firefly.php b/config/firefly.php index 3bc77eac32..08976e3f66 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-03-17', + 'version' => 'develop/2025-03-21', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25, diff --git a/package-lock.json b/package-lock.json index 6dfd63fe6d..1cf428edfb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -247,9 +247,9 @@ } }, "node_modules/@babel/helper-define-polyfill-provider": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.3.tgz", - "integrity": "sha512-HK7Bi+Hj6H+VTHA3ZvBis7V/6hu9QuTrnMXNybfUf2iiuU/N97I8VjB+KbhFF8Rld/Lx5MzoCwPCpPjfK+n8Cg==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.6.4.tgz", + "integrity": "sha512-jljfR1rGnXXNWnmQg2K3+bvhkxB51Rl32QRaOTuwwjviGrHzIbSc8+x9CpraDtbT7mfyjXObULP4w/adunNwAw==", "dev": true, "license": "MIT", "dependencies": { @@ -2591,9 +2591,9 @@ } }, "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.35.0.tgz", - "integrity": "sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.36.0.tgz", + "integrity": "sha512-jgrXjjcEwN6XpZXL0HUeOVGfjXhPyxAbbhD0BlXUB+abTOpbPiN5Wb3kOT7yb+uEtATNYF5x5gIfwutmuBA26w==", "cpu": [ "arm" ], @@ -2605,9 +2605,9 @@ ] }, "node_modules/@rollup/rollup-android-arm64": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.35.0.tgz", - "integrity": "sha512-FtKddj9XZudurLhdJnBl9fl6BwCJ3ky8riCXjEw3/UIbjmIY58ppWwPEvU3fNu+W7FUsAsB1CdH+7EQE6CXAPA==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.36.0.tgz", + "integrity": "sha512-NyfuLvdPdNUfUNeYKUwPwKsE5SXa2J6bCt2LdB/N+AxShnkpiczi3tcLJrm5mA+eqpy0HmaIY9F6XCa32N5yzg==", "cpu": [ "arm64" ], @@ -2619,9 +2619,9 @@ ] }, "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.35.0.tgz", - "integrity": "sha512-Uk+GjOJR6CY844/q6r5DR/6lkPFOw0hjfOIzVx22THJXMxktXG6CbejseJFznU8vHcEBLpiXKY3/6xc+cBm65Q==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.36.0.tgz", + "integrity": "sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==", "cpu": [ "arm64" ], @@ -2633,9 +2633,9 @@ ] }, "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.35.0.tgz", - "integrity": "sha512-3IrHjfAS6Vkp+5bISNQnPogRAW5GAV1n+bNCrDwXmfMHbPl5EhTmWtfmwlJxFRUCBZ+tZ/OxDyU08aF6NI/N5Q==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.36.0.tgz", + "integrity": "sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==", "cpu": [ "x64" ], @@ -2647,9 +2647,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.35.0.tgz", - "integrity": "sha512-sxjoD/6F9cDLSELuLNnY0fOrM9WA0KrM0vWm57XhrIMf5FGiN8D0l7fn+bpUeBSU7dCgPV2oX4zHAsAXyHFGcQ==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.36.0.tgz", + "integrity": "sha512-KXVsijKeJXOl8QzXTsA+sHVDsFOmMCdBRgFmBb+mfEb/7geR7+C8ypAml4fquUt14ZyVXaw2o1FWhqAfOvA4sg==", "cpu": [ "arm64" ], @@ -2661,9 +2661,9 @@ ] }, "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.35.0.tgz", - "integrity": "sha512-2mpHCeRuD1u/2kruUiHSsnjWtHjqVbzhBkNVQ1aVD63CcexKVcQGwJ2g5VphOd84GvxfSvnnlEyBtQCE5hxVVw==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.36.0.tgz", + "integrity": "sha512-dVeWq1ebbvByI+ndz4IJcD4a09RJgRYmLccwlQ8bPd4olz3Y213uf1iwvc7ZaxNn2ab7bjc08PrtBgMu6nb4pQ==", "cpu": [ "x64" ], @@ -2675,9 +2675,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.35.0.tgz", - "integrity": "sha512-mrA0v3QMy6ZSvEuLs0dMxcO2LnaCONs1Z73GUDBHWbY8tFFocM6yl7YyMu7rz4zS81NDSqhrUuolyZXGi8TEqg==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.36.0.tgz", + "integrity": "sha512-bvXVU42mOVcF4le6XSjscdXjqx8okv4n5vmwgzcmtvFdifQ5U4dXFYaCB87namDRKlUL9ybVtLQ9ztnawaSzvg==", "cpu": [ "arm" ], @@ -2689,9 +2689,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.35.0.tgz", - "integrity": "sha512-DnYhhzcvTAKNexIql8pFajr0PiDGrIsBYPRvCKlA5ixSS3uwo/CWNZxB09jhIapEIg945KOzcYEAGGSmTSpk7A==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.36.0.tgz", + "integrity": "sha512-JFIQrDJYrxOnyDQGYkqnNBtjDwTgbasdbUiQvcU8JmGDfValfH1lNpng+4FWlhaVIR4KPkeddYjsVVbmJYvDcg==", "cpu": [ "arm" ], @@ -2703,9 +2703,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.35.0.tgz", - "integrity": "sha512-uagpnH2M2g2b5iLsCTZ35CL1FgyuzzJQ8L9VtlJ+FckBXroTwNOaD0z0/UF+k5K3aNQjbm8LIVpxykUOQt1m/A==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.36.0.tgz", + "integrity": "sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==", "cpu": [ "arm64" ], @@ -2717,9 +2717,9 @@ ] }, "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.35.0.tgz", - "integrity": "sha512-XQxVOCd6VJeHQA/7YcqyV0/88N6ysSVzRjJ9I9UA/xXpEsjvAgDTgH3wQYz5bmr7SPtVK2TsP2fQ2N9L4ukoUg==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.36.0.tgz", + "integrity": "sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==", "cpu": [ "arm64" ], @@ -2731,9 +2731,9 @@ ] }, "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.35.0.tgz", - "integrity": "sha512-5pMT5PzfgwcXEwOaSrqVsz/LvjDZt+vQ8RT/70yhPU06PTuq8WaHhfT1LW+cdD7mW6i/J5/XIkX/1tCAkh1W6g==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.36.0.tgz", + "integrity": "sha512-1ZPyEDWF8phd4FQtTzMh8FQwqzvIjLsl6/84gzUxnMNFBtExBtpL51H67mV9xipuxl1AEAerRBgBwFNpkw8+Lg==", "cpu": [ "loong64" ], @@ -2745,9 +2745,9 @@ ] }, "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.35.0.tgz", - "integrity": "sha512-c+zkcvbhbXF98f4CtEIP1EBA/lCic5xB0lToneZYvMeKu5Kamq3O8gqrxiYYLzlZH6E3Aq+TSW86E4ay8iD8EA==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.36.0.tgz", + "integrity": "sha512-VMPMEIUpPFKpPI9GZMhJrtu8rxnp6mJR3ZzQPykq4xc2GmdHj3Q4cA+7avMyegXy4n1v+Qynr9fR88BmyO74tg==", "cpu": [ "ppc64" ], @@ -2759,9 +2759,9 @@ ] }, "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.35.0.tgz", - "integrity": "sha512-s91fuAHdOwH/Tad2tzTtPX7UZyytHIRR6V4+2IGlV0Cej5rkG0R61SX4l4y9sh0JBibMiploZx3oHKPnQBKe4g==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.36.0.tgz", + "integrity": "sha512-ttE6ayb/kHwNRJGYLpuAvB7SMtOeQnVXEIpMtAvx3kepFQeowVED0n1K9nAdraHUPJ5hydEMxBpIR7o4nrm8uA==", "cpu": [ "riscv64" ], @@ -2773,9 +2773,9 @@ ] }, "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.35.0.tgz", - "integrity": "sha512-hQRkPQPLYJZYGP+Hj4fR9dDBMIM7zrzJDWFEMPdTnTy95Ljnv0/4w/ixFw3pTBMEuuEuoqtBINYND4M7ujcuQw==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.36.0.tgz", + "integrity": "sha512-4a5gf2jpS0AIe7uBjxDeUMNcFmaRTbNv7NxI5xOCs4lhzsVyGR/0qBXduPnoWf6dGC365saTiwag8hP1imTgag==", "cpu": [ "s390x" ], @@ -2787,9 +2787,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.35.0.tgz", - "integrity": "sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.36.0.tgz", + "integrity": "sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==", "cpu": [ "x64" ], @@ -2801,9 +2801,9 @@ ] }, "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.35.0.tgz", - "integrity": "sha512-QysqXzYiDvQWfUiTm8XmJNO2zm9yC9P/2Gkrwg2dH9cxotQzunBHYr6jk4SujCTqnfGxduOmQcI7c2ryuW8XVg==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.36.0.tgz", + "integrity": "sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==", "cpu": [ "x64" ], @@ -2815,9 +2815,9 @@ ] }, "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.35.0.tgz", - "integrity": "sha512-OUOlGqPkVJCdJETKOCEf1mw848ZyJ5w50/rZ/3IBQVdLfR5jk/6Sr5m3iO2tdPgwo0x7VcncYuOvMhBWZq8ayg==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.36.0.tgz", + "integrity": "sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==", "cpu": [ "arm64" ], @@ -2829,9 +2829,9 @@ ] }, "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.35.0.tgz", - "integrity": "sha512-2/lsgejMrtwQe44glq7AFFHLfJBPafpsTa6JvP2NGef/ifOa4KBoglVf7AKN7EV9o32evBPRqfg96fEHzWo5kw==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.36.0.tgz", + "integrity": "sha512-t+RY0JuRamIocMuQcfwYSOkmdX9dtkr1PbhKW42AMvaDQa+jOdpUYysroTF/nuPpAaQMWp7ye+ndlmmthieJrQ==", "cpu": [ "ia32" ], @@ -2843,9 +2843,9 @@ ] }, "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.35.0.tgz", - "integrity": "sha512-PIQeY5XDkrOysbQblSW7v3l1MDZzkTEzAfTPkj5VAu3FW8fS4ynyLg2sINp0fp3SjZ8xkRYpLqoKcYqAkhU1dw==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.36.0.tgz", + "integrity": "sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==", "cpu": [ "x64" ], @@ -3133,9 +3133,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.13.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.10.tgz", - "integrity": "sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==", + "version": "22.13.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.11.tgz", + "integrity": "sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==", "dev": true, "license": "MIT", "dependencies": { @@ -3900,9 +3900,9 @@ } }, "node_modules/axios": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.3.tgz", - "integrity": "sha512-iP4DebzoNlP/YN2dpwCgb8zoCmhtkajzS48JvwmkSkXvPI3DHc7m+XYL5tGnSlJtR6nImXZmdCuN5aP8dh1d8A==", + "version": "1.8.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.8.4.tgz", + "integrity": "sha512-eBSYY4Y68NNlHbHBMdeDmKNtDgXWhQsJcGqzO3iLUM0GraQFSS9cVgPX5I9b3lbdFKyYoAEGAZF1DwhTaljNAw==", "dev": true, "license": "MIT", "dependencies": { @@ -3932,14 +3932,14 @@ } }, "node_modules/babel-plugin-polyfill-corejs2": { - "version": "0.4.12", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.12.tgz", - "integrity": "sha512-CPWT6BwvhrTO2d8QVorhTCQw9Y43zOu7G9HigcfxvepOU6b8o3tcWad6oVgZIsZCTt42FFv97aA7ZJsbM4+8og==", + "version": "0.4.13", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.13.tgz", + "integrity": "sha512-3sX/eOms8kd3q2KZ6DAhKPc0dgm525Gqq5NtWKZ7QYYZEv57OQ54KtblzJzH1lQF/eQxO8KjWGIK9IPUJNus5g==", "dev": true, "license": "MIT", "dependencies": { "@babel/compat-data": "^7.22.6", - "@babel/helper-define-polyfill-provider": "^0.6.3", + "@babel/helper-define-polyfill-provider": "^0.6.4", "semver": "^6.3.1" }, "peerDependencies": { @@ -3971,13 +3971,13 @@ } }, "node_modules/babel-plugin-polyfill-regenerator": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.3.tgz", - "integrity": "sha512-LiWSbl4CRSIa5x/JAU6jZiG9eit9w6mz+yVMFwDE83LAWvt0AfGBoZ7HS/mkhrKuh2ZlzfVZYKoLjXdqw6Yt7Q==", + "version": "0.6.4", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.6.4.tgz", + "integrity": "sha512-7gD3pRadPrbjhjLyxebmx/WrFYcuSjZ0XbdUujQMZ/fcE9oeewk2U/7PCvez84UeuK3oSjmPZ0Ch0dlupQvGzw==", "dev": true, "license": "MIT", "dependencies": { - "@babel/helper-define-polyfill-provider": "^0.6.3" + "@babel/helper-define-polyfill-provider": "^0.6.4" }, "peerDependencies": { "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" @@ -4448,9 +4448,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001705", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001705.tgz", - "integrity": "sha512-S0uyMMiYvA7CxNgomYBwwwPUnWzFD83f3B1ce5jHUfHTH//QL6hHsreI8RVC5606R4ssqravelYO5TU6t8sEyg==", + "version": "1.0.30001706", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001706.tgz", + "integrity": "sha512-3ZczoTApMAZwPKYWmwVbQMFpXBDds3/0VciVoUwPUbldlYyVLmRVuRs/PcUZtHpbLRpzzDvrvnFuREsGt6lUug==", "dev": true, "funding": [ { @@ -5663,9 +5663,9 @@ "license": "MIT" }, "node_modules/electron-to-chromium": { - "version": "1.5.119", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.119.tgz", - "integrity": "sha512-Ku4NMzUjz3e3Vweh7PhApPrZSS4fyiCIbcIrG9eKrriYVLmbMepETR/v6SU7xPm98QTqMSYiCwfO89QNjXLkbQ==", + "version": "1.5.123", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.123.tgz", + "integrity": "sha512-refir3NlutEZqlKaBLK0tzlVLe5P2wDKS7UQt/3SpibizgsRAPOsqQC3ffw1nlv3ze5gjRQZYHoPymgVZkplFA==", "dev": true, "license": "ISC" }, @@ -8211,9 +8211,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.10.tgz", - "integrity": "sha512-vSJJTG+t/dIKAUhUDw/dLdZ9s//5OxcHqLaDWWrW4Cdq7o6tdLIczUkMXt2MBNmk6sJRZBZRXVixs7URY1CmIg==", + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", "dev": true, "funding": [ { @@ -10020,9 +10020,9 @@ } }, "node_modules/rollup": { - "version": "4.35.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.35.0.tgz", - "integrity": "sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==", + "version": "4.36.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.36.0.tgz", + "integrity": "sha512-zwATAXNQxUcd40zgtQG0ZafcRK4g004WtEl7kbuhTWPvf07PsfohXl39jVUvPF7jvNAIkKPQ2XrsDlWuxBd++Q==", "dev": true, "license": "MIT", "dependencies": { @@ -10036,25 +10036,25 @@ "npm": ">=8.0.0" }, "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.35.0", - "@rollup/rollup-android-arm64": "4.35.0", - "@rollup/rollup-darwin-arm64": "4.35.0", - "@rollup/rollup-darwin-x64": "4.35.0", - "@rollup/rollup-freebsd-arm64": "4.35.0", - "@rollup/rollup-freebsd-x64": "4.35.0", - "@rollup/rollup-linux-arm-gnueabihf": "4.35.0", - "@rollup/rollup-linux-arm-musleabihf": "4.35.0", - "@rollup/rollup-linux-arm64-gnu": "4.35.0", - "@rollup/rollup-linux-arm64-musl": "4.35.0", - "@rollup/rollup-linux-loongarch64-gnu": "4.35.0", - "@rollup/rollup-linux-powerpc64le-gnu": "4.35.0", - "@rollup/rollup-linux-riscv64-gnu": "4.35.0", - "@rollup/rollup-linux-s390x-gnu": "4.35.0", - "@rollup/rollup-linux-x64-gnu": "4.35.0", - "@rollup/rollup-linux-x64-musl": "4.35.0", - "@rollup/rollup-win32-arm64-msvc": "4.35.0", - "@rollup/rollup-win32-ia32-msvc": "4.35.0", - "@rollup/rollup-win32-x64-msvc": "4.35.0", + "@rollup/rollup-android-arm-eabi": "4.36.0", + "@rollup/rollup-android-arm64": "4.36.0", + "@rollup/rollup-darwin-arm64": "4.36.0", + "@rollup/rollup-darwin-x64": "4.36.0", + "@rollup/rollup-freebsd-arm64": "4.36.0", + "@rollup/rollup-freebsd-x64": "4.36.0", + "@rollup/rollup-linux-arm-gnueabihf": "4.36.0", + "@rollup/rollup-linux-arm-musleabihf": "4.36.0", + "@rollup/rollup-linux-arm64-gnu": "4.36.0", + "@rollup/rollup-linux-arm64-musl": "4.36.0", + "@rollup/rollup-linux-loongarch64-gnu": "4.36.0", + "@rollup/rollup-linux-powerpc64le-gnu": "4.36.0", + "@rollup/rollup-linux-riscv64-gnu": "4.36.0", + "@rollup/rollup-linux-s390x-gnu": "4.36.0", + "@rollup/rollup-linux-x64-gnu": "4.36.0", + "@rollup/rollup-linux-x64-musl": "4.36.0", + "@rollup/rollup-win32-arm64-msvc": "4.36.0", + "@rollup/rollup-win32-ia32-msvc": "4.36.0", + "@rollup/rollup-win32-x64-msvc": "4.36.0", "fsevents": "~2.3.2" } }, @@ -10110,9 +10110,9 @@ "license": "MIT" }, "node_modules/sass": { - "version": "1.85.1", - "resolved": "https://registry.npmjs.org/sass/-/sass-1.85.1.tgz", - "integrity": "sha512-Uk8WpxM5v+0cMR0XjX9KfRIacmSG86RH4DCCZjLU2rFh5tyutt9siAXJ7G+YfxQ99Q6wrRMbMlVl6KqUms71ag==", + "version": "1.86.0", + "resolved": "https://registry.npmjs.org/sass/-/sass-1.86.0.tgz", + "integrity": "sha512-zV8vGUld/+mP4KbMLJMX7TyGCuUp7hnkOScgCMsWuHtns8CWBoz+vmEhoGMXsaJrbUP8gj+F1dLvVe79sK8UdA==", "dev": true, "license": "MIT", "dependencies": { @@ -11456,6 +11456,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", "dev": true, "license": "MIT" }, diff --git a/resources/assets/v1/src/locales/cs.json b/resources/assets/v1/src/locales/cs.json index e89c71d5b7..7e869bb037 100644 --- a/resources/assets/v1/src/locales/cs.json +++ b/resources/assets/v1/src/locales/cs.json @@ -51,7 +51,7 @@ "notes": "Pozn\u00e1mky", "external_url": "Extern\u00ed URL adresa", "update_transaction": "Aktualizovat transakci", - "after_update_create_another": "After updating, return here to continue editing.", + "after_update_create_another": "Po aktualizaci se vr\u00e1tit sem pro pokra\u010dov\u00e1n\u00ed v \u00faprav\u00e1ch.", "store_as_new": "Store as a new transaction instead of updating.", "split_title_help": "Pokud vytvo\u0159\u00edte roz\u00fa\u010dtov\u00e1n\u00ed, je t\u0159eba, aby zde byl celkov\u00fd popis pro v\u0161echna roz\u00fa\u010dtov\u00e1n\u00ed dan\u00e9 transakce.", "none_in_select_list": "(\u017e\u00e1dn\u00e9)", From dcd4f072d5a4582ebb0c1a25cb224d94329d81be Mon Sep 17 00:00:00 2001 From: JC5 Date: Sat, 22 Mar 2025 14:02:07 +0100 Subject: [PATCH 52/52] =?UTF-8?q?=F0=9F=A4=96=20Auto=20commit=20for=20rele?= =?UTF-8?q?ase=20'v6.2.10'=20on=202025-03-22?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.lock | 12 ++++++------ config/firefly.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/composer.lock b/composer.lock index 9b03a0e8f3..b7fcca3176 100644 --- a/composer.lock +++ b/composer.lock @@ -5662,16 +5662,16 @@ }, { "name": "ramsey/collection", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/ramsey/collection.git", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109" + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/collection/zipball/3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", - "reference": "3c5990b8a5e0b79cd1cf11c2dc1229e58e93f109", + "url": "https://api.github.com/repos/ramsey/collection/zipball/344572933ad0181accbf4ba763e85a0306a8c5e2", + "reference": "344572933ad0181accbf4ba763e85a0306a8c5e2", "shasum": "" }, "require": { @@ -5732,9 +5732,9 @@ ], "support": { "issues": "https://github.com/ramsey/collection/issues", - "source": "https://github.com/ramsey/collection/tree/2.1.0" + "source": "https://github.com/ramsey/collection/tree/2.1.1" }, - "time": "2025-03-02T04:48:29+00:00" + "time": "2025-03-22T05:38:12+00:00" }, { "name": "ramsey/uuid", diff --git a/config/firefly.php b/config/firefly.php index 08976e3f66..95bfbe5881 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -81,7 +81,7 @@ return [ 'running_balance_column' => env('USE_RUNNING_BALANCE', false), // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2025-03-21', + 'version' => '6.2.10', 'api_version' => '2.1.0', // field is no longer used. 'db_version' => 25,