diff --git a/.ci/php-cs-fixer/composer.lock b/.ci/php-cs-fixer/composer.lock index 6a2ddf72dc..9e10bef7fb 100644 --- a/.ci/php-cs-fixer/composer.lock +++ b/.ci/php-cs-fixer/composer.lock @@ -398,16 +398,16 @@ }, { "name": "friendsofphp/php-cs-fixer", - "version": "v3.59.1", + "version": "v3.59.3", "source": { "type": "git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", - "reference": "756fa7852c2e961cba4ea39e3e510e1c020f2123" + "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/756fa7852c2e961cba4ea39e3e510e1c020f2123", - "reference": "756fa7852c2e961cba4ea39e3e510e1c020f2123", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/30ba9ecc2b0e5205e578fe29973c15653d9bfd29", + "reference": "30ba9ecc2b0e5205e578fe29973c15653d9bfd29", "shasum": "" }, "require": { @@ -437,16 +437,16 @@ "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" }, "require-dev": { - "facile-it/paraunit": "^1.3 || ^2.0", - "infection/infection": "^0.27.11", + "facile-it/paraunit": "^1.3 || ^2.3", + "infection/infection": "^0.29.5", "justinrainbow/json-schema": "^5.2", "keradus/cli-executor": "^2.1", "mikey179/vfsstream": "^1.6.11", "php-coveralls/php-coveralls": "^2.7", "php-cs-fixer/accessible-object": "^1.1", - "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.4", - "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.4", - "phpunit/phpunit": "^9.6 || ^10.5.5 || ^11.0.2", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5", + "phpunit/phpunit": "^9.6.19 || ^10.5.21 || ^11.2", "symfony/var-dumper": "^5.4 || ^6.0 || ^7.0", "symfony/yaml": "^5.4 || ^6.0 || ^7.0" }, @@ -461,7 +461,10 @@ "autoload": { "psr-4": { "PhpCsFixer\\": "src/" - } + }, + "exclude-from-classmap": [ + "src/Fixer/Internal/*" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -486,7 +489,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.59.1" + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.59.3" }, "funding": [ { @@ -494,7 +497,7 @@ "type": "github" } ], - "time": "2024-06-15T12:19:07+00:00" + "time": "2024-06-16T14:17:03+00:00" }, { "name": "psr/container", diff --git a/app/Http/Middleware/VerifyCsrfToken.php b/app/Http/Middleware/VerifyCsrfToken.php index f0f84e9987..beb7146345 100644 --- a/app/Http/Middleware/VerifyCsrfToken.php +++ b/app/Http/Middleware/VerifyCsrfToken.php @@ -28,7 +28,8 @@ use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware; /** * Class VerifyCsrfToken. */ -class VerifyCsrfToken extends Middleware { +class VerifyCsrfToken extends Middleware +{ protected $except = [ 'oauth/token', ]; diff --git a/app/Support/Models/AccountBalanceCalculator.php b/app/Support/Models/AccountBalanceCalculator.php index cd08a3798a..fcf2afecdf 100644 --- a/app/Support/Models/AccountBalanceCalculator.php +++ b/app/Support/Models/AccountBalanceCalculator.php @@ -60,9 +60,9 @@ class AccountBalanceCalculator private function getAccountBalanceByAccount(int $account, int $currency): AccountBalance { - $query = AccountBalance::where('title', 'balance')->where('account_id', $account)->where('transaction_currency_id', $currency); + $query = AccountBalance::where('title', 'balance')->where('account_id', $account)->where('transaction_currency_id', $currency); - $entry = $query->first(); + $entry = $query->first(); if (null !== $entry) { // Log::debug(sprintf('Found account balance "balance" for account #%d and currency #%d: %s', $account, $currency, $entry->balance)); @@ -81,9 +81,9 @@ class AccountBalanceCalculator private function getAccountBalanceByJournal(string $title, int $account, int $journal, int $currency): AccountBalance { - $query = AccountBalance::where('title', $title)->where('account_id', $account)->where('transaction_journal_id', $journal)->where('transaction_currency_id', $currency); + $query = AccountBalance::where('title', $title)->where('account_id', $account)->where('transaction_journal_id', $journal)->where('transaction_currency_id', $currency); - $entry = $query->first(); + $entry = $query->first(); if (null !== $entry) { return $entry; } @@ -100,7 +100,7 @@ class AccountBalanceCalculator private function recalculateLatest(?Account $account): void { - $query = Transaction::groupBy(['transactions.account_id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id']); + $query = Transaction::groupBy(['transactions.account_id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id']); if (null !== $account) { $query->where('transactions.account_id', $account->id); @@ -121,8 +121,8 @@ class AccountBalanceCalculator $sumForeignAmount = '' === $sumForeignAmount ? '0' : $sumForeignAmount; // first create for normal currency: - $entry = $this->getAccountBalanceByAccount($account, $transactionCurrency); - $entry->balance = bcadd((string) $entry->balance, $sumAmount); + $entry = $this->getAccountBalanceByAccount($account, $transactionCurrency); + $entry->balance = bcadd((string) $entry->balance, $sumAmount); $entry->save(); // then do foreign amount, if present: @@ -160,7 +160,7 @@ class AccountBalanceCalculator */ private function recalculateJournals(?Account $account, ?TransactionJournal $transactionJournal): void { - $query = Transaction::groupBy(['transactions.account_id', 'transaction_journals.id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id']); + $query = Transaction::groupBy(['transactions.account_id', 'transaction_journals.id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id']); $query->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id'); $query->orderBy('transaction_journals.date', 'asc'); $amounts = []; @@ -171,28 +171,28 @@ class AccountBalanceCalculator $query->where('transaction_journals.date', '>=', $transactionJournal->date); $amounts = $this->getStartAmounts($account, $transactionJournal); } - $result = $query->get(['transactions.account_id', 'transaction_journals.id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id', \DB::raw('SUM(transactions.amount) as sum_amount'), \DB::raw('SUM(transactions.foreign_amount) as sum_foreign_amount')]); + $result = $query->get(['transactions.account_id', 'transaction_journals.id', 'transactions.transaction_currency_id', 'transactions.foreign_currency_id', \DB::raw('SUM(transactions.amount) as sum_amount'), \DB::raw('SUM(transactions.foreign_amount) as sum_foreign_amount')]); /** @var \stdClass $row */ foreach ($result as $row) { - $account = (int) $row->account_id; - $transactionCurrency = (int) $row->transaction_currency_id; - $foreignCurrency = (int) $row->foreign_currency_id; - $sumAmount = (string) $row->sum_amount; - $sumForeignAmount = (string) $row->sum_foreign_amount; - $journalId = (int) $row->id; + $account = (int) $row->account_id; + $transactionCurrency = (int) $row->transaction_currency_id; + $foreignCurrency = (int) $row->foreign_currency_id; + $sumAmount = (string) $row->sum_amount; + $sumForeignAmount = (string) $row->sum_foreign_amount; + $journalId = (int) $row->id; // check for empty strings - $sumAmount = '' === $sumAmount ? '0' : $sumAmount; - $sumForeignAmount = '' === $sumForeignAmount ? '0' : $sumForeignAmount; + $sumAmount = '' === $sumAmount ? '0' : $sumAmount; + $sumForeignAmount = '' === $sumForeignAmount ? '0' : $sumForeignAmount; // new amounts: $amounts[$account][$transactionCurrency] = bcadd($amounts[$account][$transactionCurrency] ?? '0', $sumAmount); $amounts[$account][$foreignCurrency] = bcadd($amounts[$account][$foreignCurrency] ?? '0', $sumForeignAmount); // first create for normal currency: - $entry = self::getAccountBalanceByJournal('balance_after_journal', $account, $journalId, $transactionCurrency); - $entry->balance = $amounts[$account][$transactionCurrency]; + $entry = self::getAccountBalanceByJournal('balance_after_journal', $account, $journalId, $transactionCurrency); + $entry->balance = $amounts[$account][$transactionCurrency]; $entry->save(); // then do foreign amount, if present: diff --git a/config/firefly.php b/config/firefly.php index 1074d6623c..3462169da2 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -117,7 +117,7 @@ return [ 'expression_engine' => false, // see cer.php for exchange rates feature flag. ], - 'version' => 'develop/2024-06-15', + 'version' => 'develop/2024-06-16', 'api_version' => '2.1.0', 'db_version' => 24, diff --git a/package-lock.json b/package-lock.json index a78656c70e..67927c4729 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4028,9 +4028,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001634", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001634.tgz", - "integrity": "sha512-fbBYXQ9q3+yp1q1gBk86tOFs4pyn/yxFm5ZNP18OXJDfA3txImOY9PhfxVggZ4vRHDqoU8NrKU81eN0OtzOgRA==", + "version": "1.0.30001635", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001635.tgz", + "integrity": "sha512-34NOwyGFZxFoIOFNoLPP08eHzaCN+3wJFKx4Vph0XpidU1tRxB0p3Q2etIbOj0W8TYeuXkYsMCcyjV1+phBzxQ==", "dev": true, "funding": [ { @@ -6974,9 +6974,9 @@ } }, "node_modules/launch-editor": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.6.1.tgz", - "integrity": "sha512-eB/uXmFVpY4zezmGp5XtU21kwo7GBbKB+EQ+UZeWtGb9yAM5xt/Evk+lYH3eRNAtId+ej4u7TYPFZ07w4s7rRw==", + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/launch-editor/-/launch-editor-2.7.0.tgz", + "integrity": "sha512-KAc66u6LxWL8MifQ94oG3YGKYWDwz/Gi0T15lN//GaQoZe08vQGFJxrXkPAeu50UXgvJPPaRKVGuP1TRUm/aHQ==", "dev": true, "dependencies": { "picocolors": "^1.0.0", @@ -10819,9 +10819,9 @@ "dev": true }, "node_modules/ws": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", - "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "dev": true, "engines": { "node": ">=10.0.0"