Compare commits

...

76 Commits

Author SHA1 Message Date
github-actions[bot]
76899389b8 Merge pull request #11291 from firefly-iii/release-1764180754
🤖 Automatically merge the PR into the develop branch.
2025-11-26 19:12:42 +01:00
JC5
e83fe023d2 🤖 Auto commit for release 'develop' on 2025-11-26 2025-11-26 19:12:34 +01:00
James Cole
1dd098a283 Fix #11284 2025-11-26 19:06:58 +01:00
James Cole
52164689d4 Switch to 1M when it's MTD. 2025-11-26 19:05:46 +01:00
github-actions[bot]
034b14eb0b Merge pull request #11290 from firefly-iii/release-1764179030
🤖 Automatically merge the PR into the develop branch.
2025-11-26 18:43:56 +01:00
JC5
8722d264dc 🤖 Auto commit for release 'develop' on 2025-11-26 2025-11-26 18:43:50 +01:00
James Cole
3603ef1cc7 Fix #11288 2025-11-26 18:39:05 +01:00
James Cole
7abd30f4dd Attempted fix with sanity check for #11284 2025-11-26 18:35:56 +01:00
github-actions[bot]
3c904c9017 Merge pull request #11286 from firefly-iii/release-1764136451
🤖 Automatically merge the PR into the develop branch.
2025-11-26 06:54:20 +01:00
JC5
d8bdbf2842 🤖 Auto commit for release 'develop' on 2025-11-26 2025-11-26 06:54:11 +01:00
James Cole
d08966d141 Add new correction command. 2025-11-26 06:50:29 +01:00
James Cole
bd71095e40 Merge branch 'main' into develop 2025-11-25 20:13:04 +01:00
James Cole
d7967a81e3 Fix https://github.com/firefly-iii/firefly-iii/issues/11284 2025-11-25 20:12:35 +01:00
James Cole
fa018e80c0 Replace classes 2025-11-25 20:12:23 +01:00
James Cole
eb4b9659cf Merge pull request #11278 from firefly-iii/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 5 to 6
2025-11-24 08:49:23 +01:00
github-actions[bot]
7b7b9118cd Merge pull request #11279 from firefly-iii/release-1763955257
🤖 Automatically merge the PR into the develop branch.
2025-11-24 04:34:26 +01:00
JC5
373e5c3733 🤖 Auto commit for release 'develop' on 2025-11-24 2025-11-24 04:34:17 +01:00
dependabot[bot]
4e0b1bf65d Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 03:17:24 +00:00
James Cole
521a496c17 Fix #11267 2025-11-23 21:03:53 +01:00
James Cole
5fea35d5b1 Allow command to be forced. 2025-11-23 08:44:01 +01:00
James Cole
21a6892601 Fix #11265 2025-11-23 06:55:54 +01:00
James Cole
3f386b9003 Fix #11191 2025-11-19 06:26:40 +01:00
github-actions[bot]
72fb534eb4 Merge pull request #11249 from firefly-iii/release-1763402892
🤖 Automatically merge the PR into the develop branch.
2025-11-17 19:08:20 +01:00
JC5
69b46af245 🤖 Auto commit for release 'develop' on 2025-11-17 2025-11-17 19:08:12 +01:00
James Cole
4a901a1b42 Add a bunch of debug #11247 2025-11-17 19:01:38 +01:00
James Cole
a8fffc25c0 Merge pull request #11241 from firefly-iii/dependabot/composer/develop/bacon/bacon-qr-code-3.0.2
Bump bacon/bacon-qr-code from 3.0.1 to 3.0.2
2025-11-17 06:48:36 +01:00
mergify[bot]
d0dab136b1 Merge branch 'develop' into dependabot/composer/develop/bacon/bacon-qr-code-3.0.2 2025-11-17 05:47:38 +00:00
James Cole
91184489da Merge pull request #11242 from firefly-iii/dependabot/npm_and_yarn/develop/alpinejs-3.15.2
Bump alpinejs from 3.15.1 to 3.15.2
2025-11-17 06:46:55 +01:00
mergify[bot]
e4e6cc71c3 Merge branch 'develop' into dependabot/composer/develop/bacon/bacon-qr-code-3.0.2 2025-11-17 03:30:51 +00:00
mergify[bot]
33d637e618 Merge branch 'develop' into dependabot/npm_and_yarn/develop/alpinejs-3.15.2 2025-11-17 03:30:49 +00:00
github-actions[bot]
42eb4410f8 Merge pull request #11243 from firefly-iii/release-1763350179
🤖 Automatically merge the PR into the develop branch.
2025-11-17 04:29:45 +01:00
JC5
5f6b345c79 🤖 Auto commit for release 'develop' on 2025-11-17 2025-11-17 04:29:39 +01:00
dependabot[bot]
30b48a479c Bump alpinejs from 3.15.1 to 3.15.2
Bumps [alpinejs](https://github.com/alpinejs/alpine/tree/HEAD/packages/alpinejs) from 3.15.1 to 3.15.2.
- [Release notes](https://github.com/alpinejs/alpine/releases)
- [Commits](https://github.com/alpinejs/alpine/commits/v3.15.2/packages/alpinejs)

---
updated-dependencies:
- dependency-name: alpinejs
  dependency-version: 3.15.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-17 03:01:12 +00:00
dependabot[bot]
55d23af802 Bump bacon/bacon-qr-code from 3.0.1 to 3.0.2
Bumps [bacon/bacon-qr-code](https://github.com/Bacon/BaconQrCode) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/Bacon/BaconQrCode/releases)
- [Changelog](https://github.com/Bacon/BaconQrCode/blob/main/CHANGELOG.md)
- [Commits](https://github.com/Bacon/BaconQrCode/compare/v3.0.1...v3.0.2)

---
updated-dependencies:
- dependency-name: bacon/bacon-qr-code
  dependency-version: 3.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-17 03:00:53 +00:00
James Cole
34bfeba63a Fix #11211 2025-11-13 20:32:02 +01:00
github-actions[bot]
761c20b670 Merge pull request #11234 from firefly-iii/release-1763009724
🤖 Automatically merge the PR into the develop branch.
2025-11-13 05:55:30 +01:00
JC5
d756977ee0 🤖 Auto commit for release 'develop' on 2025-11-13 2025-11-13 05:55:24 +01:00
github-actions[bot]
40fe0d9c57 Merge pull request #11233 from firefly-iii/develop
🤖 Automatically merge the PR into the main branch.
2025-11-13 05:42:18 +01:00
github-actions[bot]
09b3fa1a52 Merge pull request #11232 from firefly-iii/release-1763008922
🤖 Automatically merge the PR into the develop branch.
2025-11-13 05:42:11 +01:00
JC5
bab767a447 🤖 Auto commit for release 'v6.4.8' on 2025-11-13 2025-11-13 05:42:02 +01:00
James Cole
341ab69939 Merge branch 'main' into develop 2025-11-13 05:37:15 +01:00
James Cole
479b90d9fc Expand changelog. 2025-11-13 05:36:59 +01:00
James Cole
91889332b4 Merge pull request #11231 from firefly-iii/dependabot/composer/composer-da8c4f16ae 2025-11-13 05:09:28 +01:00
dependabot[bot]
22b623c561 Bump symfony/http-foundation in the composer group across 1 directory
Bumps the composer group with 1 update in the / directory: [symfony/http-foundation](https://github.com/symfony/http-foundation).


Updates `symfony/http-foundation` from 7.3.6 to 7.3.7
- [Release notes](https://github.com/symfony/http-foundation/releases)
- [Changelog](https://github.com/symfony/http-foundation/blob/7.3/CHANGELOG.md)
- [Commits](https://github.com/symfony/http-foundation/compare/v7.3.6...v7.3.7)

---
updated-dependencies:
- dependency-name: symfony/http-foundation
  dependency-version: 7.3.7
  dependency-type: indirect
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-12 23:42:25 +00:00
github-actions[bot]
75932a9671 Merge pull request #11229 from firefly-iii/release-1762967310
🤖 Automatically merge the PR into the develop branch.
2025-11-12 18:08:37 +01:00
JC5
3ec528812b 🤖 Auto commit for release 'develop' on 2025-11-12 2025-11-12 18:08:30 +01:00
James Cole
78de800777 Fix #11228 2025-11-12 18:02:24 +01:00
github-actions[bot]
4456b00cae Merge pull request #11223 from firefly-iii/develop
🤖 Automatically merge the PR into the main branch.
2025-11-12 05:50:16 +01:00
github-actions[bot]
a3c02d7e07 Merge pull request #11222 from firefly-iii/release-1762923004
🤖 Automatically merge the PR into the develop branch.
2025-11-12 05:50:11 +01:00
JC5
d9ff71b1a5 🤖 Auto commit for release 'v6.4.7' on 2025-11-12 2025-11-12 05:50:05 +01:00
James Cole
2e5528167c Don't do comment. 2025-11-12 05:46:21 +01:00
github-actions[bot]
377486d5c7 Merge pull request #11221 from firefly-iii/release-1762922569
🤖 Automatically merge the PR into the develop branch.
2025-11-12 05:42:58 +01:00
JC5
c91845a0f2 🤖 Auto commit for release 'develop' on 2025-11-12 2025-11-12 05:42:49 +01:00
James Cole
0934de09bb Fix #11206 2025-11-12 05:38:31 +01:00
James Cole
55c045c791 Fix #11172 2025-11-12 05:37:33 +01:00
James Cole
8ff2f817c6 Merge branch 'main' into develop 2025-11-12 05:36:57 +01:00
James Cole
49b42538f5 Improve automated reply message for debug info
Signed-off-by: James Cole <james@firefly-iii.org>
2025-11-11 09:37:30 +01:00
James Cole
3fd31bdf70 Fix workflows. 2025-11-11 07:01:30 +01:00
James Cole
24e144df5d Merge branch 'main' into develop 2025-11-11 06:18:49 +01:00
James Cole
abfa2af278 Expand tests. 2025-11-11 06:16:36 +01:00
James Cole
e3efb275a9 Merge pull request #11213 from firefly-iii/JC5-patch-2
Fix typo in automated reply message
2025-11-10 14:41:12 +01:00
James Cole
122a389a95 Fix typo in automated reply message
Signed-off-by: James Cole <james@firefly-iii.org>
2025-11-10 14:40:41 +01:00
James Cole
b54d7d5c7b Enhance issue reply condition for old versions
Updated condition to check for additional version variables in issue body.

Signed-off-by: James Cole <james@firefly-iii.org>
2025-11-10 09:02:57 +01:00
James Cole
897c80c2d8 Merge pull request #11209 from firefly-iii/JC5-patch-1
Update issues-reply-old-versions.yml
2025-11-10 09:00:46 +01:00
github-actions[bot]
02329a177d Merge pull request #11208 from firefly-iii/release-1762745490
🤖 Automatically merge the PR into the develop branch.
2025-11-10 04:31:36 +01:00
JC5
0ca814f718 🤖 Auto commit for release 'develop' on 2025-11-10 2025-11-10 04:31:30 +01:00
James Cole
6e9e47bc19 Merge branch 'main' into develop 2025-11-09 17:01:38 +01:00
James Cole
323c93372b Merge branch 'main' into develop 2025-11-09 12:33:57 +01:00
github-actions[bot]
c43162727f Merge pull request #11202 from firefly-iii/release-1762676397
🤖 Automatically merge the PR into the develop branch.
2025-11-09 09:20:04 +01:00
JC5
db0c7e4d9a 🤖 Auto commit for release 'develop' on 2025-11-09 2025-11-09 09:19:57 +01:00
James Cole
57ea24e73d Fix trait compatibility. 2025-11-09 09:15:29 +01:00
github-actions[bot]
e7fe6fdd3a Merge pull request #11201 from firefly-iii/release-1762675915
🤖 Automatically merge the PR into the develop branch.
2025-11-09 09:12:04 +01:00
JC5
a498169148 🤖 Auto commit for release 'develop' on 2025-11-09 2025-11-09 09:11:55 +01:00
James Cole
68183a0a0e Fix code quality with rector [skip ci] 2025-11-09 09:08:03 +01:00
James Cole
d2610be790 Fix code quality with rector [skip ci] 2025-11-09 09:07:14 +01:00
James Cole
38691d6fdf Fix code quality with rector [skip ci] 2025-11-09 09:06:11 +01:00
529 changed files with 2998 additions and 3219 deletions

View File

@@ -402,16 +402,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.89.2", "version": "v3.90.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "7569658f91e475ec93b99bd5964b059ad1336dcf" "reference": "ad732c2e9299c9743f9c55ae53cc0e7642ab1155"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/7569658f91e475ec93b99bd5964b059ad1336dcf", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ad732c2e9299c9743f9c55ae53cc0e7642ab1155",
"reference": "7569658f91e475ec93b99bd5964b059ad1336dcf", "reference": "ad732c2e9299c9743f9c55ae53cc0e7642ab1155",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -429,17 +429,17 @@
"react/socket": "^1.16", "react/socket": "^1.16",
"react/stream": "^1.4", "react/stream": "^1.4",
"sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0",
"symfony/console": "^5.4.47 || ^6.4.24 || ^7.0", "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0", "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0", "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0", "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0", "symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0",
"symfony/polyfill-mbstring": "^1.33", "symfony/polyfill-mbstring": "^1.33",
"symfony/polyfill-php80": "^1.33", "symfony/polyfill-php80": "^1.33",
"symfony/polyfill-php81": "^1.33", "symfony/polyfill-php81": "^1.33",
"symfony/polyfill-php84": "^1.33", "symfony/polyfill-php84": "^1.33",
"symfony/process": "^5.4.47 || ^6.4.24 || ^7.2", "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2 || ^8.0",
"symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0" "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0"
}, },
"require-dev": { "require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.7", "facile-it/paraunit": "^1.3.1 || ^2.7",
@@ -451,8 +451,8 @@
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6",
"phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34", "phpunit/phpunit": "^9.6.25 || ^10.5.53 || ^11.5.34",
"symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2", "symfony/var-dumper": "^5.4.48 || ^6.4.24 || ^7.3.2 || ^8.0",
"symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2" "symfony/yaml": "^5.4.45 || ^6.4.24 || ^7.3.2 || ^8.0"
}, },
"suggest": { "suggest": {
"ext-dom": "For handling output formats in XML", "ext-dom": "For handling output formats in XML",
@@ -493,7 +493,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.89.2" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.90.0"
}, },
"funding": [ "funding": [
{ {
@@ -501,7 +501,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2025-11-06T21:12:50+00:00" "time": "2025-11-20T15:15:16+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@@ -805,16 +805,16 @@
}, },
{ {
"name": "react/dns", "name": "react/dns",
"version": "v1.13.0", "version": "v1.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/dns.git", "url": "https://github.com/reactphp/dns.git",
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5" "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/dns/zipball/eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", "url": "https://api.github.com/repos/reactphp/dns/zipball/7562c05391f42701c1fccf189c8225fece1cd7c3",
"reference": "eb8ae001b5a455665c89c1df97f6fb682f8fb0f5", "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -869,7 +869,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/dns/issues", "issues": "https://github.com/reactphp/dns/issues",
"source": "https://github.com/reactphp/dns/tree/v1.13.0" "source": "https://github.com/reactphp/dns/tree/v1.14.0"
}, },
"funding": [ "funding": [
{ {
@@ -877,20 +877,20 @@
"type": "open_collective" "type": "open_collective"
} }
], ],
"time": "2024-06-13T14:18:03+00:00" "time": "2025-11-18T19:34:28+00:00"
}, },
{ {
"name": "react/event-loop", "name": "react/event-loop",
"version": "v1.5.0", "version": "v1.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/event-loop.git", "url": "https://github.com/reactphp/event-loop.git",
"reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354" "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/event-loop/zipball/bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", "url": "https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a",
"reference": "bbe0bd8c51ffc05ee43f1729087ed3bdf7d53354", "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -941,7 +941,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/event-loop/issues", "issues": "https://github.com/reactphp/event-loop/issues",
"source": "https://github.com/reactphp/event-loop/tree/v1.5.0" "source": "https://github.com/reactphp/event-loop/tree/v1.6.0"
}, },
"funding": [ "funding": [
{ {
@@ -949,7 +949,7 @@
"type": "open_collective" "type": "open_collective"
} }
], ],
"time": "2023-11-13T13:48:05+00:00" "time": "2025-11-17T20:46:25+00:00"
}, },
{ {
"name": "react/promise", "name": "react/promise",
@@ -1026,16 +1026,16 @@
}, },
{ {
"name": "react/socket", "name": "react/socket",
"version": "v1.16.0", "version": "v1.17.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/reactphp/socket.git", "url": "https://github.com/reactphp/socket.git",
"reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1" "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/reactphp/socket/zipball/23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "url": "https://api.github.com/repos/reactphp/socket/zipball/ef5b17b81f6f60504c539313f94f2d826c5faa08",
"reference": "23e4ff33ea3e160d2d1f59a0e6050e4b0fb0eac1", "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -1094,7 +1094,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/reactphp/socket/issues", "issues": "https://github.com/reactphp/socket/issues",
"source": "https://github.com/reactphp/socket/tree/v1.16.0" "source": "https://github.com/reactphp/socket/tree/v1.17.0"
}, },
"funding": [ "funding": [
{ {
@@ -1102,7 +1102,7 @@
"type": "open_collective" "type": "open_collective"
} }
], ],
"time": "2024-07-26T10:38:09+00:00" "time": "2025-11-19T20:47:34+00:00"
}, },
{ {
"name": "react/stream", "name": "react/stream",
@@ -2675,5 +2675,5 @@
"prefer-lowest": false, "prefer-lowest": false,
"platform": {}, "platform": {},
"platform-dev": {}, "platform-dev": {},
"plugin-api-version": "2.6.0" "plugin-api-version": "2.9.0"
} }

View File

@@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: 'Checkout repository' - name: 'Checkout repository'
uses: actions/checkout@v5 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: 'Dependency review' - name: 'Dependency review'

View File

@@ -31,6 +31,8 @@ jobs:
excludes: prerelease, draft excludes: prerelease, draft
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- run: | - run: |
ISSUE_BODY=$(gh issue view $NUMBER --json body)
# sure this can be done in a single step but still. # sure this can be done in a single step but still.
FFNOV="${{ steps.ff3version.outputs.release }}" FFNOV="${{ steps.ff3version.outputs.release }}"
FFNOV="${FFNOV:1}" FFNOV="${FFNOV:1}"
@@ -38,21 +40,74 @@ jobs:
DDNOV="${{ steps.importerversion.outputs.release }}" DDNOV="${{ steps.importerversion.outputs.release }}"
DDNOV="${DDNOV:1}" DDNOV="${DDNOV:1}"
echo "Version is ${{ steps.ff3version.outputs.release }}, without v is $FFNOV" echo "Firefly III version is ${{ steps.ff3version.outputs.release }}, without v is $FFNOV"
echo "Data importer version is ${{ steps.ff3version.outputs.release }}, without v is $FFNOV"
ISSUE_BODY=$(gh issue view $NUMBER --json body)
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY != *${{ steps.ff3version.outputs.release }}* && $ISSUE_BODY != *${{ steps.importerversion.outputs.release }}* ]]; then # user includes no debug info at all, and does not mention current version.
# user includes no debug info at all, but does mention current version
# user includes debug info, but not the current version.
# user includes debug info, and the current version.
# first test: user includes no debug info at all, and does not mention current version.
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY != *"Debug information generated at"* && $ISSUE_BODY != *${{ steps.ff3version.outputs.release }}* && $ISSUE_BODY != *${{ steps.importerversion.outputs.release }}* && $ISSUE_BODY != *$FFNOV* && $ISSUE_BODY != *$DDNOV* ]]; then
MESSAGE="Hi there!
This is an automated reply. \`Share and enjoy\`
You triggered an automated reply, because it looks like you didn't include the output from the \`/debug\` page. Would you be so kind as to do that? It helps the developers debug your issue more easily.
If you *did* include debug information or of if the debug information isn't relevant (or even reachable), my apologies for the intrusion."
gh issue comment "$NUMBER" --body "$MESSAGE"
echo "Triggered on first test"
exit 0
fi
# second test: user includes no debug info at all, but does mention current version
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY != *"Debug information generated at"* && ( $ISSUE_BODY == *${{ steps.ff3version.outputs.release }}* || $ISSUE_BODY == *${{ steps.importerversion.outputs.release }}* || $ISSUE_BODY == *$FFNOV* || $ISSUE_BODY == *$DDNOV* ) ]]; then
MESSAGE="Hi there!
This is an automated reply. \`Share and enjoy\`
Thank you for running the latest version of Firefly III (or the data importer). You triggered an automated reply, because it looks like you didn't include the output from the \`/debug\` page. Would you be so kind as to do that? It helps the developers debug your issue more easily.
If you *did* include debug information or of if the debug information isn't relevant (or even reachable), my apologies for the intrusion."
gh issue comment "$NUMBER" --body "$MESSAGE"
echo "Triggered on second test"
exit 0
fi
# third test: user includes debug info, but not the current version.
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY == *"Debug information generated at"* && $ISSUE_BODY != *${{ steps.ff3version.outputs.release }}* && $ISSUE_BODY != *${{ steps.importerversion.outputs.release }}* && $ISSUE_BODY != *$FFNOV* && $ISSUE_BODY != *$DDNOV* ]]; then
MESSAGE="Hi there! MESSAGE="Hi there!
This is an automated reply. \`Share and enjoy\` This is an automated reply. \`Share and enjoy\`
You triggered an automated reply, because it looks like you're not running Firefly III version **${{ steps.ff3version.outputs.release }}** or version **${{ steps.importerversion.outputs.release }}** of the data importer. Thank you for including debug information. You triggered an automated reply, because it looks like you're not running Firefly III version **${{ steps.ff3version.outputs.release }}** or version **${{ steps.importerversion.outputs.release }}** of the data importer.
Please be so kind as to include the output from the \`/debug\`-page, if you have not done so already. If you already included the debug information, plase make sure to upgrade to the latest version of Firefly III (or the data importer) *first*. This may already solve your issue. Please make sure to upgrade to the latest version of Firefly III (or the data importer) *first*. This may already solve your issue.
If you *are* running the latest version, and this message is wrong, my apologies for the intrusion."
If you are running the latest version, and this message is wrong, my apologies for the intrusion."
gh issue comment "$NUMBER" --body "$MESSAGE" gh issue comment "$NUMBER" --body "$MESSAGE"
echo "Triggered on third test"
exit 0
fi
# fourth test: user includes debug info, and the current version.
if [[ $ISSUE_BODY == *"MZ2udTpin6FL"* && $ISSUE_BODY == *"Debug information generated at"* && ( $ISSUE_BODY == *${{ steps.ff3version.outputs.release }}* || $ISSUE_BODY == *${{ steps.importerversion.outputs.release }}* || $ISSUE_BODY == *$FFNOV* || $ISSUE_BODY == *$DDNOV* ) ]]; then
MESSAGE="Hi there!
This is an automated reply. \`Share and enjoy\`
Thank you for running the latest version of Firefly III (or the data importer)."
# gh issue comment "$NUMBER" --body "$MESSAGE"
echo "Triggered on fourth test"
exit 0
fi fi
env: env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -29,7 +29,7 @@ jobs:
env: env:
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }} version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
- name: Checkout - name: Checkout
uses: actions/checkout@v5 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Import GPG key - name: Import GPG key

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Enums\AccountTypeEnum;
@@ -60,7 +61,7 @@ class AccountController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);
@@ -138,7 +139,7 @@ class AccountController extends Controller
// custom order. // custom order.
usort( usort(
$return, $return,
static function (array $left, array $right) { static function (array $left, array $right): int {
$order = [AccountTypeEnum::ASSET->value, AccountTypeEnum::REVENUE->value, AccountTypeEnum::EXPENSE->value]; $order = [AccountTypeEnum::ASSET->value, AccountTypeEnum::REVENUE->value, AccountTypeEnum::EXPENSE->value];
$posA = (int)array_search($left['type'], $order, true); $posA = (int)array_search($left['type'], $order, true);
$posB = (int)array_search($right['type'], $order, true); $posB = (int)array_search($right['type'], $order, true);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class BillController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(BillRepositoryInterface::class); $this->repository = app(BillRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);
@@ -65,7 +66,7 @@ class BillController extends Controller
{ {
$result = $this->repository->searchBill($request->attributes->get('query'), $request->attributes->get('limit')); $result = $this->repository->searchBill($request->attributes->get('query'), $request->attributes->get('limit'));
$filtered = $result->map( $filtered = $result->map(
static fn (Bill $item) => [ static fn (Bill $item): array => [
'id' => (string) $item->id, 'id' => (string) $item->id,
'name' => $item->name, 'name' => $item->name,
'active' => $item->active, 'active' => $item->active,

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class BudgetController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);
@@ -65,7 +66,7 @@ class BudgetController extends Controller
{ {
$result = $this->repository->searchBudget($request->attributes->get('query'), $request->attributes->get('limit')); $result = $this->repository->searchBudget($request->attributes->get('query'), $request->attributes->get('limit'));
$filtered = $result->map( $filtered = $result->map(
static fn (Budget $item) => [ static fn (Budget $item): array => [
'id' => (string) $item->id, 'id' => (string) $item->id,
'name' => $item->name, 'name' => $item->name,
'active' => $item->active, 'active' => $item->active,

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class CategoryController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(CategoryRepositoryInterface::class); $this->repository = app(CategoryRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);
@@ -65,7 +66,7 @@ class CategoryController extends Controller
{ {
$result = $this->repository->searchCategory($request->attributes->get('query'), $request->attributes->get('limit')); $result = $this->repository->searchCategory($request->attributes->get('query'), $request->attributes->get('limit'));
$filtered = $result->map( $filtered = $result->map(
static fn (Category $item) => [ static fn (Category $item): array => [
'id' => (string) $item->id, 'id' => (string) $item->id,
'name' => $item->name, 'name' => $item->name,
] ]

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use Deprecated; use Deprecated;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
@@ -48,7 +49,7 @@ class CurrencyController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(CurrencyRepositoryInterface::class); $this->repository = app(CurrencyRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class ObjectGroupController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(ObjectGroupRepositoryInterface::class); $this->repository = app(ObjectGroupRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -50,7 +51,7 @@ class PiggyBankController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->piggyRepository = app(PiggyBankRepositoryInterface::class); $this->piggyRepository = app(PiggyBankRepositoryInterface::class);
$this->accountRepository = app(AccountRepositoryInterface::class); $this->accountRepository = app(AccountRepositoryInterface::class);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class RecurrenceController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(RecurringRepositoryInterface::class); $this->repository = app(RecurringRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class RuleController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(RuleRepositoryInterface::class); $this->repository = app(RuleRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class RuleGroupController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(RuleGroupRepositoryInterface::class); $this->repository = app(RuleGroupRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class TagController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(TagRepositoryInterface::class); $this->repository = app(TagRepositoryInterface::class);
$this->repository->setUser($this->user); $this->repository->setUser($this->user);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteTransactionApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteTransactionApiRequest;
@@ -51,7 +52,7 @@ class TransactionController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(JournalRepositoryInterface::class); $this->repository = app(JournalRepositoryInterface::class);
$this->groupRepository = app(TransactionGroupRepositoryInterface::class); $this->groupRepository = app(TransactionGroupRepositoryInterface::class);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Autocomplete; namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest; use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteApiRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -46,7 +47,7 @@ class TransactionTypeController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(TransactionTypeRepositoryInterface::class); $this->repository = app(TransactionTypeRepositoryInterface::class);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Chart; namespace FireflyIII\Api\V1\Controllers\Chart;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Chart\ChartRequest; use FireflyIII\Api\V1\Requests\Chart\ChartRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -59,7 +60,7 @@ class AccountController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository->setUserGroup($this->userGroup); $this->repository->setUserGroup($this->userGroup);

View File

@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Chart; namespace FireflyIII\Api\V1\Controllers\Chart;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Chart\ChartRequest; use FireflyIII\Api\V1\Requests\Chart\ChartRequest;
use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Enums\TransactionTypeEnum;
@@ -56,7 +57,7 @@ class BalanceController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
$this->collector = app(GroupCollectorInterface::class); $this->collector = app(GroupCollectorInterface::class);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Chart; namespace FireflyIII\Api\V1\Controllers\Chart;
use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\DateRangeRequest; use FireflyIII\Api\V1\Requests\DateRangeRequest;
@@ -61,7 +62,7 @@ class BudgetController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(BudgetRepositoryInterface::class); $this->repository = app(BudgetRepositoryInterface::class);
$this->blRepository = app(BudgetLimitRepositoryInterface::class); $this->blRepository = app(BudgetLimitRepositoryInterface::class);
@@ -140,14 +141,14 @@ class BudgetController extends Controller
} }
// convert data if necessary. // convert data if necessary.
if (true === $this->convertToPrimary && $currencyId !== $this->primaryCurrency->id) { if ($this->convertToPrimary && $currencyId !== $this->primaryCurrency->id) {
$currencies[$currencyId] ??= Amount::getTransactionCurrencyById($currencyId); $currencies[$currencyId] ??= Amount::getTransactionCurrencyById($currencyId);
$row['pc_budgeted'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['budgeted']); $row['pc_budgeted'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['budgeted']);
$row['pc_spent'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['spent']); $row['pc_spent'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['spent']);
$row['pc_left'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['left']); $row['pc_left'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['left']);
$row['pc_overspent'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['overspent']); $row['pc_overspent'] = $converter->convert($currencies[$currencyId], $this->primaryCurrency, $start, $row['overspent']);
} }
if (true === $this->convertToPrimary && $currencyId === $this->primaryCurrency->id) { if ($this->convertToPrimary && $currencyId === $this->primaryCurrency->id) {
$row['pc_budgeted'] = $row['budgeted']; $row['pc_budgeted'] = $row['budgeted'];
$row['pc_spent'] = $row['spent']; $row['pc_spent'] = $row['spent'];
$row['pc_left'] = $row['left']; $row['pc_left'] = $row['left'];
@@ -265,7 +266,7 @@ class BudgetController extends Controller
/** @var BudgetLimit $current */ /** @var BudgetLimit $current */
foreach ($limits as $current) { foreach ($limits as $current) {
if (true === $this->convertToPrimary) { if ($this->convertToPrimary) {
if ($current->transaction_currency_id === $this->primaryCurrency->id) { if ($current->transaction_currency_id === $this->primaryCurrency->id) {
// simply add it. // simply add it.
$amount = bcadd($amount, (string)$current->amount); $amount = bcadd($amount, (string)$current->amount);
@@ -283,7 +284,7 @@ class BudgetController extends Controller
$limit = $current; $limit = $current;
} }
} }
if (null !== $limit && true === $this->convertToPrimary) { if (null !== $limit && $this->convertToPrimary) {
// convert and add all amounts. // convert and add all amounts.
$limit->amount = app('steam')->positive($amount); $limit->amount = app('steam')->positive($amount);
Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount)); Log::debug(sprintf('Final amount in limit with converted amount %s', $limit->amount));

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Chart; namespace FireflyIII\Api\V1\Controllers\Chart;
use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\DateRangeRequest; use FireflyIII\Api\V1\Requests\DateRangeRequest;
@@ -58,7 +59,7 @@ class CategoryController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->accountRepos = app(AccountRepositoryInterface::class); $this->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class); $this->currencyRepos = app(CurrencyRepositoryInterface::class);
@@ -181,7 +182,7 @@ class CategoryController extends Controller
$return = array_values($return); $return = array_values($return);
// order by amount // order by amount
usort($return, static fn (array $a, array $b) => ((float)$a['entries']['spent'] + (float)$a['entries']['earned']) < ((float)$b['entries']['spent'] + (float)$b['entries']['earned']) ? 1 : -1); usort($return, static fn (array $a, array $b): int => ((float)$a['entries']['spent'] + (float)$a['entries']['earned']) < ((float)$b['entries']['spent'] + (float)$b['entries']['earned']) ? 1 : -1);
return response()->json($this->clean($return)); return response()->json($this->clean($return));
} }

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers; namespace FireflyIII\Api\V1\Controllers;
use Deprecated;
use Carbon\Carbon; use Carbon\Carbon;
use Carbon\Exceptions\InvalidFormatException; use Carbon\Exceptions\InvalidFormatException;
use FireflyIII\Exceptions\BadHttpHeaderException; use FireflyIII\Exceptions\BadHttpHeaderException;
@@ -100,10 +101,10 @@ abstract class Controller extends BaseController
); );
} }
/** #[Deprecated(message: <<<'TXT'
* @deprecated use Request classes use Request classes
* Method to grab all parameters from the URL Method to grab all parameters from the URL
*/ TXT)]
private function getParameters(): ParameterBag private function getParameters(): ParameterBag
{ {
$bag = new ParameterBag(); $bag = new ParameterBag();

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Data\Bulk; namespace FireflyIII\Api\V1\Controllers\Data\Bulk;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\Bulk\TransactionRequest; use FireflyIII\Api\V1\Requests\Data\Bulk\TransactionRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -51,7 +52,7 @@ class TransactionController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->repository = app(AccountRepositoryInterface::class); $this->repository = app(AccountRepositoryInterface::class);
$this->repository->setUserGroup($this->userGroup); $this->repository->setUserGroup($this->userGroup);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Data; namespace FireflyIII\Api\V1\Controllers\Data;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\DestroyRequest; use FireflyIII\Api\V1\Requests\Data\DestroyRequest;
use FireflyIII\Enums\AccountTypeEnum; use FireflyIII\Enums\AccountTypeEnum;
@@ -63,7 +64,7 @@ class DestroyController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
return $next($request); return $next($request);
@@ -185,7 +186,7 @@ class DestroyController extends Controller
/** @var Account $account */ /** @var Account $account */
foreach ($collection as $account) { foreach ($collection as $account) {
$count = $account->transactions()->count(); $count = $account->transactions()->count();
if (true === $this->unused && 0 === $count) { if ($this->unused && 0 === $count) {
Log::info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name)); Log::info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
Log::channel('audit')->info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name)); Log::channel('audit')->info(sprintf('Deleted unused account #%d "%s"', $account->id, $account->name));
$service->destroy($account, null); $service->destroy($account, null);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Data\Export; namespace FireflyIII\Api\V1\Controllers\Data\Export;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest; use FireflyIII\Api\V1\Requests\Data\Export\ExportRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -49,7 +50,7 @@ class ExportController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
$this->exporter = app(ExportDataGenerator::class); $this->exporter = app(ExportDataGenerator::class);
$this->exporter->setUserGroup($this->userGroup); $this->exporter->setUserGroup($this->userGroup);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Data; namespace FireflyIII\Api\V1\Controllers\Data;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
@@ -51,7 +52,7 @@ class PurgeController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->validateUserGroup($request); $this->validateUserGroup($request);
return $next($request); return $next($request);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\DestroyRequest; use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\DestroyRequest;
@@ -47,7 +48,7 @@ class DestroyController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->repository = app(ExchangeRateRepositoryInterface::class); $this->repository = app(ExchangeRateRepositoryInterface::class);
$this->repository->setUserGroup($this->validateUserGroup($request)); $this->repository->setUserGroup($this->validateUserGroup($request));

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface; use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
@@ -39,7 +40,7 @@ class IndexController extends Controller
{ {
use ValidatesUserGroupTrait; use ValidatesUserGroupTrait;
public const string RESOURCE_KEY = 'currency_exchange_rates'; public const string RESOURCE_KEY = 'exchange-rates';
protected array $acceptedRoles = [UserRoleEnum::OWNER]; protected array $acceptedRoles = [UserRoleEnum::OWNER];
private ExchangeRateRepositoryInterface $repository; private ExchangeRateRepositoryInterface $repository;
@@ -47,7 +48,7 @@ class IndexController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->repository = app(ExchangeRateRepositoryInterface::class); $this->repository = app(ExchangeRateRepositoryInterface::class);
$this->repository->setUserGroup($this->validateUserGroup($request)); $this->repository->setUserGroup($this->validateUserGroup($request));

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -51,7 +52,7 @@ class ShowController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->repository = app(ExchangeRateRepositoryInterface::class); $this->repository = app(ExchangeRateRepositoryInterface::class);
$this->repository->setUserGroup($this->validateUserGroup($request)); $this->repository->setUserGroup($this->validateUserGroup($request));

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreByCurrenciesRequest; use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreByCurrenciesRequest;
@@ -52,7 +53,7 @@ class StoreController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->repository = app(ExchangeRateRepositoryInterface::class); $this->repository = app(ExchangeRateRepositoryInterface::class);
$this->repository->setUserGroup($this->validateUserGroup($request)); $this->repository->setUserGroup($this->validateUserGroup($request));

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use Illuminate\Http\Request;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\UpdateRequest; use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\UpdateRequest;
@@ -48,7 +49,7 @@ class UpdateController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
$this->repository = app(ExchangeRateRepositoryInterface::class); $this->repository = app(ExchangeRateRepositoryInterface::class);
$this->repository->setUserGroup($this->validateUserGroup($request)); $this->repository->setUserGroup($this->validateUserGroup($request));

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\Transaction; namespace FireflyIII\Api\V1\Controllers\Models\Transaction;
use Illuminate\Http\Request;
use FireflyIII\Api\V1\Controllers\Controller; use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\Transaction\StoreRequest; use FireflyIII\Api\V1\Requests\Models\Transaction\StoreRequest;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
@@ -61,7 +62,7 @@ class StoreController extends Controller
{ {
parent::__construct(); parent::__construct();
$this->middleware( $this->middleware(
function ($request, $next) { function (Request $request, $next) {
/** @var User $admin */ /** @var User $admin */
$admin = auth()->user(); $admin = auth()->user();
$userGroup = $this->validateUserGroup($request); $userGroup = $this->validateUserGroup($request);

View File

@@ -90,7 +90,7 @@ class ListController extends Controller
// filter list on currency preference: // filter list on currency preference:
$collection = $unfiltered->filter( $collection = $unfiltered->filter(
static function (Account $account) use ($currency, $accountRepository) { static function (Account $account) use ($currency, $accountRepository): bool {
$currencyId = (int) $accountRepository->getMetaValue($account, 'currency_id'); $currencyId = (int) $accountRepository->getMetaValue($account, 'currency_id');
return $currencyId === $currency->id; return $currencyId === $currency->id;
@@ -178,7 +178,7 @@ class ListController extends Controller
// filter and paginate list: // filter and paginate list:
$collection = $unfiltered->filter( $collection = $unfiltered->filter(
static fn (Bill $bill) => $bill->transaction_currency_id === $currency->id static fn (Bill $bill): bool => $bill->transaction_currency_id === $currency->id
); );
$count = $collection->count(); $count = $collection->count();
$bills = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize); $bills = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
@@ -261,8 +261,8 @@ class ListController extends Controller
// filter selection // filter selection
$collection = $unfiltered->filter( $collection = $unfiltered->filter(
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line static function (Recurrence $recurrence) use ($currency): ?Recurrence { // @phpstan-ignore-line
if (array_any($recurrence->recurrenceTransactions, fn ($transaction) => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) { if (array_any($recurrence->recurrenceTransactions, fn ($transaction): bool => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id)) {
return $recurrence; return $recurrence;
} }
@@ -310,8 +310,8 @@ class ListController extends Controller
$unfiltered = $ruleRepos->getAll(); $unfiltered = $ruleRepos->getAll();
$collection = $unfiltered->filter( $collection = $unfiltered->filter(
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line static function (Rule $rule) use ($currency): ?Rule { // @phpstan-ignore-line
if (array_any($rule->ruleTriggers, fn ($trigger) => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) { if (array_any($rule->ruleTriggers, fn ($trigger): bool => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value)) {
return $rule; return $rule;
} }

View File

@@ -45,18 +45,17 @@ class AccountController extends Controller
{ {
use AccountFilter; use AccountFilter;
private array $validFields; private array $validFields = [
AccountSearch::SEARCH_ALL,
AccountSearch::SEARCH_ID,
AccountSearch::SEARCH_NAME,
AccountSearch::SEARCH_IBAN,
AccountSearch::SEARCH_NUMBER,
];
public function __construct() public function __construct()
{ {
parent::__construct(); parent::__construct();
$this->validFields = [
AccountSearch::SEARCH_ALL,
AccountSearch::SEARCH_ID,
AccountSearch::SEARCH_NAME,
AccountSearch::SEARCH_IBAN,
AccountSearch::SEARCH_NUMBER,
];
} }
/** /**

View File

@@ -591,7 +591,7 @@ class BasicController extends Controller
// filter list on preference of being included. // filter list on preference of being included.
$filtered = $allAccounts->filter( $filtered = $allAccounts->filter(
function (Account $account) { function (Account $account): bool {
$includeNetWorth = $this->accountRepository->getMetaValue($account, 'include_net_worth'); $includeNetWorth = $this->accountRepository->getMetaValue($account, 'include_net_worth');
return null === $includeNetWorth || '1' === $includeNetWorth; return null === $includeNetWorth || '1' === $includeNetWorth;
@@ -651,11 +651,8 @@ class BasicController extends Controller
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) { if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
return true; return true;
} }
// start and end in the past? use $end
if ($start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date)) {
return true;
}
return false; // start and end in the past? use $end
return $start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date);
} }
} }

View File

@@ -23,10 +23,11 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests; namespace FireflyIII\Api\V1\Requests;
use Override;
use Illuminate\Contracts\Validation\Validator;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
use RuntimeException; use RuntimeException;
abstract class AggregateFormRequest extends ApiRequest abstract class AggregateFormRequest extends ApiRequest
@@ -39,6 +40,7 @@ abstract class AggregateFormRequest extends ApiRequest
/** @return array<array|string> */ /** @return array<array|string> */
abstract protected function getRequests(): array; abstract protected function getRequests(): array;
#[Override]
public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null): void public function initialize(array $query = [], array $request = [], array $attributes = [], array $cookies = [], array $files = [], array $server = [], $content = null): void
{ {
parent::initialize($query, $request, $attributes, $cookies, $files, $server, $content); parent::initialize($query, $request, $attributes, $cookies, $files, $server, $content);
@@ -76,7 +78,7 @@ abstract class AggregateFormRequest extends ApiRequest
// check all subrequests for rules and combine them // check all subrequests for rules and combine them
return array_reduce( return array_reduce(
$this->requests, $this->requests,
static fn (array $rules, FormRequest $request) => $rules static fn (array $rules, FormRequest $request): array => $rules
+ ( + (
method_exists($request, 'rules') method_exists($request, 'rules')
? $request->rules() ? $request->rules()
@@ -91,7 +93,7 @@ abstract class AggregateFormRequest extends ApiRequest
// register all subrequests' validators // register all subrequests' validators
foreach ($this->requests as $request) { foreach ($this->requests as $request) {
if (method_exists($request, 'withValidator')) { if (method_exists($request, 'withValidator')) {
Log::debug(sprintf('Process withValidator from class %s', get_class($request))); Log::debug(sprintf('Process withValidator from class %s', $request::class));
$request->withValidator($validator); $request->withValidator($validator);
} }
} }

View File

@@ -24,13 +24,13 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Chart; namespace FireflyIII\Api\V1\Requests\Chart;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Enums\UserRoleEnum; use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait; use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class ChartRequest * Class ChartRequest

View File

@@ -24,12 +24,12 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Data\Bulk; namespace FireflyIII\Api\V1\Requests\Data\Bulk;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class MoveTransactionsRequest * Class MoveTransactionsRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Data\Bulk; namespace FireflyIII\Api\V1\Requests\Data\Bulk;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Enums\ClauseType; use FireflyIII\Enums\ClauseType;
use FireflyIII\Rules\IsValidBulkClause; use FireflyIII\Rules\IsValidBulkClause;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\Api\Data\Bulk\ValidatesBulkTransactionQuery; use FireflyIII\Validation\Api\Data\Bulk\ValidatesBulkTransactionQuery;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
use JsonException; use JsonException;
use function Safe\json_decode; use function Safe\json_decode;

View File

@@ -23,7 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests; namespace FireflyIII\Api\V1\Requests;
use Illuminate\Validation\Validator; use Illuminate\Contracts\Validation\Validator;
class DateRangeRequest extends ApiRequest class DateRangeRequest extends ApiRequest
{ {

View File

@@ -23,8 +23,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests; namespace FireflyIII\Api\V1\Requests;
use Illuminate\Contracts\Validation\Validator;
use Carbon\Carbon; use Carbon\Carbon;
use Illuminate\Validation\Validator;
class DateRequest extends ApiRequest class DateRequest extends ApiRequest
{ {

View File

@@ -24,13 +24,15 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Generic; namespace FireflyIII\Api\V1\Requests\Generic;
use FireflyIII\Api\V1\Requests\ApiRequest; use FireflyIII\Api\V1\Requests\ApiRequest;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction; use FireflyIII\Models\Transaction;
use FireflyIII\Rules\Account\IsValidAccountTypeList; use FireflyIII\Rules\Account\IsValidAccountTypeList;
use FireflyIII\Rules\TransactionType\IsValidTransactionTypeList; use FireflyIII\Rules\TransactionType\IsValidTransactionTypeList;
use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter; use FireflyIII\Support\Http\Api\TransactionFilter;
use Illuminate\Validation\Validator; use Illuminate\Contracts\Validation\Validator;
use Override;
use RuntimeException; use RuntimeException;
class ObjectTypeApiRequest extends ApiRequest class ObjectTypeApiRequest extends ApiRequest
@@ -40,6 +42,7 @@ class ObjectTypeApiRequest extends ApiRequest
private ?string $objectType = null; private ?string $objectType = null;
#[Override]
public function handleConfig(array $config): void public function handleConfig(array $config): void
{ {
parent::handleConfig($config); parent::handleConfig($config);
@@ -86,7 +89,11 @@ class ObjectTypeApiRequest extends ApiRequest
// no break // no break
case Account::class: case Account::class:
$this->attributes->set('types', $this->mapAccountTypes($type)); $types = $this->mapAccountTypes($type);
// remove system account types because autocomplete doesn't need them.
$types = array_values(array_diff($types, [AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::RECONCILIATION->value, AccountTypeEnum::LIABILITY_CREDIT->value]));
$this->attributes->set('types', $types);
break; break;

View File

@@ -23,10 +23,10 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Generic; namespace FireflyIII\Api\V1\Requests\Generic;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Api\V1\Requests\ApiRequest; use FireflyIII\Api\V1\Requests\ApiRequest;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Validation\Validator;
class QueryRequest extends ApiRequest class QueryRequest extends ApiRequest
{ {

View File

@@ -23,9 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Account; namespace FireflyIII\Api\V1\Requests\Models\Account;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Api\V1\Requests\ApiRequest; use FireflyIII\Api\V1\Requests\ApiRequest;
use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\AccountFilter;
use Illuminate\Validation\Validator;
class AccountTypeApiRequest extends ApiRequest class AccountTypeApiRequest extends ApiRequest
{ {

View File

@@ -23,10 +23,10 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Account; namespace FireflyIII\Api\V1\Requests\Models\Account;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Api\V1\Requests\ApiRequest; use FireflyIII\Api\V1\Requests\ApiRequest;
use FireflyIII\Rules\Account\IsValidAccountTypeList; use FireflyIII\Rules\Account\IsValidAccountTypeList;
use FireflyIII\Support\Http\Api\AccountFilter; use FireflyIII\Support\Http\Api\AccountFilter;
use Illuminate\Validation\Validator;
class AccountTypesApiRequest extends ApiRequest class AccountTypesApiRequest extends ApiRequest
{ {

View File

@@ -26,7 +26,6 @@ namespace FireflyIII\Api\V1\Requests\Models\Account;
use FireflyIII\Api\V1\Requests\AggregateFormRequest; use FireflyIII\Api\V1\Requests\AggregateFormRequest;
use FireflyIII\Api\V1\Requests\DateRangeRequest; use FireflyIII\Api\V1\Requests\DateRangeRequest;
use FireflyIII\Api\V1\Requests\DateRequest; use FireflyIII\Api\V1\Requests\DateRequest;
use FireflyIII\Api\V1\Requests\Generic\ObjectTypeApiRequest;
use FireflyIII\Api\V1\Requests\PaginationRequest; use FireflyIII\Api\V1\Requests\PaginationRequest;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Account; namespace FireflyIII\Api\V1\Requests\Models\Account;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\Account; use FireflyIII\Models\Account;
use FireflyIII\Models\Location; use FireflyIII\Models\Location;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@@ -35,7 +36,6 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -58,7 +58,7 @@ class StoreRequest extends FormRequest
{ {
$models = config('firefly.valid_attachment_models'); $models = config('firefly.valid_attachment_models');
$models = array_map( $models = array_map(
static fn (string $className) => str_replace('FireflyIII\Models\\', '', $className), static fn (string $className): string => str_replace('FireflyIII\Models\\', '', $className),
$models $models
); );
$models = implode(',', $models); $models = implode(',', $models);

View File

@@ -60,7 +60,7 @@ class UpdateRequest extends FormRequest
{ {
$models = config('firefly.valid_attachment_models'); $models = config('firefly.valid_attachment_models');
$models = array_map( $models = array_map(
static fn (string $className) => str_replace('FireflyIII\Models\\', '', $className), static fn (string $className): string => str_replace('FireflyIII\Models\\', '', $className),
$models $models
); );
$models = implode(',', $models); $models = implode(',', $models);

View File

@@ -24,13 +24,13 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\AvailableBudget; namespace FireflyIII\Api\V1\Requests\Models\AvailableBudget;
use Illuminate\Contracts\Validation\Validator;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class Request * Class Request

View File

@@ -24,13 +24,13 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Bill; namespace FireflyIII\Api\V1\Requests\Models\Bill;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
use TypeError; use TypeError;
use ValueError; use ValueError;

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Bill; namespace FireflyIII\Api\V1\Requests\Models\Bill;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\Bill; use FireflyIII\Models\Bill;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Budget; namespace FireflyIII\Api\V1\Requests\Models\Budget;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest; use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Budget; namespace FireflyIII\Api\V1\Requests\Models\Budget;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\Budget; use FireflyIII\Models\Budget;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
@@ -32,7 +33,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest; use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit; namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit;
use Illuminate\Contracts\Validation\Validator;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Factory\TransactionCurrencyFactory; use FireflyIII\Factory\TransactionCurrencyFactory;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
@@ -33,7 +34,6 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit; namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit;
use Illuminate\Contracts\Validation\Validator;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -24,12 +24,12 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
use Illuminate\Contracts\Validation\Validator;
use Carbon\Carbon; use Carbon\Carbon;
use Carbon\Exceptions\InvalidFormatException; use Carbon\Exceptions\InvalidFormatException;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreByCurrenciesRequest extends FormRequest class StoreByCurrenciesRequest extends FormRequest
{ {

View File

@@ -24,13 +24,13 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate; namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Support\Facades\Amount; use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
class StoreByDateRequest extends FormRequest class StoreByDateRequest extends FormRequest
{ {

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\PiggyBank; namespace FireflyIII\Api\V1\Requests\Models\PiggyBank;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface; use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Rules\IsValidZeroOrMoreAmount; use FireflyIII\Rules\IsValidZeroOrMoreAmount;
@@ -32,7 +33,6 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Recurrence; namespace FireflyIII\Api\V1\Requests\Models\Recurrence;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Rules\BelongsUser; use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidPositiveAmount; use FireflyIII\Rules\IsValidPositiveAmount;
@@ -35,7 +36,6 @@ use FireflyIII\Validation\RecurrenceValidation;
use FireflyIII\Validation\TransactionValidation; use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Recurrence; namespace FireflyIII\Api\V1\Requests\Models\Recurrence;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\Recurrence; use FireflyIII\Models\Recurrence;
use FireflyIII\Rules\BelongsUser; use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
@@ -36,7 +37,6 @@ use FireflyIII\Validation\RecurrenceValidation;
use FireflyIII\Validation\TransactionValidation; use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Rule; namespace FireflyIII\Api\V1\Requests\Models\Rule;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidActionExpression; use FireflyIII\Rules\IsValidActionExpression;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Support\Request\GetRuleConfiguration; use FireflyIII\Support\Request\GetRuleConfiguration;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest
@@ -202,7 +202,7 @@ class StoreRequest extends FormRequest
$inactiveIndex = $index; $inactiveIndex = $index;
} }
} }
if (true === $allInactive) { if ($allInactive) {
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger')); $validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger'));
} }
} }
@@ -231,7 +231,7 @@ class StoreRequest extends FormRequest
$inactiveIndex = $index; $inactiveIndex = $index;
} }
} }
if (true === $allInactive) { if ($allInactive) {
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action')); $validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action'));
} }
} }

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Rule; namespace FireflyIII\Api\V1\Requests\Models\Rule;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\Rule; use FireflyIII\Models\Rule;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsValidActionExpression; use FireflyIII\Rules\IsValidActionExpression;
@@ -32,7 +33,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Support\Request\GetRuleConfiguration; use FireflyIII\Support\Request\GetRuleConfiguration;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest
@@ -207,7 +207,7 @@ class UpdateRequest extends FormRequest
$inactiveIndex = $index; $inactiveIndex = $index;
} }
} }
if (true === $allInactive) { if ($allInactive) {
$validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger')); $validator->errors()->add(sprintf('triggers.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_trigger'));
} }
} }
@@ -248,7 +248,7 @@ class UpdateRequest extends FormRequest
$inactiveIndex = $index; $inactiveIndex = $index;
} }
} }
if (true === $allInactive) { if ($allInactive) {
$validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action')); $validator->errors()->add(sprintf('actions.%d.active', $inactiveIndex), (string) trans('validation.at_least_one_active_action'));
} }
} }

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Transaction; namespace FireflyIII\Api\V1\Requests\Models\Transaction;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\Location; use FireflyIII\Models\Location;
use FireflyIII\Rules\BelongsUser; use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
@@ -39,7 +40,6 @@ use FireflyIII\Validation\GroupValidation;
use FireflyIII\Validation\TransactionValidation; use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Transaction; namespace FireflyIII\Api\V1\Requests\Models\Transaction;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Exceptions\FireflyException; use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionGroup; use FireflyIII\Models\TransactionGroup;
use FireflyIII\Rules\BelongsUser; use FireflyIII\Rules\BelongsUser;
@@ -37,7 +38,6 @@ use FireflyIII\Validation\GroupValidation;
use FireflyIII\Validation\TransactionValidation; use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -23,8 +23,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\TransactionCurrency; namespace FireflyIII\Api\V1\Requests\Models\TransactionCurrency;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Api\V1\Requests\ApiRequest; use FireflyIII\Api\V1\Requests\ApiRequest;
use Illuminate\Validation\Validator;
class CurrencyCodeRequest extends ApiRequest class CurrencyCodeRequest extends ApiRequest
{ {

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\TransactionLink; namespace FireflyIII\Api\V1\Requests\Models\TransactionLink;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class StoreRequest * Class StoreRequest

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\TransactionLink; namespace FireflyIII\Api\V1\Requests\Models\TransactionLink;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Models\TransactionJournalLink; use FireflyIII\Models\TransactionJournalLink;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface; use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface; use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
@@ -31,7 +32,6 @@ use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UpdateRequest * Class UpdateRequest

View File

@@ -52,7 +52,7 @@ class CreateRequest extends FormRequest
$responses = $this->get('responses', []); $responses = $this->get('responses', []);
$deliveries = $this->get('deliveries', []); $deliveries = $this->get('deliveries', []);
if (0 === count($triggers) || 0 === count($responses) || 0 === count($deliveries)) { if (in_array(0, [count($triggers), count($responses), count($deliveries)], true)) {
throw new FireflyException('Unexpectedly got no responses, triggers or deliveries.'); throw new FireflyException('Unexpectedly got no responses, triggers or deliveries.');
} }

View File

@@ -53,7 +53,7 @@ class UpdateRequest extends FormRequest
$responses = $this->get('responses', []); $responses = $this->get('responses', []);
$deliveries = $this->get('deliveries', []); $deliveries = $this->get('deliveries', []);
if (0 === count($triggers) || 0 === count($responses) || 0 === count($deliveries)) { if (in_array(0, [count($triggers), count($responses), count($deliveries)], true)) {
throw new FireflyException('Unexpectedly got no responses, triggers or deliveries.'); throw new FireflyException('Unexpectedly got no responses, triggers or deliveries.');
} }

View File

@@ -23,16 +23,18 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests; namespace FireflyIII\Api\V1\Requests;
use Override;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Rules\IsValidSortInstruction; use FireflyIII\Rules\IsValidSortInstruction;
use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Facades\Preferences;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Validation\Validator;
use RuntimeException; use RuntimeException;
class PaginationRequest extends ApiRequest class PaginationRequest extends ApiRequest
{ {
private ?string $sortClass = null; private ?string $sortClass = null;
#[Override]
public function handleConfig(array $config): void public function handleConfig(array $config): void
{ {
parent::handleConfig($config); parent::handleConfig($config);

View File

@@ -24,13 +24,13 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\System; namespace FireflyIII\Api\V1\Requests\System;
use Illuminate\Contracts\Validation\Validator;
use FireflyIII\Rules\IsBoolean; use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes; use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/** /**
* Class UserUpdateRequest * Class UserUpdateRequest

View File

@@ -220,7 +220,7 @@ class CorrectsAmounts extends Command
/** @var RuleTrigger $item */ /** @var RuleTrigger $item */
foreach ($set as $item) { foreach ($set as $item) {
$result = $this->fixRuleTrigger($item); $result = $this->fixRuleTrigger($item);
if (true === $result) { if ($result) {
++$fixed; ++$fixed;
} }
} }

View File

@@ -115,7 +115,7 @@ class CorrectsCurrencies extends Command
$found = array_values( $found = array_values(
array_filter( array_filter(
$found, $found,
static fn (int $currencyId) => 0 !== $currencyId static fn (int $currencyId): bool => 0 !== $currencyId
) )
); );

View File

@@ -74,6 +74,7 @@ class CorrectsDatabase extends Command
'correction:group-accounts', 'correction:group-accounts',
'correction:recalculates-liabilities', 'correction:recalculates-liabilities',
'correction:preferences', 'correction:preferences',
'correction:corrects-inverted-budget-limits',
// 'correction:transaction-types', // resource heavy, disabled. // 'correction:transaction-types', // resource heavy, disabled.
'correction:recalculate-pc-amounts', 'correction:recalculate-pc-amounts',
'correction:remove-links-to-deleted-objects', 'correction:remove-links-to-deleted-objects',

View File

@@ -55,10 +55,8 @@ class CorrectsGroupInformation extends Command
/** /**
* Execute the console command. * Execute the console command.
*
* @return int
*/ */
public function handle() public function handle(): int
{ {
// objects: accounts, attachments, available budgets, bills, budgets, categories, currency_exchange_rates // objects: accounts, attachments, available budgets, bills, budgets, categories, currency_exchange_rates
// recurrences, rule groups, rules, tags, transaction groups, transaction journals, webhooks // recurrences, rule groups, rules, tags, transaction groups, transaction journals, webhooks

View File

@@ -93,25 +93,20 @@ class CorrectsIbans extends Command
if (in_array($type, [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value], true)) { if (in_array($type, [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value], true)) {
$type = 'liabilities'; $type = 'liabilities';
} }
if (array_key_exists($iban, $set[$userId])) { // iban already in use! two exceptions exist:
// iban already in use! two exceptions exist: if (array_key_exists($iban, $set[$userId]) && (!AccountTypeEnum::EXPENSE->value === $set[$userId][$iban] && AccountTypeEnum::REVENUE->value === $type && !(AccountTypeEnum::REVENUE->value === $set[$userId][$iban] && AccountTypeEnum::EXPENSE->value === $type))) {
if ( $this->friendlyWarning(
!(AccountTypeEnum::EXPENSE->value === $set[$userId][$iban] && AccountTypeEnum::REVENUE->value === $type) // allowed combination sprintf(
&& !(AccountTypeEnum::REVENUE->value === $set[$userId][$iban] && AccountTypeEnum::EXPENSE->value === $type) // also allowed combination. 'IBAN "%s" is used more than once and will be removed from %s #%d ("%s")',
) { $iban,
$this->friendlyWarning( $account->accountType->type,
sprintf( $account->id,
'IBAN "%s" is used more than once and will be removed from %s #%d ("%s")', $account->name
$iban, )
$account->accountType->type, );
$account->id, $account->iban = null;
$account->name $account->save();
) ++$this->count;
);
$account->iban = null;
$account->save();
++$this->count;
}
} }
if (!array_key_exists($iban, $set[$userId])) { if (!array_key_exists($iban, $set[$userId])) {

View File

@@ -0,0 +1,80 @@
<?php
declare(strict_types=1);
/*
* CorrectsInversedBudgetLimits.php
* Copyright (c) 2025 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
class CorrectsInvertedBudgetLimits extends Command
{
use ShowsFriendlyMessages;
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'correction:corrects-inverted-budget-limits';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Reverse budget limits where the dates are inverted.';
/**
* Execute the console command.
*/
public function handle(): int
{
$set = BudgetLimit::where('start_date', '>', DB::raw('end_date'))->get();
if (0 === $set->count()) {
Log::debug('No inverted budget limits found.');
return Command::SUCCESS;
}
/** @var BudgetLimit $budgetLimit */
foreach ($set as $budgetLimit) {
$start = $budgetLimit->start_date->copy();
$end = $budgetLimit->end_date->copy();
$budgetLimit->start_date = $end;
$budgetLimit->end_date = $start;
$budgetLimit->saveQuietly();
}
if (1 === $set->count()) {
$this->friendlyInfo('Corrected one budget limit to have the right start/end dates.');
return Command::SUCCESS;
}
$this->friendlyInfo(sprintf('Corrected %d budget limits to have the right start/end dates.', count($set)));
return Command::SUCCESS;
}
}

View File

@@ -130,7 +130,7 @@ class CorrectsPrimaryCurrencyAmounts extends Command
$repository->setUserGroup($userGroup); $repository->setUserGroup($userGroup);
$set = $repository->getPiggyBanks(); $set = $repository->getPiggyBanks();
$set = $set->filter( $set = $set->filter(
static fn (PiggyBank $piggyBank) => $currency->id !== $piggyBank->transaction_currency_id static fn (PiggyBank $piggyBank): bool => $currency->id !== $piggyBank->transaction_currency_id
); );
foreach ($set as $piggyBank) { foreach ($set as $piggyBank) {
$piggyBank->encrypted = false; $piggyBank->encrypted = false;

View File

@@ -53,7 +53,7 @@ class CorrectsTransactionTypes extends Command
/** @var TransactionJournal $journal */ /** @var TransactionJournal $journal */
foreach ($journals as $journal) { foreach ($journals as $journal) {
$fixed = $this->fixJournal($journal); $fixed = $this->fixJournal($journal);
if (true === $fixed) { if ($fixed) {
++$count; ++$count;
} }
} }
@@ -115,7 +115,7 @@ class CorrectsTransactionTypes extends Command
private function getSourceAccount(TransactionJournal $journal): Account private function getSourceAccount(TransactionJournal $journal): Account
{ {
$collection = $journal->transactions->filter( $collection = $journal->transactions->filter(
static fn (Transaction $transaction) => $transaction->amount < 0 static fn (Transaction $transaction): bool => $transaction->amount < 0
); );
if (0 === $collection->count()) { if (0 === $collection->count()) {
throw new FireflyException(sprintf('300001: Journal #%d has no source transaction.', $journal->id)); throw new FireflyException(sprintf('300001: Journal #%d has no source transaction.', $journal->id));
@@ -142,7 +142,7 @@ class CorrectsTransactionTypes extends Command
private function getDestinationAccount(TransactionJournal $journal): Account private function getDestinationAccount(TransactionJournal $journal): Account
{ {
$collection = $journal->transactions->filter( $collection = $journal->transactions->filter(
static fn (Transaction $transaction) => $transaction->amount > 0 static fn (Transaction $transaction): bool => $transaction->amount > 0
); );
if (0 === $collection->count()) { if (0 === $collection->count()) {
throw new FireflyException(sprintf('300004: Journal #%d has no destination transaction.', $journal->id)); throw new FireflyException(sprintf('300004: Journal #%d has no destination transaction.', $journal->id));

View File

@@ -257,21 +257,14 @@ class CorrectsUnevenAmount extends Command
// source currency = dest foreign currency // source currency = dest foreign currency
// dest amount = source foreign currency // dest amount = source foreign currency
// dest currency = source foreign currency // dest currency = source foreign currency
// Log::debug(sprintf('[a] %s', bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount)))); // Log::debug(sprintf('[a] %s', bccomp(app('steam')->positive($source->amount), app('steam')->positive($destination->foreign_amount))));
// Log::debug(sprintf('[b] %s', bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount)))); // Log::debug(sprintf('[b] %s', bccomp(app('steam')->positive($destination->amount), app('steam')->positive($source->foreign_amount))));
// Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true))); // Log::debug(sprintf('[c] %s', var_export($source->transaction_currency_id === $destination->foreign_currency_id,true)));
// Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true))); // Log::debug(sprintf('[d] %s', var_export((int) $destination->transaction_currency_id ===(int) $source->foreign_currency_id, true)));
return 0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
if (0 === bccomp(Steam::positive($source->amount), Steam::positive($destination->foreign_amount))
&& $source->transaction_currency_id === $destination->foreign_currency_id && $source->transaction_currency_id === $destination->foreign_currency_id
&& 0 === bccomp(Steam::positive($destination->amount), Steam::positive($source->foreign_amount)) && 0 === bccomp(Steam::positive($destination->amount), Steam::positive($source->foreign_amount))
&& (int) $destination->transaction_currency_id === (int) $source->foreign_currency_id && (int) $destination->transaction_currency_id === (int) $source->foreign_currency_id;
) {
return true;
}
return false;
} }
private function matchCurrencies(): void private function matchCurrencies(): void

View File

@@ -56,7 +56,7 @@ class RestoresOAuthKeys extends Command
} }
if ($this->keysInDatabase() && !$this->keysOnDrive()) { if ($this->keysInDatabase() && !$this->keysOnDrive()) {
$result = $this->restoreKeysFromDB(); $result = $this->restoreKeysFromDB();
if (true === $result) { if ($result) {
$this->friendlyInfo('Restored OAuth keys from database.'); $this->friendlyInfo('Restored OAuth keys from database.');
return; return;

View File

@@ -206,7 +206,7 @@ class ExportsData extends Command
$error = true; $error = true;
} }
if (true === $error && 'start' === $field) { if ($error && 'start' === $field) {
$journal = $this->journalRepository->firstNull(); $journal = $this->journalRepository->firstNull();
$date = $journal instanceof TransactionJournal ? $journal->date : today(config('app.timezone'))->subYear(); $date = $journal instanceof TransactionJournal ? $journal->date : today(config('app.timezone'))->subYear();
$date->startOfDay(); $date->startOfDay();
@@ -214,7 +214,7 @@ class ExportsData extends Command
return $date; return $date;
} }
// field can only be 'end' at this point, so no need to include it in the check. // field can only be 'end' at this point, so no need to include it in the check.
if (true === $error) { if ($error) {
$date = today(config('app.timezone')); $date = today(config('app.timezone'));
$date->endOfDay(); $date->endOfDay();

View File

@@ -86,7 +86,7 @@ class CreatesDatabase extends Command
$pdo->exec(sprintf('CREATE DATABASE `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', env('DB_DATABASE'))); $pdo->exec(sprintf('CREATE DATABASE `%s` CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;', env('DB_DATABASE')));
$this->friendlyInfo(sprintf('Created database "%s"', env('DB_DATABASE'))); $this->friendlyInfo(sprintf('Created database "%s"', env('DB_DATABASE')));
} }
if (true === $exists) { if ($exists) {
$this->friendlyInfo(sprintf('Database "%s" exists.', env('DB_DATABASE'))); $this->friendlyInfo(sprintf('Database "%s" exists.', env('DB_DATABASE')));
} }

View File

@@ -56,7 +56,7 @@ class ForcesDecimalSize extends Command
use ShowsFriendlyMessages; use ShowsFriendlyMessages;
protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).'; protected $description = 'This command resizes DECIMAL columns in MySQL or PostgreSQL and correct amounts (only MySQL).';
protected $signature = 'firefly-iii:force-decimal-size'; protected $signature = 'firefly-iii:force-decimal-size {--force}';
private string $cast; private string $cast;
private array $classes private array $classes
= [ = [
@@ -98,9 +98,14 @@ class ForcesDecimalSize extends Command
Log::debug('Now in ForceDecimalSize::handle()'); Log::debug('Now in ForceDecimalSize::handle()');
$this->determineDatabaseType(); $this->determineDatabaseType();
$this->friendlyError('Running this command is dangerous and can cause data loss.'); $force = $this->option('force');
$this->friendlyError('Please do not continue.'); $question = true;
$question = $this->confirm('Do you want to continue?'); if (false === $force) {
$this->friendlyError('Running this command is dangerous and can cause data loss.');
$this->friendlyError('Please make sure you have a backup.');
$question = $this->confirm('Do you want to continue?');
}
if (true === $question) { if (true === $question) {
$this->correctAmounts(); $this->correctAmounts();
$this->updateDecimals(); $this->updateDecimals();
@@ -131,17 +136,17 @@ class ForcesDecimalSize extends Command
private function correctAmounts(): void private function correctAmounts(): void
{ {
// if sqlite, add function? // if sqlite, add function?
if ('sqlite' === (string) config('database.default')) { if ('sqlite' === (string)config('database.default')) {
DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value) { DB::connection()->getPdo()->sqliteCreateFunction('REGEXP', static function ($pattern, $value): int {
mb_regex_encoding('UTF-8'); mb_regex_encoding('UTF-8');
$pattern = trim($pattern, '"'); $pattern = trim($pattern, '"');
return (false !== mb_ereg($pattern, (string) $value)) ? 1 : 0; return (mb_ereg($pattern, (string)$value)) ? 1 : 0;
}); });
} }
if (!in_array((string) config('database.default'), ['mysql', 'pgsql', 'sqlite'], true)) { if (!in_array((string)config('database.default'), ['mysql', 'pgsql', 'sqlite'], true)) {
$this->friendlyWarning(sprintf('Skip correcting amounts, does not support "%s"...', (string) config('database.default'))); $this->friendlyWarning(sprintf('Skip correcting amounts, does not support "%s"...', (string)config('database.default')));
return; return;
} }
@@ -236,7 +241,7 @@ class ForcesDecimalSize extends Command
/** @var Builder $query */ /** @var Builder $query */
$query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') $query = Account::leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string) $currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
; ;
$query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void { $query->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
@@ -264,7 +269,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10 ** $currency->decimal_places; $pow = 10 ** $currency->decimal_places;
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct)); $this->friendlyInfo(sprintf('Account #%d has %s with value "%s", this has been corrected to "%s".', $account->id, $field, $value, $correct));
/** @var null|Account $updateAccount */ /** @var null|Account $updateAccount */
@@ -316,7 +321,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10 ** $currency->decimal_places; $pow = 10 ** $currency->decimal_places;
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct)); $this->friendlyWarning(sprintf('%s #%d has %s with value "%s", this has been corrected to "%s".', $table, $item->id, $field, $value, $correct));
/** @var null|Model $model */ /** @var null|Model $model */
@@ -340,7 +345,7 @@ class ForcesDecimalSize extends Command
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id') ->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string) $currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression): void { ->where(static function (Builder $q) use ($fields, $currency, $cast, $operator, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
@@ -369,7 +374,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10 ** $currency->decimal_places; $pow = 10 ** $currency->decimal_places;
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning( $this->friendlyWarning(
sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct) sprintf('Piggy bank event #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
); );
@@ -396,7 +401,7 @@ class ForcesDecimalSize extends Command
->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id') ->leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string) $currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void { ->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
@@ -425,7 +430,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10 ** $currency->decimal_places; $pow = 10 ** $currency->decimal_places;
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning( $this->friendlyWarning(
sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct) sprintf('Piggy bank repetition #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)
); );
@@ -450,7 +455,7 @@ class ForcesDecimalSize extends Command
$query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id') $query = PiggyBank::leftJoin('accounts', 'piggy_banks.account_id', '=', 'accounts.id')
->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id') ->leftJoin('account_meta', 'accounts.id', '=', 'account_meta.account_id')
->where('account_meta.name', 'currency_id') ->where('account_meta.name', 'currency_id')
->where('account_meta.data', json_encode((string) $currency->id)) ->where('account_meta.data', json_encode((string)$currency->id))
->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void { ->where(static function (Builder $q) use ($fields, $currency, $operator, $cast, $regularExpression): void {
foreach ($fields as $field) { foreach ($fields as $field) {
$q->orWhere( $q->orWhere(
@@ -479,7 +484,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10 ** $currency->decimal_places; $pow = 10 ** $currency->decimal_places;
$correct = bcdiv((string) round($value * $pow), (string) $pow, 12); $correct = bcdiv((string)round($value * $pow), (string)$pow, 12);
$this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct)); $this->friendlyWarning(sprintf('Piggy bank #%d has %s with value "%s", this has been corrected to "%s".', $item->id, $field, $value, $correct));
/** @var null|PiggyBank $piggyBank */ /** @var null|PiggyBank $piggyBank */
@@ -515,7 +520,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10.0 ** $currency->decimal_places; $pow = 10.0 ** $currency->decimal_places;
$correct = bcdiv((string) round((float) $value * $pow), (string) $pow, 12); $correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12);
$this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)); $this->friendlyWarning(sprintf('Transaction #%d has amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct));
/** @var null|Transaction $transaction */ /** @var null|Transaction $transaction */
@@ -546,7 +551,7 @@ class ForcesDecimalSize extends Command
} }
// fix $field by rounding it down correctly. // fix $field by rounding it down correctly.
$pow = 10.0 ** $currency->decimal_places; $pow = 10.0 ** $currency->decimal_places;
$correct = bcdiv((string) round((float) $value * $pow), (string) $pow, 12); $correct = bcdiv((string)round((float)$value * $pow), (string)$pow, 12);
$this->friendlyWarning( $this->friendlyWarning(
sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct) sprintf('Transaction #%d has foreign amount with value "%s", this has been corrected to "%s".', $item->id, $value, $correct)
); );
@@ -560,7 +565,7 @@ class ForcesDecimalSize extends Command
private function updateDecimals(): void private function updateDecimals(): void
{ {
$this->friendlyInfo('Going to force the size of DECIMAL columns. Please hold.'); $this->friendlyInfo('Going to force the size of DECIMAL columns. Please hold.');
$type = (string) config('database.default'); $type = (string)config('database.default');
/** /**
* @var string $name * @var string $name

View File

@@ -314,7 +314,7 @@ class ApplyRules extends Command
foreach ($rules as $rule) { foreach ($rules as $rule) {
// if in rule selection, or group in selection or all rules, it's included. // if in rule selection, or group in selection or all rules, it's included.
$test = $this->includeRule($rule, $group); $test = $this->includeRule($rule, $group);
if (true === $test) { if ($test) {
Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title)); Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
$rulesToApply->push($rule); $rulesToApply->push($rule);
} }

View File

@@ -136,11 +136,8 @@ class UpgradesLiabilitiesEight extends Command
if (null === $liabilityJournal) { if (null === $liabilityJournal) {
return false; return false;
} }
if (!$openingJournal->date->isSameDay($liabilityJournal->date)) {
return false;
}
return true; return (bool) $openingJournal->date->isSameDay($liabilityJournal->date);
} }
private function deleteCreditTransaction(Account $account): void private function deleteCreditTransaction(Account $account): void

View File

@@ -77,7 +77,7 @@ class UpgradesTagLocations extends Command
private function hasLocationDetails(Tag $tag): bool private function hasLocationDetails(Tag $tag): bool
{ {
return null !== $tag->latitude && null !== $tag->longitude && null !== $tag->zoomLevel; return !in_array(null, [$tag->latitude, $tag->longitude, $tag->zoomLevel], true);
} }
private function migrateLocationDetails(Tag $tag): void private function migrateLocationDetails(Tag $tag): void

View File

@@ -180,7 +180,7 @@ class UpgradesToGroups extends Command
private function getDestinationTransactions(TransactionJournal $journal): Collection private function getDestinationTransactions(TransactionJournal $journal): Collection
{ {
return $journal->transactions->filter( return $journal->transactions->filter(
static fn (Transaction $transaction) => $transaction->amount > 0 static fn (Transaction $transaction): bool => $transaction->amount > 0
); );
} }
@@ -278,7 +278,7 @@ class UpgradesToGroups extends Command
private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction
{ {
$set = $journal->transactions->filter( $set = $journal->transactions->filter(
static function (Transaction $subject) use ($transaction) { static function (Transaction $subject) use ($transaction): bool {
$amount = (float) $transaction->amount * -1 === (float) $subject->amount; // intentional float $amount = (float) $transaction->amount * -1 === (float) $subject->amount; // intentional float
$identifier = $transaction->identifier === $subject->identifier; $identifier = $transaction->identifier === $subject->identifier;
Log::debug(sprintf('Amount the same? %s', var_export($amount, true))); Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));

View File

@@ -211,7 +211,6 @@ class UpgradesVariousCurrencyInformation extends Command
break; break;
} }
/** @var null|Transaction */
return $lead; return $lead;
} }

View File

@@ -84,7 +84,7 @@ class UpgradesWebhooks extends Command
$delivery = WebhookDelivery::tryFrom((int)$webhook->delivery); $delivery = WebhookDelivery::tryFrom((int)$webhook->delivery);
$response = WebhookResponse::tryFrom((int)$webhook->response); $response = WebhookResponse::tryFrom((int)$webhook->response);
$trigger = WebhookTrigger::tryFrom((int)$webhook->trigger); $trigger = WebhookTrigger::tryFrom((int)$webhook->trigger);
if (null === $delivery || null === $response || null === $trigger) { if (in_array(null, [$delivery, $response, $trigger], true)) {
$this->friendlyError(sprintf('[a] Webhook #%d has an invalid delivery, response or trigger value. Will not upgrade.', $webhook->id)); $this->friendlyError(sprintf('[a] Webhook #%d has an invalid delivery, response or trigger value. Will not upgrade.', $webhook->id));
return; return;
@@ -92,7 +92,7 @@ class UpgradesWebhooks extends Command
$deliveryModel = WebhookDeliveryModel::where('key', $delivery->value)->first(); $deliveryModel = WebhookDeliveryModel::where('key', $delivery->value)->first();
$responseModel = WebhookResponseModel::where('key', $response->value)->first(); $responseModel = WebhookResponseModel::where('key', $response->value)->first();
$triggerModel = WebhookTriggerModel::where('key', $trigger->value)->first(); $triggerModel = WebhookTriggerModel::where('key', $trigger->value)->first();
if (null === $deliveryModel || null === $responseModel || null === $triggerModel) { if (in_array(null, [$deliveryModel, $responseModel, $triggerModel], true)) {
$this->friendlyError(sprintf('[b] Webhook #%d has an invalid delivery, response or trigger model. Will not upgrade.', $webhook->id)); $this->friendlyError(sprintf('[b] Webhook #%d has an invalid delivery, response or trigger model. Will not upgrade.', $webhook->id));
return; return;

View File

@@ -50,10 +50,8 @@ class RequestedReportOnJournals
/** /**
* Get the channels the event should broadcast on. * Get the channels the event should broadcast on.
*
* @return PrivateChannel
*/ */
public function broadcastOn() public function broadcastOn(): PrivateChannel
{ {
return new PrivateChannel('channel-name'); return new PrivateChannel('channel-name');
} }

View File

@@ -194,7 +194,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
$user = auth()->user(); $user = auth()->user();
$route = $request->route(); $route = $request->route();
$param = $route->parameter('transactionGroup'); $param = $route->parameter('transactionGroup');
$groupId = !is_object($param) ? (int) $param : 0; $groupId = is_object($param) ? 0 : (int) $param;
/** @var null|TransactionGroup $group */ /** @var null|TransactionGroup $group */
$group = $user->transactionGroups()->withTrashed()->find($groupId); $group = $user->transactionGroups()->withTrashed()->find($groupId);

View File

@@ -274,7 +274,7 @@ class Handler extends ExceptionHandler
{ {
return null !== Arr::first( return null !== Arr::first(
$this->dontReport, $this->dontReport,
static fn ($type) => $e instanceof $type static fn ($type): bool => $e instanceof $type
); );
} }

View File

@@ -33,17 +33,15 @@ use Throwable;
*/ */
final class IntervalException extends Exception final class IntervalException extends Exception
{ {
public array $availableIntervals; public array $availableIntervals = [];
public Periodicity $periodicity; public Periodicity $periodicity = Periodicity::Monthly;
/** @var mixed */ /** @var mixed */
protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s'; protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s';
public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null) public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null)
{ {
parent::__construct($message, $code, $previous); parent::__construct($message, $code, $previous);
$this->availableIntervals = [];
$this->periodicity = Periodicity::Monthly;
} }
public static function unavailable( public static function unavailable(

View File

@@ -130,7 +130,7 @@ class AccountFactory
protected function getAccountType(array $data): ?AccountType protected function getAccountType(array $data): ?AccountType
{ {
$accountTypeId = array_key_exists('account_type_id', $data) ? (int) $data['account_type_id'] : 0; $accountTypeId = array_key_exists('account_type_id', $data) ? (int) $data['account_type_id'] : 0;
$accountTypeName = array_key_exists('account_type_name', $data) ? $data['account_type_name'] : null; $accountTypeName = $data['account_type_name'] ?? null;
$result = null; $result = null;
// find by name or ID // find by name or ID
if ($accountTypeId > 0) { if ($accountTypeId > 0) {
@@ -174,7 +174,7 @@ class AccountFactory
$this->accountRepository->resetAccountOrder(); $this->accountRepository->resetAccountOrder();
// create it: // create it:
$virtualBalance = array_key_exists('virtual_balance', $data) ? $data['virtual_balance'] : null; $virtualBalance = $data['virtual_balance'] ?? null;
$active = array_key_exists('active', $data) ? $data['active'] : true; $active = array_key_exists('active', $data) ? $data['active'] : true;
$databaseData = [ $databaseData = [
'user_id' => $this->user->id, 'user_id' => $this->user->id,

View File

@@ -44,8 +44,8 @@ class AttachmentFactory
public function create(array $data): ?Attachment public function create(array $data): ?Attachment
{ {
// append if necessary. // append if necessary.
$model = !str_contains((string) $data['attachable_type'], 'FireflyIII') ? sprintf('FireflyIII\Models\%s', $data['attachable_type']) $model = str_contains((string) $data['attachable_type'], 'FireflyIII') ? $data['attachable_type']
: $data['attachable_type']; : sprintf('FireflyIII\Models\%s', $data['attachable_type']);
// get journal instead of transaction. // get journal instead of transaction.
if (Transaction::class === $model) { if (Transaction::class === $model) {

View File

@@ -89,7 +89,7 @@ class TagFactory
/** @var null|Tag $tag */ /** @var null|Tag $tag */
$tag = Tag::create($array); $tag = Tag::create($array);
if (null !== $tag && null !== $latitude && null !== $longitude) { if (!in_array(null, [$tag, $latitude, $longitude], true)) {
// create location object. // create location object.
$location = new Location(); $location = new Location();
$location->latitude = $latitude; $location->latitude = $latitude;

View File

@@ -41,20 +41,11 @@ use Illuminate\Support\Facades\Log;
class TransactionFactory class TransactionFactory
{ {
private Account $account; private Account $account;
private array $accountInformation; private array $accountInformation = [];
private TransactionCurrency $currency; private TransactionCurrency $currency;
private ?TransactionCurrency $foreignCurrency = null; private ?TransactionCurrency $foreignCurrency = null;
private TransactionJournal $journal; private TransactionJournal $journal;
private bool $reconciled; private bool $reconciled = false;
/**
* Constructor.
*/
public function __construct()
{
$this->reconciled = false;
$this->accountInformation = [];
}
/** /**
* Create transaction with negative amount (for source accounts). * Create transaction with negative amount (for source accounts).

View File

@@ -71,7 +71,7 @@ class TransactionJournalFactory
private AccountValidator $accountValidator; private AccountValidator $accountValidator;
private BillRepositoryInterface $billRepository; private BillRepositoryInterface $billRepository;
private CurrencyRepositoryInterface $currencyRepository; private CurrencyRepositoryInterface $currencyRepository;
private bool $errorOnHash; private bool $errorOnHash = false;
private array $fields; private array $fields;
private PiggyBankEventFactory $piggyEventFactory; private PiggyBankEventFactory $piggyEventFactory;
private PiggyBankRepositoryInterface $piggyRepository; private PiggyBankRepositoryInterface $piggyRepository;
@@ -86,7 +86,6 @@ class TransactionJournalFactory
*/ */
public function __construct() public function __construct()
{ {
$this->errorOnHash = false;
$this->fields = config('firefly.journal_meta_fields'); $this->fields = config('firefly.journal_meta_fields');
$this->currencyRepository = app(CurrencyRepositoryInterface::class); $this->currencyRepository = app(CurrencyRepositoryInterface::class);
$this->typeRepository = app(TransactionTypeRepositoryInterface::class); $this->typeRepository = app(TransactionTypeRepositoryInterface::class);
@@ -237,7 +236,7 @@ class TransactionJournalFactory
Log::debug('Done with getAccount(2x)'); Log::debug('Done with getAccount(2x)');
// there is a safety catch here. If either account is NULL, they will be replaced with the cash account. // there is a safety catch here. If either account is NULL, they will be replaced with the cash account.
if (null === $destinationAccount) { if (!$destinationAccount instanceof Account) {
Log::warning('Destination account is NULL, will replace with cash account.'); Log::warning('Destination account is NULL, will replace with cash account.');
$destinationAccount = $this->accountRepository->getCashAccount(); $destinationAccount = $this->accountRepository->getCashAccount();
} }
@@ -615,7 +614,7 @@ class TransactionJournalFactory
private function storeLocation(TransactionJournal $journal, NullArrayObject $data): void private function storeLocation(TransactionJournal $journal, NullArrayObject $data): void
{ {
if (null !== $data['longitude'] && null !== $data['latitude'] && null !== $data['zoom_level']) { if (!in_array(null, [$data['longitude'], $data['latitude'], $data['zoom_level']], true)) {
$location = new Location(); $location = new Location();
$location->longitude = $data['longitude']; $location->longitude = $data['longitude'];
$location->latitude = $data['latitude']; $location->latitude = $data['latitude'];
@@ -628,7 +627,7 @@ class TransactionJournalFactory
public function setErrorOnHash(bool $errorOnHash): void public function setErrorOnHash(bool $errorOnHash): void
{ {
$this->errorOnHash = $errorOnHash; $this->errorOnHash = $errorOnHash;
if (true === $errorOnHash) { if ($errorOnHash) {
Log::info('Will trigger duplication alert for this journal.'); Log::info('Will trigger duplication alert for this journal.');
} }
} }

Some files were not shown because too many files have changed in this diff Show More