Compare commits

...

542 Commits

Author SHA1 Message Date
github-actions[bot]
3bf1c0075e Merge pull request #10018 from firefly-iii/develop
🤖 Automatically merge the PR into the main branch.
2025-03-22 14:02:18 +01:00
github-actions[bot]
1821ade319 Merge pull request #10017 from firefly-iii/release-1742648527
🤖 Automatically merge the PR into the develop branch.
2025-03-22 14:02:13 +01:00
JC5
dcd4f072d5 🤖 Auto commit for release 'v6.2.10' on 2025-03-22 2025-03-22 14:02:07 +01:00
James Cole
1734c7f545 Fix output.txt routine. 2025-03-22 13:58:40 +01:00
James Cole
aef3d340ae Escalate to sudo. 2025-03-22 13:53:56 +01:00
James Cole
e39d4bc288 Correct access rights. 2025-03-22 13:50:04 +01:00
James Cole
ed35b0f81a Debug run. 2025-03-22 09:54:25 +01:00
James Cole
4805c9e1c9 Merge branch 'main' into develop 2025-03-22 09:48:37 +01:00
James Cole
eebcbe0f67 Merge pull request #10016 from firefly-iii/move-action
Move action until after commits.
2025-03-22 09:48:14 +01:00
James Cole
61e2b79357 Move action until after commits. 2025-03-22 09:47:43 +01:00
github-actions[bot]
fd3b03d3de Merge pull request #10013 from firefly-iii/release-1742584829
🤖 Automatically merge the PR into the develop branch.
2025-03-21 20:20:34 +01:00
JC5
9423a28158 🤖 Auto commit for release 'develop' on 2025-03-21 2025-03-21 20:20:29 +01:00
James Cole
55062068fd Merge pull request #10012 from firefly-iii/update-changelog
Update changelog.
2025-03-21 20:15:39 +01:00
James Cole
542b6f670d Update changelog. 2025-03-21 20:15:10 +01:00
James Cole
5b163b42b4 Merge pull request #10010 from firefly-iii/debug-timer-10005
Add debug for #10005
2025-03-21 05:51:52 +01:00
James Cole
613dce51fb Add debug for #10005 2025-03-21 05:51:24 +01:00
James Cole
40adb5b203 Merge pull request #10009 from firefly-iii/fix-10007
Fix #10007
2025-03-21 05:49:50 +01:00
James Cole
fba796fa84 Fix #10007 2025-03-21 05:48:51 +01:00
James Cole
db4c3f9bfa Merge pull request #10008 from firefly-iii/fix-missing-init
Fix missing initialisation
2025-03-21 05:37:26 +01:00
James Cole
d960cc6ad7 Fix missing initialisation 2025-03-21 05:36:58 +01:00
github-actions[bot]
c620ec1f24 Merge pull request #9991 from firefly-iii/release-1742181403
🤖 Automatically merge the PR into the develop branch.
2025-03-17 04:16:47 +01:00
JC5
2d78bba6f4 🤖 Auto commit for release 'develop' on 2025-03-17 2025-03-17 04:16:43 +01:00
James Cole
b7a3f5d740 Merge branch 'main' into develop
# Conflicts:
#	package-lock.json
2025-03-16 17:54:09 +01:00
James Cole
96def3c5d4 Merge branch 'main' of github.com:firefly-iii/firefly-iii 2025-03-16 17:53:01 +01:00
James Cole
e1941d9d87 Remove test commit. 2025-03-16 17:52:47 +01:00
github-actions[bot]
a30cf03678 Merge pull request #9987 from firefly-iii/release-1742143821
🤖 Automatically merge the PR into the develop branch.
2025-03-16 17:50:27 +01:00
JC5
aa0dcd3b7e 🤖 Auto commit for release 'develop' on 2025-03-16 2025-03-16 17:50:22 +01:00
James Cole
810e92f7a3 Merge pull request #9977 from firefly-iii/dependabot/npm_and_yarn/npm_and_yarn-4692130362
Bump axios from 1.7.9 to 1.8.2 in the npm_and_yarn group across 1 directory
2025-03-16 17:46:41 +01:00
mergify[bot]
5dd49fc1e1 Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-4692130362 2025-03-16 16:44:48 +00:00
James Cole
8517af105d Fancy new release job. 2025-03-16 17:44:09 +01:00
mergify[bot]
442cf7f9b3 Merge branch 'main' into dependabot/npm_and_yarn/npm_and_yarn-4692130362 2025-03-16 06:19:29 +00:00
James Cole
82878b5214 Merge branch 'main' into develop 2025-03-16 07:19:02 +01:00
James Cole
b0f1102540 Ignore file. 2025-03-16 07:18:50 +01:00
dependabot[bot]
2efee7e6de Bump axios in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [axios](https://github.com/axios/axios).


Updates `axios` from 1.7.9 to 1.8.2
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.7.9...v1.8.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-15 10:05:12 +00:00
James Cole
abcecc7476 Can develop be merged through a PR and not a push? 2025-03-15 11:03:56 +01:00
github-actions
c28005f649 Auto commit for release 'develop' on 2025-03-14 2025-03-14 19:28:44 +01:00
James Cole
a369e61f18 Add changelog. 2025-03-14 19:24:54 +01:00
James Cole
05d82b6c05 Fix missing method. 2025-03-14 19:19:33 +01:00
James Cole
68ca8fd250 Merge pull request #9975 from firefly-iii/remove-transformers
Remove references to old transformers.
2025-03-14 19:18:50 +01:00
James Cole
b55b565ee5 Remove references to old transformers. 2025-03-14 19:18:17 +01:00
github-actions
fc98d66ef4 Auto commit for release 'develop' on 2025-03-14 2025-03-14 17:45:16 +01:00
James Cole
f6642c075d Merge pull request #9969 from firefly-iii/fix-9770
Fix #9770
2025-03-13 20:24:50 +01:00
James Cole
458a337521 Fix #9770 2025-03-13 20:23:53 +01:00
James Cole
37d2299a1d Merge pull request #9957 from firefly-iii/dependabot/composer/develop/phpstan/phpstan-2.1.8
Bump phpstan/phpstan from 2.1.7 to 2.1.8
2025-03-10 05:51:33 +01:00
James Cole
f69cffc50b Merge pull request #9958 from firefly-iii/dependabot/npm_and_yarn/develop/axios-1.8.2
Bump axios from 1.8.1 to 1.8.2
2025-03-10 05:51:22 +01:00
James Cole
fd77a17ba5 Merge pull request #9959 from firefly-iii/dependabot/npm_and_yarn/develop/vite-6.2.1
Bump vite from 6.2.0 to 6.2.1
2025-03-10 05:51:11 +01:00
dependabot[bot]
b481cf53e7 Bump vite from 6.2.0 to 6.2.1
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.2.0 to 6.2.1.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/create-vite@6.2.1/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 03:41:58 +00:00
dependabot[bot]
a4a4590c45 Bump axios from 1.8.1 to 1.8.2
Bumps [axios](https://github.com/axios/axios) from 1.8.1 to 1.8.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v1.8.1...v1.8.2)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 03:41:42 +00:00
dependabot[bot]
9e398beb07 Bump phpstan/phpstan from 2.1.7 to 2.1.8
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 2.1.7 to 2.1.8.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Changelog](https://github.com/phpstan/phpstan/blob/2.1.x/CHANGELOG.md)
- [Commits](https://github.com/phpstan/phpstan/compare/2.1.7...2.1.8)

---
updated-dependencies:
- dependency-name: phpstan/phpstan
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-10 03:19:15 +00:00
James Cole
38ae3df423 Merge pull request #9955 from firefly-iii/fix-9954
Fix #9954
2025-03-09 18:45:04 +01:00
James Cole
2f17701b68 Fix #9954 2025-03-09 18:44:39 +01:00
James Cole
4c797c1d4c Merge pull request #9953 from firefly-iii/fix-9876
Fix #9876
2025-03-09 10:35:38 +01:00
James Cole
a8e1c22c93 Fix #9876 2025-03-09 10:35:12 +01:00
James Cole
b60021e0ce Merge pull request #9952 from firefly-iii/speed-up-account-show
Speed up account show
2025-03-09 09:57:24 +01:00
James Cole
453ccd3271 Clean up overview. 2025-03-09 09:54:14 +01:00
James Cole
08f13aebe3 Fix period overview for account 2025-03-09 09:54:06 +01:00
James Cole
26df1be871 Remove debug 2025-03-09 09:53:52 +01:00
James Cole
fe2def9684 Fix nullpointer. 2025-03-09 09:53:36 +01:00
James Cole
db2cab3cef Add custom method. 2025-03-09 09:53:27 +01:00
James Cole
d84405191f Add debug timers. 2025-03-09 09:53:19 +01:00
James Cole
349d32a268 Merge pull request #9951 from firefly-iii/fix-phpstan-issues
Various code cleanup and sorting.
2025-03-08 19:55:51 +01:00
James Cole
30b7e17b6f Various code cleanup and sorting. 2025-03-08 19:55:21 +01:00
James Cole
2d3d3bc0a4 Merge pull request #9950 from firefly-iii/fix-9948
Fix #9948
2025-03-08 19:35:03 +01:00
James Cole
a4f887921a Fix #9948 2025-03-08 19:34:18 +01:00
James Cole
710732d7f5 Merge pull request #9949 from firefly-iii/missing-phpstan-methods
Missing phpstan methods
2025-03-08 15:58:27 +01:00
James Cole
cd08c16dee Replace missing methods. 2025-03-08 15:57:59 +01:00
James Cole
a8f36a2490 Add missing methods so phpstan stops complaining. 2025-03-08 15:52:50 +01:00
James Cole
7f12d06989 Merge pull request #9947 from firefly-iii/remove-usergroup-repositories
Remove references to user group specific repositories and instead use…
2025-03-08 15:12:13 +01:00
James Cole
8eb0313841 Remove references to user group specific repositories and instead use the normal ones. 2025-03-08 15:10:24 +01:00
James Cole
113eb84461 Merge pull request #9946 from firefly-iii/fix-currency-autocomplete
Add missing method to repository.
2025-03-08 05:57:19 +01:00
mergify[bot]
cdf42e50f0 Merge branch 'develop' into fix-currency-autocomplete 2025-03-08 04:56:06 +00:00
James Cole
e59cf03d80 Merge branch 'main' into develop
# Conflicts:
#	composer.lock
2025-03-08 05:55:45 +01:00
James Cole
0bd0e6caeb Add missing method to repository. 2025-03-08 05:51:50 +01:00
James Cole
605623a7af Merge pull request #9944 from firefly-iii/add-validation-command
Add command to validate various settings.
2025-03-08 05:50:47 +01:00
James Cole
042d055d85 Merge pull request #9945 from firefly-iii/mergify/JC5/config-update
ci(Mergify): configuration update
2025-03-08 05:45:27 +01:00
James Cole
cc29d0a850 ci(Mergify): configuration update
Signed-off-by: James Cole <james@firefly-iii.org>
2025-03-08 05:45:00 +01:00
James Cole
7dede49aee Add command to validate various settings. 2025-03-08 05:38:51 +01:00
James Cole
775282ae02 Fix #9941 2025-03-07 05:25:43 +01:00
James Cole
e49806078a Merge pull request #9935 from firefly-iii/dependabot/composer/composer-e6d0169aed 2025-03-06 05:28:45 +01:00
dependabot[bot]
71d8c0d219 Bump laravel/framework in the composer group across 1 directory
Bumps the composer group with 1 update in the / directory: [laravel/framework](https://github.com/laravel/framework).


Updates `laravel/framework` from 11.43.2 to 11.44.1
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/12.x/CHANGELOG.md)
- [Commits](https://github.com/laravel/framework/compare/v11.43.2...v11.44.1)

---
updated-dependencies:
- dependency-name: laravel/framework
  dependency-type: direct:production
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-05 23:45:21 +00:00
James Cole
0031c5a5ad Fix #9914 2025-03-05 20:12:44 +01:00
James Cole
3ce111550e Merge branch 'main' into develop 2025-03-05 19:53:29 +01:00
James Cole
58af83cc8c Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	.ci/php-cs-fixer/composer.lock
2025-03-05 19:52:36 +01:00
github-actions
422a23e700 Auto commit for release 'develop' on 2025-03-05 2025-03-05 15:50:17 +01:00
Sander Dorigo
8c2672cdf8 Fix #9895 2025-03-05 15:02:40 +01:00
Sander Dorigo
764e49985b add default values 2025-03-05 14:58:10 +01:00
Sander Dorigo
84251f8f10 Merge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop 2025-03-05 14:42:34 +01:00
James Cole
3d878cb5dd Merge pull request #9899 from firefly-iii/dependabot/github_actions/github/command-2.0.0
Bump github/command from 1.3.0 to 2.0.0
2025-03-05 12:28:06 +01:00
Sander Dorigo
8b4740d28c fix #9902 2025-03-05 12:27:08 +01:00
James Cole
0845e265c2 Merge pull request #9903 from lompi/add_support_for_strpos_in_expressions
Add support for PHP function `strpos` in expressions
2025-03-05 12:25:50 +01:00
Sander Dorigo
b4455a3802 Fix #9906 2025-03-05 12:18:14 +01:00
Sander Dorigo
8d12d47691 fix #9908 2025-03-05 12:13:56 +01:00
James Cole
3dc01b0d5c Merge pull request #9918 from firefly-iii/dependabot/composer/develop/diglactic/laravel-breadcrumbs-10.0.0
Bump diglactic/laravel-breadcrumbs from 9.0.0 to 10.0.0
2025-03-05 11:44:32 +01:00
dependabot[bot]
b442645280 Bump diglactic/laravel-breadcrumbs from 9.0.0 to 10.0.0
Bumps [diglactic/laravel-breadcrumbs](https://github.com/diglactic/laravel-breadcrumbs) from 9.0.0 to 10.0.0.
- [Release notes](https://github.com/diglactic/laravel-breadcrumbs/releases)
- [Upgrade guide](https://github.com/diglactic/laravel-breadcrumbs/blob/main/UPGRADE.md)
- [Commits](https://github.com/diglactic/laravel-breadcrumbs/compare/v9.0.0...v10.0.0)

---
updated-dependencies:
- dependency-name: diglactic/laravel-breadcrumbs
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-03-03 03:20:25 +00:00
github-actions
eda2b5f822 Auto commit for release 'develop' on 2025-03-03 2025-03-03 04:14:36 +01:00
Lompi
d9593db5e2 Add support for PHP function strpos in expressions
Signed-off-by: Lompi <lompi91+github_com@gmail.com>
2025-02-24 16:55:00 +01:00
dependabot[bot]
9dcb8e2680 Bump github/command from 1.3.0 to 2.0.0
Bumps [github/command](https://github.com/github/command) from 1.3.0 to 2.0.0.
- [Release notes](https://github.com/github/command/releases)
- [Commits](https://github.com/github/command/compare/v1.3.0...v2.0.0)

---
updated-dependencies:
- dependency-name: github/command
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-24 03:51:39 +00:00
github-actions
56bac9fc97 Auto commit for release 'develop' on 2025-02-24 2025-02-24 04:13:39 +01:00
James Cole
f7ad9c56c8 Add imports for facades 2025-02-23 12:47:04 +01:00
James Cole
0086a0ddc8 Fix namespace. 2025-02-23 12:35:13 +01:00
James Cole
25ebfd6978 php cs cleanup 2025-02-23 12:28:43 +01:00
James Cole
de8149137a Use trait and interface. 2025-02-23 12:28:27 +01:00
James Cole
79ae110368 Update php cs fixer 2025-02-23 12:27:49 +01:00
James Cole
60aef0de1a Mark as deprecated. 2025-02-23 12:27:34 +01:00
James Cole
8d464962a8 Remove methods, point to interface. 2025-02-23 12:27:07 +01:00
github-actions
b93cfc5de2 Auto commit for release 'develop' on 2025-02-22 2025-02-22 17:26:08 +01:00
github-actions
d41f5b1090 Auto commit for release 'v6.2.9' on 2025-02-22 2025-02-22 17:20:52 +01:00
James Cole
40322813c9 Also include user group 2025-02-22 17:17:28 +01:00
James Cole
4a98927e32 Update changelog. 2025-02-22 17:16:30 +01:00
James Cole
193e529803 Fix #9887 2025-02-22 17:16:20 +01:00
github-actions
fbf20ef2c2 Auto commit for release 'v6.2.8' on 2025-02-22 2025-02-22 12:30:53 +01:00
github-actions
54de829c8a Merge branch 'develop' 2025-02-22 11:28:39 +00:00
James Cole
131b987561 Remove TZ 2025-02-22 12:27:22 +01:00
James Cole
dce6754c62 Merge branch 'main' into develop 2025-02-22 10:27:58 +01:00
James Cole
f4bca90080 Add time and time zone perhaps? 2025-02-22 10:25:31 +01:00
James Cole
b2960b1ed9 Remove docker ignore, not useful in this context. 2025-02-22 10:20:55 +01:00
James Cole
33f87bce23 Merge branch 'main' into develop 2025-02-22 10:20:31 +01:00
James Cole
23aa45609b Remove files from zip. 2025-02-22 10:20:23 +01:00
github-actions
b098952f82 Auto commit for release 'develop' on 2025-02-22 2025-02-22 10:16:15 +01:00
James Cole
68c3e14b0c Update changelog. 2025-02-22 10:12:30 +01:00
James Cole
19d08137a5 Fix #9887 2025-02-22 10:06:59 +01:00
James Cole
73776e7869 Fix #9887 2025-02-22 10:05:44 +01:00
github-actions
bf04ca12c1 Auto commit for release 'develop' on 2025-02-22 2025-02-22 08:18:27 +01:00
James Cole
a4637debe9 Update changelog, fix log reference. 2025-02-22 08:07:52 +01:00
James Cole
48c1b525be Fix #9874 2025-02-22 08:03:42 +01:00
github-actions
56470bfbba Auto commit for release 'develop' on 2025-02-21 2025-02-21 08:32:55 +01:00
James Cole
0f732ca874 Merge pull request #9880 from josegonzalez/patch-1
fix: ignore the Procfile when building the docker image
2025-02-21 08:06:04 +01:00
James Cole
e452ba938d Update changelog. 2025-02-21 06:20:17 +01:00
James Cole
9921c5a925 Fix #9882 2025-02-21 06:18:11 +01:00
Jose Diaz-Gonzalez
58fab75681 fix: ignore the Procfile when building the docker image
The Procfile is heroku-specific, causing issues on platforms which respect it when specifying processes to run for docker image or dockerfile based deploys.

Closes #9833

Signed-off-by: Jose Diaz-Gonzalez <email@josediazgonzalez.com>
2025-02-20 14:51:04 -05:00
Sander Dorigo
54990308f6 fix type error 2025-02-20 12:58:38 +01:00
github-actions
f95758ff47 Auto commit for release 'develop' on 2025-02-20 2025-02-20 08:11:36 +01:00
James Cole
8d830e178f Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-02-20 08:08:18 +01:00
James Cole
334a521ca1 Better fix for nullpointer. 2025-02-20 08:08:07 +01:00
github-actions
12629a1955 Auto commit for release 'develop' on 2025-02-20 2025-02-20 08:00:12 +01:00
James Cole
2e3669a32f Fix #9871 2025-02-20 07:43:32 +01:00
James Cole
ea337607c4 Fix #9868 2025-02-20 07:30:30 +01:00
James Cole
f7f317a3b2 Fix #9863 2025-02-20 07:28:24 +01:00
James Cole
adbf6defe5 Catch nullpointer. 2025-02-20 06:21:29 +01:00
github-actions
e0709f2975 Auto commit for release 'develop' on 2025-02-19 2025-02-19 09:14:18 +01:00
James Cole
30007b05cb Fix #9861 2025-02-19 06:37:40 +01:00
James Cole
13fc7f0d8d Fix #9862 2025-02-19 06:21:27 +01:00
github-actions
7c85138115 Auto commit for release 'v6.2.7' on 2025-02-18 2025-02-18 19:52:25 +01:00
James Cole
2c25f65f7f Expand changelog. 2025-02-18 19:46:01 +01:00
github-actions
7eaba962e8 Auto commit for release 'develop' on 2025-02-18 2025-02-18 15:17:06 +01:00
Sander Dorigo
7c38393cde merge 2025-02-18 15:12:42 +01:00
Sander Dorigo
153fd2ae74 fix missing var 2025-02-18 15:06:51 +01:00
github-actions
c0204c810c Auto commit for release 'develop' on 2025-02-18 2025-02-18 10:31:05 +01:00
Sander Dorigo
944c107e26 Add enrichment 2025-02-18 10:26:36 +01:00
Sander Dorigo
18e05c06fd Catch nullpointer 2025-02-18 10:24:23 +01:00
Sander Dorigo
fb79dbf17c Merge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop 2025-02-18 10:22:42 +01:00
github-actions
31a8163c61 Auto commit for release 'develop' on 2025-02-17 2025-02-17 16:52:58 +01:00
Sander Dorigo
8bcd729250 remove unused script 2025-02-17 16:49:00 +01:00
Sander Dorigo
80c4e69528 Fix #9848 2025-02-17 13:43:43 +01:00
github-actions
7f6d8fdb87 Auto commit for release 'develop' on 2025-02-17 2025-02-17 13:37:44 +01:00
Sander Dorigo
c8e301326e Fix #9855 2025-02-17 13:32:07 +01:00
github-actions
4820ef6580 Auto commit for release 'develop' on 2025-02-17 2025-02-17 04:11:50 +01:00
James Cole
4cb775cf4b Various code cleanup. 2025-02-16 19:45:31 +01:00
James Cole
c371662c51 Fix missing method. 2025-02-16 19:38:07 +01:00
James Cole
ffaa164aa5 Replace facade 2025-02-16 19:32:50 +01:00
James Cole
344bfbe059 Various includes fixed, optimize account deletion. 2025-02-16 19:30:40 +01:00
James Cole
6c38b87ec5 Fix #9842 2025-02-16 07:23:03 +01:00
James Cole
dfcd5d79be Fix preferences. 2025-02-16 06:33:53 +01:00
James Cole
07631eea28 Add some debug logging. 2025-02-15 20:51:43 +01:00
James Cole
26c4fe36cc Fix #9803 2025-02-15 19:19:23 +01:00
James Cole
90fc4b44f2 A lot less queries for the account transformer. 2025-02-15 16:51:13 +01:00
James Cole
f755dd2d48 Fix nullpointer 2025-02-15 16:46:25 +01:00
James Cole
d2647f96e7 Fix type error. 2025-02-15 15:44:21 +01:00
James Cole
9f94ec067a Greatly reduce number of queries in transaction transformer. 2025-02-15 14:10:54 +01:00
James Cole
a795755618 Fix #9835 2025-02-15 07:24:31 +01:00
James Cole
8457a1c881 Add cron routine for update. 2025-02-15 06:12:02 +01:00
James Cole
fc9429bf3e Fix #9835 2025-02-15 05:39:21 +01:00
James Cole
b6e8b66035 Make sure user_group_id is rendered as int where relevant. 2025-02-15 05:38:40 +01:00
github-actions
7504b21c3e Auto commit for release 'develop' on 2025-02-12 2025-02-12 20:11:21 +01:00
github-actions
b7dad8166d Auto commit for release 'v6.2.6' on 2025-02-12 2025-02-12 20:06:45 +01:00
James Cole
2da1b43c37 Expand changelog. 2025-02-12 20:01:45 +01:00
James Cole
a606315884 Fix balance display #9826 2025-02-12 11:53:51 +01:00
github-actions
295feedd77 Auto commit for release 'develop' on 2025-02-12 2025-02-12 10:50:48 +01:00
James Cole
d3b2748c8f Ok this fix for #9797 goes out to @nebster9k who is delightfully stubborn and absolutely correct. 2025-02-12 06:38:21 +01:00
James Cole
1b4655fd70 Fix #9821 2025-02-12 06:06:28 +01:00
Sander Dorigo
05f67ef584 Fix #9810 2025-02-11 16:27:18 +01:00
Sander Dorigo
04ab7ba07d qMerge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop 2025-02-11 16:10:48 +01:00
Sander Dorigo
5806323970 Add some notes 2025-02-11 16:10:16 +01:00
github-actions
ee260a3df7 Auto commit for release 'develop' on 2025-02-11 2025-02-11 10:47:28 +01:00
Sander Dorigo
7cb41fb333 fix a null pointer 2025-02-11 10:41:32 +01:00
Sander Dorigo
d38adbfdc2 Fix #9808 2025-02-11 08:39:44 +01:00
Sander Dorigo
e6a6766ef1 update instructions 2025-02-11 08:36:24 +01:00
James Cole
a1e596491c Add debug logging. 2025-02-11 06:13:28 +01:00
James Cole
9c920908a6 Fix type errors 2025-02-11 06:06:30 +01:00
James Cole
0014bffeb8 Fix #9807 2025-02-11 06:06:09 +01:00
James Cole
63c17f99b2 Fix parse error 2025-02-11 06:05:47 +01:00
James Cole
ec1e0e2807 New notifications controller (not yet used) 2025-02-11 05:53:34 +01:00
Sander Dorigo
2f16419a7b Add debug logging to finalAccountBalance. 2025-02-10 16:47:59 +01:00
James Cole
02c13859e7 Update ValidatesUserGroupTrait.php
Signed-off-by: James Cole <james@firefly-iii.org>
2025-02-10 10:28:50 +01:00
github-actions
57ec9b8e36 Auto commit for release 'develop' on 2025-02-10 2025-02-10 04:10:23 +01:00
James Cole
41ad35880d Fix #9797 2025-02-09 17:39:18 +01:00
James Cole
3aa946e028 Fix nullpointer. 2025-02-09 09:35:26 +01:00
James Cole
53e46895aa Expand a few repositories to support user groups. 2025-02-09 09:30:44 +01:00
James Cole
c61389037d Small code cleanup. 2025-02-09 07:10:05 +01:00
James Cole
6172d60e00 Fix phpstan issues (or ignore them). 2025-02-09 07:02:12 +01:00
github-actions
f909f1d9ff Auto commit for release 'develop' on 2025-02-09 2025-02-09 06:14:15 +01:00
James Cole
55018ca046 Remove duplicate copyright statement. 2025-02-09 06:10:46 +01:00
github-actions
19c746a865 Auto commit for release 'v6.2.5' on 2025-02-09 2025-02-09 06:08:12 +01:00
James Cole
503d2aa786 Rename class to stop phpunit complaining. 2025-02-09 05:57:47 +01:00
James Cole
70d83ab501 Fix #9784 2025-02-09 05:52:18 +01:00
James Cole
edab602bb7 Fix #9784 2025-02-09 05:26:37 +01:00
James Cole
f9bcc4b1fa Extra code for #9747 2025-02-08 10:51:52 +01:00
github-actions
f3fe86167c Auto commit for release 'develop' on 2025-02-08 2025-02-08 08:18:18 +01:00
James Cole
2189fb46a2 Disble tests 2025-02-08 08:11:15 +01:00
James Cole
7ff4178c8b Add some basic feature tests. 2025-02-08 08:11:01 +01:00
James Cole
fffd695ef8 Expand changelog. 2025-02-08 07:18:50 +01:00
James Cole
ee592de035 Fix #9769 2025-02-08 07:16:56 +01:00
James Cole
7394e50ae2 Method should be public. 2025-02-08 06:57:26 +01:00
James Cole
f42fcff04a Fix #9783 2025-02-08 06:42:12 +01:00
James Cole
4eb3ce7c14 Fix #9789 2025-02-07 05:26:03 +01:00
James Cole
a977c567ce Fix #9787 2025-02-06 18:28:42 +01:00
James Cole
785bd7e905 Fix #9786 2025-02-06 17:06:48 +01:00
James Cole
df19f699d4 Fix tests. 2025-02-06 08:56:58 +01:00
James Cole
5e6e932e7e Add subscriptions, over bills. 2025-02-06 08:32:22 +01:00
James Cole
5bc397f01a Disable old parser tests. 2025-02-06 08:32:06 +01:00
James Cole
42209e367f Make sure this order is used. #9780 2025-02-06 05:55:46 +01:00
James Cole
d53b1670d3 Fix #9781 2025-02-06 05:51:51 +01:00
James Cole
a6d450ba18 Some fixes for #9747 2025-02-05 18:50:09 +01:00
James Cole
e8c1a95128 Add debug logs to ntfy. 2025-02-05 18:37:00 +01:00
James Cole
edb201f210 Fix #9736 2025-02-05 15:31:53 +01:00
github-actions
fe57367a8c Auto commit for release 'v6.2.4' on 2025-02-05 2025-02-05 08:03:34 +01:00
James Cole
134194a95b Fix search code here too. 2025-02-05 07:46:26 +01:00
github-actions
41c0e6fe2d Auto commit for release 'develop' on 2025-02-05 2025-02-05 07:43:04 +01:00
James Cole
c07914e733 Update changelog 2025-02-05 07:39:53 +01:00
James Cole
52e2302f4f Fix search code. 2025-02-05 07:37:22 +01:00
github-actions
0a6b34b4f2 Auto commit for release 'v6.2.3' on 2025-02-05 2025-02-05 07:25:30 +01:00
github-actions
1e06b4dd0b Merge branch 'develop' 2025-02-05 06:23:14 +00:00
James Cole
5701f95e0b Expand changelog 2025-02-05 07:22:00 +01:00
James Cole
60d3572d37 Expand changelog 2025-02-05 07:21:31 +01:00
github-actions
ffa6e6a571 Auto commit for release 'develop' on 2025-02-05 2025-02-05 06:50:00 +01:00
James Cole
d6453cd735 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-02-05 06:46:35 +01:00
James Cole
fd79f9df44 Expand changelog, fix migration. 2025-02-05 06:46:27 +01:00
github-actions
4587340293 Auto commit for release 'develop' on 2025-02-05 2025-02-05 06:41:08 +01:00
James Cole
90bfdc7573 Fix #9754 2025-02-05 06:36:51 +01:00
James Cole
eca12f661f Fix #9327 2025-02-05 06:31:15 +01:00
James Cole
f85878b843 Final tweaks in account balance logic. 2025-02-05 06:29:07 +01:00
James Cole
6499b5eaab Rename variable for consistency. 2025-02-05 06:03:57 +01:00
James Cole
7e4fece63d add some checks and balances to migrations. 2025-02-05 05:58:53 +01:00
James Cole
512eddf8be Fix #9736 2025-02-05 05:51:22 +01:00
github-actions
f0fa93a811 Auto commit for release 'develop' on 2025-02-04 2025-02-04 21:38:20 +01:00
James Cole
3c8de21709 Fix balance and native balance lists. 2025-02-04 21:34:46 +01:00
James Cole
81173e8340 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	app/Support/Steam.php
2025-02-04 21:28:43 +01:00
James Cole
35a8fa5f02 Fix balance in range. 2025-02-04 21:27:24 +01:00
James Cole
443036936d Update changelog. 2025-02-04 21:26:53 +01:00
James Cole
ac88007593 Replace steam call. 2025-02-04 21:26:40 +01:00
github-actions
2297589dca Auto commit for release 'develop' on 2025-02-04 2025-02-04 19:48:38 +01:00
James Cole
6ada5fa560 Fix #9751 2025-02-04 19:43:53 +01:00
Sander Dorigo
8f6eefb5e7 Fix #9745 2025-02-04 08:45:08 +01:00
Sander Dorigo
b36a50381b Fix #9747 2025-02-04 08:42:54 +01:00
Sander Dorigo
51f84b3060 Fix #9762 2025-02-04 08:37:02 +01:00
Sander Dorigo
72132a19b0 Fix #9736 2025-02-04 08:30:27 +01:00
Sander Dorigo
065d165211 Fix #9713 2025-02-04 08:28:43 +01:00
James Cole
cabedf39b2 Merge pull request #9750 from firefly-iii/dependabot/github_actions/aws-actions/closed-issue-message-2
Bump aws-actions/closed-issue-message from 1 to 2
2025-02-03 08:03:16 +01:00
dependabot[bot]
5d3806fcd4 Bump aws-actions/closed-issue-message from 1 to 2
Bumps [aws-actions/closed-issue-message](https://github.com/aws-actions/closed-issue-message) from 1 to 2.
- [Release notes](https://github.com/aws-actions/closed-issue-message/releases)
- [Commits](https://github.com/aws-actions/closed-issue-message/compare/v1...v2)

---
updated-dependencies:
- dependency-name: aws-actions/closed-issue-message
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-02-03 03:34:11 +00:00
github-actions
01695b3342 Auto commit for release 'develop' on 2025-02-03 2025-02-03 04:08:56 +01:00
James Cole
71fb5fe077 Fix changelog. 2025-02-02 16:24:10 +01:00
github-actions
3bec106840 Auto commit for release 'v6.2.2' on 2025-02-02 2025-02-02 16:20:11 +01:00
James Cole
fb01c36be1 Update changelog and manifest [skip ci] 2025-02-02 16:14:32 +01:00
James Cole
26d851e69e Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-02-02 16:14:09 +01:00
James Cole
28c18c046b Fix #9744 2025-02-02 16:13:56 +01:00
github-actions
318cef7e3b Auto commit for release 'develop' on 2025-02-02 2025-02-02 16:06:22 +01:00
James Cole
e8dc8f25be Update changelog [skip ci] 2025-02-02 16:02:45 +01:00
James Cole
10ccc30240 Fix #9738 2025-02-02 16:02:17 +01:00
James Cole
5adc877d5e Merge pull request #9743 from mansehr/feature-nordic-currencies
Feature nordic currencies
2025-02-02 15:23:05 +01:00
SoftBrix
30923afb2b Added ISK 2025-02-02 14:48:01 +01:00
SoftBrix
4eb6813b43 Added NOK 2025-02-02 14:46:26 +01:00
James Cole
7521a31619 Expand changelog. 2025-02-02 06:48:57 +01:00
James Cole
fc05beb452 Fix #9727 2025-02-02 06:24:10 +01:00
James Cole
1103428a83 Smaller issue replies. 2025-02-02 05:41:54 +01:00
James Cole
d06d521bf0 Merge branch 'main' into develop 2025-02-02 05:39:41 +01:00
James Cole
8f64f1c0eb Expand explanation. 2025-02-02 05:39:33 +01:00
James Cole
d11c232171 Fix https://github.com/firefly-iii/firefly-iii/issues/9736 2025-02-02 05:38:47 +01:00
SoftBrix
93c73248de Added SEK 2025-02-02 00:03:31 +01:00
James Cole
5bed081ab9 Fix https://github.com/firefly-iii/firefly-iii/issues/9731 2025-02-01 21:14:28 +01:00
James Cole
c5188c503e Fix https://github.com/firefly-iii/firefly-iii/issues/9713 2025-02-01 21:06:06 +01:00
James Cole
98ffcac7b6 Fix https://github.com/firefly-iii/firefly-iii/issues/9729 2025-02-01 20:58:35 +01:00
James Cole
df1e81d611 Fix https://github.com/firefly-iii/firefly-iii/issues/9730 2025-02-01 20:52:41 +01:00
James Cole
9711170b08 Fix https://github.com/firefly-iii/firefly-iii/issues/9732 2025-02-01 20:43:20 +01:00
github-actions
e43264bdce Auto commit for release 'develop' on 2025-02-01 2025-02-01 19:12:18 +01:00
github-actions
e0643bed7a Auto commit for release 'v6.2.1' on 2025-02-01 2025-02-01 19:06:02 +01:00
James Cole
7f0eb3b064 Expand changelog. 2025-02-01 19:01:17 +01:00
James Cole
f38e510526 Fix https://github.com/firefly-iii/firefly-iii/issues/9714 2025-02-01 18:59:55 +01:00
James Cole
25f99b23b2 Merge branch 'main' into develop 2025-02-01 18:40:00 +01:00
James Cole
44281fc8a0 Respond to "fixed" label. 2025-02-01 18:39:51 +01:00
James Cole
eed3902cb7 Fix https://github.com/firefly-iii/firefly-iii/issues/9726 2025-02-01 18:37:26 +01:00
James Cole
94a3bb0443 Limit the number of recurring transactions returned. 2025-02-01 15:39:34 +01:00
James Cole
8dcc36880e Fix https://github.com/firefly-iii/firefly-iii/issues/9722 2025-02-01 13:03:19 +01:00
James Cole
695bb31894 Fix https://github.com/firefly-iii/firefly-iii/issues/9723 2025-02-01 13:01:13 +01:00
James Cole
f8ded66869 Fix https://github.com/firefly-iii/firefly-iii/issues/9721 2025-02-01 12:53:34 +01:00
James Cole
8e4bdbc584 Fix https://github.com/firefly-iii/firefly-iii/issues/9720 2025-02-01 12:50:48 +01:00
James Cole
f7b14b01bc Fix https://github.com/firefly-iii/firefly-iii/issues/9717 2025-02-01 12:01:50 +01:00
James Cole
705b9bf0f2 Fix https://github.com/firefly-iii/firefly-iii/issues/9719 2025-02-01 11:44:56 +01:00
James Cole
f0226dbc54 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-02-01 11:29:21 +01:00
James Cole
1b1dfb0d7b Fix https://github.com/firefly-iii/firefly-iii/issues/9718 2025-02-01 11:28:39 +01:00
github-actions
8ed5092a76 Auto commit for release 'develop' on 2025-02-01 2025-02-01 06:23:31 +01:00
James Cole
d609821be6 Expand debug table. 2025-02-01 06:18:58 +01:00
github-actions
cd0201074c Auto commit for release 'v6.2.0' on 2025-01-31 2025-01-31 20:35:34 +01:00
James Cole
1d8feec7bc Update changelog. 2025-01-31 20:28:17 +01:00
James Cole
d941472c84 Merge branch 'main' into develop 2025-01-29 20:12:19 +01:00
James Cole
674a118fac Merge pull request #9709 from firefly-iii/dependabot/composer/composer-aeff1b7291
Bump twig/twig from 3.18.0 to 3.19.0 in the composer group across 1 directory
2025-01-29 20:11:54 +01:00
dependabot[bot]
1334d793f6 Bump twig/twig in the composer group across 1 directory
Bumps the composer group with 1 update in the / directory: [twig/twig](https://github.com/twigphp/Twig).


Updates `twig/twig` from 3.18.0 to 3.19.0
- [Changelog](https://github.com/twigphp/Twig/blob/3.x/CHANGELOG)
- [Commits](https://github.com/twigphp/Twig/compare/v3.18.0...v3.19.0)

---
updated-dependencies:
- dependency-name: twig/twig
  dependency-type: indirect
  dependency-group: composer
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-29 18:44:41 +00:00
James Cole
60354c0202 Fix https://github.com/firefly-iii/firefly-iii/issues/9704 2025-01-29 08:40:16 +01:00
James Cole
22081d3f0a Add skip help text 2025-01-29 07:52:16 +01:00
James Cole
4b3f8fc78d Remove logging [skip ci] 2025-01-29 07:48:43 +01:00
github-actions
4bd1aab86d Auto commit for release 'develop' on 2025-01-27 2025-01-27 04:08:46 +01:00
James Cole
60362cb60c Remove debug header, does not work. 2025-01-26 17:07:45 +01:00
github-actions
27f740bf98 Auto commit for release 'v6.2.0-beta.1' on 2025-01-26 2025-01-26 14:41:24 +01:00
github-actions
5e15747a5b Auto commit for release 'develop' on 2025-01-26 2025-01-26 14:33:19 +01:00
James Cole
8a6eaad2bb Fix vite 2025-01-26 14:29:11 +01:00
James Cole
5ab52d9f66 Fix vite 2025-01-26 14:26:17 +01:00
James Cole
21a327bf08 Merge branch 'main' into develop 2025-01-26 14:10:30 +01:00
James Cole
15dd175394 Add date [skip ci] 2025-01-26 14:10:09 +01:00
James Cole
3f35305beb Update changelog. 2025-01-26 14:09:49 +01:00
James Cole
768d8b1515 Fix currency exchange rates 2025-01-26 10:09:09 +01:00
James Cole
1c19428a12 Catch API endpoint errors. 2025-01-26 07:44:41 +01:00
James Cole
c204533195 Fix various API 500 errors. 2025-01-26 06:30:38 +01:00
James Cole
6d89485792 Fix endpoints, validate dates. 2025-01-25 09:17:21 +01:00
James Cole
949d818bad Cleanup code. 2025-01-25 04:51:09 +01:00
James Cole
a12e200a0a Put query count in debug header 2025-01-25 04:50:36 +01:00
James Cole
b4039b1f13 Report if the version is a dev version 2025-01-25 04:50:26 +01:00
James Cole
32921e15b1 Remove errors from handler 2025-01-25 04:50:15 +01:00
James Cole
4f7cc7d53b More strict date validation 2025-01-25 04:49:28 +01:00
James Cole
0986bfbc34 Rename warnings to notifications 2025-01-25 04:49:08 +01:00
James Cole
663202bfc6 Return correct headers 2025-01-25 04:48:51 +01:00
James Cole
6f63ddf5b0 [chore] Fix https://github.com/firefly-iii/firefly-iii/issues/9683 and rename default to native. 2025-01-22 05:24:12 +01:00
James Cole
a9805b144a Merge pull request #9684 from firefly-iii/dependabot/npm_and_yarn/npm_and_yarn-545022be4d 2025-01-22 04:37:48 +01:00
dependabot[bot]
e1b8b9b3ae Bump vite in the npm_and_yarn group across 1 directory
Bumps the npm_and_yarn group with 1 update in the / directory: [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite).


Updates `vite` from 6.0.7 to 6.0.9
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.9/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  dependency-group: npm_and_yarn
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-01-21 21:02:17 +00:00
James Cole
d57327fd11 [chore] various code cleanup. 2025-01-21 06:34:39 +01:00
github-actions
15ac69bfad Auto commit for release 'develop' on 2025-01-20 2025-01-20 04:08:13 +01:00
github-actions
a5bd28f8d4 Auto commit for release 'develop' on 2025-01-19 2025-01-19 19:26:58 +01:00
github-actions
b2516ca1b4 Auto commit for release 'v6.2.0-alpha.2' on 2025-01-19 2025-01-19 19:12:01 +01:00
James Cole
053b46ae63 [chore] fix phpstan errors. 2025-01-19 19:07:19 +01:00
James Cole
6e836aceec Expand changelog. 2025-01-19 18:55:03 +01:00
James Cole
0e8bcd2e79 [chore] cod cleanup 2025-01-19 18:53:32 +01:00
James Cole
bd1f8b2497 [chore] Move to native from default. [skip ci] 2025-01-19 11:54:40 +01:00
James Cole
19dfcf7139 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	app/Transformers/CurrencyTransformer.php
#	app/Transformers/V2/CurrencyTransformer.php
2025-01-19 11:48:18 +01:00
James Cole
ef7a3287bb Add info to changelog 2025-01-19 11:47:49 +01:00
James Cole
2900049498 Add default 2025-01-19 11:47:41 +01:00
github-actions
04d1e8fd59 Auto commit for release 'develop' on 2025-01-19 2025-01-19 11:46:08 +01:00
James Cole
9d2f57e40a Fix menu 2025-01-19 11:41:24 +01:00
James Cole
ae366341cc Rename default to native. 2025-01-19 11:40:07 +01:00
James Cole
3766128cb8 Add code for administrations. 2025-01-19 11:34:23 +01:00
James Cole
950c60d55c Fix https://github.com/firefly-iii/firefly-iii/issues/9667 2025-01-19 07:18:07 +01:00
James Cole
4b2807de48 rename admin to settings. 2025-01-18 17:26:31 +01:00
James Cole
649736cb31 Rename admin to settings. 2025-01-18 17:22:11 +01:00
James Cole
6a121a8a78 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	app/Transformers/AccountTransformer.php
2025-01-18 17:21:34 +01:00
James Cole
f69b9ac9da Commit updated transformers. 2025-01-18 17:20:39 +01:00
James Cole
23d70a2fac Rename to settings 2025-01-18 17:20:21 +01:00
James Cole
d178ff9de0 Rename admin routes to settings. 2025-01-18 17:20:06 +01:00
James Cole
3ecad3457f Rename "administration" to "settings" 2025-01-18 17:10:47 +01:00
github-actions
fa6c621968 Auto commit for release 'develop' on 2025-01-15 2025-01-15 20:30:00 +01:00
James Cole
df863b6cff Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-01-15 18:54:56 +01:00
James Cole
9316ff3e51 Fix account api for new features. 2025-01-15 18:54:49 +01:00
James Cole
bfd91f8ee6 Update default.twig
Signed-off-by: James Cole <james@firefly-iii.org>
2025-01-13 11:32:54 +01:00
github-actions
13e5d25cfe Auto commit for release 'develop' on 2025-01-13 2025-01-13 04:14:18 +01:00
James Cole
b13030420b Merge branch 'main' into develop 2025-01-11 10:07:21 +01:00
github-actions
44d1e8181c Auto commit for release 'develop' on 2025-01-11 2025-01-11 10:06:32 +01:00
James Cole
63b34c1853 Remove unused step. 2025-01-11 10:05:51 +01:00
github-actions
facd0144cb Auto commit for release 'develop' on 2025-01-10 2025-01-10 17:56:21 +01:00
James Cole
115e3435af Fix https://github.com/orgs/firefly-iii/discussions/9576 2025-01-10 06:26:28 +01:00
github-actions
d44cd50768 Auto commit for release 'develop' on 2025-01-06 2025-01-06 07:37:27 +01:00
James Cole
1afcaea4c6 Trim quotes 2025-01-06 06:55:34 +01:00
James Cole
2bd1b37717 Move class to separate file. 2025-01-06 06:19:09 +01:00
github-actions
2d37177316 Auto commit for release 'develop' on 2025-01-06 2025-01-06 04:13:41 +01:00
James Cole
abb25e2015 Fix sql query error and upgrade error. 2025-01-05 14:33:33 +01:00
James Cole
d08d075e30 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-01-05 09:23:17 +01:00
github-actions
b4c67c02a7 Auto commit for release 'develop' on 2025-01-05 2025-01-05 09:23:02 +01:00
James Cole
04fb6a953e This rule is no longer necessary. 2025-01-05 09:21:29 +01:00
James Cole
5dce0bec8e This is no longer necessary since translations are no longer stored in the repository. 2025-01-05 09:20:55 +01:00
James Cole
481bb3fb0a Fix a few test cases. 2025-01-05 09:18:03 +01:00
James Cole
b6960dc299 Fix search result page. 2025-01-05 08:03:15 +01:00
James Cole
73104aae1f Fix data provider. 2025-01-05 07:52:23 +01:00
James Cole
10a284848b Drop else-statements, remove debug statement. 2025-01-05 07:45:29 +01:00
James Cole
fd6560bdd0 Fix copyright for new files. 2025-01-05 07:40:30 +01:00
James Cole
0810f617c7 Merge pull request #9598 from Sobuno/NewQueryParserV3
New Query Parser for Search Engine and Rules
2025-01-05 07:32:55 +01:00
James Cole
c3ffd39450 run phpcs 2025-01-05 07:31:26 +01:00
James Cole
0f69e0d672 Level 7 yay! 2025-01-04 19:43:58 +01:00
James Cole
1aa8ebe57f Fixed level 7! 2025-01-04 19:25:43 +01:00
James Cole
23178614d5 First fixes for level 7. 2025-01-04 19:12:04 +01:00
James Cole
d2b6829574 First fixes for level 7. 2025-01-04 19:05:24 +01:00
James Cole
5602715c96 Made it to level 6! 2025-01-04 15:16:11 +01:00
James Cole
54d0433dd4 Start with level 6. [skip ci] 2025-01-04 09:34:17 +01:00
James Cole
f4bc313d0b Fix level 5! Mostly by ignoring the errors lol. 2025-01-04 09:15:39 +01:00
James Cole
5617de3a79 Level 4 fixed! 2025-01-04 09:01:44 +01:00
James Cole
2d62f0ff06 Rename class [skip ci] 2025-01-04 08:44:02 +01:00
James Cole
1c79f6b1b6 Rename again [skip ci] 2025-01-04 08:42:57 +01:00
James Cole
bf01153c6b Rename file [skip ci] 2025-01-04 08:42:36 +01:00
James Cole
c43b37baef Various phpstan fixes [skip ci] 2025-01-04 08:42:06 +01:00
James Cole
d4942efd8e Fix various level 4 issues [skip ci] 2025-01-04 08:02:05 +01:00
James Cole
ea9f635b1a Improved cs fixer config [skip ci] 2025-01-04 07:39:33 +01:00
James Cole
7eaa0e16b3 Run phpcs locally to make sure phpstan stays fixed. [skip ci] 2025-01-04 07:39:16 +01:00
James Cole
1b97d8fd48 Fix phpcs things [skip ci] 2025-01-04 07:31:25 +01:00
James Cole
89a29b9b10 Disable a rule. 2025-01-04 07:25:45 +01:00
James Cole
2baac1a6d7 Fix phpstan level 3! 2025-01-04 07:10:37 +01:00
James Cole
cd296aa9ac Fix test run. 2025-01-04 06:35:26 +01:00
James Cole
959d168352 Fix various phpstan issues. 2025-01-03 19:16:38 +01:00
James Cole
6cd60951ba Fix for level 2 2025-01-03 19:07:29 +01:00
James Cole
3898c0c0ef Fix phpstan issues. 2025-01-03 18:16:27 +01:00
James Cole
fe4d139817 fix phpstan warnings 2025-01-03 15:53:10 +01:00
James Cole
d95f3ca59f No errors on level 1. 2025-01-03 15:07:30 +01:00
James Cole
7f6c03ce17 Fix phpstan issues. 2025-01-03 15:04:15 +01:00
James Cole
394d0eabef Fix various phpstan issues. 2025-01-03 14:56:06 +01:00
James Cole
a8ae496fda Replace enum 2025-01-03 09:15:52 +01:00
James Cole
1787f4421b Replace enum 2025-01-03 09:11:20 +01:00
James Cole
36351a5dd9 Replace enum 2025-01-03 09:09:15 +01:00
James Cole
d009ce31ca Replace enum 2025-01-03 09:05:56 +01:00
James Cole
44eafeeae5 Replace enum 2025-01-03 09:05:19 +01:00
James Cole
21165eb3e0 Update packages. 2025-01-03 08:30:04 +01:00
James Cole
2ef3a33fbf Merge branch 'main' into develop 2025-01-03 08:17:57 +01:00
James Cole
f74be0402f Add copyright statements. 2025-01-03 08:15:09 +01:00
github-actions
a60cb366b2 Auto commit for release 'develop' on 2025-01-03 2025-01-03 07:12:13 +01:00
github-actions
58e2ef187d Auto commit for release 'develop' on 2025-01-03 2025-01-03 07:01:02 +01:00
James Cole
ae80fd8578 Fix test cases. 2025-01-03 04:51:42 +01:00
James Cole
c17f2efca6 Fix missing variables. 2025-01-03 04:36:41 +01:00
James Cole
4a185639b9 Fix removal of all piggy banks. 2025-01-03 04:32:51 +01:00
Sobuno
dae7e7d507 Handle excludedWords on Rule management pages as well 2025-01-03 01:00:17 +01:00
Sobuno
e33e3cc40f Tweak UI 2025-01-03 00:45:19 +01:00
Sobuno
36ec1daf3a Update UI 2025-01-03 00:29:38 +01:00
Sobuno
50aff9cfb6 Make prohibited word search work 2025-01-03 00:13:51 +01:00
Sobuno
058a0f9fb2 Show excluded words in UI 2025-01-03 00:08:11 +01:00
Sobuno
0c955efa8b Allow flipping of subqueries 2025-01-03 00:07:57 +01:00
Sobuno
a62916a63d Simplify further 2025-01-02 23:36:00 +01:00
Sobuno
af7a4b5d3d Renaming of classes, making true recursive structure 2025-01-02 23:19:21 +01:00
Sobuno
2ae3929dd6 Give a bit better error messages in tests 2025-01-02 22:40:50 +01:00
Sobuno
ebd30f4861 Move tests to match rearranged structure + standardize tests 2025-01-02 22:18:12 +01:00
Sobuno
afc9ea08f3 Rearrange structure 2025-01-02 22:17:56 +01:00
Sobuno
78f9f7e2dd Add QUERY_PARSER_IMPLEMENTATION in .env.example 2025-01-02 20:06:11 +01:00
Sobuno
c44b827922 Fix environment-based selection of Query Parser 2025-01-02 20:03:39 +01:00
James Cole
fb30f7ec8f Update build script. 2025-01-02 19:10:39 +01:00
James Cole
e878d5ce07 Fix linking piggy banks to transactions. 2025-01-02 04:54:29 +01:00
github-actions
f727a38b69 Auto commit for release 'develop' on 2025-01-01 2025-01-01 16:47:50 +01:00
James Cole
c11a5384da Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2025-01-01 16:43:44 +01:00
James Cole
ed92cbd4b8 Fix piggy bank rule action 2025-01-01 16:43:31 +01:00
github-actions
a9ea32772f Auto commit for release 'develop' on 2025-01-01 2025-01-01 16:38:58 +01:00
Sobuno
92f5cca65b Add QueryParser tests to correct group 2025-01-01 14:18:56 +01:00
Sobuno
57b064f590 Remove incorrect LICENSE message at top of file 2025-01-01 14:18:19 +01:00
Sobuno
9729434926 Allow choosing QueryParser implementation 2025-01-01 05:36:22 +01:00
Sobuno
9d9dffee74 Always assert prohibited field 2025-01-01 05:32:49 +01:00
Sobuno
b3f374f4ea Introduce assertion helpers to make tests more readable 2025-01-01 05:32:49 +01:00
Sobuno
50e07d422f Small QoL additions 2025-01-01 05:32:49 +01:00
Sobuno
631ed4956a Handle right parenthesis behaviour correctly 2025-01-01 05:32:49 +01:00
Sobuno
0eca1c8d03 Fix test 2025-01-01 05:32:49 +01:00
Sobuno
e38e4574ad Fix warnings in tests and add some more 2025-01-01 05:32:49 +01:00
Sobuno
be2d3f3637 Rename QueryParser2 to QueryParser 2025-01-01 05:32:49 +01:00
Sobuno
0e3d779e24 Remove V1 2025-01-01 05:32:49 +01:00
Sobuno
4d25336d87 More WIP 2025-01-01 05:32:49 +01:00
Sobuno
74f76a2835 Fix namespace 2025-01-01 05:32:49 +01:00
Sobuno
84560a6f44 WIP 2025-01-01 05:32:49 +01:00
James Cole
6fde693e7a Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts:
#	app/Support/Steam.php
2024-12-31 08:19:47 +01:00
James Cole
2e46d9ba33 Clean up some logs. 2024-12-31 08:18:40 +01:00
James Cole
e36f8deb08 Clean up some logs. 2024-12-31 08:18:21 +01:00
James Cole
1631b422f1 Clean up logs, add cache. 2024-12-31 08:17:35 +01:00
github-actions
b58d809063 Auto commit for release 'develop' on 2024-12-31 2024-12-31 08:09:51 +01:00
James Cole
9e34314dbc Fix various issues with new features, nullpointers and missing checks. 2024-12-31 08:05:25 +01:00
github-actions
e4aa218b5f Auto commit for release 'v6.2.0-alpha.1' on 2024-12-30 2024-12-30 17:09:40 +01:00
github-actions
31722477d4 Merge branch 'develop' 2024-12-30 16:07:29 +00:00
github-actions
ec82105433 Auto commit for release 'develop' on 2024-12-30 2024-12-30 15:35:26 +01:00
James Cole
146e164f04 Back to 8. 2024-12-30 15:31:27 +01:00
James Cole
7d37c93988 Expand workflow. 2024-12-30 15:25:39 +01:00
James Cole
73dffacd9a Expand to support alpha and beta versions. 2024-12-30 12:23:50 +01:00
James Cole
d37304fa68 Fix available budgets. 2024-12-30 12:22:39 +01:00
James Cole
62f4da6063 Update available budgets code. 2024-12-30 10:51:34 +01:00
James Cole
760da08ab7 Update exchange rates. 2024-12-30 07:36:22 +01:00
James Cole
e68c4d4408 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2024-12-30 07:36:12 +01:00
James Cole
46a200aa1f Fix broken variable. 2024-12-30 07:30:23 +01:00
James Cole
c422039335 Merge pull request #9589 from tasnim0tantawi/autocomplete-test
Autocomplete test - CurrencyControllerTest & ObjectGroupControllerTest
2024-12-30 07:18:05 +01:00
github-actions
0579c8565d Auto commit for release 'develop' on 2024-12-30 2024-12-30 04:12:18 +01:00
James Cole
9f25880a59 Clean up several endpoints with complex code. 2024-12-29 18:32:02 +01:00
James Cole
05f1819f7d Fix API convert to native. Still needs refactoring. 2024-12-29 14:24:20 +01:00
James Cole
fa2149f957 Update API to convert to native. 2024-12-29 13:47:48 +01:00
James Cole
c21a79e029 Better, but not perfect, currency switch. 2024-12-29 08:16:27 +01:00
James Cole
03e31ebb5e Clean up endpoint. 2024-12-29 06:36:49 +01:00
James Cole
3c20e5f3af Make sure integers are converted to strings because sqlite sucks. 2024-12-29 06:32:50 +01:00
James Cole
9a9dd9e075 Double fix. Not sure yet what causes this. 2024-12-29 06:17:29 +01:00
James Cole
7189986c03 Remove some debug logging. 2024-12-29 06:15:42 +01:00
James Cole
b407d8d315 Add usergroup, clean up some code. 2024-12-29 06:14:40 +01:00
James Cole
41fa2a6208 Include user group in test set. 2024-12-29 06:10:54 +01:00
James Cole
fe00c4c373 Fix unauthenticated get default currency. 2024-12-29 06:08:35 +01:00
James Cole
7248a76c63 Fix chart, expand changelog. 2024-12-29 05:58:12 +01:00
James Cole
ee3c618797 Fix https://github.com/firefly-iii/firefly-iii/issues/9586 2024-12-29 05:55:49 +01:00
James Cole
a1241ebedb Various multi-currency things in the autocomplete API. 2024-12-28 18:38:19 +01:00
James Cole
af78d998db Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2024-12-28 14:09:42 +01:00
James Cole
d96c235ffe Fix path 2024-12-28 14:09:22 +01:00
James Cole
79ca1b5f4e Change some CS fixer settings. 2024-12-28 14:08:34 +01:00
github-actions
0f68735e1c Auto commit for release 'develop' on 2024-12-28 2024-12-28 13:59:31 +01:00
James Cole
82abee37de Fix a string of text. 2024-12-28 13:45:45 +01:00
James Cole
507040f1fd Update various code for sqlite compatibility. 2024-12-28 13:36:25 +01:00
James Cole
42dc8486e9 Fix string. 2024-12-28 11:16:55 +01:00
github-actions
6c655634bc Auto commit for release 'develop' on 2024-12-28 2024-12-28 10:58:01 +01:00
James Cole
f2166b97b8 Various fixes for sqlite databases 2024-12-28 10:52:46 +01:00
James Cole
da88e02be0 Catch exception. 2024-12-28 07:47:32 +01:00
James Cole
0d56b7d251 Ignore error. Must test more with sqlite. 2024-12-28 07:39:39 +01:00
James Cole
0a089efcac Clean up commands. 2024-12-28 07:35:20 +01:00
James Cole
89ab360391 Remove reference to cacheable models 2024-12-28 07:10:33 +01:00
James Cole
2bd97d9a99 Remove references to laravel json api 2024-12-28 07:09:25 +01:00
James Cole
103b9056e4 Expand changelog, remove unused packages. 2024-12-28 06:55:17 +01:00
github-actions
23c4352c18 Auto commit for release 'develop' on 2024-12-27 2024-12-27 22:03:16 +01:00
James Cole
2dddaa36d5 Actions will default to php 8.4 2024-12-27 19:51:20 +01:00
James Cole
8ab7cf2388 Merge branch 'v6.2' into develop
# Conflicts:
#	composer.lock
#	config/firefly.php
#	package-lock.json
2024-12-27 19:50:05 +01:00
James Cole
f191086adb Enable cache again. 2024-12-27 19:47:35 +01:00
James Cole
68b446db18 Final changes. 2024-12-27 19:46:40 +01:00
James Cole
3d49d81856 Expand some multi currency things. 2024-12-27 16:36:01 +01:00
James Cole
96493425d1 Convert more of the budget view to native currency. 2024-12-27 13:42:48 +01:00
James Cole
419975285c Fix nullpointer 2024-12-27 13:02:23 +01:00
github-actions
aa5bde122e Auto commit for release 'branch-v6.2' on 2024-12-27 2024-12-27 12:43:57 +01:00
James Cole
0fa3c2bd8d Fix issue with prefilled piggy banks. 2024-12-27 12:39:26 +01:00
James Cole
b9249a4d96 Update commands. 2024-12-27 09:30:41 +01:00
James Cole
6638ca270f Merge branch 'v6.2' of github.com:firefly-iii/firefly-iii into v6.2 2024-12-27 07:36:37 +01:00
James Cole
9bfef892f8 Remove lots of debug logs 2024-12-27 07:36:30 +01:00
github-actions
32e5efec7c Auto commit for release 'branch-v6.2' on 2024-12-27 2024-12-27 07:29:17 +01:00
James Cole
36457455ca Rename and clean up commands. 2024-12-27 07:24:47 +01:00
James Cole
062c148e43 Rename all correction commands. 2024-12-27 06:56:08 +01:00
James Cole
2314ce8004 Refactor and renam commands. 2024-12-27 06:48:58 +01:00
James Cole
a3ff73903a Fix bad error message. 2024-12-27 05:44:03 +01:00
James Cole
7c8445707e Add moar debug. 2024-12-26 14:12:05 +01:00
James Cole
291e73da4b Rename bills to subscriptions 2024-12-26 13:41:57 +01:00
James Cole
286a29ca3e Display for bills. 2024-12-26 11:28:31 +01:00
github-actions
71cf6c6a5e Auto commit for release 'branch-v6.2' on 2024-12-26 2024-12-26 10:24:39 +01:00
James Cole
1e8f0adaf8 Fix broken account balance. 2024-12-26 10:20:40 +01:00
James Cole
33531244aa Merge branch 'v6.2' of github.com:firefly-iii/firefly-iii into v6.2
# Conflicts:
#	app/Http/Controllers/Chart/AccountController.php
#	app/Support/Steam.php
2024-12-26 09:19:04 +01:00
James Cole
06049a9a28 Update various pages, clean up some code. 2024-12-26 09:16:17 +01:00
James Cole
d313f5fdf5 Fix chart balance. 2024-12-26 08:53:16 +01:00
github-actions
f4868126c1 Auto commit for release 'branch-v6.2' on 2024-12-26 2024-12-26 05:25:46 +01:00
James Cole
00147e98dd Fix home chart. 2024-12-26 05:21:28 +01:00
James Cole
6d22663ca2 Fix charts and balances. 2024-12-26 05:11:32 +01:00
James Cole
756bb9cf5e Fix overview, skip chart for now. 2024-12-25 11:59:15 +01:00
TasneemTantawy
5971d155ef fixed create authenticated user 2024-12-23 09:37:06 +03:00
James Cole
cea52c0ac7 Merge pull request #9571 from firefly-iii/dependabot/composer/develop/phpunit/phpunit-10.5.40
Bump phpunit/phpunit from 10.5.39 to 10.5.40
2024-12-23 07:02:55 +01:00
James Cole
1b33ff9c25 Merge pull request #9573 from firefly-iii/dependabot/npm_and_yarn/develop/i18next-24.2.0
Bump i18next from 24.1.2 to 24.2.0
2024-12-23 07:02:41 +01:00
James Cole
594ba205bb Merge pull request #9574 from firefly-iii/dependabot/npm_and_yarn/develop/vite-6.0.5
Bump vite from 6.0.3 to 6.0.5
2024-12-23 07:01:29 +01:00
dependabot[bot]
495f5c71c3 Bump vite from 6.0.3 to 6.0.5
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 6.0.3 to 6.0.5.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v6.0.5/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 03:12:47 +00:00
dependabot[bot]
7e80f607b7 Bump i18next from 24.1.2 to 24.2.0
Bumps [i18next](https://github.com/i18next/i18next) from 24.1.2 to 24.2.0.
- [Release notes](https://github.com/i18next/i18next/releases)
- [Changelog](https://github.com/i18next/i18next/blob/master/CHANGELOG.md)
- [Commits](https://github.com/i18next/i18next/compare/v24.1.2...v24.2.0)

---
updated-dependencies:
- dependency-name: i18next
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 03:12:31 +00:00
github-actions
d93732e451 Auto commit for release 'develop' on 2024-12-23 2024-12-23 04:12:14 +01:00
dependabot[bot]
1b57bc7889 Bump phpunit/phpunit from 10.5.39 to 10.5.40
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 10.5.39 to 10.5.40.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/10.5.40/ChangeLog-10.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/10.5.39...10.5.40)

---
updated-dependencies:
- dependency-name: phpunit/phpunit
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-12-23 03:01:52 +00:00
TasneemTantawy
9e373a9b0d object group controller test 2024-12-22 16:29:56 +03:00
TasneemTantawy
4fb61646b4 currency controller test 2024-12-22 15:54:18 +03:00
github-actions
e2f1fc307f Auto commit for release 'develop' on 2024-12-18 2024-12-18 16:52:40 +01:00
964 changed files with 18781 additions and 16217 deletions

View File

@@ -29,7 +29,7 @@ $paths = [
$current . '/../../database',
$current . '/../../routes',
$current . '/../../tests',
$current . '/../../resources/lang',
$current . '/../../resources/lang/en_US',
];
$finder = PhpCsFixer\Finder::create()
@@ -61,6 +61,7 @@ return $config->setRules(
'comment_to_phpdoc' => false, // breaks phpstan lines in combination with PHPStorm.
'type_declaration_spaces' => false,
'cast_spaces' => false,
'phpdoc_to_comment' => false, // do not overrule single line comment style, breaks phpstan.
// complex rules
'array_syntax' => ['syntax' => 'short'],

View File

@@ -406,16 +406,16 @@
},
{
"name": "friendsofphp/php-cs-fixer",
"version": "v3.65.0",
"version": "v3.73.1",
"source": {
"type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f"
"reference": "ffcb8200a42045e65049af7910cfd022f631b064"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f",
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/ffcb8200a42045e65049af7910cfd022f631b064",
"reference": "ffcb8200a42045e65049af7910cfd022f631b064",
"shasum": ""
},
"require": {
@@ -423,6 +423,7 @@
"composer/semver": "^3.4",
"composer/xdebug-handler": "^3.0.3",
"ext-filter": "*",
"ext-hash": "*",
"ext-json": "*",
"ext-tokenizer": "*",
"fidry/cpu-core-counter": "^1.2",
@@ -432,31 +433,31 @@
"react/promise": "^2.0 || ^3.0",
"react/socket": "^1.0",
"react/stream": "^1.0",
"sebastian/diff": "^4.0 || ^5.0 || ^6.0",
"symfony/console": "^5.4 || ^6.0 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.0 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.0 || ^7.0",
"symfony/finder": "^5.4 || ^6.0 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.0 || ^7.0",
"symfony/polyfill-mbstring": "^1.28",
"symfony/polyfill-php80": "^1.28",
"symfony/polyfill-php81": "^1.28",
"symfony/process": "^5.4 || ^6.0 || ^7.0",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0"
"sebastian/diff": "^4.0 || ^5.1 || ^6.0 || ^7.0",
"symfony/console": "^5.4 || ^6.4 || ^7.0",
"symfony/event-dispatcher": "^5.4 || ^6.4 || ^7.0",
"symfony/filesystem": "^5.4 || ^6.4 || ^7.0",
"symfony/finder": "^5.4 || ^6.4 || ^7.0",
"symfony/options-resolver": "^5.4 || ^6.4 || ^7.0",
"symfony/polyfill-mbstring": "^1.31",
"symfony/polyfill-php80": "^1.31",
"symfony/polyfill-php81": "^1.31",
"symfony/process": "^5.4 || ^6.4 || ^7.2",
"symfony/stopwatch": "^5.4 || ^6.4 || ^7.0"
},
"require-dev": {
"facile-it/paraunit": "^1.3.1 || ^2.4",
"infection/infection": "^0.29.8",
"justinrainbow/json-schema": "^5.3 || ^6.0",
"facile-it/paraunit": "^1.3.1 || ^2.6",
"infection/infection": "^0.29.14",
"justinrainbow/json-schema": "^5.3 || ^6.2",
"keradus/cli-executor": "^2.1",
"mikey179/vfsstream": "^1.6.12",
"php-coveralls/php-coveralls": "^2.7",
"php-cs-fixer/accessible-object": "^1.1",
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.5",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.5",
"phpunit/phpunit": "^9.6.21 || ^10.5.38 || ^11.4.3",
"symfony/var-dumper": "^5.4.47 || ^6.4.15 || ^7.1.8",
"symfony/yaml": "^5.4.45 || ^6.4.13 || ^7.1.6"
"php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6",
"php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6",
"phpunit/phpunit": "^9.6.22 || ^10.5.45 || ^11.5.12",
"symfony/var-dumper": "^5.4.48 || ^6.4.18 || ^7.2.3",
"symfony/yaml": "^5.4.45 || ^6.4.18 || ^7.2.3"
},
"suggest": {
"ext-dom": "For handling output formats in XML",
@@ -497,7 +498,7 @@
],
"support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0"
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.73.1"
},
"funding": [
{
@@ -505,7 +506,7 @@
"type": "github"
}
],
"time": "2024-11-25T00:39:24+00:00"
"time": "2025-03-19T23:42:16+00:00"
},
{
"name": "psr/container",
@@ -734,33 +735,33 @@
},
{
"name": "react/child-process",
"version": "v0.6.5",
"version": "v0.6.6",
"source": {
"type": "git",
"url": "https://github.com/reactphp/child-process.git",
"reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43"
"reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/reactphp/child-process/zipball/e71eb1aa55f057c7a4a0d08d06b0b0a484bead43",
"reference": "e71eb1aa55f057c7a4a0d08d06b0b0a484bead43",
"url": "https://api.github.com/repos/reactphp/child-process/zipball/1721e2b93d89b745664353b9cfc8f155ba8a6159",
"reference": "1721e2b93d89b745664353b9cfc8f155ba8a6159",
"shasum": ""
},
"require": {
"evenement/evenement": "^3.0 || ^2.0 || ^1.0",
"php": ">=5.3.0",
"react/event-loop": "^1.2",
"react/stream": "^1.2"
"react/stream": "^1.4"
},
"require-dev": {
"phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35",
"react/socket": "^1.8",
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/socket": "^1.16",
"sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0"
},
"type": "library",
"autoload": {
"psr-4": {
"React\\ChildProcess\\": "src"
"React\\ChildProcess\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
@@ -797,19 +798,15 @@
],
"support": {
"issues": "https://github.com/reactphp/child-process/issues",
"source": "https://github.com/reactphp/child-process/tree/v0.6.5"
"source": "https://github.com/reactphp/child-process/tree/v0.6.6"
},
"funding": [
{
"url": "https://github.com/WyriHaximus",
"type": "github"
},
{
"url": "https://github.com/clue",
"type": "github"
"url": "https://opencollective.com/reactphp",
"type": "open_collective"
}
],
"time": "2022-09-16T13:41:56+00:00"
"time": "2025-01-01T16:37:48+00:00"
},
{
"name": "react/dns",
@@ -1192,29 +1189,29 @@
},
{
"name": "sebastian/diff",
"version": "6.0.2",
"version": "7.0.0",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "b4ccd857127db5d41a5b676f24b51371d76d8544"
"reference": "7ab1ea946c012266ca32390913653d844ecd085f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544",
"reference": "b4ccd857127db5d41a5b676f24b51371d76d8544",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/7ab1ea946c012266ca32390913653d844ecd085f",
"reference": "7ab1ea946c012266ca32390913653d844ecd085f",
"shasum": ""
},
"require": {
"php": ">=8.2"
"php": ">=8.3"
},
"require-dev": {
"phpunit/phpunit": "^11.0",
"symfony/process": "^4.2 || ^5"
"phpunit/phpunit": "^12.0",
"symfony/process": "^7.2"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "6.0-dev"
"dev-main": "7.0-dev"
}
},
"autoload": {
@@ -1247,7 +1244,7 @@
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"security": "https://github.com/sebastianbergmann/diff/security/policy",
"source": "https://github.com/sebastianbergmann/diff/tree/6.0.2"
"source": "https://github.com/sebastianbergmann/diff/tree/7.0.0"
},
"funding": [
{
@@ -1255,7 +1252,7 @@
"type": "github"
}
],
"time": "2024-07-03T04:53:05+00:00"
"time": "2025-02-07T04:55:46+00:00"
},
{
"name": "symfony/console",
@@ -1369,12 +1366,12 @@
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
@@ -1517,12 +1514,12 @@
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
@@ -1641,16 +1638,16 @@
},
{
"name": "symfony/finder",
"version": "v7.2.0",
"version": "v7.2.2",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49"
"reference": "87a71856f2f56e4100373e92529eed3171695cfb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/6de263e5868b9a137602dd1e33e4d48bfae99c49",
"reference": "6de263e5868b9a137602dd1e33e4d48bfae99c49",
"url": "https://api.github.com/repos/symfony/finder/zipball/87a71856f2f56e4100373e92529eed3171695cfb",
"reference": "87a71856f2f56e4100373e92529eed3171695cfb",
"shasum": ""
},
"require": {
@@ -1685,7 +1682,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/finder/tree/v7.2.0"
"source": "https://github.com/symfony/finder/tree/v7.2.2"
},
"funding": [
{
@@ -1701,7 +1698,7 @@
"type": "tidelift"
}
],
"time": "2024-10-23T06:56:12+00:00"
"time": "2024-12-30T19:00:17+00:00"
},
{
"name": "symfony/options-resolver",
@@ -2246,16 +2243,16 @@
},
{
"name": "symfony/process",
"version": "v7.2.0",
"version": "v7.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e"
"reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e",
"url": "https://api.github.com/repos/symfony/process/zipball/d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf",
"reference": "d8f411ff3c7ddc4ae9166fb388d1190a2df5b5cf",
"shasum": ""
},
"require": {
@@ -2287,7 +2284,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v7.2.0"
"source": "https://github.com/symfony/process/tree/v7.2.4"
},
"funding": [
{
@@ -2303,7 +2300,7 @@
"type": "tidelift"
}
],
"time": "2024-11-06T14:24:19+00:00"
"time": "2025-02-05T08:33:46+00:00"
},
{
"name": "symfony/service-contracts",
@@ -2329,12 +2326,12 @@
},
"type": "library",
"extra": {
"thanks": {
"url": "https://github.com/symfony/contracts",
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
},
"thanks": {
"name": "symfony/contracts",
"url": "https://github.com/symfony/contracts"
}
},
"autoload": {
@@ -2390,16 +2387,16 @@
},
{
"name": "symfony/stopwatch",
"version": "v7.2.0",
"version": "v7.2.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/stopwatch.git",
"reference": "696f418b0d722a4225e1c3d95489d262971ca924"
"reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/696f418b0d722a4225e1c3d95489d262971ca924",
"reference": "696f418b0d722a4225e1c3d95489d262971ca924",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd",
"reference": "5a49289e2b308214c8b9c2fda4ea454d8b8ad7cd",
"shasum": ""
},
"require": {
@@ -2432,7 +2429,7 @@
"description": "Provides a way to profile code",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/stopwatch/tree/v7.2.0"
"source": "https://github.com/symfony/stopwatch/tree/v7.2.4"
},
"funding": [
{
@@ -2448,7 +2445,7 @@
"type": "tidelift"
}
],
"time": "2024-09-25T14:21:43+00:00"
"time": "2025-02-24T10:49:57+00:00"
},
{
"name": "symfony/string",

View File

@@ -28,7 +28,7 @@ composer update --quiet
rm -f .php-cs-fixer.cache
PHP_CS_FIXER_IGNORE_ENV=true ./vendor/bin/php-cs-fixer fix \
--config $SCRIPT_DIR/php-cs-fixer/.php-cs-fixer.php \
--format=txt \
--format=txt -v \
--allow-risky=yes
EXIT_CODE=$?

View File

@@ -1,61 +1,36 @@
parameters:
scanFiles:
- ../_ide_helper_models.php
universalObjectCratesClasses:
- Illuminate\Database\Eloquent\Model
# TODO: slowly remove these parameters and fix the issues found.
reportUnmatchedIgnoredErrors: false
ignoreErrors:
# TODO: slowly remove these exceptions and fix the issues found.
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.
- '#Control structures using switch should not be used.#' # switch is fine in some cases.
- '#with no value type specified in iterable type array#' # remove this rule when all other issues are solved.
- '#has no value type specified in iterable type array#' # remove this rule when all other issues are solved.
- '#is not allowed to extend#'
- '#does not specify its types#'
- '#switch is forbidden to use#'
- '#is neither abstract nor final#'
- '#on left side of \?\?\= always exists and is not nullable#'
- '#has a nullable return type declaration#' # perhaps throw errors instead?
- '#with a nullable type declaration#' # decide what action should be if param is null.
- '#with null as default value#'
-
message: '#Constructor in [a-zA-Z0-9\\_]+ has parameter \$[a-zA-Z0-9\\_]+ with default value#'
paths:
- ../app/Exceptions/IntervalException.php
- ../app/Support/Navigation.php
-
message: '#but containers should not be injected#'
paths:
- ../app/Support/Authentication/RemoteUserGuard.php
-
message: '#Function compact\(\) should not be used#' # too useful in template rendering.
paths:
- ../app/Generator/Report/Account/MonthReportGenerator.php
- ../app/Generator/Report/Audit/MonthReportGenerator.php
- ../app/Generator/Report/Budget/MonthReportGenerator.php
- ../app/Generator/Report/Category/MonthReportGenerator.php
- ../app/Generator/Report/Standard/MonthReportGenerator.php
- ../app/Generator/Report/Standard/MultiYearReportGenerator.php
- ../app/Generator/Report/Standard/YearReportGenerator.php
- ../app/Generator/Report/Tag/MonthReportGenerator.php
- ../app/Http/Controllers/Account/*.php
- ../app/Http/Controllers/Admin/*.php
- ../app/Http/Controllers/*.php
- ../app/Support/ExpandedForm.php
- ../app/Support/Form/AccountForm.php
- ../app/Support/Form/CurrencyForm.php
- ../app/Support/Form/FormSupport.php
-
message: '#Either catch a more specific exception#'
paths:
- ../app/Support/Form/FormSupport.php
- ../_ide_helper
paths:
- ../app
- ../database
- ../routes
- ../config
- ../bootstrap/app.php
universalObjectCratesClasses:
- Illuminate\Database\Eloquent\Model
# TODO: slowly remove these parameters and fix the issues found.
reportUnmatchedIgnoredErrors: true
ignoreErrors:
# TODO: slowly remove these exceptions and fix the issues found.
- '#Dynamic call to static method#' # all the Laravel ORM things depend on this.
- identifier: varTag.nativeType
- identifier: varTag.type
-
identifier: larastan.noEnvCallsOutsideOfConfig
path: ../app/Console/Commands/System/CreatesDatabase.php
- identifier: missingType.iterableValue # not interesting enough to fix.
- identifier: missingType.generics # not interesting enough to fix.
- "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
- '#expects view-string, string given#'
- '#expects view-string\|null, string given#'
# phpstan can't handle this so we ignore them.
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#'
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::after#'
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#'
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::accountTypeIn#'
- '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\BelongsTo::withTrashed#'
# The level 8 is the highest level. original was 5
# 7 is more than enough, higher just leaves NULL things.

View File

@@ -19,7 +19,7 @@ SITE_OWNER=mail@example.com
APP_KEY=SomeRandomStringOf32CharsExactly
# Firefly III will launch using this language (for new users and unauthenticated visitors)
# For a list of available languages: https://github.com/firefly-iii/firefly-iii/tree/main/resources/lang
# For a list of available languages: https://github.com/firefly-iii/firefly-iii/blob/main/config/firefly.php#L123
#
# If text is still in English, remember that not everything may have been translated.
DEFAULT_LANGUAGE=en_US
@@ -189,7 +189,7 @@ SEND_REPORT_JOURNALS=true
ENABLE_EXTERNAL_MAP=false
#
# Enable or disable exchange rate conversion. This function isn't used yet by Firefly III
# Enable or disable exchange rate conversion.
#
ENABLE_EXCHANGE_RATES=false
@@ -325,6 +325,12 @@ USE_RUNNING_BALANCE=false
#
FIREFLY_III_LAYOUT=v1
#
# Which Query Parser implementation to use for the search engine and rules
# 'new' is experimental, 'legacy' is the classic one
#
QUERY_PARSER_IMPLEMENTATION=legacy
#
# Please make sure this URL matches the external URL of your Firefly III installation.
# It is used to validate specific requests and to generate URLs in emails.

View File

@@ -1,16 +1,29 @@
# Configuration for Label Actions - https://github.com/dessant/label-actions
# The `feature` label is added to issues
fixed:
issues:
# Post a comment, `{issue-author}` is an optional placeholder
comment: |
Hi there!
This is an automatic reply. `Share and enjoy`
This issue has been marked as fixed. Thanks for reporting! A new version will be released in due time. Unfortunately, [I cannot give an estimate](https://docs.firefly-iii.org/references/faq/firefly-iii/general/#when-will-you-release-version-the-next-version), but [the roadmap](https://roadmap.firefly-iii.org/) is available for your reading pleasure.
There is no need to close the issue. It will be closed automatically.
Thank you for your contributions.
feature:
issues:
# Post a comment, `{issue-author}` is an optional placeholder
unlabel: feature
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`
This issue has been marked as a feature request. The requested (new) feature will become a part of Firefly III or the data importer in due course.
This issue has been marked as a feature request.
If you come across this issue, please be aware there is NO need to reply with "+1" or "me too" or "I need this too" or whatever. Such comments are not helpful, and do not influence [the roadmap](https://roadmap.firefly-iii.org/). Your comment may be :skull: deleted. You can subscribe to this issue to get updates.
@@ -20,13 +33,13 @@ epic:
issues:
# Post a comment, `{issue-author}` is an optional placeholder
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`
This issue has been marked as an epic. In epics, large amounts of works are collected that will be part of a major new feature. If you have more ideas that could be a part of this epic, feel free to reply.
*However*, please be aware there is NO need to reply with "+1" or "me too" or "I need this too" or whatever. Such comments are not helpful, and do not influence [the roadmap](https://roadmap.firefly-iii.org/). Your comment may be :skull: deleted.
*However*, please be aware there is NO need to reply with "+1" or "me too" or "I need this too" or whatever. Such comments are not helpful, and do not influence [the roadmap](https://roadmap.firefly-iii.org/). Your comment may be :skull: deleted.
If you are merely interested in this epic's progress, you can subscribe to this issue to get updates.
@@ -37,11 +50,11 @@ enhancement:
issues:
# Post a comment, `{issue-author}` is an optional placeholder
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`
This issue has been marked as an enhancement. The requested enhancement to an existing feature will become a part of Firefly III or the data importer in due course.
This issue has been marked as an enhancement.
If you come across this issue, please be aware there is NO need to reply with "+1" or "me too" or "I need this too" or whatever. Such comments are not helpful, and do not influence [the roadmap](https://roadmap.firefly-iii.org/). Your comment may be :skull: deleted. You can subscribe to this issue to get updates.
@@ -51,7 +64,7 @@ triage:
issues:
# Post a comment, `{issue-author}` is an optional placeholder
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`
@@ -62,7 +75,7 @@ triage:
needs-moar-debug:
issues:
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`
@@ -80,7 +93,7 @@ needs-moar-debug:
needs-moar-logs:
issues:
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`
@@ -96,7 +109,7 @@ needs-moar-logs:
v2-layout-issue:
issues:
comment: |
Hi there!
Hi there!
This is an automatic reply. `Share and enjoy`

61
.github/mergify.yml vendored
View File

@@ -1,5 +1,11 @@
---
pull_request_rules:
- name: Make sure PR are up to date before merging
description: This automatically updates PRs when they are out-of-date with the
base branch to avoid semantic conflicts (next step is using a merge
queue).
conditions: []
actions:
update:
- name: Close all on main
conditions:
- base=main
@@ -8,56 +14,3 @@ pull_request_rules:
close:
message: Please do not open PR's on the `main` branch, but on the `develop`
branch only. Thank you!
- name: No translations
conditions:
- -author~=^dependabot(|-preview)\[bot\]$
- base=develop
- or:
- files~=^resources/lang/bg_BG
- files~=^resources/lang/ca_ES
- files~=^resources/lang/cs_CZ
- files~=^resources/lang/da_DK
- files~=^resources/lang/de_DE
- files~=^resources/lang/el_GR
- files~=^resources/lang/en_GB
- files~=^resources/lang/es_ES
- files~=^resources/lang/et_EE
- files~=^resources/lang/fa_IR
- files~=^resources/lang/fi_FI
- files~=^resources/lang/fr_FR
- files~=^resources/lang/he_IL
- files~=^resources/lang/hu_HU
- files~=^resources/lang/id_ID
- files~=^resources/lang/is_IS
- files~=^resources/lang/it_IT
- files~=^resources/lang/ja_JP
- files~=^resources/lang/ko_KR
- files~=^resources/lang/lt_LT
- files~=^resources/lang/nb_NO
- files~=^resources/lang/nl_NL
- files~=^resources/lang/pl_PL
- files~=^resources/lang/pt_BR
- files~=^resources/lang/pt_PT
- files~=^resources/lang/ro_RO
- files~=^resources/lang/ru_RU
- files~=^resources/lang/si_LK
- files~=^resources/lang/sk_SK
- files~=^resources/lang/sl_SI
- files~=^resources/lang/sr_CS
- files~=^resources/lang/sv_SE
- files~=^resources/lang/th_TH
- files~=^resources/lang/tlh_AA
- files~=^resources/lang/tr_TR
- files~=^resources/lang/uk_UA
- files~=^resources/lang/vi_VN
- files~=^resources/lang/zh_CN
- files~=^resources/lang/zh_TW
actions:
comment:
message: >
Please do not submit translated strings in your PR. If you need new
sentences to be translated, add them to the `en_US` language strings.
New or changed translations for other languages can be submitted at
https://crowdin.com/project/firefly-iii
Thank you!

View File

@@ -13,7 +13,7 @@ jobs:
close_duplicates:
runs-on: ubuntu-latest
steps:
- uses: github/command@v1.3.0
- uses: github/command@v2.0.0
id: command
with:
allowed_contexts: "issue"

View File

@@ -8,7 +8,7 @@ jobs:
command_and_close:
runs-on: ubuntu-latest
steps:
- uses: aws-actions/closed-issue-message@v1
- uses: aws-actions/closed-issue-message@v2
with:
message: |
Hi there! This is an automatic reply. `Share and enjoy`

View File

@@ -10,7 +10,7 @@ on:
phpversion:
description: 'PHP version'
required: true
default: '8.3'
default: '8.4'
schedule:
- cron: '0 3 * * MON'
@@ -22,31 +22,43 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Switch branch
run: |
if [[ "develop" == "$version" ]]; then
git checkout --track origin/develop
git pull
elif [[ "$version" == branch* ]]; then
PULLBRANCH=${version:7}
echo "The branch is '$PULLBRANCH' ($version)"
git checkout --track origin/$PULLBRANCH
git pull
else
git config user.name github-actions
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git checkout --track origin/develop
git pull
git checkout main
git merge develop
fi
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ github.event.inputs.phpversion }}
extensions: mbstring, intl, zip, bcmath
- name: Switch and pull
run: |
#
# Always check out origin/develop, unless its a branch release.
#
BRANCH_TO_PULL=origin/develop
if [[ "$version" == branch* ]]; then
BRANCH_TO_PULL=origin/$version
fi
echo "Version is '$version', check out '$BRANCH_TO_PULL'-branch"
git checkout --track $BRANCH_TO_PULL
git pull
echo "Current branch is $(git branch --show-current)"
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Configure Git
run: |
# do some configuration
sudo timedatectl set-timezone Europe/Amsterdam
git config user.name JC5
git config user.email release@firefly-iii.org
git config advice.addIgnoredFile false
git config push.autoSetupRemote true
- name: crowdin action
uses: crowdin/github-action@v2
with:
@@ -58,15 +70,6 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
CROWDIN_PROJECT_NR: ${{ secrets.CROWDIN_PROJECT_NR }}
CROWDIN_TOKEN: ${{ secrets.CROWDIN_TOKEN }}
- name: Cleanup translations
id: cleanup-transactions
uses: JC5/firefly-iii-dev@main
with:
action: 'ff3:crowdin-warning'
output: ''
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ''
- name: Cleanup changelog
id: cleanup-changelog
uses: JC5/firefly-iii-dev@main
@@ -85,15 +88,6 @@ jobs:
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ''
- name: Extract changelog
id: extract-changelog
uses: JC5/firefly-iii-dev@main
with:
action: 'ff3:extract-changelog'
output: 'output'
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ""
- name: Replace version
id: replace-version
uses: JC5/firefly-iii-dev@main
@@ -143,18 +137,8 @@ jobs:
composer update --no-dev --no-scripts --no-plugins -q
sudo chown -R runner:docker resources/lang
.ci/phpcs.sh || true
- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Release
- name: Calculate variables
run: |
# do some configuration
sudo timedatectl set-timezone Europe/Amsterdam
git config user.name github-actions
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git config advice.addIgnoredFile false
# set some variables
releaseName=$version
@@ -162,13 +146,9 @@ jobs:
zipName=FireflyIII-$version.zip
tarName=FireflyIII-$version.tar.gz
# update composer (again)
composer update --no-dev --no-scripts --no-plugins
composer dump-autoload
# if this is a develop build, slightly different variable names.
if [[ "develop" == "$version" ]]; then
[[ -z $(git status --untracked-files=normal --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
#[[ -z $(git status --untracked-files=normal --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
releaseName=$version-$(date +'%Y%m%d')
originalName=$releaseName
zipName=FireflyIII-develop.zip
@@ -177,7 +157,7 @@ jobs:
# if this is a branch build, also slightly different variable names.
if [[ "$version" == branch* ]]; then
[[ -z $(git status --untracked-files=normal --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
#[[ -z $(git status --untracked-files=normal --porcelain) ]] && echo "this branch is clean, no need to push..." && exit 0;
# branch builds overrule develop
releaseName=$version-$(date +'%Y%m%d')
originalName=$releaseName
@@ -200,41 +180,59 @@ jobs:
tagFound=false
fi
done
echo "Will use tag and release name $releaseName."
# set some variables
echo "Release name is $releaseName."
echo "Original name is $originalName."
echo "Zip name is $zipName."
echo "Tar name is $tarName."
# create a new branch to store the difference in.
BRANCH_NAME=release-$(date +'%s')
git checkout -b $BRANCH_NAME
echo "Temporary branch name is '$BRANCH_NAME'."
# share variables with next step.
echo "releaseName=$releaseName" >> "$GITHUB_ENV"
echo "originalName=$originalName" >> "$GITHUB_ENV"
echo "zipName=$zipName" >> "$GITHUB_ENV"
echo "tarName=$tarName" >> "$GITHUB_ENV"
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Commit all changes
run: |
# add all content, except output.txt (this contains the changelog and/or the download instructions)
echo 'Add all and reset output.txt'
echo 'Add all'
git add -A
if test -f "output.txt"; then
git reset output.txt
fi
git commit -m "Auto commit for release '$version' on $(date +'%Y-%m-%d')" || true
# push to a new branch.
echo "Auto commit on branch '$(git branch --show-current)'."
git commit -m "🤖 Auto commit for release '$version' on $(date +'%Y-%m-%d')" || true
git push
# zip and tar everything
echo 'Zip and tar...'
zip -rq $zipName . -x "*.git*" "*.ci*" "*.github*" "*node_modules*" "*output.txt*"
touch $tarName
tar --exclude=$tarName --exclude=$zipName --exclude='./.git' --exclude='./.ci' --exclude='./.github' --exclude='./node_modules' --exclude='./output.txt' -czf $tarName .
# add sha256 sum
echo 'Sha sum ...'
sha256sum -b $zipName > $zipName.sha256
sha256sum -b $tarName > $tarName.sha256
# add signatures:
gpg --armor --detach-sign $zipName
gpg --armor --detach-sign $tarName
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Extract changelog
id: extract-changelog
uses: JC5/firefly-iii-dev@main
with:
action: 'ff3:extract-changelog'
output: 'output'
env:
FIREFLY_III_ROOT: /github/workspace
GH_TOKEN: ""
- name: Describe new release
run: |
# describe the development release.
if [[ "develop" == "$version" ]]; then
echo 'Develop release.'
rm output.txt
echo 'Describe the latest develop release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
echo "Weekly development release of Firefly III with the latest fixes, translations and features. Docker users can find this release under the \`develop\` tag." >> output.txt
echo "" >> output.txt
echo "This release was created on **$(date +'%Y-%m-%d')** and may contain unexpected bugs. Data loss is rare but is not impossible. The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
echo "This release was created on **$(date +'%Y-%m-%d %H:%M')** and may contain unexpected bugs. Data loss is rare but is not impossible. The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
echo "" >> output.txt
echo "* Please read the installation instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/installation/docker/), [Portainer](https://docs.firefly-iii.org/how-to/firefly-iii/installation/portainer/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/installation/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/installation/self-managed/)" >> output.txt
echo "* Or read the upgrade instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/docker/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/self-managed/)" >> output.txt
@@ -243,13 +241,13 @@ jobs:
fi
# describe a branch release
if [[ "$version" == branch* ]]; then
echo 'Branch release.'
rm output.txt
echo 'Describe a branch release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
echo "Irregular BRANCH release of Firefly III. This release contains specific features or changes. Docker users can find this release under the \`$version\` tag." >> output.txt
echo "" >> output.txt
echo "This release was created on **$(date +'%Y-%m-%d')** and may contain unexpected bugs. Data loss is rare but is not impossible. The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
echo "This release was created on **$(date +'%Y-%m-%d %H:%M')** and may contain unexpected bugs. Data loss is rare but is not impossible. The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
echo "" >> output.txt
echo "* Please read the installation instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/installation/docker/), [Portainer](https://docs.firefly-iii.org/how-to/firefly-iii/installation/portainer/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/installation/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/installation/self-managed/)" >> output.txt
echo "* Or read the upgrade instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/docker/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/self-managed/)" >> output.txt
@@ -257,9 +255,10 @@ jobs:
echo ":warning: Please be careful with this branch pre-release, as it may not work as expected." >> output.txt
fi
# describe the main release
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]]; then
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]] && [[ "$version" != *alpha* ]] && [[ "$version" != *beta* ]]; then
echo 'Describe the latest release'
sudo chown -R runner:docker output.txt
echo 'Main release.'
touch output.txt
echo '' >> output.txt
echo '### Instructions' >> output.txt
echo '' >> output.txt
@@ -269,85 +268,203 @@ jobs:
fi
# describe alpha release
if [[ "$version" == *alpha* ]]; then
echo 'Describe an ALPHA release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
echo "Very early ALPHA release of Firefly III. This release contains specific features or changes. Docker users can find this release under the \`$version\` tag." >> output.txt
echo '' >> output.txt
echo "This release was created on **$(date +'%Y-%m-%d %H:%M')** and may contain unexpected bugs. Data loss is rare but is not impossible. The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
echo '' >> output.txt
echo '### Instructions' >> output.txt
echo '' >> output.txt
echo "* Installation instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/installation/docker/), [Portainer](https://docs.firefly-iii.org/how-to/firefly-iii/installation/portainer/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/installation/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/installation/self-managed/)" >> output.txt
echo "* Or read the upgrade instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/docker/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/self-managed/)" >> output.txt
echo "* The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
fi
# describe beta release
if [[ "$version" == *beta* ]]; then
echo 'Describe a BETA release'
rm -f output.txt
touch output.txt
sudo chown -R runner:docker output.txt
echo "Very early BETA release of Firefly III. This release contains specific features or changes. Docker users can find this release under the \`$version\` tag." >> output.txt
echo '' >> output.txt
echo "This release was created on **$(date +'%Y-%m-%d %H:%M')** and may contain unexpected bugs. Data loss is rare but is not impossible. The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
echo '' >> output.txt
echo '### Instructions' >> output.txt
echo '' >> output.txt
echo "* Installation instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/installation/docker/), [Portainer](https://docs.firefly-iii.org/how-to/firefly-iii/installation/portainer/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/installation/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/installation/self-managed/)" >> output.txt
echo "* Or read the upgrade instructions for [Docker](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/docker/), [Kubernetes](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/kubernetes/) or [self-managed servers](https://docs.firefly-iii.org/how-to/firefly-iii/upgrade/self-managed/)" >> output.txt
echo "* The releases are signed, and you can verify them using the [Firefly III releases PGP key](https://docs.firefly-iii.org/explanation/more-information/signatures/)." >> output.txt
fi
env:
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Merge all into working branch
run: |
MERGE_INTO=develop
if [[ "$version" == branch* ]]; then
MERGE_INTO=$version
fi
echo "Merge all changes from $BRANCH_NAME back into '$MERGE_INTO' using a PR"
PR_URL=$(gh pr create -B $MERGE_INTO -H $BRANCH_NAME --title "🤖 Automatic PR to merge all changes into the '$MERGE_INTO' branch." --body '🤖 Created by GitHub action')
echo "PR URL is '$PR_URL'"
IFS='/' read -ra parts <<< "$PR_URL"
PR_NR=$(printf %s\\n "${parts[@]:(-1)}")
echo "PR number is '$PR_NR'"
gh pr merge $PR_NR -b "🤖 Automatically merge the PR into the $MERGE_INTO branch." -d --merge
# pull the changes from the $MERGE_INTO branch.
git checkout $MERGE_INTO
git merge origin/$MERGE_INTO
git pull
git status
echo "Current branch '$(git branch --show-current)'."
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]]; then
git checkout main
git merge origin/main
git pull
git status
echo "Also merge everything into main since this is a release."
echo 'create PR'
PR_URL=$(gh pr create -B main -H develop --title "🤖 Automatic PR to merge all changes into the main branch." --body "🤖 Created by GitHub action")
echo "PR URL is '$PR_URL'"
IFS='/' read -ra parts <<< "$PR_URL"
PR_NR=$(printf %s\\n "${parts[@]:(-1)}")
echo "PR number is '$PR_NR'"
echo 'Merge PR'
gh pr merge $PR_NR -b "🤖 Automatically merge the PR into the main branch." --merge
git checkout main
git merge origin/main
git pull
git status
echo "Current branch '$(git branch --show-current)'."
fi
echo "DONE!"
env:
GH_TOKEN: ${{ github.token }}
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Create archives
run: |
echo "Create zip file $zipName"
zip -rq $zipName . -x "*.git*" "*.ci*" "*.github*" "*node_modules*" "*output.txt*" "*Procfile*" "*crowdin.yml*" "*sonar-project.properties*"
touch $tarName
echo "Create tar file $tarName"
tar --exclude=$tarName --exclude=$zipName --exclude='./.git' --exclude='./.ci' --exclude='./.github' --exclude='./node_modules' --exclude='./output.txt' --exclude='./Procfile' --exclude='../crowdin.yml' --exclude='./sonar-project.properties' -czf $tarName .
# add sha256 sum
echo 'Sha sum ...'
sha256sum -b $zipName > $zipName.sha256
sha256sum -b $tarName > $tarName.sha256
# add signatures:
gpg --armor --detach-sign $zipName
gpg --armor --detach-sign $tarName
- name: Create release
run: |
# create a development release:
if [[ "develop" == "$version" ]]; then
# create the release:
echo "Create develop release."
git tag -a $releaseName -m "Development release '$version' on $(date +'%Y-%m-%d')"
# pull the changes from the develop branch.
git checkout develop
git merge origin/develop
git pull
# create the release:
echo "Create develop release under tag '$releaseName'."
git tag -a $releaseName -m "🤖 Development release '$version' on $(date +'%Y-%m-%d')"
git push origin $releaseName
gh release create $releaseName -p --verify-tag \
-t "Development release for $(date +'%Y-%m-%d')" \
--latest=false \
-F output.txt
fi
# create a branch release:
if [[ "$version" == branch* ]]; then
# pull the changes from the branch-* branch.
git checkout $version
git merge origin/$version
git pull
# create the release:
echo "Create branch release."
git tag -a $releaseName -m "Branch release '$version' on $(date +'%Y-%m-%d')"
git push origin $releaseName
gh release create $releaseName -p --verify-tag \
-t "Branch release for $(date +'%Y-%m-%d')" \
--latest=false \
-F output.txt
fi
# create a development (nightly) release:
if [[ "develop" == "$version" ]] || [[ "$version" == branch* ]]; then
# add zip file to release.
gh release upload $releaseName $zipName
gh release upload $releaseName $tarName
# Create a production release.
if [[ "develop" != "$version" ]] && [[ "$version" != branch* ]]; then
git checkout main
git merge origin/main
git pull
git status
# add sha256 sum to release
gh release upload $releaseName $zipName.sha256
gh release upload $releaseName $tarName.sha256
# add signatures to release
gh release upload $releaseName $zipName.asc
gh release upload $releaseName $tarName.asc
# get current HEAD and add as file to the release
HEAD=$(git rev-parse HEAD)
echo $HEAD > HEAD.txt
gh release upload $releaseName HEAD.txt
else
echo 'MAIN (real) release'
git tag -a $releaseName -m "Here be changelog"
echo "Create prod release."
git tag -a $releaseName -m "Release $version"
git push origin $releaseName
gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag
# add archive files to release
gh release upload $releaseName $zipName
gh release upload $releaseName $tarName
# do not tag as latest when alpha or beta.
if [[ "$version" == *alpha* ]] || [[ "$version" == *beta* ]]; then
echo 'Mark alpha or beta as NOT the latest.'
gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag --latest=false
fi
# add sha256 sums to release
gh release upload $releaseName $zipName.sha256
gh release upload $releaseName $tarName.sha256
# add signatures to release
gh release upload $releaseName $zipName.asc
gh release upload $releaseName $tarName.asc
# get current HEAD and add as file to the release
HEAD=$(git rev-parse HEAD)
echo $HEAD > HEAD.txt
gh release upload $releaseName HEAD.txt
# remove all temporary files
rm output.txt
rm HEAD.txt
rm $zipName
rm $zipName.sha256
rm $tarName
rm $tarName.sha256
# merge main back into develop
git checkout develop
git merge main
git push
# tag as latest when NOT alpha or beta.
if [[ "$version" != *alpha* ]] && [[ "$version" != *beta* ]]; then
echo 'Mark prod as the latest.'
gh release create $releaseName -F output.txt -t "$releaseName" --verify-tag --latest=true
fi
fi
env:
GH_TOKEN: ${{ github.token }}
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
- name: Upload artifacts
run: |
# add zip file to release.
gh release upload $releaseName $zipName
gh release upload $releaseName $tarName
# add sha256 sum to release
gh release upload $releaseName $zipName.sha256
gh release upload $releaseName $tarName.sha256
# add signatures to release
gh release upload $releaseName $zipName.asc
gh release upload $releaseName $tarName.asc
# get current HEAD and add as file to the release
HEAD=$(git rev-parse HEAD)
echo $HEAD > HEAD.txt
gh release upload $releaseName HEAD.txt
# remove all temporary files
rm -f output.txt
rm -f HEAD.txt
rm -f $zipName
rm -f $zipName.sha256
rm -f $tarName
rm -f $tarName.sha256
env:
GH_TOKEN: ${{ github.token }}
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}

View File

@@ -8,7 +8,7 @@ on:
- develop
env:
DB_CONNECTION: sqlite
APP_KEY: UfpBqqeXx7zpNodsC6yjYQcRfDdm4Bxh
APP_KEY: TestTestTestTestTestTestTestTest
jobs:
sonarcloud:
name: SonarCloud
@@ -19,7 +19,7 @@ jobs:
- name: Setup PHP with Xdebug
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
php-version: '8.4'
coverage: xdebug
extensions: >-
bcmath
@@ -46,7 +46,9 @@ jobs:
run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
- name: "Create database file"
run: touch storage/database/database.sqlite
run: |
touch storage/database/database.sqlite
wget -q https://github.com/firefly-iii/test-fixtures/raw/refs/heads/main/test-database.sqlite -O storage/database/database.sqlite
- name: "Upgrades the database to the latest version"
run: php artisan firefly-iii:upgrade-database

10
.gitignore vendored
View File

@@ -7,6 +7,7 @@ yarn-error.log
.env
/.ci/php-cs-fixer/vendor
coverage.xml
output.txt
# ignore generated files.
public/build
@@ -14,7 +15,16 @@ public/build
# ignore v1 build files
resources/assets/v1/node_modules
resources/assets/v1/build
public/v1/js/app.js*
public/v1/js/app_vue.js*
public/v1/js/create*
public/v1/js/edit*
public/v1/js/profile*
public/v1/js/administrations
public/v1/js/exchange-rates
public/v1/js/webhooks
# ignore v2 build files
resources/assets/v2/node_modules
resources/assets/v2/build
public/v2/i18n

View File

@@ -3,7 +3,14 @@
Over time, many people have contributed to Firefly III. Their efforts are not always visible, but always remembered and appreciated.
Please find below all the people who contributed to the Firefly III code. Their names are mentioned in the year of their first contribution.
## 2025
- Lompi
- Jose Diaz-Gonzalez
- SoftBrix
## 2024
- Sobuno
- TasneemTantawy
- Antônio Franco
- yparitcher
- Jhon Pedroza

View File

@@ -26,14 +26,16 @@ namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Debug\Timer;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
/**
* Class AccountController
@@ -41,6 +43,8 @@ use Illuminate\Http\JsonResponse;
class AccountController extends Controller
{
use AccountFilter;
// this array only exists to test if the constructor will use it properly.
protected array $accepts = ['application/json', 'application/vnd.api+json'];
/** @var array<int, string> */
private array $balanceTypes;
@@ -62,7 +66,7 @@ class AccountController extends Controller
return $next($request);
}
);
$this->balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
$this->balanceTypes = [AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value];
}
/**
@@ -74,40 +78,51 @@ class AccountController extends Controller
*/
public function accounts(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$types = $data['types'];
$query = $data['query'];
$date = $data['date'] ?? today(config('app.timezone'));
$return = [];
$result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit'));
$data = $request->getData();
$types = $data['types'];
$query = $data['query'];
$date = $data['date'] ?? today(config('app.timezone'));
$return = [];
Timer::start(sprintf('AC accounts "%s"', $query));
$result = $this->repository->searchAccount((string) $query, $types, $this->parameters->get('limit'));
// TODO this code is duplicated in the V2 Autocomplete controller, which means this code is due to be deprecated.
$defaultCurrency = app('amount')->getDefaultCurrency();
// set date to subday + end-of-day for account balance. so it is at $date 23:59:59
$date->endOfDay();
/** @var Account $account */
foreach ($result as $account) {
$nameWithBalance = $account->name;
$currency = $this->repository->getAccountCurrency($account) ?? $defaultCurrency;
$currency = $this->repository->getAccountCurrency($account) ?? $this->nativeCurrency;
$useCurrency = $currency;
if (in_array($account->accountType->type, $this->balanceTypes, true)) {
// this one is correct.
Log::debug(sprintf('accounts: Call finalAccountBalance with date/time "%s"', $date->toIso8601String()));
$balance = Steam::finalAccountBalance($account, $date);
$key = $this->convertToNative && $currency->id !== $this->nativeCurrency->id ? 'native_balance' : 'balance';
$useCurrency = $this->convertToNative && $currency->id !== $this->nativeCurrency->id ? $this->nativeCurrency : $currency;
$amount = $balance[$key] ?? '0';
$nameWithBalance = sprintf(
'%s (%s)',
$account->name,
app('amount')->formatAnything($currency, $balance['balance'], false)
app('amount')->formatAnything($useCurrency, $amount, false)
);
}
$return[] = [
'id' => (string) $account->id,
'name' => $account->name,
'name_with_balance' => $nameWithBalance,
'type' => $account->accountType->type,
'currency_id' => (string) $currency->id,
'currency_name' => $currency->name,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'id' => (string) $account->id,
'name' => $account->name,
'name_with_balance' => $nameWithBalance,
'type' => $account->accountType->type,
'currency_id' => (string) $useCurrency->id,
'currency_name' => $useCurrency->name,
'currency_code' => $useCurrency->code,
'currency_symbol' => $useCurrency->symbol,
'currency_decimal_places' => $useCurrency->decimal_places,
'account_currency_id' => (string) $currency->id,
'account_currency_name' => $currency->name,
'account_currency_code' => $currency->code,
'account_currency_symbol' => $currency->symbol,
'account_currency_decimal_places' => $currency->decimal_places,
];
}
@@ -115,14 +130,15 @@ class AccountController extends Controller
usort(
$return,
static function (array $left, array $right) {
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
$order = [AccountTypeEnum::ASSET->value, AccountTypeEnum::REVENUE->value, AccountTypeEnum::EXPENSE->value];
$posA = (int) array_search($left['type'], $order, true);
$posB = (int) array_search($right['type'], $order, true);
return $posA - $posB;
}
);
Timer::stop(sprintf('AC accounts "%s"', $query));
return response()->json($return);
return response()->api($return);
}
}

View File

@@ -74,6 +74,6 @@ class BillController extends Controller
}
);
return response()->json($filtered->toArray());
return response()->api($filtered->toArray());
}
}

View File

@@ -73,6 +73,6 @@ class BudgetController extends Controller
}
);
return response()->json($filtered);
return response()->api($filtered->toArray());
}
}

View File

@@ -73,6 +73,6 @@ class CategoryController extends Controller
}
);
return response()->json($filtered);
return response()->api($filtered->toArray());
}
}

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -77,7 +77,7 @@ class CurrencyController extends Controller
];
}
return response()->json($result);
return response()->api($result);
}
/**
@@ -103,6 +103,6 @@ class CurrencyController extends Controller
];
}
return response()->json($result);
return response()->api($result);
}
}

View File

@@ -75,6 +75,6 @@ class ObjectGroupController extends Controller
];
}
return response()->json($return);
return response()->api($return);
}
}

View File

@@ -87,7 +87,7 @@ class PiggyBankController extends Controller
];
}
return response()->json($response);
return response()->api($response);
}
/**
@@ -124,6 +124,6 @@ class PiggyBankController extends Controller
];
}
return response()->json($response);
return response()->api($response);
}
}

View File

@@ -73,6 +73,6 @@ class RecurrenceController extends Controller
];
}
return response()->json($response);
return response()->api($response);
}
}

View File

@@ -72,6 +72,6 @@ class RuleController extends Controller
];
}
return response()->json($response);
return response()->api($response);
}
}

View File

@@ -72,6 +72,6 @@ class RuleGroupController extends Controller
];
}
return response()->json($response);
return response()->api($response);
}
}

View File

@@ -75,6 +75,6 @@ class TagController extends Controller
];
}
return response()->json($array);
return response()->api($array);
}
}

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
@@ -41,6 +42,8 @@ class TransactionController extends Controller
private TransactionGroupRepositoryInterface $groupRepository;
private JournalRepositoryInterface $repository;
protected array $acceptedRoles = [UserRoleEnum::READ_ONLY];
/**
* TransactionController constructor.
*/
@@ -51,10 +54,12 @@ class TransactionController extends Controller
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$userGroup = $this->validateUserGroup($request);
$this->repository = app(JournalRepositoryInterface::class);
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
$this->repository->setUser($user);
$this->groupRepository->setUser($user);
$this->groupRepository->setUserGroup($userGroup);
return $next($request);
}
@@ -84,7 +89,7 @@ class TransactionController extends Controller
];
}
return response()->json($array);
return response()->api($array);
}
/**
@@ -122,6 +127,6 @@ class TransactionController extends Controller
];
}
return response()->json($array);
return response()->api($array);
}
}

View File

@@ -72,6 +72,6 @@ class TransactionTypeController extends Controller
];
}
return response()->json($array);
return response()->api($array);
}
}

View File

@@ -27,11 +27,12 @@ namespace FireflyIII\Api\V1\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\DateRequest;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Preference;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Api\ApiSupport;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -80,12 +81,15 @@ class AccountController extends Controller
/** @var Carbon $end */
$end = $dates['end'];
// set dates to end of day + start of day:
$start->startOfDay();
$end->endOfDay();
// user's preferences
$defaultSet = $this->repository->getAccountsByType([AccountType::ASSET])->pluck('id')->toArray();
$defaultSet = $this->repository->getAccountsByType([AccountTypeEnum::ASSET->value])->pluck('id')->toArray();
/** @var Preference $frontpage */
$frontpage = app('preferences')->get('frontpageAccounts', $defaultSet);
$default = app('amount')->getDefaultCurrency();
if (!(is_array($frontpage->data) && count($frontpage->data) > 0)) {
$frontpage->data = $defaultSet;
@@ -98,10 +102,8 @@ class AccountController extends Controller
/** @var Account $account */
foreach ($accounts as $account) {
$currency = $this->repository->getAccountCurrency($account);
if (null === $currency) {
$currency = $default;
}
$currency = $this->repository->getAccountCurrency($account) ?? $this->nativeCurrency;
$field = $this->convertToNative && $currency->id !== $this->nativeCurrency->id ? 'native_balance' : 'balance';
$currentSet = [
'label' => $account->name,
'currency_id' => (string) $currency->id,
@@ -116,13 +118,12 @@ class AccountController extends Controller
];
// TODO this code is also present in the V2 chart account controller so this method is due to be deprecated.
$currentStart = clone $start;
$range = app('steam')->finalAccountBalanceInRange($account, $start, clone $end);
// 2022-10-11 this method no longer converts to float.
$previous = array_values($range)[0];
$range = Steam::finalAccountBalanceInRange($account, $start, clone $end, $this->convertToNative);
$previous = array_values($range)[0][$field];
while ($currentStart <= $end) {
$format = $currentStart->format('Y-m-d');
$label = $currentStart->toAtomString();
$balance = array_key_exists($format, $range) ? $range[$format]['balance'] : $previous;
$balance = array_key_exists($format, $range) ? $range[$format][$field] : $previous;
$previous = $balance;
$currentStart->addDay();
$currentSet['entries'][$label] = $balance;

View File

@@ -25,15 +25,26 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers;
use Carbon\Carbon;
use Carbon\Exceptions\InvalidDateException;
use Carbon\Exceptions\InvalidFormatException;
use FireflyIII\Exceptions\BadHttpHeaderException;
use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Facades\Steam;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\AbstractTransformer;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Collection;
use League\Fractal\Manager;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use League\Fractal\Serializer\JsonApiSerializer;
use Symfony\Component\HttpFoundation\Exception\BadRequestException;
use Symfony\Component\HttpFoundation\ParameterBag;
@@ -41,20 +52,25 @@ use Symfony\Component\HttpFoundation\ParameterBag;
/**
* Class Controller.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
* @SuppressWarnings(PHPMD.NumberOfChildren)
* @SuppressWarnings("PHPMD.CouplingBetweenObjects")
* @SuppressWarnings("PHPMD.NumberOfChildren")
*/
abstract class Controller extends BaseController
{
use AuthorizesRequests;
use DispatchesJobs;
use ValidatesRequests;
use ValidatesUserGroupTrait;
protected const string CONTENT_TYPE = 'application/vnd.api+json';
protected const string CONTENT_TYPE = 'application/vnd.api+json';
protected const string JSON_CONTENT_TYPE = 'application/json';
/** @var array<int, string> */
protected array $allowedSort;
protected ParameterBag $parameters;
protected bool $convertToNative = false;
protected array $accepts = ['application/json', 'application/vnd.api+json'];
protected TransactionCurrency $nativeCurrency;
/**
* Controller constructor.
@@ -67,10 +83,19 @@ abstract class Controller extends BaseController
function ($request, $next) {
$this->parameters = $this->getParameters();
if (auth()->check()) {
$language = app('steam')->getLanguage();
$language = Steam::getLanguage();
$this->convertToNative = Amount::convertToNative();
$this->nativeCurrency = Amount::getNativeCurrency();
app()->setLocale($language);
}
// filter down what this endpoint accepts.
if (!$request->accepts($this->accepts)) {
throw new BadHttpHeaderException(sprintf('Sorry, Accept header "%s" is not something this endpoint can provide.', $request->header('Accept')));
}
return $next($request);
}
);
@@ -108,7 +133,7 @@ abstract class Controller extends BaseController
if (null !== $date) {
try {
$obj = Carbon::parse((string) $date);
} catch (InvalidDateException|InvalidFormatException $e) {
} catch (InvalidFormatException $e) {
// don't care
app('log')->warning(
sprintf(
@@ -134,7 +159,15 @@ abstract class Controller extends BaseController
$value = null;
}
if (null !== $value) {
$bag->set($integer, (int) $value);
$value = (int) $value;
if ($value < 1) {
$value = 1;
}
if ($value > 2 ** 16) {
$value = 2 ** 16;
}
$bag->set($integer, $value);
}
if (null === $value
&& 'limit' === $integer // @phpstan-ignore-line
@@ -216,4 +249,45 @@ abstract class Controller extends BaseController
return $manager;
}
final protected function jsonApiList(string $key, LengthAwarePaginator $paginator, AbstractTransformer $transformer): array
{
$manager = new Manager();
$baseUrl = sprintf('%s/api/v1/', request()->getSchemeAndHttpHost());
// TODO add stuff to path?
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$objects = $paginator->getCollection();
// the transformer, at this point, needs to collect information that ALL items in the collection
// require, like meta-data and stuff like that, and save it for later.
// $objects = $transformer->collectMetaData($objects);
$paginator->setCollection($objects);
$resource = new FractalCollection($objects, $transformer, $key);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return $manager->createData($resource)->toArray();
}
/**
* Returns a JSON API object and returns it.
*
* @param array<int, mixed>|Model $object
*/
final protected function jsonApiObject(string $key, array|Model $object, AbstractTransformer $transformer): array
{
// create some objects:
$manager = new Manager();
$baseUrl = sprintf('%s/api/v1', request()->getSchemeAndHttpHost());
$manager->setSerializer(new JsonApiSerializer($baseUrl));
// $transformer->collectMetaData(new Collection([$object]));
$resource = new Item($object, $transformer, $key);
return $manager->createData($resource)->toArray();
}
}

View File

@@ -26,10 +26,10 @@ namespace FireflyIII\Api\V1\Controllers\Data;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\DestroyRequest;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
@@ -66,9 +66,9 @@ class DestroyController extends Controller
$objects = $request->getObjects();
$this->unused = $request->boolean('unused', false);
$allExceptAssets = [AccountType::BENEFICIARY, AccountType::CASH, AccountType::CREDITCARD, AccountType::DEFAULT, AccountType::EXPENSE, AccountType::IMPORT, AccountType::INITIAL_BALANCE, AccountType::LIABILITY_CREDIT, AccountType::RECONCILIATION, AccountType::REVENUE];
$all = [AccountType::ASSET, AccountType::BENEFICIARY, AccountType::CASH, AccountType::CREDITCARD, AccountType::DEBT, AccountType::DEFAULT, AccountType::EXPENSE, AccountType::IMPORT, AccountType::INITIAL_BALANCE, AccountType::LIABILITY_CREDIT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::RECONCILIATION];
$liabilities = [AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD];
$allExceptAssets = [AccountTypeEnum::BENEFICIARY->value, AccountTypeEnum::CASH->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::DEFAULT->value, AccountTypeEnum::EXPENSE->value, AccountTypeEnum::IMPORT->value, AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::LIABILITY_CREDIT->value, AccountTypeEnum::RECONCILIATION->value, AccountTypeEnum::REVENUE->value];
$all = [AccountTypeEnum::ASSET->value, AccountTypeEnum::BENEFICIARY->value, AccountTypeEnum::CASH->value, AccountTypeEnum::CREDITCARD->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::DEFAULT->value, AccountTypeEnum::EXPENSE->value, AccountTypeEnum::IMPORT->value, AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::LIABILITY_CREDIT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::RECONCILIATION->value];
$liabilities = [AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::CREDITCARD->value];
$transactions = [TransactionTypeEnum::WITHDRAWAL->value, TransactionTypeEnum::DEPOSIT->value, TransactionTypeEnum::TRANSFER->value, TransactionTypeEnum::RECONCILIATION->value];
match ($objects) {
@@ -82,9 +82,9 @@ class DestroyController extends Controller
'object_groups' => $this->destroyObjectGroups(),
'not_assets_liabilities' => $this->destroyAccounts($allExceptAssets),
'accounts' => $this->destroyAccounts($all),
'asset_accounts' => $this->destroyAccounts([AccountType::ASSET, AccountType::DEFAULT]),
'expense_accounts' => $this->destroyAccounts([AccountType::BENEFICIARY, AccountType::EXPENSE]),
'revenue_accounts' => $this->destroyAccounts([AccountType::REVENUE]),
'asset_accounts' => $this->destroyAccounts([AccountTypeEnum::ASSET->value, AccountTypeEnum::DEFAULT->value]),
'expense_accounts' => $this->destroyAccounts([AccountTypeEnum::BENEFICIARY->value, AccountTypeEnum::EXPENSE->value]),
'revenue_accounts' => $this->destroyAccounts([AccountTypeEnum::REVENUE->value]),
'liabilities' => $this->destroyAccounts($liabilities),
'transactions' => $this->destroyTransactions($transactions),
'withdrawals' => $this->destroyTransactions([TransactionTypeEnum::WITHDRAWAL->value]),

View File

@@ -59,7 +59,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function accounts(ExportRequest $request): LaravelResponse
{
@@ -100,7 +100,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function bills(ExportRequest $request): LaravelResponse
{
@@ -115,7 +115,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function budgets(ExportRequest $request): LaravelResponse
{
@@ -130,7 +130,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function categories(ExportRequest $request): LaravelResponse
{
@@ -145,7 +145,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function piggyBanks(ExportRequest $request): LaravelResponse
{
@@ -160,7 +160,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function recurring(ExportRequest $request): LaravelResponse
{
@@ -175,7 +175,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function rules(ExportRequest $request): LaravelResponse
{
@@ -190,7 +190,7 @@ class ExportController extends Controller
*
* @throws FireflyException
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function tags(ExportRequest $request): LaravelResponse
{

View File

@@ -29,7 +29,9 @@ use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
/**
* Class BillController
@@ -63,11 +65,13 @@ class BillController extends Controller
*/
public function bill(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$bills = $request->getBills();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$bills = $request->getBills();
$start = $request->getStart();
$end = $request->getEnd();
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
$response = [];
// get all bills:
if (0 === $bills->count()) {
@@ -75,17 +79,30 @@ class BillController extends Controller
}
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->setRange($start, $end)->setSourceAccounts($accounts);
$collector->setBills($bills);
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$billId = (int) $journal['bill_id'];
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
$key = sprintf('%d-%d', $billId, $currencyId);
$foreignKey = sprintf('%d-%d', $billId, $foreignCurrencyId);
$billId = (int) $journal['bill_id'];
$currencyId = (int) $journal['currency_id'];
$currencyCode = $journal['currency_code'];
$field = 'amount';
// use the native amount if the user wants to convert to native currency
if ($convertToNative && $currencyId !== $default->id) {
$currencyId = $default->id;
$currencyCode = $default->code;
$field = 'native_amount';
}
// use foreign amount when the foreign currency IS the default currency.
if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
Log::debug(sprintf('Journal #%d in bill #%d will use %s (%s %s)', $journal['transaction_group_id'], $billId, $field, $currencyCode, $journal[$field] ?? '0'));
$key = sprintf('%d-%d', $billId, $currencyId);
if (0 !== $currencyId) {
$response[$key] ??= [
@@ -94,21 +111,11 @@ class BillController extends Controller
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
'currency_code' => $currencyCode,
];
$response[$key]['difference'] = bcadd($response[$key]['difference'], $journal['amount']);
$response[$key]['difference'] = bcadd($response[$key]['difference'], (string) ($journal[$field] ?? '0'));
$response[$key]['difference_float'] = (float) $response[$key]['difference']; // intentional float
}
if (0 !== $foreignCurrencyId) {
$response[$foreignKey] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignKey]['difference'] = bcadd($response[$foreignKey]['difference'], $journal['foreign_amount']);
$response[$foreignKey]['difference_float'] = (float) $response[$foreignKey]['difference']; // intentional float
}
}
return response()->json(array_values($response));
@@ -122,42 +129,47 @@ class BillController extends Controller
*/
public function noBill(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
$response = [];
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->setRange($start, $end)->setSourceAccounts($accounts);
$collector->withoutBill();
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
$currencyId = (int) $journal['currency_id'];
$currencyCode = $journal['currency_code'];
$field = 'amount';
// use the native amount if the user wants to convert to native currency
if ($convertToNative && $currencyId !== $default->id) {
$currencyId = $default->id;
$currencyCode = $default->code;
$field = 'native_amount';
}
// use foreign amount when the foreign currency IS the default currency.
if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
Log::debug(sprintf('Journal #%d will use %s (%s %s)', $journal['transaction_group_id'], $field, $currencyCode, $journal[$field] ?? '0'));
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], (string) ($journal[$field] ?? '0'));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // intentional float
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; // intentional float
}
}
return response()->json(array_values($response));

View File

@@ -28,7 +28,9 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
/**
* Class PeriodController
@@ -41,39 +43,49 @@ class PeriodController extends Controller
*/
public function total(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// collect all expenses in this period (regardless of type)
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->setRange($start, $end)->setSourceAccounts($accounts);
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
// same code as many other sumExpense methods. I think this needs some kind of generic method.
$amount = '0';
$currencyId = (int) $journal['currency_id'];
$currencyCode = $journal['currency_code'];
if ($convertToNative) {
$amount = Amount::getAmountFromJournal($journal);
if ($default->id !== (int) $journal['currency_id'] && $default->id !== (int) $journal['foreign_currency_id']) {
$currencyId = $default->id;
$currencyCode = $default->code;
}
if ($default->id !== (int) $journal['currency_id'] && $default->id === (int) $journal['foreign_currency_id']) {
$currencyId = $journal['foreign_currency_id'];
$currencyCode = $journal['foreign_currency_code'];
}
Log::debug(sprintf('[a] Add amount %s %s', $currencyCode, $amount));
}
if (!$convertToNative) {
// ignore the amount in foreign currency.
Log::debug(sprintf('[b] Add amount %s %s', $currencyCode, $journal['amount']));
$amount = $journal['amount'];
}
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // intentional float
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; // intentional float
}
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $amount);
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // intentional float
}
return response()->json(array_values($response));

View File

@@ -29,7 +29,9 @@ use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
/**
* Class TagController
@@ -62,42 +64,51 @@ class TagController extends Controller
*/
public function noTag(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::WITHDRAWAL->value])->setRange($start, $end)->setSourceAccounts($accounts);
$collector->withoutTags();
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
// same code as many other sumExpense methods. I think this needs some kind of generic method.
$amount = '0';
$currencyId = (int) $journal['currency_id'];
$currencyCode = $journal['currency_code'];
if ($convertToNative) {
$amount = Amount::getAmountFromJournal($journal);
if ($default->id !== (int) $journal['currency_id'] && $default->id !== (int) $journal['foreign_currency_id']) {
$currencyId = $default->id;
$currencyCode = $default->code;
}
if ($default->id !== (int) $journal['currency_id'] && $default->id === (int) $journal['foreign_currency_id']) {
$currencyId = $journal['foreign_currency_id'];
$currencyCode = $journal['foreign_currency_code'];
}
Log::debug(sprintf('[a] Add amount %s %s', $currencyCode, $amount));
}
if (!$convertToNative) {
// ignore the amount in foreign currency.
Log::debug(sprintf('[b] Add amount %s %s', $currencyCode, $journal['amount']));
$amount = $journal['amount'];
}
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $journal['amount']);
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // float but on purpose.
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd($response[$foreignCurrencyId]['difference'], $journal['foreign_amount']);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; // float but on purpose.
}
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], $amount);
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // float but on purpose.
}
return response()->json(array_values($response));

View File

@@ -73,6 +73,7 @@ class AccountController extends Controller
$start = $request->getStart();
$end = $request->getEnd();
$assetAccounts = $request->getAssetAccounts();
$income = $this->opsRepository->sumIncomeByDestination($start, $end, $assetAccounts);
$result = [];

View File

@@ -28,6 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
/**
@@ -41,42 +42,41 @@ class PeriodController extends Controller
*/
public function total(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// collect all expenses in this period (regardless of type)
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::DEPOSIT->value])->setRange($start, $end)->setDestinationAccounts($accounts);
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
$field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // float but on purpose.
// perhaps use default currency instead?
if ($convertToNative && $journal['currency_id'] !== $default->id) {
$currencyId = $default->id;
$currencyCode = $default->code;
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd(
$response[$foreignCurrencyId]['difference'],
app('steam')->positive($journal['foreign_amount'])
);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference']; // float but on purpose.
// use foreign amount when the foreign currency IS the default currency.
if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference']; // float but on purpose.
}
return response()->json(array_values($response));

View File

@@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
/**
@@ -63,45 +64,45 @@ class TagController extends Controller
*/
public function noTag(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::DEPOSIT->value])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector->withoutTags();
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
$field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
// perhaps use default currency instead?
if ($convertToNative && $journal['currency_id'] !== $default->id) {
$currencyId = $default->id;
$currencyCode = $default->code;
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd(
$response[$foreignCurrencyId]['difference'],
app('steam')->positive($journal['foreign_amount'])
);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
// use foreign amount when the foreign currency IS the default currency.
if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
}
return response()->json(array_values($response));

View File

@@ -26,8 +26,9 @@ namespace FireflyIII\Api\V1\Controllers\Insight\Transfer;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionType;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
/**
@@ -41,42 +42,42 @@ class PeriodController extends Controller
*/
public function total(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// collect all expenses in this period (regardless of type)
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
$genericSet = $collector->getExtractedJournals();
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::TRANSFER->value])->setRange($start, $end)->setDestinationAccounts($accounts);
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
$field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
// perhaps use default currency instead?
if ($convertToNative && $journal['currency_id'] !== $default->id) {
$currencyId = $default->id;
$currencyCode = $default->code;
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd(
$response[$foreignCurrencyId]['difference'],
app('steam')->positive($journal['foreign_amount'])
);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
// use foreign amount when the foreign currency IS the default currency.
if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
}
return response()->json(array_values($response));

View File

@@ -26,9 +26,10 @@ namespace FireflyIII\Api\V1\Controllers\Insight\Transfer;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Insight\GenericRequest;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use Illuminate\Http\JsonResponse;
/**
@@ -61,45 +62,46 @@ class TagController extends Controller
*/
public function noTag(GenericRequest $request): JsonResponse
{
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$accounts = $request->getAssetAccounts();
$start = $request->getStart();
$end = $request->getEnd();
$response = [];
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionTypeEnum::TRANSFER->value])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector->withoutTags();
$genericSet = $collector->getExtractedJournals();
$genericSet = $collector->getExtractedJournals();
foreach ($genericSet as $journal) {
$currencyId = (int) $journal['currency_id'];
$foreignCurrencyId = (int) $journal['foreign_currency_id'];
// currency
$currencyId = $journal['currency_id'];
$currencyCode = $journal['currency_code'];
$field = $convertToNative && $currencyId !== $default->id ? 'native_amount' : 'amount';
if (0 !== $currencyId) {
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $journal['currency_code'],
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal['amount']));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
// perhaps use default currency instead?
if ($convertToNative && $journal['currency_id'] !== $default->id) {
$currencyId = $default->id;
$currencyCode = $default->code;
}
if (0 !== $foreignCurrencyId) {
$response[$foreignCurrencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $foreignCurrencyId,
'currency_code' => $journal['foreign_currency_code'],
];
$response[$foreignCurrencyId]['difference'] = bcadd(
$response[$foreignCurrencyId]['difference'],
app('steam')->positive($journal['foreign_amount'])
);
$response[$foreignCurrencyId]['difference_float'] = (float) $response[$foreignCurrencyId]['difference'];
// use foreign amount when the foreign currency IS the default currency.
if ($convertToNative && $journal['currency_id'] !== $default->id && $default->id === $journal['foreign_currency_id']) {
$field = 'foreign_amount';
}
$response[$currencyId] ??= [
'difference' => '0',
'difference_float' => 0,
'currency_id' => (string) $currencyId,
'currency_code' => $currencyCode,
];
$response[$currencyId]['difference'] = bcadd($response[$currencyId]['difference'], app('steam')->positive($journal[$field]));
$response[$currencyId]['difference_float'] = (float) $response[$currencyId]['difference'];
}
return response()->json(array_values($response));
@@ -126,7 +128,7 @@ class TagController extends Controller
// collect all expenses in this period (regardless of type) by the given bills and accounts.
$collector = app(GroupCollectorInterface::class);
$collector->setTypes([TransactionType::TRANSFER])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector->setTypes([TransactionTypeEnum::TRANSFER->value])->setRange($start, $end)->setDestinationAccounts($accounts);
$collector->setTags($tags);
$genericSet = $collector->getExtractedJournals();

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\PiggyBankTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
@@ -140,18 +141,18 @@ class ListController extends Controller
*/
public function transactions(Request $request, Account $account): JsonResponse
{
$pageSize = $this->parameters->get('limit');
$type = $request->get('type') ?? 'default';
$pageSize = $this->parameters->get('limit');
$type = $request->get('type') ?? 'default';
$this->parameters->set('type', $type);
$types = $this->mapTransactionTypes($this->parameters->get('type'));
$manager = $this->getManager();
$types = $this->mapTransactionTypes($this->parameters->get('type'));
$manager = $this->getManager();
/** @var User $admin */
$admin = auth()->user();
$admin = auth()->user();
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setUser($admin)->setAccounts(new Collection([$account]))
->withAPIInformation()->setLimit($pageSize)->setPage($this->parameters->get('page'))->setTypes($types)
;
@@ -163,15 +164,19 @@ class ListController extends Controller
$collector->setEnd($this->parameters->get('end'));
}
$paginator = $collector->getPaginatedGroups();
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.accounts.transactions', [$account->id]).$this->buildParams());
$groups = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($groups, $transformer, 'transactions');
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);

View File

@@ -29,7 +29,9 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
use FireflyIII\Transformers\AccountTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
@@ -88,9 +90,16 @@ class ShowController extends Controller
$count = $collection->count();
// continue sort:
$accounts = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);
// make paginator:
$paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.accounts.index').$this->buildParams());
@@ -118,6 +127,15 @@ class ShowController extends Controller
$account->refresh();
$manager = $this->getManager();
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$account = $enrichment->enrichSingle($account);
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);

View File

@@ -27,7 +27,9 @@ namespace FireflyIII\Api\V1\Controllers\Models\Account;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\Account\StoreRequest;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
use FireflyIII\Transformers\AccountTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use League\Fractal\Resource\Item;
@@ -69,6 +71,14 @@ class StoreController extends Controller
$account = $this->repository->store($data);
$manager = $this->getManager();
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$account = $enrichment->enrichSingle($account);
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);

View File

@@ -28,7 +28,9 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\Account\UpdateRequest;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
use FireflyIII\Transformers\AccountTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use League\Fractal\Resource\Item;
@@ -73,6 +75,14 @@ class UpdateController extends Controller
$account->refresh();
app('preferences')->mark();
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$account = $enrichment->enrichSingle($account);
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\RuleTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
@@ -176,7 +177,11 @@ class ListController extends Controller
// get paginator.
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.bills.transactions', [$bill->id]).$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -25,12 +25,14 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\Budget;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\BudgetLimitTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
@@ -171,7 +173,11 @@ class ListController extends Controller
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.budgets.transactions', [$budget->id]).$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
@@ -208,6 +214,8 @@ class ListController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector
->setUser($admin)
// withdrawals only
->setTypes([TransactionTypeEnum::WITHDRAWAL->value])
// filter on budget.
->withoutBudget()
// all info needed for the API:
@@ -229,7 +237,11 @@ class ListController extends Controller
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.budgets.without-budget').$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -84,7 +85,11 @@ class ListController extends Controller
$collector->setTypes($types);
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.budgets.limits.transactions', [$budget->id, $budgetLimit->id]).$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -100,7 +100,7 @@ class ShowController extends Controller
*
* Display a listing of the budget limits for this budget.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function indexAll(SameDateRequest $request): JsonResponse
{

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
@@ -139,7 +140,11 @@ class ListController extends Controller
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.categories.transactions', [$category->id]).$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -2,7 +2,7 @@
/*
* DestroyController.php
* Copyright (c) 2024 james@firefly-iii.org.
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -22,12 +22,15 @@
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\ExchangeRate\DestroyRequest;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\DestroyRequest;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Exceptions\ValidationException;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use Illuminate\Http\JsonResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -36,6 +39,8 @@ class DestroyController extends Controller
{
use ValidatesUserGroupTrait;
protected array $acceptedRoles = [UserRoleEnum::OWNER];
public const string RESOURCE_KEY = 'exchange-rates';
private ExchangeRateRepositoryInterface $repository;
@@ -56,6 +61,9 @@ class DestroyController extends Controller
public function destroy(DestroyRequest $request, TransactionCurrency $from, TransactionCurrency $to): JsonResponse
{
$date = $request->getDate();
if (null === $date) {
throw new ValidationException('Date is required');
}
$rate = $this->repository->getSpecificRateOnDate($from, $to, $date);
if (null === $rate) {
throw new NotFoundHttpException();
@@ -64,4 +72,11 @@ class DestroyController extends Controller
return response()->json([], 204);
}
public function destroySingle(CurrencyExchangeRate $exchangeRate): JsonResponse
{
$this->repository->deleteRate($exchangeRate);
return response()->json([], 204);
}
}

View File

@@ -1,8 +1,8 @@
<?php
/*
* ShowController.php
* Copyright (c) 2023 james@firefly-iii.org
* IndexController.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -17,16 +17,17 @@
* 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/>.
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
@@ -37,7 +38,7 @@ class IndexController extends Controller
{
use ValidatesUserGroupTrait;
public const string RESOURCE_KEY = 'exchange-rates';
public const string RESOURCE_KEY = 'currency_exchange_rates';
private ExchangeRateRepositoryInterface $repository;
@@ -56,14 +57,11 @@ class IndexController extends Controller
public function index(): JsonResponse
{
$piggies = $this->repository->getAll();
$entries = $this->repository->getAll();
$pageSize = $this->parameters->get('limit');
$count = $piggies->count();
$piggies = $piggies->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($piggies, $count, $pageSize, $this->parameters->get('page'));
var_dump('here we are');
$count = $entries->count();
$entries = $entries->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($entries, $count, $pageSize, $this->parameters->get('page'));
$transformer = new ExchangeRateTransformer();
$transformer->setParameters($this->parameters); // give params to transformer

View File

@@ -2,7 +2,7 @@
/*
* ShowController.php
* Copyright (c) 2023 james@firefly-iii.org
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -17,18 +17,19 @@
* 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/>.
* along with this program. If not, see https://www.gnu.org/licenses/.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
@@ -73,4 +74,15 @@ class ShowController extends Controller
->header('Content-Type', self::CONTENT_TYPE)
;
}
public function showSingle(CurrencyExchangeRate $exchangeRate): JsonResponse
{
$transformer = new ExchangeRateTransformer();
$transformer->setParameters($this->parameters);
return response()
->api($this->jsonApiObject(self::RESOURCE_KEY, $exchangeRate, $transformer))
->header('Content-Type', self::CONTENT_TYPE)
;
}
}

View File

@@ -1,8 +1,8 @@
<?php
/*
* DestroyController.php
* Copyright (c) 2024 james@firefly-iii.org.
* StoreController.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -22,13 +22,13 @@
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\StoreRequest;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\ExchangeRate\StoreRequest;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
class StoreController extends Controller

View File

@@ -1,8 +1,8 @@
<?php
/*
* DestroyController.php
* Copyright (c) 2024 james@firefly-iii.org.
* UpdateController.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -22,14 +22,14 @@
declare(strict_types=1);
namespace FireflyIII\Api\V2\Controllers\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Controllers\Models\CurrencyExchangeRate;
use FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate\UpdateRequest;
use FireflyIII\Api\V2\Controllers\Controller;
use FireflyIII\Api\V2\Request\Model\ExchangeRate\UpdateRequest;
use FireflyIII\Models\CurrencyExchangeRate;
use FireflyIII\Repositories\UserGroups\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Repositories\ExchangeRate\ExchangeRateRepositoryInterface;
use FireflyIII\Support\Http\Api\ValidatesUserGroupTrait;
use FireflyIII\Transformers\V2\ExchangeRateTransformer;
use FireflyIII\Transformers\ExchangeRateTransformer;
use Illuminate\Http\JsonResponse;
class UpdateController extends Controller

View File

@@ -28,9 +28,11 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
use FireflyIII\Transformers\AccountTransformer;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\PiggyBankEventTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
@@ -75,17 +77,25 @@ class ListController extends Controller
$collection = $piggyBank->accounts;
$count = $collection->count();
$events = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$accounts = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);
// make paginator:
$paginator = new LengthAwarePaginator($events, $count, $pageSize, $this->parameters->get('page'));
$paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.piggy-banks.accounts', [$piggyBank->id]).$this->buildParams());
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($events, $transformer, 'accounts');
$resource = new FractalCollection($accounts, $transformer, 'accounts');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Recurrence;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -110,7 +111,11 @@ class ListController extends Controller
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.transactions.index').$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -37,7 +37,7 @@ class ExpressionController extends Controller
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/rules/validateExpression
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings("PHPMD.UnusedFormalParameter")
*/
public function validateExpression(ValidateExpressionRequest $request): JsonResponse
{

View File

@@ -29,6 +29,7 @@ use FireflyIII\Api\V1\Requests\Models\Rule\TestRequest;
use FireflyIII\Api\V1\Requests\Models\Rule\TriggerRequest;
use FireflyIII\Models\Rule;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\TransactionRules\Engine\RuleEngineInterface;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
@@ -94,6 +95,11 @@ class TriggerController extends Controller
$transactions = $ruleEngine->find();
$count = $transactions->count();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($rule->user);
$transactions = $enrichment->enrich($transactions);
$paginator = new LengthAwarePaginator($transactions, $count, 31337, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.rules.test', [$rule->id]).$this->buildParams());

View File

@@ -30,6 +30,7 @@ use FireflyIII\Api\V1\Requests\Models\RuleGroup\TriggerRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\TransactionRules\Engine\RuleEngineInterface;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
@@ -100,6 +101,11 @@ class TriggerController extends Controller
$transactions = $ruleEngine->find();
$count = $transactions->count();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($group->user);
$transactions = $enrichment->enrich($transactions);
$paginator = new LengthAwarePaginator($transactions, $count, 31337, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.rule-groups.test', [$group->id]).$this->buildParams());

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
@@ -141,7 +142,12 @@ class ListController extends Controller
}
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.tags.transactions', [$tag->id]).$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -85,7 +86,11 @@ class ShowController extends Controller
}
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.transactions.index').$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
@@ -137,6 +142,11 @@ class ShowController extends Controller
throw new NotFoundHttpException();
}
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\Transaction;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\Transaction\StoreRequest;
use FireflyIII\Enums\UserRoleEnum;
use FireflyIII\Events\StoredTransactionGroup;
use FireflyIII\Exceptions\DuplicateTransactionException;
use FireflyIII\Exceptions\FireflyException;
@@ -33,10 +34,12 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Rules\IsDuplicateTransaction;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use League\Fractal\Resource\Item;
@@ -49,6 +52,8 @@ class StoreController extends Controller
private TransactionGroupRepositoryInterface $groupRepository;
protected array $acceptedRoles = [UserRoleEnum::MANAGE_TRANSACTIONS];
/**
* TransactionController constructor.
*/
@@ -59,9 +64,11 @@ class StoreController extends Controller
function ($request, $next) {
/** @var User $admin */
$admin = auth()->user();
$userGroup = $this->validateUserGroup($request);
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
$this->groupRepository->setUser($admin);
$this->groupRepository->setUserGroup($userGroup);
return $next($request);
}
@@ -79,61 +86,64 @@ class StoreController extends Controller
public function store(StoreRequest $request): JsonResponse
{
app('log')->debug('Now in API StoreController::store()');
$data = $request->getAll();
$data['user'] = auth()->user()->id;
$data = $request->getAll();
$data['user'] = auth()->user();
$data['user_group'] = $this->userGroup;
Log::channel('audit')
->info('Store new transaction over API.', $data)
;
Log::channel('audit')->info('Store new transaction over API.', $data);
try {
$transactionGroup = $this->groupRepository->store($data);
} catch (DuplicateTransactionException $e) { // @phpstan-ignore-line
} catch (DuplicateTransactionException $e) {
app('log')->warning('Caught a duplicate transaction. Return error message.');
$validator = \Validator::make(
['transactions' => [['description' => $e->getMessage()]]],
['transactions.0.description' => new IsDuplicateTransaction()]
);
$validator = Validator::make(['transactions' => [['description' => $e->getMessage()]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator); // @phpstan-ignore-line
} catch (FireflyException $e) { // @phpstan-ignore-line
throw new ValidationException($validator);
} catch (FireflyException $e) {
app('log')->warning('Caught an exception. Return error message.');
app('log')->error($e->getMessage());
$message = sprintf('Internal exception: %s', $e->getMessage());
$validator = \Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
$validator = Validator::make(['transactions' => [['description' => $message]]], ['transactions.0.description' => new IsDuplicateTransaction()]);
throw new ValidationException($validator); // @phpstan-ignore-line
throw new ValidationException($validator);
}
app('preferences')->mark();
$applyRules = $data['apply_rules'] ?? true;
$fireWebhooks = $data['fire_webhooks'] ?? true;
$applyRules = $data['apply_rules'] ?? true;
$fireWebhooks = $data['fire_webhooks'] ?? true;
event(new StoredTransactionGroup($transactionGroup, $applyRules, $fireWebhooks));
$manager = $this->getManager();
$manager = $this->getManager();
/** @var User $admin */
$admin = auth()->user();
$admin = auth()->user();
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector
->setUser($admin)
->setUserGroup($this->userGroup)
// filter on transaction group.
->setTransactionGroup($transactionGroup)
// all info needed for the API:
->withAPIInformation()
;
$selectedGroup = $collector->getGroups()->first();
$selectedGroup = $collector->getGroups()->first();
if (null === $selectedGroup) {
throw new FireflyException('200032: Cannot find transaction. Possibly, a rule deleted this transaction after its creation.');
}
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($selectedGroup, $transformer, 'transactions');
$resource = new Item($selectedGroup, $transformer, 'transactions');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}

View File

@@ -30,6 +30,7 @@ use FireflyIII\Events\UpdatedTransactionGroup;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -72,13 +73,6 @@ class UpdateController extends Controller
{
app('log')->debug('Now in update routine for transaction group');
$data = $request->getAll();
// Fixes 8750.
$transactions = $data['transactions'] ?? [];
foreach ($transactions as $index => $info) {
unset($data['transactions'][$index]['type']);
}
$transactionGroup = $this->groupRepository->update($transactionGroup, $data);
$manager = $this->getManager();
@@ -106,6 +100,11 @@ class UpdateController extends Controller
throw new NotFoundHttpException();
}
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$selectedGroup = $enrichment->enrichSingle($selectedGroup);
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);

View File

@@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;

View File

@@ -42,6 +42,8 @@ use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\AccountTransformer;
use FireflyIII\Transformers\AvailableBudgetTransformer;
use FireflyIII\Transformers\BillTransformer;
@@ -100,6 +102,14 @@ class ListController extends Controller
$count = $collection->count();
$accounts = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);
// make paginator:
$paginator = new LengthAwarePaginator($accounts, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.currencies.accounts', [$currency->code]).$this->buildParams());
@@ -236,10 +246,10 @@ class ListController extends Controller
// get list of budgets. Count it and split it.
/** @var RecurringRepositoryInterface $recurringRepos */
$recurringRepos = app(RecurringRepositoryInterface::class);
$unfiltered = $recurringRepos->getAll();
$unfiltered = $recurringRepos->get();
// filter selection
$collection = $unfiltered->filter( // @phpstan-ignore-line
$collection = $unfiltered->filter(
static function (Recurrence $recurrence) use ($currency) { // @phpstan-ignore-line
/** @var RecurrenceTransaction $transaction */
foreach ($recurrence->recurrenceTransactions as $transaction) {
@@ -286,7 +296,7 @@ class ListController extends Controller
$ruleRepos = app(RuleRepositoryInterface::class);
$unfiltered = $ruleRepos->getAll();
$collection = $unfiltered->filter( // @phpstan-ignore-line
$collection = $unfiltered->filter(
static function (Rule $rule) use ($currency) { // @phpstan-ignore-line
/** @var RuleTrigger $trigger */
foreach ($rule->ruleTriggers as $trigger) {
@@ -360,7 +370,11 @@ class ListController extends Controller
}
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.currencies.transactions', [$currency->code]).$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer;
@@ -105,26 +105,25 @@ class ShowController extends Controller
public function show(TransactionCurrency $currency): JsonResponse
{
/** @var User $user */
$user = auth()->user();
$manager = $this->getManager();
$defaultCurrency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
$this->parameters->set('defaultCurrency', $defaultCurrency);
$user = auth()->user();
$manager = $this->getManager();
$this->parameters->set('nativeCurrency', $this->nativeCurrency);
// update fields with user info.
$currency->refreshForUser($user);
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);
$transformer = app(CurrencyTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($currency, $transformer, 'currencies');
$resource = new Item($currency, $transformer, 'currencies');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/getDefaultCurrency
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/getNativeCurrency
*
* Show a currency.
*
@@ -135,7 +134,7 @@ class ShowController extends Controller
/** @var User $user */
$user = auth()->user();
$manager = $this->getManager();
$currency = app('amount')->getDefaultCurrencyByUserGroup($user->userGroup);
$currency = $this->nativeCurrency;
// update fields with user info.
$currency->refreshForUser($user);

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\Models\TransactionCurrency;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\StoreRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer;

View File

@@ -28,7 +28,7 @@ use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\TransactionCurrency\UpdateRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\CurrencyTransformer;
@@ -100,7 +100,7 @@ class UpdateController extends Controller
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/defaultCurrency
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/currencies/nativeCurrency
*
* Make the currency a default currency.
*

View File

@@ -30,6 +30,7 @@ use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\LinkType;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -109,7 +110,11 @@ class ListController extends Controller
}
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.transactions.index').$this->buildParams());
$transactions = $paginator->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -0,0 +1,71 @@
<?php
/*
* IndexController.php
* Copyright (c) 2024 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/.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\UserGroup;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Data\DateRequest;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
class IndexController extends Controller
{
public const string RESOURCE_KEY = 'user_groups';
private UserGroupRepositoryInterface $repository;
/**
* AccountController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
$this->repository = app(UserGroupRepositoryInterface::class);
return $next($request);
}
);
}
public function index(DateRequest $request): JsonResponse
{
$administrations = $this->repository->get();
$pageSize = $this->parameters->get('limit');
$count = $administrations->count();
$administrations = $administrations->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
$paginator = new LengthAwarePaginator($administrations, $count, $pageSize, $this->parameters->get('page'));
$transformer = new UserGroupTransformer();
$transformer->setParameters($this->parameters); // give params to transformer
return response()
->json($this->jsonApiList(self::RESOURCE_KEY, $paginator, $transformer))
->header('Content-Type', self::CONTENT_TYPE)
;
}
}

View File

@@ -0,0 +1,64 @@
<?php
/*
* ShowController.php
* Copyright (c) 2021 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/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\UserGroup;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\Webhook\WebhookRepositoryInterface;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
/**
* Class ShowController
*/
class ShowController extends Controller
{
public const string RESOURCE_KEY = 'user_groups';
private WebhookRepositoryInterface $repository;
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
$this->repository = app(WebhookRepositoryInterface::class);
$this->repository->setUser(auth()->user());
return $next($request);
}
);
}
public function show(UserGroup $userGroup): JsonResponse
{
$transformer = new UserGroupTransformer();
$transformer->setParameters($this->parameters);
return response()
->api($this->jsonApiObject(self::RESOURCE_KEY, $userGroup, $transformer))
->header('Content-Type', self::CONTENT_TYPE)
;
}
}

View File

@@ -0,0 +1,71 @@
<?php
/*
* UpdateController.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/.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Models\UserGroup;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Models\UserGroup\UpdateRequest;
use FireflyIII\Models\UserGroup;
use FireflyIII\Repositories\UserGroup\UserGroupRepositoryInterface;
use FireflyIII\Transformers\UserGroupTransformer;
use Illuminate\Http\JsonResponse;
class UpdateController extends Controller
{
public const string RESOURCE_KEY = 'user_groups';
private UserGroupRepositoryInterface $repository;
/**
* AccountController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
$this->repository = app(UserGroupRepositoryInterface::class);
return $next($request);
}
);
}
public function update(UpdateRequest $request, UserGroup $userGroup): JsonResponse
{
app('log')->debug(sprintf('Now in %s', __METHOD__));
$data = $request->getData();
$userGroup = $this->repository->update($userGroup, $data);
$userGroup->refresh();
app('preferences')->mark();
$transformer = new UserGroupTransformer();
$transformer->setParameters($this->parameters);
return response()
->api($this->jsonApiObject(self::RESOURCE_KEY, $userGroup, $transformer))
->header('Content-Type', self::CONTENT_TYPE)
;
}
}

View File

@@ -26,8 +26,10 @@ namespace FireflyIII\Api\V1\Controllers\Search;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
use FireflyIII\Support\Search\AccountSearch;
use FireflyIII\Transformers\AccountTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
@@ -81,6 +83,14 @@ class AccountController extends Controller
$accounts = $search->search();
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setUser($admin);
$enrichment->setNative($this->nativeCurrency);
$accounts = $enrichment->enrich($accounts);
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V1\Controllers\Search;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Support\JsonApi\Enrichments\TransactionGroupEnrichment;
use FireflyIII\Support\Search\SearchInterface;
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Http\JsonResponse;
@@ -57,7 +58,11 @@ class TransactionController extends Controller
$parameters = ['search' => $fullQuery];
$url = route('api.v1.search.transactions').'?'.http_build_query($parameters);
$groups->setPath($url);
$transactions = $groups->getCollection();
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser(auth()->user());
$transactions = $enrichment->enrich($groups->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);

View File

@@ -37,7 +37,7 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use FireflyIII\Repositories\UserGroups\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
@@ -102,11 +102,11 @@ class BasicController extends Controller
$balanceData = $this->getBalanceInformation($start, $end);
$billData = $this->getBillInformation($start, $end);
$spentData = $this->getLeftToSpendInfo($start, $end);
$netWorthData = $this->getNetWorthInfo($start, $end);
// $balanceData = [];
// $billData = [];
// $spentData = [];
// $netWorthData = [];
$netWorthData = $this->getNetWorthInfo($end);
// $balanceData = [];
// $billData = [];
// $spentData = [];
// $netWorthData = [];
$total = array_merge($balanceData, $billData, $spentData, $netWorthData);
// give new keys
@@ -123,8 +123,8 @@ class BasicController extends Controller
private function getBalanceInformation(Carbon $start, Carbon $end): array
{
// some config settings
$convertToNative = app('preferences')->get('convert_to_native', false)->data;
$default = app('amount')->getDefaultCurrency();
$convertToNative = Amount::convertToNative();
$default = Amount::getNativeCurrency();
// prep some arrays:
$incomes = [];
$expenses = [];
@@ -185,8 +185,8 @@ class BasicController extends Controller
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, $sums[$currencyId] ?? '0', false),
'local_icon' => 'balance-scale',
'sub_title' => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false).
' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false),
'sub_title' => app('amount')->formatAnything($currency, $expenses[$currencyId] ?? '0', false)
.' + '.app('amount')->formatAnything($currency, $incomes[$currencyId] ?? '0', false),
];
$return[] = [
'key' => sprintf('spent-in-%s', $currency->code),
@@ -213,6 +213,47 @@ class BasicController extends Controller
'sub_title' => '',
];
}
if (0 === count($return)) {
$currency = $this->nativeCurrency;
// create objects for big array.
$return[] = [
'key' => sprintf('balance-in-%s', $currency->code),
'title' => trans('firefly.box_balance_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, '0', false),
'local_icon' => 'balance-scale',
'sub_title' => app('amount')->formatAnything($currency, '0', false)
.' + '.app('amount')->formatAnything($currency, '0', false),
];
$return[] = [
'key' => sprintf('spent-in-%s', $currency->code),
'title' => trans('firefly.box_spent_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, '0', false),
'local_icon' => 'balance-scale',
'sub_title' => '',
];
$return[] = [
'key' => sprintf('earned-in-%s', $currency->code),
'title' => trans('firefly.box_earned_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatAnything($currency, '0', false),
'local_icon' => 'balance-scale',
'sub_title' => '',
];
}
return $return;
}
@@ -268,6 +309,37 @@ class BasicController extends Controller
}
app('log')->debug(sprintf('Done with getBillInformation("%s", "%s")', $start->format('Y-m-d'), $end->format('Y-m-d-')));
if (0 === count($return)) {
$currency = $this->nativeCurrency;
unset($info, $amount);
$return[] = [
'key' => sprintf('bills-paid-in-%s', $currency->code),
'title' => trans('firefly.box_bill_paid_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false),
'local_icon' => 'check',
'sub_title' => '',
];
$return[] = [
'key' => sprintf('bills-unpaid-in-%s', $currency->code),
'title' => trans('firefly.box_bill_unpaid_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false),
'local_icon' => 'calendar-o',
'sub_title' => '',
];
}
return $return;
}
@@ -276,13 +348,13 @@ class BasicController extends Controller
*/
private function getLeftToSpendInfo(Carbon $start, Carbon $end): array
{
Log::debug(sprintf('Now in getLeftToSpendInfo("%s", "%s")', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
$return = [];
$today = today(config('app.timezone'));
$available = $this->abRepository->getAvailableBudgetWithCurrency($start, $end);
$budgets = $this->budgetRepository->getActiveBudgets();
$spent = $this->opsRepository->sumExpenses($start, $end, null, $budgets);
$days = (int) $today->diffInDays($end, true) + 1;
Log::debug(sprintf('Now in getLeftToSpendInfo("%s", "%s")', $start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')));
foreach ($spent as $row) {
// either an amount was budgeted or 0 is available.
@@ -315,22 +387,37 @@ class BasicController extends Controller
),
];
}
if (0 === count($return)) {
$currency = $this->nativeCurrency;
$return[] = [
'key' => sprintf('left-to-spend-in-%s', $currency->code),
'title' => trans('firefly.box_left_to_spend_in_currency', ['currency' => $currency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $currency->id,
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'value_parsed' => app('amount')->formatFlat($currency->symbol, $currency->decimal_places, '0', false),
'local_icon' => 'money',
'sub_title' => app('amount')->formatFlat(
$currency->symbol,
$currency->decimal_places,
'0',
false
),
];
}
return $return;
}
private function getNetWorthInfo(Carbon $start, Carbon $end): array
private function getNetWorthInfo(Carbon $end): array
{
Log::debug('getNetWorthInfo');
$end->endOfDay();
/** @var User $user */
$user = auth()->user();
$date = now(config('app.timezone'));
// start and end in the future? use $end
if ($this->notInDateRange($date, $start, $end)) {
/** @var Carbon $date */
$date = session('end', today(config('app.timezone'))->endOfMonth());
}
Log::debug(sprintf('getNetWorthInfo up until "%s".', $end->format('Y-m-d H:i:s')));
/** @var NetWorthInterface $netWorthHelper */
$netWorthHelper = app(NetWorthInterface::class);
@@ -346,7 +433,7 @@ class BasicController extends Controller
}
);
$netWorthSet = $netWorthHelper->byAccounts($filtered, $date);
$netWorthSet = $netWorthHelper->byAccounts($filtered, $end);
$return = [];
foreach ($netWorthSet as $key => $data) {
if ('native' === $key) {
@@ -370,6 +457,22 @@ class BasicController extends Controller
'sub_title' => '',
];
}
if (0 === count($return)) {
$return[] = [
'key' => sprintf('net-worth-in-%s', $this->nativeCurrency->code),
'title' => trans('firefly.box_net_worth_in_currency', ['currency' => $this->nativeCurrency->symbol]),
'monetary_value' => '0',
'currency_id' => (string) $this->nativeCurrency->id,
'currency_code' => $this->nativeCurrency->code,
'currency_symbol' => $this->nativeCurrency->symbol,
'currency_decimal_places' => $this->nativeCurrency->decimal_places,
'value_parsed' => app('amount')->formatFlat($this->nativeCurrency->symbol, $this->nativeCurrency->decimal_places, '0', false),
'local_icon' => 'line-chart',
'sub_title' => '',
];
}
Log::debug('End of getNetWorthInfo');
return $return;

View File

@@ -27,6 +27,7 @@ namespace FireflyIII\Api\V1\Controllers\System;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Transformers\UserTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Facades\DB;
use League\Fractal\Resource\Item;
/**
@@ -48,7 +49,7 @@ class AboutController extends Controller
$replace = ['\~', '# '];
$phpVersion = str_replace($search, $replace, PHP_VERSION);
$phpOs = str_replace($search, $replace, PHP_OS);
$currentDriver = \DB::getDriverName();
$currentDriver = DB::getDriverName();
$data
= [
'version' => config('firefly.version'),
@@ -58,7 +59,7 @@ class AboutController extends Controller
'driver' => $currentDriver,
];
return response()->api(['data' => $data])->header('Content-Type', self::CONTENT_TYPE);
return response()->api(['data' => $data])->header('Content-Type', self::JSON_CONTENT_TYPE);
}
/**

View File

@@ -86,7 +86,7 @@ class ConfigurationController extends Controller
];
}
return response()->json($return);
return response()->api($return);
}
/**
@@ -142,7 +142,7 @@ class ConfigurationController extends Controller
];
}
return response()->json(['data' => $data])->header('Content-Type', self::CONTENT_TYPE);
return response()->api(['data' => $data])->header('Content-Type', self::JSON_CONTENT_TYPE);
}
/**
@@ -173,6 +173,6 @@ class ConfigurationController extends Controller
'editable' => true,
];
return response()->json(['data' => $data])->header('Content-Type', self::CONTENT_TYPE);
return response()->api(['data' => $data])->header('Content-Type', self::CONTENT_TYPE);
}
}

View File

@@ -52,8 +52,8 @@ class CronController extends Controller
if (true === config('cer.download_enabled')) {
$return['exchange_rates'] = $this->exchangeRatesCronJob($config['force'], $config['date']);
}
$return['bill_warnings'] = $this->billWarningCronJob($config['force'], $config['date']);
$return['bill_notifications'] = $this->billWarningCronJob($config['force'], $config['date']);
return response()->json($return);
return response()->api($return);
}
}

View File

@@ -32,7 +32,6 @@ use FireflyIII\Models\Preference;
use FireflyIII\Transformers\PreferenceTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
@@ -86,7 +85,7 @@ class PreferencesController extends Controller
$manager = $this->getManager();
if ('currencyPreference' === $preference->name) {
throw new FireflyException('Please use api/v1/currencies/default instead.');
throw new FireflyException('Please use api/v1/currencies/native instead.');
}
/** @var PreferenceTransformer $transformer */
@@ -98,34 +97,6 @@ class PreferencesController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* TODO This endpoint is not documented.
*
* Return a single preference by name.
*
* @param Collection<int, Preference> $collection
*/
public function showList(Collection $collection): JsonResponse
{
$manager = $this->getManager();
$count = $collection->count();
$pageSize = $this->parameters->get('limit');
$preferences = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// make paginator:
$paginator = new LengthAwarePaginator($preferences, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.preferences.show-list').$this->buildParams());
/** @var PreferenceTransformer $transformer */
$transformer = app(PreferenceTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($preferences, $transformer, self::RESOURCE_KEY);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
/**
* This endpoint is documented at:
* https://api-docs.firefly-iii.org/?urls.primaryName=2.0.0%20(v1)#/preferences/storePreference
@@ -161,7 +132,7 @@ class PreferencesController extends Controller
public function update(PreferenceUpdateRequest $request, Preference $preference): JsonResponse
{
if ('currencyPreference' === $preference->name) {
throw new FireflyException('Please use api/v1/currencies/default instead.');
throw new FireflyException('Please use api/v1/currencies/native instead.');
}
$manager = $this->getManager();

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Autocomplete;
use FireflyIII\Models\AccountType;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
@@ -46,7 +46,7 @@ class AutocompleteRequest extends FormRequest
}
// remove 'initial balance' from allowed types. its internal
$array = array_diff($array, [AccountType::INITIAL_BALANCE, AccountType::RECONCILIATION]);
$array = array_diff($array, [AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::RECONCILIATION->value]);
return [
'types' => $array,
@@ -58,6 +58,7 @@ class AutocompleteRequest extends FormRequest
public function rules(): array
{
return [
'date' => 'date|after:1900-01-01|before:2099-12-31',
];
}
}

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Data;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Exceptions\ValidationException;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
@@ -49,12 +49,13 @@ class DateRequest extends FormRequest
$start->startOfDay();
$end->endOfDay();
if ($start->diffInYears($end, true) > 5) {
throw new FireflyException('Date range out of range.');
throw new ValidationException('Date range out of range.');
}
return [
'start' => $start,
'end' => $end,
'date' => $this->getCarbonDate('date'),
];
}
@@ -64,8 +65,9 @@ class DateRequest extends FormRequest
public function rules(): array
{
return [
'start' => 'required|date',
'end' => 'required|date|after:start',
'date' => 'date|after:1900-01-01|before:2099-12-31',
'start' => 'date|after:1900-01-01|before:2099-12-31|before:end|required_with:end',
'end' => 'date|after:1900-01-01|before:2099-12-31|after:start|required_with:start',
];
}
}

View File

@@ -49,9 +49,9 @@ class DestroyRequest extends FormRequest
*/
public function rules(): array
{
$valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'.
',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'.
',not_assets_liabilities';
$valid = 'budgets,bills,piggy_banks,rules,recurring,categories,tags,object_groups'
.',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'
.',not_assets_liabilities';
return [
'objects' => sprintf('required|max:255|min:1|string|in:%s', $valid),

View File

@@ -24,7 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Data\Export;
use FireflyIII\Models\AccountType;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
@@ -55,7 +55,7 @@ class ExportRequest extends FormRequest
$accountId = (int) $part;
if (0 !== $accountId) {
$account = $repository->find($accountId);
if (null !== $account && AccountType::ASSET === $account->accountType->type) {
if (null !== $account && AccountTypeEnum::ASSET->value === $account->accountType->type) {
$accounts->push($account);
}
}

View File

@@ -25,8 +25,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Insight;
use Carbon\Carbon;
use FireflyIII\Enums\AccountTypeEnum;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
@@ -70,7 +70,7 @@ class GenericRequest extends FormRequest
/** @var Account $account */
foreach ($this->accounts as $account) {
$type = $account->accountType->type;
if (in_array($type, [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE], true)) {
if (in_array($type, [AccountTypeEnum::ASSET->value, AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value], true)) {
$return->push($account);
}
}
@@ -191,7 +191,7 @@ class GenericRequest extends FormRequest
/** @var Account $account */
foreach ($this->accounts as $account) {
$type = $account->accountType->type;
if (AccountType::EXPENSE === $type) {
if (AccountTypeEnum::EXPENSE->value === $type) {
$return->push($account);
}
}
@@ -207,7 +207,7 @@ class GenericRequest extends FormRequest
/** @var Account $account */
foreach ($this->accounts as $account) {
$type = $account->accountType->type;
if (AccountType::REVENUE === $type) {
if (AccountTypeEnum::REVENUE->value === $type) {
$return->push($account);
}
}

View File

@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V1\Requests\Models\Account;
use FireflyIII\Models\Account;
use FireflyIII\Models\Location;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\UniqueAccountNumber;
use FireflyIII\Rules\UniqueIban;
@@ -33,6 +34,8 @@ use FireflyIII\Support\Request\AppendsLocationData;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Log;
use Illuminate\Validation\Validator;
/**
* Class UpdateRequest
@@ -112,4 +115,36 @@ class UpdateRequest extends FormRequest
return Location::requestRules($rules);
}
/**
* Configure the validator instance with special rules for after the basic validation rules.
*/
public function withValidator(Validator $validator): void
{
$validator->after(
function (Validator $validator): void {
// validate start before end only if both are there.
$data = $validator->getData();
/** @var Account $account */
$account = $this->route()->parameter('account');
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$currency = $repository->getAccountCurrency($account);
// how many piggies are attached?
$piggyBanks = $account->piggyBanks()->count();
if ($piggyBanks > 0 && array_key_exists('currency_code', $data) && $data['currency_code'] !== $currency->code) {
$validator->errors()->add('currency_code', (string) trans('validation.piggy_no_change_currency'));
}
if ($piggyBanks > 0 && array_key_exists('currency_id', $data) && (int) $data['currency_id'] !== $currency->id) {
$validator->errors()->add('currency_id', (string) trans('validation.piggy_no_change_currency'));
}
}
);
if ($validator->fails()) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}
}

View File

@@ -66,8 +66,8 @@ class Request extends FormRequest
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
'amount' => ['nullable', new IsValidPositiveAmount()],
'start' => 'date',
'end' => 'date',
'start' => 'date|after:1900-01-01|before:2099-12-31',
'end' => 'date|after:1900-01-01|before:2099-12-31',
];
}

View File

@@ -78,9 +78,9 @@ class StoreRequest extends FormRequest
'amount_max' => ['required', new IsValidPositiveAmount()],
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
'date' => 'date|required',
'end_date' => 'nullable|date|after:date',
'extension_date' => 'nullable|date|after:date',
'date' => 'date|required|after:1900-01-01|before:2099-12-31',
'end_date' => 'nullable|date|after:date|after:1900-01-01|before:2099-12-31',
'extension_date' => 'nullable|date|after:date|after:1900-01-01|before:2099-12-31',
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly|required',
'skip' => 'min:0|max:31|numeric',
'active' => [new IsBoolean()],
@@ -95,16 +95,40 @@ class StoreRequest extends FormRequest
{
$validator->after(
static function (Validator $validator): void {
$data = $validator->getData();
$min = (string) ($data['amount_min'] ?? '0');
$max = (string) ($data['amount_max'] ?? '0');
$data = $validator->getData();
$min = $data['amount_min'] ?? '0';
$max = $data['amount_max'] ?? '0';
if (1 === bccomp($min, $max)) {
if (is_array($min) || is_array($max)) {
$validator->errors()->add('amount_min', (string) trans('validation.generic_invalid'));
$validator->errors()->add('amount_max', (string) trans('validation.generic_invalid'));
$min = '0';
$max = '0';
}
$result = false;
try {
$result = bccomp($min, $max);
} catch (\ValueError $e) {
Log::error($e->getMessage());
$validator->errors()->add('amount_min', (string) trans('validation.generic_invalid'));
$validator->errors()->add('amount_max', (string) trans('validation.generic_invalid'));
}
if (1 === $result) {
$validator->errors()->add('amount_min', (string) trans('validation.amount_min_over_max'));
}
}
);
if ($validator->fails()) {
$failed = false;
try {
$failed = $validator->fails();
} catch (\TypeError $e) {
Log::error($e->getMessage());
$failed = false;
}
if ($failed) {
Log::channel('audit')->error(sprintf('Validation errors in %s', __CLASS__), $validator->errors()->toArray());
}
}

View File

@@ -81,9 +81,9 @@ class UpdateRequest extends FormRequest
'amount_max' => ['nullable', new IsValidPositiveAmount()],
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',
'date' => 'date',
'end_date' => 'date|after:date',
'extension_date' => 'date|after:date',
'date' => 'date|after:1900-01-01|before:2099-12-31',
'end_date' => 'date|after:date|after:1900-01-01|before:2099-12-31',
'extension_date' => 'date|after:date|after:1900-01-01|before:2099-12-31',
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly',
'skip' => 'min:0|max:31|numeric',
'active' => [new IsBoolean()],

View File

@@ -67,8 +67,8 @@ class UpdateRequest extends FormRequest
public function rules(): array
{
return [
'start' => 'date',
'end' => 'date',
'start' => 'date|after:1900-01-01|before:2099-12-31',
'end' => 'date|after:1900-01-01|before:2099-12-31',
'amount' => ['nullable', new IsValidPositiveAmount()],
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:51|exists:transaction_currencies,code',

View File

@@ -2,7 +2,7 @@
/*
* DestroyRequest.php
* Copyright (c) 2024 james@firefly-iii.org.
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -22,7 +22,7 @@
declare(strict_types=1);
namespace FireflyIII\Api\V2\Request\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
use Carbon\Carbon;
use FireflyIII\Support\Request\ChecksLogin;
@@ -34,7 +34,7 @@ class DestroyRequest extends FormRequest
use ChecksLogin;
use ConvertsDataTypes;
public function getDate(): Carbon
public function getDate(): ?Carbon
{
return $this->getCarbonDate('date');
}

View File

@@ -1,8 +1,8 @@
<?php
/*
* DestroyRequest.php
* Copyright (c) 2024 james@firefly-iii.org.
* StoreRequest.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -22,7 +22,7 @@
declare(strict_types=1);
namespace FireflyIII\Api\V2\Request\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
use Carbon\Carbon;
use FireflyIII\Models\TransactionCurrency;

View File

@@ -1,8 +1,8 @@
<?php
/*
* DestroyRequest.php
* Copyright (c) 2024 james@firefly-iii.org.
* UpdateRequest.php
* Copyright (c) 2025 james@firefly-iii.org.
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -22,7 +22,7 @@
declare(strict_types=1);
namespace FireflyIII\Api\V2\Request\Model\ExchangeRate;
namespace FireflyIII\Api\V1\Requests\Models\CurrencyExchangeRate;
use Carbon\Carbon;
use FireflyIII\Support\Request\ChecksLogin;

View File

@@ -65,25 +65,6 @@ class StoreRequest extends FormRequest
return $data;
}
private function parseAccounts(mixed $array): array
{
if (!is_array($array)) {
return [];
}
$return = [];
foreach ($array as $entry) {
if (!is_array($entry)) {
continue;
}
$return[] = [
'account_id' => $this->integerFromValue((string) ($entry['account_id'] ?? '0')),
'current_amount' => $this->clearString((string) ($entry['current_amount'] ?? '0')),
];
}
return $return;
}
/**
* The rules that the incoming request must be matched against.
*/

View File

@@ -25,8 +25,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\PiggyBank;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Rules\IsAssetAccountId;
use FireflyIII\Rules\IsValidPositiveAmount;
use FireflyIII\Rules\IsValidZeroOrMoreAmount;
use FireflyIII\Rules\LessThanPiggyTarget;
use FireflyIII\Support\Request\ChecksLogin;
use FireflyIII\Support\Request\ConvertsDataTypes;
@@ -45,20 +45,23 @@ class UpdateRequest extends FormRequest
*/
public function getAll(): array
{
$fields = [
'name' => ['name', 'convertString'],
'account_id' => ['account_id', 'convertInteger'],
'targetamount' => ['target_amount', 'convertString'],
'current_amount' => ['current_amount', 'convertString'],
'startdate' => ['start_date', 'convertDateTime'],
'targetdate' => ['target_date', 'convertDateTime'],
'notes' => ['notes', 'stringWithNewlines'],
'order' => ['order', 'convertInteger'],
'object_group_title' => ['object_group_title', 'convertString'],
'object_group_id' => ['object_group_id', 'convertInteger'],
$fields = [
'name' => ['name', 'convertString'],
'target_amount' => ['target_amount', 'convertString'],
'start_date' => ['start_date', 'convertDateTime'],
'target_date' => ['target_date', 'convertDateTime'],
'notes' => ['notes', 'stringWithNewlines'],
'order' => ['order', 'convertInteger'],
'object_group_title' => ['object_group_title', 'convertString'],
'object_group_id' => ['object_group_id', 'convertInteger'],
'transaction_currency_code' => ['transaction_currency_code', 'convertString'],
'transaction_currency_id' => ['transaction_currency_id', 'convertInteger'],
];
return $this->getAllData($fields);
$result = $this->getAllData($fields);
$result['accounts'] = $this->parseAccounts($this->get('accounts'));
return $result;
}
/**
@@ -70,13 +73,20 @@ class UpdateRequest extends FormRequest
$piggyBank = $this->route()->parameter('piggyBank');
return [
'name' => 'min:1|max:255|uniquePiggyBankForUser:'.$piggyBank->id,
'current_amount' => ['nullable', new LessThanPiggyTarget(), new IsValidPositiveAmount()],
'target_amount' => ['nullable', new IsValidPositiveAmount()],
'start_date' => 'date|nullable',
'target_date' => 'date|nullable|after:start_date',
'notes' => 'max:65000',
'account_id' => ['belongsToUser:accounts', new IsAssetAccountId()],
'name' => 'min:1|max:255|uniquePiggyBankForUser:'.$piggyBank->id,
'current_amount' => ['nullable', new LessThanPiggyTarget(), new IsValidPositiveAmount()],
'target_amount' => ['nullable', new IsValidZeroOrMoreAmount()],
'start_date' => 'date|nullable',
'target_date' => 'date|nullable|after:start_date',
'notes' => 'max:65000',
'accounts' => 'required',
'accounts.*' => 'array|required',
'accounts.*.account_id' => ['required', 'numeric', 'belongsToUser:accounts,id'],
'accounts.*.current_amount' => ['numeric', 'nullable', new IsValidZeroOrMoreAmount(true)],
'object_group_id' => 'numeric|belongsToUser:object_groups,id',
'object_group_title' => ['min:1', 'max:255'],
'transaction_currency_id' => 'exists:transaction_currencies,id|nullable',
'transaction_currency_code' => 'exists:transaction_currencies,code|nullable',
];
}
}

View File

@@ -154,7 +154,7 @@ class UpdateRequest extends FormRequest
return [
'title' => sprintf('min:1|max:255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
'description' => 'min:1|max:32768',
'first_date' => 'date',
'first_date' => 'date|after:1900-01-01|before:2099-12-31',
'apply_rules' => [new IsBoolean()],
'active' => [new IsBoolean()],
'repeat_until' => 'nullable|date',

View File

@@ -65,14 +65,14 @@ class TestRequest extends FormRequest
private function getAccounts(): array
{
return $this->get('accounts');
return $this->get('accounts') ?? [];
}
public function rules(): array
{
return [
'start' => 'date',
'end' => 'date|after_or_equal:start',
'start' => 'date|after:1900-01-01|before:2099-12-31',
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
'accounts' => '',
'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts',
];

View File

@@ -65,8 +65,8 @@ class TriggerRequest extends FormRequest
public function rules(): array
{
return [
'start' => 'date',
'end' => 'date|after_or_equal:start',
'start' => 'date|after:1900-01-01|before:2099-12-31',
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
'accounts' => '',
'accounts.*' => 'exists:accounts,id|belongsToUser:accounts',
];

View File

@@ -59,14 +59,14 @@ class TestRequest extends FormRequest
private function getAccounts(): array
{
return $this->get('accounts');
return $this->get('accounts') ?? [];
}
public function rules(): array
{
return [
'start' => 'date',
'end' => 'date|after_or_equal:start',
'start' => 'date|after:1900-01-01|before:2099-12-31',
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
'accounts' => '',
'accounts.*' => 'exists:accounts,id|belongsToUser:accounts',
];

View File

@@ -69,8 +69,8 @@ class TriggerRequest extends FormRequest
public function rules(): array
{
return [
'start' => 'date',
'end' => 'date|after_or_equal:start',
'start' => 'date|after:1900-01-01|before:2099-12-31',
'end' => 'date|after_or_equal:start|after:1900-01-01|before:2099-12-31',
];
}
}

View File

@@ -62,7 +62,7 @@ class StoreRequest extends FormRequest
$rules = [
'tag' => 'required|min:1|uniqueObjectForUser:tags,tag|max:1024',
'description' => 'min:1|nullable|max:32768',
'date' => 'date|nullable',
'date' => 'date|nullable|after:1900-01-01|before:2099-12-31',
];
return Location::requestRules($rules);

View File

@@ -63,11 +63,10 @@ class UpdateRequest extends FormRequest
{
/** @var Tag $tag */
$tag = $this->route()->parameter('tagOrId');
// TODO check if uniqueObjectForUser is obsolete
$rules = [
'tag' => 'min:1|max:1024|uniqueObjectForUser:tags,tag,'.$tag->id,
'description' => 'min:1|nullable|max:32768',
'date' => 'date|nullable',
'date' => 'date|nullable|after:1900-01-01|before:2099-12-31',
];
return Location::requestRules($rules);

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests\Models\Transaction;
use FireflyIII\Models\Location;
use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsDateOrTime;
@@ -82,82 +83,87 @@ class StoreRequest extends FormRequest
foreach ($this->get('transactions') as $transaction) {
$object = new NullArrayObject($transaction);
$return[] = [
'type' => $this->clearString($object['type']),
'date' => $this->dateFromValue($object['date']),
'order' => $this->integerFromValue((string) $object['order']),
'type' => $this->clearString($object['type']),
'date' => $this->dateFromValue($object['date']),
'order' => $this->integerFromValue((string) $object['order']),
'currency_id' => $this->integerFromValue((string) $object['currency_id']),
'currency_code' => $this->clearString((string) $object['currency_code']),
'currency_id' => $this->integerFromValue((string) $object['currency_id']),
'currency_code' => $this->clearString((string) $object['currency_code']),
// location
'latitude' => $this->floatFromValue((string) $object['latitude']),
'longitude' => $this->floatFromValue((string) $object['longitude']),
'zoom_level' => $this->integerFromValue((string) $object['zoom_level']),
// foreign currency info:
'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']),
'foreign_currency_code' => $this->clearString((string) $object['foreign_currency_code']),
'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']),
'foreign_currency_code' => $this->clearString((string) $object['foreign_currency_code']),
// amount and foreign amount. Cannot be 0.
'amount' => $this->clearString((string) $object['amount']),
'foreign_amount' => $this->clearString((string) $object['foreign_amount']),
'amount' => $this->clearString((string) $object['amount']),
'foreign_amount' => $this->clearString((string) $object['foreign_amount']),
// description.
'description' => $this->clearString($object['description']),
'description' => $this->clearString($object['description']),
// source of transaction. If everything is null, assume cash account.
'source_id' => $this->integerFromValue((string) $object['source_id']),
'source_name' => $this->clearString((string) $object['source_name']),
'source_iban' => $this->clearIban((string) $object['source_iban']),
'source_number' => $this->clearString((string) $object['source_number']),
'source_bic' => $this->clearString((string) $object['source_bic']),
'source_id' => $this->integerFromValue((string) $object['source_id']),
'source_name' => $this->clearString((string) $object['source_name']),
'source_iban' => $this->clearIban((string) $object['source_iban']),
'source_number' => $this->clearString((string) $object['source_number']),
'source_bic' => $this->clearString((string) $object['source_bic']),
// destination of transaction. If everything is null, assume cash account.
'destination_id' => $this->integerFromValue((string) $object['destination_id']),
'destination_name' => $this->clearString((string) $object['destination_name']),
'destination_iban' => $this->clearIban((string) $object['destination_iban']),
'destination_number' => $this->clearString((string) $object['destination_number']),
'destination_bic' => $this->clearString((string) $object['destination_bic']),
'destination_id' => $this->integerFromValue((string) $object['destination_id']),
'destination_name' => $this->clearString((string) $object['destination_name']),
'destination_iban' => $this->clearIban((string) $object['destination_iban']),
'destination_number' => $this->clearString((string) $object['destination_number']),
'destination_bic' => $this->clearString((string) $object['destination_bic']),
// budget info
'budget_id' => $this->integerFromValue((string) $object['budget_id']),
'budget_name' => $this->clearString((string) $object['budget_name']),
'budget_id' => $this->integerFromValue((string) $object['budget_id']),
'budget_name' => $this->clearString((string) $object['budget_name']),
// category info
'category_id' => $this->integerFromValue((string) $object['category_id']),
'category_name' => $this->clearString((string) $object['category_name']),
'category_id' => $this->integerFromValue((string) $object['category_id']),
'category_name' => $this->clearString((string) $object['category_name']),
// journal bill reference. Optional. Will only work for withdrawals
'bill_id' => $this->integerFromValue((string) $object['bill_id']),
'bill_name' => $this->clearString((string) $object['bill_name']),
'bill_id' => $this->integerFromValue((string) $object['bill_id']),
'bill_name' => $this->clearString((string) $object['bill_name']),
// piggy bank reference. Optional. Will only work for transfers
'piggy_bank_id' => $this->integerFromValue((string) $object['piggy_bank_id']),
'piggy_bank_name' => $this->clearString((string) $object['piggy_bank_name']),
'piggy_bank_id' => $this->integerFromValue((string) $object['piggy_bank_id']),
'piggy_bank_name' => $this->clearString((string) $object['piggy_bank_name']),
// some other interesting properties
'reconciled' => $this->convertBoolean((string) $object['reconciled']),
'notes' => $this->clearStringKeepNewlines((string) $object['notes']),
'tags' => $this->arrayFromValue($object['tags']),
'reconciled' => $this->convertBoolean((string) $object['reconciled']),
'notes' => $this->clearStringKeepNewlines((string) $object['notes']),
'tags' => $this->arrayFromValue($object['tags']),
// all custom fields:
'internal_reference' => $this->clearString((string) $object['internal_reference']),
'external_id' => $this->clearString((string) $object['external_id']),
'original_source' => sprintf('ff3-v%s', config('firefly.version')),
'recurrence_id' => $this->integerFromValue($object['recurrence_id']),
'bunq_payment_id' => $this->clearString((string) $object['bunq_payment_id']),
'external_url' => $this->clearString((string) $object['external_url']),
'internal_reference' => $this->clearString((string) $object['internal_reference']),
'external_id' => $this->clearString((string) $object['external_id']),
'original_source' => sprintf('ff3-v%s', config('firefly.version')),
'recurrence_id' => $this->integerFromValue($object['recurrence_id']),
'bunq_payment_id' => $this->clearString((string) $object['bunq_payment_id']),
'external_url' => $this->clearString((string) $object['external_url']),
'sepa_cc' => $this->clearString((string) $object['sepa_cc']),
'sepa_ct_op' => $this->clearString((string) $object['sepa_ct_op']),
'sepa_ct_id' => $this->clearString((string) $object['sepa_ct_id']),
'sepa_db' => $this->clearString((string) $object['sepa_db']),
'sepa_country' => $this->clearString((string) $object['sepa_country']),
'sepa_ep' => $this->clearString((string) $object['sepa_ep']),
'sepa_ci' => $this->clearString((string) $object['sepa_ci']),
'sepa_batch_id' => $this->clearString((string) $object['sepa_batch_id']),
'sepa_cc' => $this->clearString((string) $object['sepa_cc']),
'sepa_ct_op' => $this->clearString((string) $object['sepa_ct_op']),
'sepa_ct_id' => $this->clearString((string) $object['sepa_ct_id']),
'sepa_db' => $this->clearString((string) $object['sepa_db']),
'sepa_country' => $this->clearString((string) $object['sepa_country']),
'sepa_ep' => $this->clearString((string) $object['sepa_ep']),
'sepa_ci' => $this->clearString((string) $object['sepa_ci']),
'sepa_batch_id' => $this->clearString((string) $object['sepa_batch_id']),
// custom date fields. Must be Carbon objects. Presence is optional.
'interest_date' => $this->dateFromValue($object['interest_date']),
'book_date' => $this->dateFromValue($object['book_date']),
'process_date' => $this->dateFromValue($object['process_date']),
'due_date' => $this->dateFromValue($object['due_date']),
'payment_date' => $this->dateFromValue($object['payment_date']),
'invoice_date' => $this->dateFromValue($object['invoice_date']),
'interest_date' => $this->dateFromValue($object['interest_date']),
'book_date' => $this->dateFromValue($object['book_date']),
'process_date' => $this->dateFromValue($object['process_date']),
'due_date' => $this->dateFromValue($object['due_date']),
'payment_date' => $this->dateFromValue($object['payment_date']),
'invoice_date' => $this->dateFromValue($object['invoice_date']),
];
}
@@ -171,6 +177,7 @@ class StoreRequest extends FormRequest
{
app('log')->debug('Collect rules of TransactionStoreRequest');
$validProtocols = config('firefly.valid_url_protocols');
$locationRules = Location::requestRules([]);
return [
// basic fields for group:
@@ -178,6 +185,11 @@ class StoreRequest extends FormRequest
'error_if_duplicate_hash' => [new IsBoolean()],
'apply_rules' => [new IsBoolean()],
// location rules
'transactions.*.latitude' => $locationRules['latitude'],
'transactions.*.longitude' => $locationRules['longitude'],
'transactions.*.zoom_level' => $locationRules['zoom_level'],
// transaction rules (in array for splits):
'transactions.*.type' => 'required|in:withdrawal,deposit,transfer,opening-balance,reconciliation',
'transactions.*.date' => ['required', new IsDateOrTime()],

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