Compare commits

...

458 Commits

Author SHA1 Message Date
James Cole
ff85654cb9 Merge branch 'release/5.4.0-alpha.1' into main 2020-08-14 11:09:13 +02:00
James Cole
56a122705d Code for 5.4.0-alpha.1 2020-08-14 10:56:43 +02:00
James Cole
a48df9ac83 Pretty basic copy/paste code for #3648 2020-08-14 10:12:07 +02:00
James Cole
d4029775ec Fix #3586 2020-08-14 09:59:56 +02:00
James Cole
3dc1050929 Merge pull request #3696 from psychowood/develop
Added revenue/liabilities *_account_inactive keys
2020-08-13 16:59:08 +00:00
psychowood
c9a444b079 Added revenue/liabilities *_account_inactive keys 2020-08-13 18:07:02 +02:00
James Cole
831267b2ab Fix audit logger. 2020-08-13 13:55:16 +02:00
James Cole
d8b807df50 Add version to show login form call. 2020-08-13 13:54:32 +02:00
James Cole
879e24e7b1 Remove unused code. 2020-08-13 13:49:15 +02:00
James Cole
a1e454d693 Whhops 2020-08-13 13:31:06 +02:00
James Cole
39f8f14aa1 Fix PHP error 2020-08-13 13:30:24 +02:00
James Cole
d7fd1e333e Expand message 2020-08-13 13:29:11 +02:00
James Cole
76cd77cc73 Better audit logs 2020-08-13 13:18:54 +02:00
James Cole
ee3ef4b8cc Make audit log configurable. 2020-08-13 10:39:21 +02:00
James Cole
5f9ba78d94 Clean up example file 2020-08-12 07:12:00 +02:00
James Cole
93628f4d36 Remove some example things. 2020-08-12 07:08:45 +02:00
James Cole
ac2824dfdd Add missing file #3681 2020-08-12 07:05:51 +02:00
James Cole
9dd6a4430e Fix https://github.com/firefly-iii/firefly-iii/issues/3659 2020-08-12 06:47:43 +02:00
James Cole
f840de0b93 Slightly different failure message. 2020-08-11 23:52:27 +02:00
James Cole
6b5e4d34d5 Merge branch 'feature/custom-guard-header' into develop 2020-08-11 06:00:28 +02:00
James Cole
94f0b9f331 Merge pull request #3683 from sephrat/fix-3679
Fix #3679
2020-08-10 07:48:32 +00:00
Florian Dupret
67b5a6c096 Merge branch 'fix-3679' of https://github.com/sephrat/firefly-iii into fix-3679 2020-08-10 09:42:27 +02:00
Florian Dupret
644796e466 Rollback rule_trigger_* pluralization - Fix #3679 2020-08-10 09:41:39 +02:00
Florian Dupret
d244ab1af9 Rollback rule_trigger_* pluralization - Fix #3679 2020-08-10 09:38:00 +02:00
James Cole
f2683ae011 Merge pull request #3682 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/vue-router-3.4.2
Bump vue-router from 3.4.1 to 3.4.2 in /frontend
2020-08-10 06:44:43 +00:00
dependabot[bot]
8844583807 Bump vue-router from 3.4.1 to 3.4.2 in /frontend
Bumps [vue-router](https://github.com/vuejs/vue-router) from 3.4.1 to 3.4.2.
- [Release notes](https://github.com/vuejs/vue-router/releases)
- [Changelog](https://github.com/vuejs/vue-router/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/vuejs/vue-router/compare/v3.4.1...v3.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-10 06:23:29 +00:00
James Cole
c7bf6fc866 Fix #3679 2020-08-09 22:32:00 +02:00
James Cole
55c4465e5d Some translations. 2020-08-09 19:02:58 +02:00
James Cole
f63054823b Update libraries. 2020-08-09 18:59:47 +02:00
James Cole
83f441340c Fix search for #3678 2020-08-09 18:58:18 +02:00
James Cole
e81865fce3 Clean up JS 2020-08-09 08:57:06 +02:00
James Cole
bceffbc874 Better transaction overview. 2020-08-09 08:56:51 +02:00
James Cole
c6e8a63f7c Fix https://github.com/firefly-iii/firefly-iii/issues/3675 2020-08-09 08:56:41 +02:00
James Cole
10c9118f49 Optimise transformer. 2020-08-09 08:56:15 +02:00
James Cole
cdf42e2a37 Fix #3673 2020-08-08 17:34:56 +02:00
James Cole
d4c26820fc Fix #3673 2020-08-08 17:33:53 +02:00
James Cole
87c134322d Fix #3673 2020-08-08 17:17:09 +02:00
James Cole
6d627be679 Fix #3638 2020-08-08 14:09:30 +02:00
James Cole
1191ec00db Fix misaligned table 2020-08-08 11:07:29 +02:00
James Cole
027c212546 New fields for bills. 2020-08-08 11:07:15 +02:00
James Cole
be0f2f0b9f Fix budget date. 2020-08-08 11:07:08 +02:00
James Cole
73c1452aa9 Clean up profile 2020-08-07 12:05:58 +02:00
James Cole
7a7f1e7d97 Fix #3435 2020-08-07 11:38:31 +02:00
James Cole
f60bacba85 Fix transaction link route. 2020-08-07 11:10:35 +02:00
James Cole
d078764ae4 Fix #3265 2020-08-07 11:10:22 +02:00
James Cole
1558a41397 From daily to weekly 2020-08-07 11:07:48 +02:00
James Cole
9fca946821 Merge pull request #3668 from firefly-iii/dependabot/composer/develop/laravel/framework-7.23.2
Bump laravel/framework from 7.23.0 to 7.23.2
2020-08-07 07:17:00 +00:00
James Cole
4f35b9f327 Merge pull request #3669 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/bootstrap-4.5.2
Bump bootstrap from 4.5.1 to 4.5.2 in /frontend
2020-08-07 07:16:49 +00:00
James Cole
74d7183a10 Merge pull request #3670 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/vue-router-3.4.1
Bump vue-router from 3.4.0 to 3.4.1 in /frontend
2020-08-07 07:16:38 +00:00
James Cole
3990f4b7af Update dependabot.yml 2020-08-07 07:15:26 +00:00
dependabot[bot]
99342d615e Bump vue-router from 3.4.0 to 3.4.1 in /frontend
Bumps [vue-router](https://github.com/vuejs/vue-router) from 3.4.0 to 3.4.1.
- [Release notes](https://github.com/vuejs/vue-router/releases)
- [Changelog](https://github.com/vuejs/vue-router/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/vuejs/vue-router/compare/v3.4.0...v3.4.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-07 06:44:30 +00:00
dependabot[bot]
0ad9380226 Bump bootstrap from 4.5.1 to 4.5.2 in /frontend
Bumps [bootstrap](https://github.com/twbs/bootstrap) from 4.5.1 to 4.5.2.
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v4.5.1...v4.5.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-07 06:43:18 +00:00
dependabot[bot]
0453493a9e Bump laravel/framework from 7.23.0 to 7.23.2
Bumps [laravel/framework](https://github.com/laravel/framework) from 7.23.0 to 7.23.2.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/7.x/CHANGELOG-7.x.md)
- [Commits](https://github.com/laravel/framework/compare/v7.23.0...v7.23.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-07 05:17:39 +00:00
James Cole
eb256fced6 Fix #3475 2020-08-06 20:08:04 +02:00
James Cole
ed0f04d644 Fix #3475 2020-08-06 18:34:10 +02:00
James Cole
1a17d5be39 Merge pull request #3663 from firefly-iii/dependabot/composer/develop/phpstan/phpstan-0.12.36
Bump phpstan/phpstan from 0.12.35 to 0.12.36
2020-08-06 07:40:37 +00:00
James Cole
0f33e9d48f Merge pull request #3666 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/vue-router-3.4.0
Bump vue-router from 3.3.4 to 3.4.0 in /frontend
2020-08-06 07:39:45 +00:00
James Cole
5be8c8e2a7 Merge pull request #3665 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/sass-loader-9.0.3
Bump sass-loader from 9.0.2 to 9.0.3 in /frontend
2020-08-06 07:39:31 +00:00
dependabot[bot]
66c1b881ef Bump vue-router from 3.3.4 to 3.4.0 in /frontend
Bumps [vue-router](https://github.com/vuejs/vue-router) from 3.3.4 to 3.4.0.
- [Release notes](https://github.com/vuejs/vue-router/releases)
- [Changelog](https://github.com/vuejs/vue-router/blob/dev/CHANGELOG.md)
- [Commits](https://github.com/vuejs/vue-router/compare/v3.3.4...v3.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-06 06:43:54 +00:00
dependabot[bot]
520206ad52 Bump sass-loader from 9.0.2 to 9.0.3 in /frontend
Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 9.0.2 to 9.0.3.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v9.0.2...v9.0.3)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-06 06:43:26 +00:00
dependabot[bot]
db00e22063 Bump phpstan/phpstan from 0.12.35 to 0.12.36
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.35 to 0.12.36.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.35...0.12.36)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-06 05:15:41 +00:00
James Cole
342626684b Allows for a simpler fix for #3382 2020-08-05 18:55:51 +02:00
James Cole
8df6356abf Simplify frontpage. 2020-08-05 18:51:17 +02:00
James Cole
dfa60ec703 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2020-08-05 18:39:33 +02:00
James Cole
1e3fb073e0 Merge pull request #3603 from sephrat/fix-transfer-sign
Improvements to transactions list on home page
2020-08-05 16:39:20 +00:00
James Cole
cbf44a9069 Merge pull request #3656 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/bootstrap-4.5.1
Bump bootstrap from 4.5.0 to 4.5.1 in /frontend
2020-08-05 07:37:29 +00:00
James Cole
54e6b5aa83 Merge pull request #3655 from firefly-iii/dependabot/composer/develop/phpstan/phpstan-0.12.35
Bump phpstan/phpstan from 0.12.34 to 0.12.35
2020-08-05 07:37:17 +00:00
James Cole
bd20500d39 Merge pull request #3654 from firefly-iii/dependabot/composer/develop/laravel/framework-7.23.0
Bump laravel/framework from 7.22.4 to 7.23.0
2020-08-05 07:37:03 +00:00
dependabot[bot]
d26331bd36 Bump bootstrap from 4.5.0 to 4.5.1 in /frontend
Bumps [bootstrap](https://github.com/twbs/bootstrap) from 4.5.0 to 4.5.1.
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v4.5.0...v4.5.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-05 07:05:26 +00:00
dependabot[bot]
9d6d15635f Bump phpstan/phpstan from 0.12.34 to 0.12.35
Bumps [phpstan/phpstan](https://github.com/phpstan/phpstan) from 0.12.34 to 0.12.35.
- [Release notes](https://github.com/phpstan/phpstan/releases)
- [Commits](https://github.com/phpstan/phpstan/compare/0.12.34...0.12.35)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-05 05:32:45 +00:00
dependabot[bot]
3e372bb1d9 Bump laravel/framework from 7.22.4 to 7.23.0
Bumps [laravel/framework](https://github.com/laravel/framework) from 7.22.4 to 7.23.0.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/7.x/CHANGELOG-7.x.md)
- [Commits](https://github.com/laravel/framework/compare/v7.22.4...v7.23.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-05 05:31:38 +00:00
James Cole
8f22b97905 Code for #3651 2020-08-05 07:15:28 +02:00
James Cole
6ecbaf554b Merge pull request #3643 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/overlayscrollbars-1.13.0
Bump overlayscrollbars from 1.12.0 to 1.13.0 in /frontend
2020-08-03 08:03:32 +00:00
dependabot[bot]
74b9b0db10 Bump overlayscrollbars from 1.12.0 to 1.13.0 in /frontend
Bumps [overlayscrollbars](https://github.com/KingSora/OverlayScrollbars) from 1.12.0 to 1.13.0.
- [Release notes](https://github.com/KingSora/OverlayScrollbars/releases)
- [Commits](https://github.com/KingSora/OverlayScrollbars/compare/v1.12.0...v1.13.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-03 06:47:18 +00:00
James Cole
4623ff9955 Fix env files. 2020-08-03 06:35:06 +02:00
James Cole
2a3651013c Fix #3642 2020-08-03 06:24:25 +02:00
James Cole
3fa5694bb8 property_exists doesn't seem to work 2020-08-02 18:58:44 +02:00
James Cole
839ba9d109 Use correct method for key. 2020-08-02 18:43:58 +02:00
James Cole
8dd315d7d6 Add some custom order. 2020-08-02 18:25:09 +02:00
James Cole
9a4a2708c0 Merge pull request #3640 from sephrat/hide-empty-budget
Hide budgets list when it is empty
2020-08-02 15:22:57 +00:00
James Cole
e93521f3ac Merge pull request #3641 from sephrat/fix-empty-piggy-banks
Fix "Let's create a piggy bank!" not being displayed anymore
2020-08-02 15:22:06 +00:00
James Cole
71ce9eb004 Merge pull request #3638 from sephrat/windows-locale
UTF8 locale support for Windows
2020-08-02 15:19:02 +00:00
Florian Dupret
1338dab5e7 Do not return ungrouped piggy banks if none assigned to group 2020-08-02 16:29:33 +02:00
Florian Dupret
7208f8ae35 Indentation fix 2020-08-02 15:57:26 +02:00
James Cole
490740721e Update some translations. 2020-08-02 15:56:13 +02:00
Florian Dupret
9d9d1325bd Hide budget list when it is empty 2020-08-02 15:55:33 +02:00
James Cole
a22e757502 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
2020-08-02 15:49:44 +02:00
Florian Dupret
6db2b3d434 Remove string for warning about Windows locale 2020-08-02 15:33:56 +02:00
Florian Dupret
e74bce197f Merge remote-tracking branch 'upstream/develop' into windows-locale 2020-08-02 15:33:22 +02:00
James Cole
bb6f4843b9 Merge pull request #3639 from sephrat/docker-locale
Remove mention of Docker when not running Docker
2020-08-02 13:27:56 +00:00
Florian Dupret
61dc1b6f33 Remove string for mention of Docker when not running Docker 2020-08-02 15:15:46 +02:00
Florian Dupret
700579e06a Remove mention of Docker when not running Docker 2020-08-02 14:56:23 +02:00
Florian Dupret
bff6c81ed2 Remove warning about Windows locale 2020-08-02 14:48:12 +02:00
Florian Dupret
c741d56b32 UTF8 locale support for Windows 2020-08-02 14:37:15 +02:00
James Cole
0219069766 Fix some nullable methods. 2020-08-02 12:19:10 +02:00
James Cole
d0a01d73c4 Function no longer returns nulls. 2020-08-02 12:14:56 +02:00
James Cole
e7e21348eb Remove deprecated method. 2020-08-02 12:13:23 +02:00
James Cole
e29b2066c2 Remove deprecated method. 2020-08-02 11:59:43 +02:00
James Cole
fb0d31226a Remove use of deprecated function. 2020-08-02 11:53:04 +02:00
James Cole
30d7d5d90e Fix some translations. 2020-08-02 09:47:19 +02:00
James Cole
386c067e93 Make note of some query heavy pages. 2020-08-02 09:26:14 +02:00
James Cole
384854b353 New language strings. 2020-08-02 08:54:28 +02:00
Florian Dupret
5d63f54fe2 Rollback #3382 part 3 2020-08-01 18:57:58 +02:00
Florian Dupret
9db79c3142 Rollback #3382 part 2 2020-08-01 18:53:42 +02:00
Florian Dupret
f4b6a63514 Rollback #3382 2020-08-01 18:51:12 +02:00
James Cole
1947d81c58 New translations. 2020-08-01 17:54:35 +02:00
James Cole
1169c5c5e2 Various code quality improvements. 2020-08-01 17:51:52 +02:00
James Cole
ae7cd76d87 Fix #3635 2020-08-01 17:40:27 +02:00
James Cole
7b7076116e Merge pull request #3635 from sephrat/text-fix
Fix copy/paste error
2020-08-01 15:39:32 +00:00
Florian Dupret
1b8ebe498a Fix copy/paste error 2020-08-01 17:36:06 +02:00
James Cole
dc53bedff7 Exit 0 fixes build. 2020-08-01 16:29:20 +02:00
James Cole
b9b8c1168f Fix #3246 2020-08-01 15:52:28 +02:00
James Cole
35d30fea9c Fix #3238 2020-08-01 15:31:11 +02:00
James Cole
f3b116cfce Always return 0. Cheap but it works. 2020-08-01 15:09:05 +02:00
James Cole
3bf6891e1c Fix #3630 2020-08-01 15:08:39 +02:00
James Cole
723d1cffe2 Fix some tests, disable actions for the time being. 2020-08-01 15:06:02 +02:00
Florian Dupret
977c78412f Better refactorization for #3382 2020-08-01 14:08:03 +02:00
James Cole
a6a83286b9 Update libraries, add phpunit xml for coverage. 2020-08-01 07:56:13 +02:00
James Cole
43fc4c5f52 Expand some test code. 2020-08-01 07:55:55 +02:00
James Cole
c26de3bdd2 Fix order query. 2020-08-01 06:45:20 +02:00
James Cole
65f54ed8f3 Include correct URI for transaction autocomplete [skip ci] 2020-08-01 06:21:15 +02:00
James Cole
c2fc759b68 Reference to correct DB 2020-08-01 06:00:36 +02:00
James Cole
c41d766604 Update libraries [skip ci] 2020-08-01 05:57:32 +02:00
James Cole
f76fd06055 Copied to wrong path. 2020-08-01 05:56:32 +02:00
James Cole
3d5230228e Fix env file, fix logging 2020-08-01 05:49:45 +02:00
James Cole
07b93037b3 No need to cat non-existent file. 2020-08-01 05:46:52 +02:00
James Cole
8cebd03298 Fix namespace. 2020-08-01 05:46:10 +02:00
James Cole
a502594545 Run PHPUnit 2020-08-01 05:44:26 +02:00
James Cole
57cb325639 Optimise tests 2020-08-01 05:34:32 +02:00
James Cole
e0b71c316b Fix first test! 2020-08-01 05:32:38 +02:00
James Cole
ad76afe4f6 Correct namespace and location. 2020-08-01 05:32:17 +02:00
James Cole
895762ff18 Move tests 2020-08-01 05:31:26 +02:00
James Cole
214dcc7e4c Don't echo to file 2020-07-31 19:30:30 +02:00
James Cole
49b855f7fd Not raw, echo more. 2020-07-31 19:28:08 +02:00
James Cole
62494e7943 Fix format. 2020-07-31 19:18:40 +02:00
James Cole
d2fd858d18 Analyse less code, optimise run. 2020-07-31 19:15:26 +02:00
James Cole
749236bc8d Push better PHPStan config. 2020-07-31 19:10:02 +02:00
James Cole
d3daf8d61e Composer install (duh) 2020-07-31 17:47:48 +02:00
James Cole
d3051cb229 Switch directory 2020-07-31 17:46:26 +02:00
James Cole
bb89c59b51 Back to correct dir. 2020-07-31 17:44:01 +02:00
James Cole
fbd46c683e Try again with local packages. 2020-07-31 17:41:21 +02:00
James Cole
d45a5e6c93 Expand cache, better links. 2020-07-31 17:36:09 +02:00
James Cole
fbb8a0e543 Fix script and neon locations. 2020-07-31 17:33:23 +02:00
James Cole
4d5a50c026 Correct dir for phpstan 2020-07-31 17:28:45 +02:00
James Cole
b25d046528 Switch to PHP so composer is present. Make script executable. 2020-07-31 17:25:37 +02:00
James Cole
142b7b9c0e Let's see what Travis will do. 2020-07-31 17:24:18 +02:00
James Cole
e46958c23e Update some code style 2020-07-31 15:12:26 +02:00
James Cole
c3d8d70b34 Move phpstan config file for cleaner root. 2020-07-31 12:56:32 +02:00
James Cole
b302775c37 Various code cleanup. 2020-07-31 12:45:02 +02:00
James Cole
4b96558433 Do some code cleanup and call correct phpunit. 2020-07-31 12:12:54 +02:00
James Cole
c3110a43da Downgrade to php 8 so CI works. 2020-07-31 12:11:01 +02:00
James Cole
22b1bfd189 Small improvements to CI 2020-07-31 12:08:58 +02:00
James Cole
c0b7ef878a Code style fixes. 2020-07-31 09:42:00 +02:00
James Cole
9234636422 Basic code standard fixes. 2020-07-31 09:24:08 +02:00
James Cole
886e9459a5 Switch to v9 2020-07-31 08:56:12 +02:00
James Cole
9d6979e3dd Fix path. 2020-07-31 08:48:06 +02:00
James Cole
cea3f860f2 Try another path 2020-07-31 07:46:24 +02:00
James Cole
bc27ce8c56 Fix command. 2020-07-31 07:41:13 +02:00
James Cole
c78c1bea7d Add thing for code standard. 2020-07-31 07:37:44 +02:00
James Cole
7dcc76f217 Add empty factory. 2020-07-31 07:28:59 +02:00
James Cole
4c38c7c67b Update lock files. 2020-07-31 07:05:28 +02:00
James Cole
fcf6863aaf Update .env.ci. 2020-07-31 06:58:14 +02:00
James Cole
e57251abf4 Rename file. 2020-07-31 06:57:38 +02:00
James Cole
6e6dd60b46 Merge pull request #3604 from hoshsadiq/feature/ci
Add initial continuous integration
2020-07-31 04:55:31 +00:00
James Cole
8a91618f8d Merge branch 'develop' into feature/ci 2020-07-31 04:55:23 +00:00
James Cole
cd19e86141 Clean up test code, prep for merge. 2020-07-31 06:53:48 +02:00
James Cole
1e2829ed8e New config for custom guard header 2020-07-31 06:50:57 +02:00
James Cole
981960fcb4 Remote user guard accepts custom header 2020-07-31 06:21:53 +02:00
James Cole
77658d19dd Update env for custom guard. 2020-07-31 06:21:39 +02:00
James Cole
0264184442 New trait for tests 2020-07-31 06:21:03 +02:00
James Cole
eabda85b1e Add missing API endpoints. 2020-07-31 06:19:48 +02:00
James Cole
93856a3c57 Basic test, no value. 2020-07-30 21:16:14 +02:00
James Cole
7351d98590 Update libraries. 2020-07-30 20:56:25 +02:00
James Cole
7ad1458ad7 Fix test with DB fixtures 2020-07-30 20:56:12 +02:00
James Cole
2cb61ea501 Fix issue when DB is empty. 2020-07-30 20:55:58 +02:00
James Cole
7c2ae7a91e Add column for new OAuth thing. 2020-07-30 20:50:22 +02:00
James Cole
5ae786516a Mark all tests as incomplete. 2020-07-30 20:49:40 +02:00
James Cole
a590cfd881 Clean up test case 2020-07-30 20:48:47 +02:00
James Cole
3b03fb7e8b Add sqlite test entry 2020-07-30 20:48:28 +02:00
James Cole
d6564f7b7b Clean up test code. 2020-07-30 20:48:07 +02:00
James Cole
fcdeaf3510 Merge pull request #3622 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/vue-i18n-8.20.0
Bump vue-i18n from 8.19.0 to 8.20.0 in /frontend
2020-07-30 06:37:35 +00:00
James Cole
b3761c7088 Merge pull request #3621 from firefly-iii/dependabot/npm_and_yarn/develop/vue-i18n-8.20.0
Bump vue-i18n from 8.19.0 to 8.20.0
2020-07-30 06:37:24 +00:00
dependabot[bot]
2486faebe9 Bump vue-i18n from 8.19.0 to 8.20.0 in /frontend
Bumps [vue-i18n](https://github.com/kazupon/vue-i18n) from 8.19.0 to 8.20.0.
- [Release notes](https://github.com/kazupon/vue-i18n/releases)
- [Changelog](https://github.com/kazupon/vue-i18n/blob/v8.x/CHANGELOG.md)
- [Commits](https://github.com/kazupon/vue-i18n/compare/v8.19.0...v8.20.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-30 05:56:36 +00:00
dependabot[bot]
0c7a38a1ad Bump vue-i18n from 8.19.0 to 8.20.0
Bumps [vue-i18n](https://github.com/kazupon/vue-i18n) from 8.19.0 to 8.20.0.
- [Release notes](https://github.com/kazupon/vue-i18n/releases)
- [Changelog](https://github.com/kazupon/vue-i18n/blob/v8.x/CHANGELOG.md)
- [Commits](https://github.com/kazupon/vue-i18n/compare/v8.19.0...v8.20.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-30 05:04:44 +00:00
James Cole
bdfce234b0 Merge pull request #3619 from firefly-iii/dependabot/composer/develop/phpunit/phpunit-9.2.6
Bump phpunit/phpunit from 8.5.8 to 9.2.6
2020-07-29 09:21:01 +00:00
James Cole
c5e0ced4bd Merge branch 'develop' into dependabot/composer/develop/phpunit/phpunit-9.2.6 2020-07-29 09:11:36 +00:00
James Cole
2aed0651b5 Merge pull request #3618 from firefly-iii/dependabot/composer/develop/laravel/passport-9.3.2
Bump laravel/passport from 8.5.0 to 9.3.2
2020-07-29 07:19:45 +00:00
dependabot[bot]
15089217f0 Bump phpunit/phpunit from 8.5.8 to 9.2.6
Bumps [phpunit/phpunit](https://github.com/sebastianbergmann/phpunit) from 8.5.8 to 9.2.6.
- [Release notes](https://github.com/sebastianbergmann/phpunit/releases)
- [Changelog](https://github.com/sebastianbergmann/phpunit/blob/master/ChangeLog-8.5.md)
- [Commits](https://github.com/sebastianbergmann/phpunit/compare/8.5.8...9.2.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-29 05:26:06 +00:00
dependabot[bot]
9dff2cca2b Bump laravel/passport from 8.5.0 to 9.3.2
Bumps [laravel/passport](https://github.com/laravel/passport) from 8.5.0 to 9.3.2.
- [Release notes](https://github.com/laravel/passport/releases)
- [Changelog](https://github.com/laravel/passport/blob/9.x/CHANGELOG.md)
- [Upgrade guide](https://github.com/laravel/passport/blob/9.x/UPGRADE.md)
- [Commits](https://github.com/laravel/passport/compare/v8.5.0...v9.3.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-29 05:24:57 +00:00
James Cole
6eb401247e Fix dependabot in dev 2020-07-28 20:41:44 +02:00
James Cole
dc66163edd Update libraries thanks to dependabot, fix some issues. 2020-07-28 20:40:08 +02:00
James Cole
8d7972ed07 Merge pull request #3607 from firefly-iii/dependabot/composer/develop/rcrowe/twigbridge-0.12.1
Bump rcrowe/twigbridge from 0.11.3 to 0.12.1
2020-07-28 18:19:24 +00:00
James Cole
a40bbb34b3 Merge branch 'develop' into dependabot/composer/develop/rcrowe/twigbridge-0.12.1 2020-07-28 18:19:17 +00:00
James Cole
ab2602b5d6 Merge pull request #3608 from firefly-iii/dependabot/composer/develop/pragmarx/google2fa-8.0.0
Bump pragmarx/google2fa from 7.0.0 to 8.0.0
2020-07-28 18:18:08 +00:00
dependabot[bot]
9123222830 Bump rcrowe/twigbridge from 0.11.3 to 0.12.1
Bumps [rcrowe/twigbridge](https://github.com/rcrowe/TwigBridge) from 0.11.3 to 0.12.1.
- [Release notes](https://github.com/rcrowe/TwigBridge/releases)
- [Changelog](https://github.com/rcrowe/TwigBridge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rcrowe/TwigBridge/compare/v0.11.3...v0.12.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 18:17:52 +00:00
dependabot[bot]
b8994a7755 Bump pragmarx/google2fa from 7.0.0 to 8.0.0
Bumps [pragmarx/google2fa](https://github.com/antonioribeiro/google2fa) from 7.0.0 to 8.0.0.
- [Release notes](https://github.com/antonioribeiro/google2fa/releases)
- [Changelog](https://github.com/antonioribeiro/google2fa/blob/8.x/CHANGELOG.md)
- [Commits](https://github.com/antonioribeiro/google2fa/compare/v7.0.0...8.0.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 18:17:51 +00:00
James Cole
089bb9e076 Merge pull request #3605 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/sass-loader-9.0.2
Bump sass-loader from 8.0.2 to 9.0.2 in /frontend
2020-07-28 18:16:09 +00:00
James Cole
5b3bb0fa80 Merge pull request #3615 from firefly-iii/dependabot/composer/develop/ramsey/uuid-4.1.0
Bump ramsey/uuid from 3.9.3 to 4.1.0
2020-07-28 18:15:32 +00:00
dependabot[bot]
fafee5f527 Bump ramsey/uuid from 3.9.3 to 4.1.0
Bumps [ramsey/uuid](https://github.com/ramsey/uuid) from 3.9.3 to 4.1.0.
- [Release notes](https://github.com/ramsey/uuid/releases)
- [Changelog](https://github.com/ramsey/uuid/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ramsey/uuid/compare/3.9.3...4.1.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 18:14:47 +00:00
James Cole
21d7eadee2 Merge pull request #3606 from firefly-iii/dependabot/npm_and_yarn/frontend/develop/vue-i18n-8.19.0
Bump vue-i18n from 8.18.2 to 8.19.0 in /frontend
2020-07-28 18:14:45 +00:00
James Cole
fe7a30c238 Merge pull request #3612 from firefly-iii/dependabot/npm_and_yarn/develop/uiv-0.36.0
Bump uiv from 0.34.4 to 0.36.0
2020-07-28 18:13:27 +00:00
James Cole
e769a10a95 Merge pull request #3610 from firefly-iii/dependabot/npm_and_yarn/develop/axios-0.19.2
Bump axios from 0.18.1 to 0.19.2
2020-07-28 18:13:14 +00:00
James Cole
24b5a3787e Merge pull request #3613 from firefly-iii/dependabot/composer/develop/bacon/bacon-qr-code-2.0.1
Bump bacon/bacon-qr-code from 1.0.3 to 2.0.1
2020-07-28 18:12:29 +00:00
James Cole
f227f19d9f Merge pull request #3614 from firefly-iii/dependabot/composer/develop/laravel/framework-7.22.4
Bump laravel/framework from 7.21.0 to 7.22.4
2020-07-28 18:12:05 +00:00
James Cole
8f95e4c55d Merge pull request #3611 from firefly-iii/dependabot/npm_and_yarn/develop/cross-env-7.0.2
Bump cross-env from 5.2.1 to 7.0.2
2020-07-28 18:11:54 +00:00
dependabot[bot]
da309a3d03 Bump laravel/framework from 7.21.0 to 7.22.4
Bumps [laravel/framework](https://github.com/laravel/framework) from 7.21.0 to 7.22.4.
- [Release notes](https://github.com/laravel/framework/releases)
- [Changelog](https://github.com/laravel/framework/blob/7.x/CHANGELOG-7.x.md)
- [Commits](https://github.com/laravel/framework/compare/v7.21.0...v7.22.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:55:46 +00:00
dependabot[bot]
c2650df224 Bump bacon/bacon-qr-code from 1.0.3 to 2.0.1
Bumps [bacon/bacon-qr-code](https://github.com/Bacon/BaconQrCode) from 1.0.3 to 2.0.1.
- [Release notes](https://github.com/Bacon/BaconQrCode/releases)
- [Changelog](https://github.com/Bacon/BaconQrCode/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Bacon/BaconQrCode/compare/1.0.3...2.0.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:54:57 +00:00
dependabot[bot]
8bbbaab9bb Bump uiv from 0.34.4 to 0.36.0
Bumps [uiv](https://github.com/wxsms/uiv) from 0.34.4 to 0.36.0.
- [Release notes](https://github.com/wxsms/uiv/releases)
- [Commits](https://github.com/wxsms/uiv/compare/v0.34.4...v0.36.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:54:30 +00:00
dependabot[bot]
67482858b9 Bump cross-env from 5.2.1 to 7.0.2
Bumps [cross-env](https://github.com/kentcdodds/cross-env) from 5.2.1 to 7.0.2.
- [Release notes](https://github.com/kentcdodds/cross-env/releases)
- [Changelog](https://github.com/kentcdodds/cross-env/blob/master/CHANGELOG.md)
- [Commits](https://github.com/kentcdodds/cross-env/compare/v5.2.1...v7.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:54:22 +00:00
dependabot[bot]
a29487abcd Bump axios from 0.18.1 to 0.19.2
Bumps [axios](https://github.com/axios/axios) from 0.18.1 to 0.19.2.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md)
- [Commits](https://github.com/axios/axios/compare/v0.18.1...v0.19.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:54:13 +00:00
dependabot[bot]
b910a249cb Bump vue-i18n from 8.18.2 to 8.19.0 in /frontend
Bumps [vue-i18n](https://github.com/kazupon/vue-i18n) from 8.18.2 to 8.19.0.
- [Release notes](https://github.com/kazupon/vue-i18n/releases)
- [Changelog](https://github.com/kazupon/vue-i18n/blob/v8.x/CHANGELOG.md)
- [Commits](https://github.com/kazupon/vue-i18n/compare/v8.18.2...v8.19.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:52:13 +00:00
dependabot[bot]
20498efd2e Bump sass-loader from 8.0.2 to 9.0.2 in /frontend
Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 8.0.2 to 9.0.2.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v8.0.2...v9.0.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-28 13:51:54 +00:00
James Cole
4feddb61c5 Update dependabot.yml 2020-07-28 15:50:37 +02:00
James Cole
012420c47d Remove ability to see balance. 2020-07-28 06:31:56 +02:00
James Cole
ff9d8865d1 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2020-07-28 06:27:05 +02:00
James Cole
3cda3b27e2 Merge pull request #3598 from maroux/fix_recurring_create
Fix recurring transactions create and fix cache access
2020-07-28 04:26:55 +00:00
James Cole
8363efd1f9 Add locale to JS variables. 2020-07-28 06:25:28 +02:00
James Cole
36b0167eac Expand charts with currency code. 2020-07-28 06:25:14 +02:00
James Cole
66b5523310 Remove unused method. 2020-07-28 06:24:30 +02:00
Hosh Sadiq
8f568d41ca Add initial continuous integration
Currently it will run phpunit, check coding standards and run
phpstan. This can and should be build upon, so that eventually builds
are automated and hopefully reproducable.
2020-07-27 19:47:22 +01:00
James Cole
1c07feb446 Add locale to variables. 2020-07-27 20:06:18 +02:00
Florian Dupret
261156588f Fix broken merge from 294cda7 2020-07-27 11:52:25 +02:00
Florian Dupret
294cda7f33 Merge remote-tracking branch 'upstream/develop' into fix-transfer-sign 2020-07-27 11:06:00 +02:00
Florian Dupret
995c43d832 First refactoring towards fixing #3382 2020-07-27 10:53:36 +02:00
James Cole
d49743031f Add windows locale support #3519 2020-07-27 07:13:39 +02:00
James Cole
7017d33b87 Small code improv #3578 2020-07-27 07:08:29 +02:00
James Cole
fade9ae6f9 Simpler get currency routine 2020-07-27 07:06:44 +02:00
James Cole
c5489a7c55 Restore locale info from localeconv #3578 2020-07-27 07:05:41 +02:00
James Cole
9c14bc24e2 Expand limit. 2020-07-26 19:30:24 +02:00
James Cole
fe66be673a Some extra code for #3578 2020-07-26 17:35:13 +02:00
James Cole
fdea25051c Make sure sorting doesnt break opening balance. 2020-07-26 15:05:48 +02:00
James Cole
c86673f3ec Trim the label. 2020-07-26 14:37:45 +02:00
James Cole
94c31ad747 Add extra order for better form. 2020-07-26 14:30:56 +02:00
James Cole
633bc043da Reverse chart sort 2020-07-26 14:18:25 +02:00
James Cole
453709a117 Reverse sort in chart 2020-07-26 14:17:49 +02:00
James Cole
83467ef2f2 Code for #3240 2020-07-26 07:57:48 +02:00
Aniruddha Maru
9d409a7412 Fix recurring transactions create
- If there's a lot of accounts to calculate balances for, then recurring transactions create page
  doesn't load. Partly because it has to calculate a lot of balances, but partly because the cache
  isn't being used at all because date is `new Date` rather than say, end of month.

Fix: Change Steam balance calculator to always default cache using end of month. Since cache is
'invalidated' upon any edit, there's no reason to use current datetime anywhere its not explicitly
required by user flow.
Fix: Don't calculate balances for revenue / expense accounts since those are unbounded.

Issue: #3597
2020-07-25 16:16:29 -07:00
James Cole
4b16d7c53d Remove unused code. 2020-07-25 08:19:31 +02:00
James Cole
5e1306282a Code to fix #3213 2020-07-25 08:03:57 +02:00
James Cole
02ad8273eb Update meta files. 2020-07-24 16:42:42 +02:00
James Cole
74247c292f Update / create methods can handle order #3200 2020-07-24 16:41:58 +02:00
James Cole
1286694efd Different method call 2020-07-24 16:41:41 +02:00
James Cole
69d63bc3ba API allows order to be set. #3200 2020-07-24 16:41:31 +02:00
James Cole
bc4b841baa Add consistency for API calls #3150 2020-07-24 16:41:10 +02:00
James Cole
ba488b71eb Register user count in upgrade instructions. 2020-07-24 16:40:54 +02:00
James Cole
117affb1d4 Model updates for #3200 2020-07-24 16:40:42 +02:00
James Cole
50ee1a11f6 UI updates for #3200 2020-07-24 16:40:32 +02:00
James Cole
74eddfa1fa New migration for #3200 2020-07-24 16:40:16 +02:00
James Cole
758e1ff2ad Update links. 2020-07-24 06:16:56 +02:00
James Cole
e1f4cd7565 Fix #3187 2020-07-23 19:40:10 +02:00
James Cole
93a0338678 Expand autocomplete for #3150 2020-07-23 19:34:17 +02:00
James Cole
3d6bf713ee Fix #3150 2020-07-23 17:58:53 +02:00
James Cole
b63e8d60bb Expand autocomplete and remove old code #3150 2020-07-23 06:58:00 +02:00
James Cole
162e791dfd Update autocomplete code for #3150 2020-07-23 06:19:34 +02:00
James Cole
0f840ad082 Updated routes for auto-complete. 2020-07-22 20:17:20 +02:00
James Cole
6a158a173d Fix #3585 2020-07-22 20:10:48 +02:00
James Cole
f777abdeb1 Add limit to object groups #3150 2020-07-21 06:30:37 +02:00
James Cole
bb841e66c7 Add currency limit, without currency code #3150 2020-07-21 06:29:24 +02:00
James Cole
74ed80aaef Add limit to category #3150 2020-07-21 06:24:49 +02:00
James Cole
723696b971 Add limit to budget #3150 2020-07-21 06:23:37 +02:00
James Cole
858158d886 Add limit to bills. #3150 2020-07-21 06:22:29 +02:00
James Cole
62fd701808 Add limit #3150 2020-07-21 06:20:31 +02:00
James Cole
b207100074 Add empty controllers #3150 2020-07-21 06:19:49 +02:00
James Cole
5ad7439241 Optimise code 2020-07-21 06:14:47 +02:00
James Cole
debbe89187 Code for #3150 2020-07-21 06:09:24 +02:00
James Cole
a654158bd4 Rename method. 2020-07-19 20:10:47 +02:00
James Cole
0bb59f5505 Yoda style and dump unused method. 2020-07-19 20:08:50 +02:00
James Cole
6881d4479e Remove round(). 2020-07-19 20:07:58 +02:00
James Cole
7f3168cc55 Merge pull request #3578 from hoshsadiq/feature/use-intl-formatter
Use php-intl to format currencies
2020-07-19 18:05:25 +00:00
Hosh Sadiq
14dd185717 Use php-intl to format currencies
Currently the php function `number_format` is used to format currencies.
This is problematic as we have to figure out different things for
different currencies ourselves. These formats are determined based on
the libc's locale functions.

The issue arises where an OS doesn't have the proper locales installed,
or, in some cases, it's not supported (see below on multiple issues).

This addresses this issue by using the php-intl extensions to format the
numbers based on the locale. The extension is already a requirement in
`composer.json`. The solution does not rely on `LC_MONETARY` from the
underlying libc (which in Alpine Linux's case, which uses musl, is not
supported as of yet).

List of issues that are related and would potentially be fixed using
this PR:

- #2298
- #2946
- #3070
- #3306
- #3519
2020-07-19 18:34:39 +01:00
James Cole
edf6ece7cb Fix category autocomplete. 2020-07-19 18:03:02 +02:00
James Cole
3619427f60 Remove old tag cloud code. 2020-07-19 18:02:48 +02:00
James Cole
bd779c8156 Include Request class. 2020-07-19 17:43:12 +02:00
James Cole
cf977a2bfa Upgrade lock file. 2020-07-19 17:29:24 +02:00
James Cole
8a4999406b More auto-complete migration. 2020-07-19 17:24:29 +02:00
James Cole
fd6f1fbbf0 Expand autocomplete routes 2020-07-19 17:05:37 +02:00
James Cole
9cf99314d1 Fix logging 2020-07-19 13:18:25 +02:00
James Cole
fc7d8bb810 Auto complete route 2020-07-19 13:06:59 +02:00
James Cole
c1f0dedd09 API token thing 2020-07-19 13:06:22 +02:00
James Cole
3653469dda Add command. 2020-07-19 13:06:01 +02:00
James Cole
1e313f80a4 Remove unused class. 2020-07-19 13:05:27 +02:00
James Cole
73f1f8aea0 Add new command 2020-07-19 13:05:15 +02:00
James Cole
78107b1212 New routes and a fix for account types. 2020-07-19 13:04:41 +02:00
James Cole
3b56f4271e Update JS, to use API auto complete routes. 2020-07-19 13:04:22 +02:00
James Cole
f3a55e6cee Add command to fix transaction types. 2020-07-19 13:03:18 +02:00
James Cole
2f70ea074e Not async url, but async function. 2020-07-19 12:34:44 +02:00
James Cole
88172dbc7c From 'title' to 'inputDescription' 2020-07-19 12:33:57 +02:00
James Cole
34eda509c2 Update readme. 2020-07-19 11:42:49 +02:00
James Cole
c7eab7873e Clean up requests 2020-07-18 08:42:13 +02:00
James Cole
58c1880219 Extend correct class 2020-07-18 08:36:42 +02:00
James Cole
d73195ec36 Point to all the right classes. 2020-07-18 08:34:00 +02:00
James Cole
427bcaa522 First basic remodelling of request classes 2020-07-18 08:25:25 +02:00
James Cole
d55cc03edf Fix issue with reconciliation displayed amount. 2020-07-18 04:45:12 +02:00
James Cole
1282009257 Merge tag '5.3.3' into develop
5.3.3
2020-07-17 19:16:37 +02:00
James Cole
106f097b45 Merge branch 'release/5.3.3' into main 2020-07-17 19:16:36 +02:00
James Cole
fafb7f5e49 Add dependabot 2020-07-17 19:16:05 +02:00
James Cole
e54c08e2d3 Update meta files for new release. 2020-07-17 19:12:29 +02:00
James Cole
03a63d0119 Update translations. 2020-07-17 19:00:38 +02:00
James Cole
e2b698f166 Fix timezone call 2020-07-17 18:52:34 +02:00
James Cole
f14ac5928f Fix some tests. 2020-07-17 18:51:54 +02:00
James Cole
cd65d4d4c5 Call correct timezone. 2020-07-17 18:51:35 +02:00
James Cole
7aa3cd5ba4 Fix #3568 2020-07-17 17:26:36 +02:00
James Cole
0fe17d5458 Fix #3574 2020-07-17 17:24:36 +02:00
James Cole
aaa3cc3d19 Merge pull request #3573 from emansih/develop
Fix url
2020-07-17 13:23:37 +00:00
emansih
c80d1d3402 Fix url 2020-07-17 20:48:18 +10:00
James Cole
254b004587 Fix #3566 2020-07-16 09:55:26 +02:00
James Cole
d813d0b7c2 Merge pull request #3565 from maroux/fix-monthly-date
Fix update monthly_payment_date using the API
2020-07-16 04:14:23 +00:00
Aniruddha Maru
53909fdd8a Fix maybe? 2020-07-15 12:22:09 -07:00
James Cole
0ba03be9a3 Merge branch 'release/5.3.2' into main 2020-07-13 16:03:36 +02:00
James Cole
7aac446cf2 Merge tag '5.3.2' into develop
5.3.2
2020-07-13 16:03:36 +02:00
James Cole
f2dcb108e8 Update meta files for new release. 2020-07-13 15:57:39 +02:00
James Cole
c0e5d6dd68 Update version. 2020-07-13 15:13:57 +02:00
James Cole
0b966ed541 Less verbose error logging for https://github.com/firefly-iii/firefly-iii/issues/3559 2020-07-13 15:03:19 +02:00
James Cole
8219b51e47 Skip error fix https://github.com/firefly-iii/firefly-iii/issues/3559 2020-07-13 14:22:00 +02:00
James Cole
9b102d1cf4 Merge tag '5.3.1' into develop
5.3.1
2020-07-12 20:25:23 +02:00
James Cole
ac607483aa Merge branch 'release/5.3.1' into main 2020-07-12 20:25:20 +02:00
James Cole
3ef46a59e9 Last-minute meta files. 2020-07-12 20:24:30 +02:00
James Cole
5529fa7124 Some last-minute translations, thanks guys! 2020-07-12 20:19:54 +02:00
James Cole
7a30bc4ff6 Updated meta for new release. 2020-07-12 19:48:24 +02:00
James Cole
8a9f6b1896 Double check on integers for https://github.com/firefly-iii/firefly-iii/issues/3554 2020-07-12 17:54:51 +02:00
James Cole
da77bcde04 Update version and API. 2020-07-12 17:34:06 +02:00
James Cole
c4979bdd27 Code for #3554 2020-07-12 17:32:48 +02:00
James Cole
0c9a25a073 Code cleanup and better auth check 2020-07-12 17:31:11 +02:00
James Cole
e24c2491a6 Expand frontend 2020-07-12 17:30:24 +02:00
James Cole
72a2718a93 Fix tests 2020-07-12 17:28:43 +02:00
James Cole
54d92f5b39 Code for #3546 2020-07-11 15:13:15 +02:00
James Cole
86600d4fcf Fix timezone issues. 2020-07-11 08:16:31 +02:00
James Cole
5cfe02edf6 Small textual changes 2020-07-11 07:18:51 +02:00
James Cole
22cb9dfbe0 make sure amount is a string. 2020-07-11 07:18:41 +02:00
James Cole
3782388e45 New security policy + release document. 2020-07-11 07:16:07 +02:00
James Cole
5821256590 Fix https://github.com/firefly-iii/firefly-iii/issues/3545 2020-07-11 07:01:29 +02:00
James Cole
14e06bfedd Experimental signed commit. 2020-07-10 06:48:39 +02:00
James Cole
886475740a Fix issue with profile functions. 2020-07-09 20:03:11 +02:00
James Cole
32e0a5bd80 Fix validation for #3532 2020-07-06 06:55:27 +02:00
James Cole
26d19fab32 Slightly more robust configuration polling. 2020-07-06 06:49:48 +02:00
James Cole
4271dc1638 Better frontend code and charts. 2020-07-05 21:03:35 +02:00
James Cole
a56cefda7d Basic new dashboard. 2020-07-05 18:29:58 +02:00
James Cole
4d4d91bf84 Merge branch 'main' into develop 2020-07-05 09:36:01 +02:00
James Cole
54dfb35007 Fix .env.example 2020-07-05 09:35:44 +02:00
James Cole
3893f59773 Fix some casting 2020-07-05 09:34:56 +02:00
James Cole
7d8786a620 Update changelog 2020-07-05 09:34:48 +02:00
James Cole
f48bc8d299 Budget and category charts in new layout. 2020-07-04 12:08:38 +02:00
James Cole
d33c87c565 Add error log for #3522 2020-07-03 18:41:16 +02:00
James Cole
5a28479788 Merge tag '5.3.0' into develop
5.3.0
2020-07-03 06:24:32 +02:00
James Cole
fabd7b1bfd Merge branch 'release/5.3.0' into main 2020-07-03 06:24:31 +02:00
James Cole
e57cd13145 Fix date in changelog 2020-07-03 06:23:54 +02:00
James Cole
515ee0a503 New version. 2020-07-03 06:22:57 +02:00
James Cole
cacbef4f75 Add PHP7.4 instructions. 2020-07-03 06:19:39 +02:00
James Cole
2772275e62 Update meta files before release. 2020-07-03 05:59:36 +02:00
James Cole
34fd66c835 Remove income from category chart #3517 2020-07-03 05:42:57 +02:00
James Cole
45f5a38512 Update meta files. 2020-07-02 20:23:45 +02:00
James Cole
6874d6469d Fix bill 2020-07-02 20:13:47 +02:00
James Cole
979c1ad305 Merge tag '5.3.0-beta.2' into develop
5.3.0-beta.2
2020-07-01 19:54:32 +02:00
James Cole
80de6c78dc Merge branch 'release/5.3.0-beta.2' into main 2020-07-01 19:54:31 +02:00
James Cole
5009cb5d55 New meta files. 2020-07-01 19:53:48 +02:00
James Cole
0c90171a49 Fix range for #3513 2020-07-01 19:47:32 +02:00
James Cole
d282cb4e34 Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2020-07-01 19:47:20 +02:00
James Cole
976f79b5a6 Add account info for #3513 2020-07-01 19:43:53 +02:00
James Cole
6693a5166f Merge pull request #3506 from Johnny-Malizia/searchapi
Added transaction search api support
2020-07-01 19:35:44 +02:00
johnny
7b9906d493 Added transaction search api support
Transaction search api implemented using mostly the same process as the
existing search functionality.
Updated internal_reference and external_id search support to use exact
matches, expecting values in the database to be double quoted. This is
being done to ensure a specific transaction can be looked up at a later
time without prior knowledge of the internal transaction id.
2020-07-01 10:23:44 -07:00
James Cole
f927e61b37 Fix #3509 2020-07-01 15:46:26 +02:00
James Cole
430b498caf Fix meta files. 2020-07-01 15:45:09 +02:00
James Cole
983508e291 Expand API for bills. 2020-07-01 15:33:06 +02:00
James Cole
104a2379f3 Add fancy amounts. 2020-07-01 11:47:16 +02:00
James Cole
e337bcf8bd Can sort and group bills. 2020-07-01 06:33:21 +02:00
James Cole
029774687c Add command to fix inconsistent groups. 2020-07-01 06:02:58 +02:00
James Cole
be58545999 Make sure split transactions are always consistent. 2020-07-01 05:51:15 +02:00
James Cole
d774b4e2e3 Remove locale if using Docker. 2020-06-30 20:43:53 +02:00
James Cole
cb65999124 Expand API, add new migration. 2020-06-30 20:33:08 +02:00
James Cole
77e7af75dc Update translations and routes. 2020-06-30 19:10:17 +02:00
James Cole
714184867c Piggybank thing 2020-06-30 19:06:16 +02:00
James Cole
fad2331d80 Give bills groups too. 2020-06-30 19:06:05 +02:00
James Cole
bb5de8bf7e Update copyrights. 2020-06-30 19:05:35 +02:00
James Cole
6f78c96cee Fix piggy list. 2020-06-30 17:05:25 +02:00
James Cole
883342b2c8 Updated front matter 2020-06-29 08:04:38 +02:00
James Cole
6232858b85 Fix #3469 2020-06-29 06:44:17 +02:00
James Cole
4e4b44d41d Move to main branch. 2020-06-29 06:43:53 +02:00
James Cole
daf74e11ed Bigger max upload. 2020-06-28 15:30:59 +02:00
James Cole
3e2c2e6395 Merge tag '5.3.0-beta.1' into develop
5.3.0-beta.1
2020-06-28 09:25:31 +02:00
James Cole
bc5b2085b9 Merge branch 'release/5.3.0-beta.1' into main 2020-06-28 09:25:30 +02:00
James Cole
ebcd751145 Beta to changelog. 2020-06-28 09:25:19 +02:00
James Cole
cdfde3dca8 Update meta files for new release. 2020-06-28 09:19:18 +02:00
James Cole
4e3378451c Update readme. 2020-06-27 17:54:29 +02:00
James Cole
415fb7294c Fix sonarcloud issues 2020-06-27 17:33:18 +02:00
James Cole
1e35f0e7e3 You can logout other sessions. 2020-06-27 15:42:18 +02:00
James Cole
b83d06294d Drop Sandstorm related code. 2020-06-27 15:19:00 +02:00
James Cole
7945220825 Fix #3493 2020-06-27 13:41:27 +02:00
James Cole
3e8a4d55ef Make list grouped. 2020-06-27 13:32:40 +02:00
James Cole
e1fbdca5c1 Make list grouped. 2020-06-27 13:08:51 +02:00
James Cole
1b31d20877 Skip deleted piggies. 2020-06-27 09:56:38 +02:00
James Cole
aaaab03995 New translations 2020-06-26 08:35:59 +02:00
James Cole
affa8a317a Update packages 2020-06-26 07:30:29 +02:00
James Cole
5a03f3395c Fix #3440 2020-06-26 07:28:25 +02:00
James Cole
8da6ec3f5b Fix #3488 2020-06-26 04:04:54 +02:00
James Cole
a0402ac742 Fix text 2020-06-26 04:04:30 +02:00
James Cole
654e0fc74f Pretty basic fix #3490 2020-06-25 15:49:28 +02:00
James Cole
d3bd1f4124 Escape names to fix #3489 2020-06-25 13:37:44 +02:00
James Cole
2aa6067437 New strings. 2020-06-24 06:45:40 +02:00
James Cole
356c87da49 Fix #3427 2020-06-23 20:45:10 +02:00
James Cole
0d76fcd564 Fix #3398 2020-06-23 20:26:13 +02:00
James Cole
963c3b2a68 Fix #3391 2020-06-23 20:18:59 +02:00
James Cole
7617fe3510 Fix null pointer 2020-06-23 15:30:02 +02:00
James Cole
88724be3aa Fix mailer 2020-06-22 18:31:39 +02:00
James Cole
f845c97955 Merge tag '5.3.0-alpha.1' into develop
5.3.0-alpha.1
2020-06-22 18:18:02 +02:00
James Cole
2c69a2eda2 Merge branch 'release/5.3.0-alpha.1' 2020-06-22 18:17:59 +02:00
James Cole
dcce747e92 Mysql instructions. 2020-06-22 18:17:31 +02:00
James Cole
c251ca5daf Update meta files. 2020-06-22 18:08:23 +02:00
James Cole
bcb9794315 Update meta files. 2020-06-22 18:03:57 +02:00
James Cole
1a043e35c2 New meta files 2020-06-22 18:02:28 +02:00
James Cole
4fef316ddd Fix more date issues 2020-06-21 19:16:21 +02:00
James Cole
7196ac3ec9 Fix date issues. 2020-06-21 19:08:57 +02:00
James Cole
1c74db30ed More layout stuff 2020-06-21 18:29:23 +02:00
James Cole
00440f282b API for piggies + groups. 2020-06-21 18:28:51 +02:00
James Cole
dfe099f9c6 Emergency fix for #3479 2020-06-21 14:16:23 +02:00
James Cole
0dbee47182 Fix issue with null pointer 2020-06-20 22:16:03 +02:00
James Cole
46796a8c10 Logo 2020-06-20 19:14:28 +02:00
James Cole
c381067364 New code. 2020-06-20 19:14:06 +02:00
James Cole
19573de5df Fonts 2020-06-20 19:10:44 +02:00
James Cole
77359fbc55 Code for front page 2020-06-20 19:09:37 +02:00
James Cole
45eb758583 Fix list 2020-06-20 18:57:20 +02:00
James Cole
1a154a8d45 API for object groups. 2020-06-20 16:28:23 +02:00
James Cole
c40f6f2864 Add user id. 2020-06-20 10:23:57 +02:00
James Cole
c036c5a2bc Fix user management for groups. 2020-06-20 10:22:07 +02:00
James Cole
5b29e78c4b Group management code. 2020-06-20 10:10:55 +02:00
James Cole
b54ef9f5e5 Fix bad UUID generation. 2020-06-18 18:14:10 +02:00
James Cole
b7f48a19e8 Merge pull request #3467 from sephrat/days-left-for-bills
Fix #3437
2020-06-17 18:23:13 +00:00
James Cole
c8f1e4bbd7 Expand new layout code. 2020-06-17 07:06:45 +02:00
James Cole
5cc1369191 Expand debug. 2020-06-17 07:05:33 +02:00
Florian Dupret
16a511cf79 move 7c78708 logic from transformer to controller 2020-06-16 18:02:48 +02:00
Florian Dupret
7c78708865 Fix #3437 2020-06-16 14:07:40 +02:00
James Cole
0449430ec3 I messed up 2020-06-14 19:24:23 +02:00
James Cole
dd5a179ba1 More stuff for new layout. 2020-06-14 19:17:45 +02:00
James Cole
7c1139e42b First set of code for new layout based on AdminLTE 3.0 2020-06-14 15:51:20 +02:00
James Cole
caddf3d1c6 Fix #3461 2020-06-13 13:48:52 +02:00
James Cole
54d5778bf3 Add attachment to recurring. 2020-06-12 20:56:58 +02:00
James Cole
b1732d0de8 New possibilities for date range triggers #3403 2020-06-12 07:49:39 +02:00
James Cole
48b5f749a1 Fix logout for #3184 2020-06-11 17:55:38 +02:00
James Cole
a63b8322db Updates for #3184 2020-06-11 06:55:13 +02:00
James Cole
2130eef971 Update .env.example for #3184 2020-06-11 06:54:42 +02:00
James Cole
5b829b514f Include notes in export. 2020-06-09 17:40:09 +02:00
James Cole
1bac3258da Merge pull request #3455 from sephrat/debug_translation
Translate debug page
2020-06-09 15:18:17 +00:00
James Cole
d7181100ee Merge pull request #3454 from sephrat/translations
Translations tweaks
2020-06-09 15:17:30 +00:00
James Cole
ccc82858ad Fix drag/drop + sort 2020-06-09 17:16:21 +02:00
Florian Dupret
5dd6b23b09 Translate debug page 2020-06-09 13:51:01 +02:00
James Cole
6a08f52fa5 Update packages and order. 2020-06-09 11:09:23 +02:00
James Cole
18172b7fdb Fix order, fix bar. 2020-06-09 10:33:55 +02:00
James Cole
3eccc56c7a Better column 2020-06-09 08:48:28 +02:00
Florian Dupret
f7545af17a Missing translation on budgets index page 2020-06-09 08:37:40 +02:00
Florian Dupret
aa4da1e2e1 Telemetry count pluralization 2020-06-09 08:35:10 +02:00
James Cole
b4aafefc2b Fix NULL 2020-06-08 18:22:36 +02:00
James Cole
8304ee21f3 Fix #3450 2020-06-07 21:42:52 +02:00
James Cole
ca6479ede6 Update version. 2020-06-07 16:38:25 +02:00
James Cole
471cdefcff Organise object groups 2020-06-07 16:38:15 +02:00
James Cole
16b0307b0a Piggy bank can now have a group. 2020-06-07 11:31:01 +02:00
James Cole
2f63090e7c Split controller 2020-06-07 11:30:02 +02:00
James Cole
8643034945 Upgrade to 7.4 2020-06-06 22:25:52 +02:00
James Cole
6cc4d14fcb Remove import code. 2020-06-06 21:23:26 +02:00
James Cole
60fa0d7244 Merge tag '5.2.8' into develop
5.2.8
2020-06-06 12:19:11 +02:00
1450 changed files with 90408 additions and 46241 deletions

326
.ci/.env.ci Normal file
View File

@@ -0,0 +1,326 @@
# You can leave this on "local". If you change it to production most console commands will ask for extra confirmation.
# Never set it to "testing".
APP_ENV=local
# Set to true if you want to see debug information in error screens.
APP_DEBUG=false
# This should be your email address.
# If you use Docker or similar, you can set this variable from a file by using SITE_OWNER_FILE
SITE_OWNER=mail@example.com
# The encryption key for your sessions. Keep this very secure.
# If you generate a new one all existing attachments must be considered LOST.
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
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
#
# If text is still in English, remember that not everything may have been translated.
DEFAULT_LANGUAGE=en_US
# The locale defines how numbers are formatted.
# by default this value is the same as whatever the language is.
DEFAULT_LOCALE=equal
# Change this value to your preferred time zone.
# Example: Europe/Amsterdam
# For a list of supported time zones, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=Europe/Amsterdam
# TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy.
# Set it to ** and reverse proxies work just fine.
TRUSTED_PROXIES=
# The log channel defines where your log entries go to.
# Several other options exist. You can use 'single' for one big fat error log (not recommended).
# Also available are 'syslog', 'errorlog' and 'stdout' which will log to the system itself.
# A rotating log option is 'daily', creates 5 files that (surprise) rotate.
# Default setting 'stack' will log to 'daily' and to 'stdout' at the same time.
# - Docker + versions <= 4.8.1.8 and before: use "stdout"
# - Docker + versions > 4.8.1.8 : use "docker_out"
# - Docker + versions >= 5.1.1 : use "stack"
# - For everything else (als not Docker) : use 'stack'
LOG_CHANNEL=single
# Log level. You can set this from least severe to most severe:
# debug, info, notice, warning, error, critical, alert, emergency
# If you set it to debug your logs will grow large, and fast. If you set it to emergency probably
# nothing will get logged, ever.
APP_LOG_LEVEL=info
# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
# For other database types, please see the FAQ: https://docs.firefly-iii.org/support/faq
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
# Use "pgsql" for PostgreSQL
# Use "mysql" for MySQL and MariaDB.
# Use "sqlite" for SQLite.
DB_CONNECTION=sqlite_test
# MySQL supports SSL. You can configure it here.
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MYSQL_USE_SSL=false
MYSQL_SSL_VERIFY_SERVER_CERT=true
# You need to set at least of these options
MYSQL_SSL_CAPATH=/etc/ssl/certs/
MYSQL_SSL_CA=
MYSQL_SSL_CERT=
MYSQL_SSL_KEY=
MYSQL_SSL_CIPHER=
# PostgreSQL supports SSL. You can configure it here.
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
PGSQL_SSL_MODE=prefer
PGSQL_SSL_ROOT_CERT=null
PGSQL_SSL_CERT=null
PGSQL_SSL_KEY=null
PGSQL_SSL_CRL_FILE=null
# If you're looking for performance improvements, you could install memcached.
CACHE_DRIVER=array
SESSION_DRIVER=array
# If you set either of these to 'redis', you might want to update these settings too
# If you use Docker or similar, you can set REDIS_HOST_FILE, REDIS_PASSWORD_FILE or
# REDIS_PORT_FILE to set the value from a file instead of from an environment variable
# can be tcp, unix or http
REDIS_SCHEME=tcp
# use only when using 'unix' for REDIS_SCHEME. Leave empty otherwise.
REDIS_PATH=
# use only when using 'tcp' or 'http' for REDIS_SCHEME. Leave empty otherwise.
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=null
# always use quotes and make sure redis db "0" and "1" exists. Otherwise change accordingly.
REDIS_DB="0"
REDIS_CACHE_DB="1"
# Cookie settings. Should not be necessary to change these.
# If you use Docker or similar, you can set COOKIE_DOMAIN_FILE to set
# the value from a file instead of from an environment variable
COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
# If you want Firefly III to mail you, update these settings
# For instructions, see: https://docs.firefly-iii.org/advanced-installation/email
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAIL_MAILER=log
MAIL_HOST=null
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
# Other mail drivers:
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAILGUN_DOMAIN=
MAILGUN_SECRET=
# If you are on EU region in mailgun, use api.eu.mailgun.net, otherwise use api.mailgun.net
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
MAILGUN_ENDPOINT=api.mailgun.net
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MANDRILL_SECRET=
SPARKPOST_SECRET=
# Firefly III can send you the following messages
SEND_REGISTRATION_MAIL=true
SEND_ERROR_MESSAGE=true
# These messages contain (sensitive) transaction information:
SEND_REPORT_JOURNALS=true
# Set a Mapbox API key here (see mapbox.com) so there might be a map available at various places.
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
MAPBOX_API_KEY=
# The map will default to this location:
MAP_DEFAULT_LAT=51.983333
MAP_DEFAULT_LONG=5.916667
MAP_DEFAULT_ZOOM=6
# Firefly III currently supports two provider for live Currency Exchange Rates:
# "fixer", and "ratesapi".
# RatesApi.IO (see https://ratesapi.io) is a FREE and OPEN SOURCE live currency exchange rates,
# built compatible with Fixer.IO, based on data published by European Central Bank, and doesn't require API key.
CER_PROVIDER=ratesapi
# If you have select "fixer" as default currency exchange rates,
# set a Fixer IO API key here (see https://fixer.io) to enable live currency exchange rates.
# Please note that this WILL ONLY WORK FOR PAID fixer.io accounts because they severely limited
# the free API up to the point where you might as well offer nothing.
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
FIXER_API_KEY=
# Firefly III has two options for user authentication. "eloquent" is the default,
# and "ldap" for LDAP servers.
# For full instructions on these settings please visit:
# https://docs.firefly-iii.org/advanced-installation/authentication
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
LOGIN_PROVIDER=eloquent
#
# It's also possible to change the way users are authenticated. You could use Authelia for example.
# Authentication via the REMOTE_USER header is supported. Change the value below to "remote_user_guard".
#
# If you do this please read the documentation for instructions and warnings:
# https://docs.firefly-iii.org/advanced-installation/authentication
#
# This function is available in Firefly III v5.3.0 and higher.
AUTHENTICATION_GUARD=web
#
# Likewise, it's impossible to log out users who's authentication is handled by an external system.
# Enter a custom URL here that will force a logout (your authentication provider can tell you).
# Setting this variable only works when AUTHENTICATION_GUARD != web
#
CUSTOM_LOGOUT_URI=
# LDAP connection configuration
# OpenLDAP, FreeIPA or ActiveDirectory
# # If you use Docker or similar, you can set this variable from a file by appending it with _FILE
ADLDAP_CONNECTION_SCHEME=OpenLDAP
ADLDAP_AUTO_CONNECT=true
# LDAP connection settings
# You can set the following variables from a file by appending them with _FILE:
# ADLDAP_CONTROLLERS, ADLDAP_PORT, ADLDAP_BASEDN
ADLDAP_CONTROLLERS=
ADLDAP_PORT=389
ADLDAP_TIMEOUT=5
ADLDAP_BASEDN=""
ADLDAP_FOLLOW_REFFERALS=false
# SSL/TLS settings
ADLDAP_USE_SSL=false
ADLDAP_USE_TLS=false
ADLDAP_SSL_CACERTDIR=
ADLDAP_SSL_CACERTFILE=
ADLDAP_SSL_CERTFILE=
ADLDAP_SSL_KEYFILE=
ADLDAP_SSL_CIPHER_SUITE=
ADLDAP_SSL_REQUIRE_CERT=
# You can set the following variables from a file by appending them with _FILE:
ADLDAP_ADMIN_USERNAME=
ADLDAP_ADMIN_PASSWORD=
# You can set the following variables from a file by appending them with _FILE:
ADLDAP_ACCOUNT_PREFIX=
ADLDAP_ACCOUNT_SUFFIX=
# LDAP authentication settings.
ADLDAP_PASSWORD_SYNC=false
ADLDAP_LOGIN_FALLBACK=false
ADLDAP_DISCOVER_FIELD=distinguishedname
ADLDAP_AUTH_FIELD=distinguishedname
# Will allow SSO if your server provides an AUTH_USER field.
# You can set the following variables from a file by appending them with _FILE:
WINDOWS_SSO_ENABLED=false
WINDOWS_SSO_DISCOVER=samaccountname
WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
# You can set the following variable from a file by appending it with _FILE:
ADLDAP_SYNC_FIELD=userprincipalname
# You can disable the X-Frame-Options header if it interferes with tools like
# Organizr. This is at your own risk. Applications running in frames run the risk
# of leaking information to their parent frame.
DISABLE_FRAME_HEADER=false
# You can disable the Content Security Policy header when you're using an ancient browser
# or any version of Microsoft Edge / Internet Explorer (which amounts to the same thing really)
# This leaves you with the risk of not being able to stop XSS bugs should they ever surface.
# This is at your own risk.
DISABLE_CSP_HEADER=false
# If you wish to track your own behavior over Firefly III, set valid analytics tracker information here.
# Nobody uses this except for me on the demo site. But hey, feel free to use this if you want to.
# Do not prepend the TRACKER_URL with http:// or https://
# The only tracker supported is Matomo.
# You can set the following variables from a file by appending them with _FILE:
TRACKER_SITE_ID=
TRACKER_URL=
#
# Firefly III can collect telemetry on how you use Firefly III. This is opt-in.
# In order to allow this, change the following variable to true.
# To read more about this feature, go to this page: https://docs.firefly-iii.org/support/telemetry
SEND_TELEMETRY=false
# You can fine tune the start-up of a Docker container by editing these environment variables.
# Use this at your own risk. Disabling certain checks and features may result in lost of inconsistent data.
# However if you know what you're doing you can significantly speed up container start times.
# Set each value to true to enable, or false to disable.
# Check if the SQLite database exists. Can be skipped if you're not using SQLite.
# Won't significantly speed up things.
DKR_CHECK_SQLITE=true
# Run database creation and migration commands. Disable this only if you're 100% sure the DB exists
# and is up to date.
DKR_RUN_MIGRATION=true
# Run database upgrade commands. Disable this only when you're 100% sure your DB is up-to-date
# with the latest fixes (outside of migrations!)
DKR_RUN_UPGRADE=true
# Verify database integrity. Includes all data checks and verifications.
# Disabling this makes Firefly III assume your DB is intact.
DKR_RUN_VERIFY=true
# Run database reporting commands. When disabled, Firefly III won't go over your data to report current state.
# Disabling this should have no impact on data integrity or safety but it won't warn you of possible issues.
DKR_RUN_REPORT=true
# Generate OAuth2 keys.
# When disabled, Firefly III won't attempt to generate OAuth2 Passport keys. This won't be an issue, IFF (if and only if)
# you had previously generated keys already and they're stored in your database for restoration.
DKR_RUN_PASSPORT_INSTALL=true
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
ADLDAP_CONNECTION=default
BROADCAST_DRIVER=log
QUEUE_DRIVER=sync
CACHE_PREFIX=firefly
SEARCH_RESULT_LIMIT=50
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
USE_ENCRYPTION=false
IS_HEROKU=false
FIREFLY_III_LAYOUT=v1
#
# If you have trouble configuring your Firefly III installation, DON'T BOTHER setting this variable.
# It won't work. It doesn't do ANYTHING. Don't believe the lies you read online. I'm not joking.
# This configuration value WILL NOT HELP.
#
# This variable is ONLY used in some of the emails Firefly III sends around. Nowhere else.
# So when configuring anything WEB related this variable doesn't do anything. Nothing
#
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
#
APP_URL=http://localhost

View File

@@ -0,0 +1,250 @@
parameters:
indentation: spaces
file_extensions:
- php
exclude_files:
- fixtures/*
- fixtures*/*
- temp/*
- tmp/*
services:
# Checkers bellow aim on 1:1 copy of https://nette.org/en/coding-standard
# General rules - https://nette.org/en/coding-standard#toc-general-rules
# use tabs over spaces
# PHP_CodeSniffer\Standards\Generic\Sniffs\WhiteSpace\DisallowSpaceIndentSniff: ~
# PHP code must use only UTF-8 without BOM
PhpCsFixer\Fixer\Basic\EncodingFixer: ~
# <?php opening tag
PhpCsFixer\Fixer\PhpTag\FullOpeningTagFixer: ~
# Ensure there is no code on the same line as the PHP open tag.
PhpCsFixer\Fixer\PhpTag\LinebreakAfterOpeningTagFixer: ~
# The closing ?> tag must be omitted from files containing only PHP.
PhpCsFixer\Fixer\PhpTag\NoClosingTagFixer: ~
# There must not be trailing whitespace at the end of lines.
PhpCsFixer\Fixer\Whitespace\NoTrailingWhitespaceFixer: ~
# ...and at the end of blank lines.
PhpCsFixer\Fixer\Whitespace\NoWhitespaceInBlankLineFixer: ~
# All files must end with a single blank line.
PhpCsFixer\Fixer\Whitespace\SingleBlankLineAtEofFixer: ~
# File name should match class name if possible.
PhpCsFixer\Fixer\Basic\Psr4Fixer: ~
# Enforces using shorthand scalar typehint variants in phpDocs: `int` instead of `integer` and `bool` instead of `boolean`
SlevomatCodingStandard\Sniffs\TypeHints\LongTypeHintsSniff: ~
# File Header - https://nette.org/en/coding-standard#toc-file-header
# empty line before namespace
PhpCsFixer\Fixer\NamespaceNotation\SingleBlankLineBeforeNamespaceFixer: ~
# 1 Use statement per line
PhpCsFixer\Fixer\Import\SingleImportPerStatementFixer: ~
# Use statements are alphabetically ordered
PhpCsFixer\Fixer\Import\OrderedImportsFixer: ~
# disallow group use declarations use FooLibrary\Bar\Baz\{ ClassA, ClassB, ClassC, ClassD as Fizbo }
SlevomatCodingStandard\Sniffs\Namespaces\DisallowGroupUseSniff: ~
# Disallows leading backslash in use statement: use \Foo\Bar;
SlevomatCodingStandard\Sniffs\Namespaces\UseDoesNotStartWithBackslashSniff: ~
# Looks for unused imports from other namespaces.
Nette\CodingStandard\Sniffs\Namespaces\UnusedUsesSniff:
searchAnnotations: yes
ignoredAnnotationNames: ['@testCase']
ignoredAnnotations: ['@internal']
# Language Construct (should be placed before some other fixers)
# Functions should be used with `$strict` param set to `true`
PhpCsFixer\Fixer\Strict\StrictParamFixer: ~
# replaces is_null(parameter) expression with `null === parameter`.
PhpCsFixer\Fixer\LanguageConstruct\IsNullFixer:
use_yoda_style: true
# Calling `unset` on multiple items should be done in one call.
PhpCsFixer\Fixer\LanguageConstruct\CombineConsecutiveUnsetsFixer: ~
# Replace all `<>` with `!=`.
PhpCsFixer\Fixer\Operator\StandardizeNotEqualsFixer: ~
# Include/Require and file path should be divided with a single space. File path should not be placed under brackets.
PhpCsFixer\Fixer\ControlStructure\IncludeFixer: ~
# Requires short ternary operator ?: when possible
SlevomatCodingStandard\Sniffs\ControlStructures\RequireShortTernaryOperatorSniff: ~
# Arrays - https://nette.org/en/coding-standard#toc-arrays
# use short array fixes
PhpCsFixer\Fixer\ArrayNotation\ArraySyntaxFixer:
syntax: short
# use trailing command in last array element
PhpCsFixer\Fixer\ArrayNotation\TrailingCommaInMultilineArrayFixer: ~
# PHP single-line arrays should not have trailing comma.
# PhpCsFixer\Fixer\ArrayNotation\NoTrailingCommaInSinglelineArrayFixer: ~
# In array declaration, there MUST NOT be a whitespace before each comma.
PhpCsFixer\Fixer\ArrayNotation\NoWhitespaceBeforeCommaInArrayFixer: ~
# Arrays should be formatted like function/method arguments, without leading or trailing single line space.
PhpCsFixer\Fixer\ArrayNotation\TrimArraySpacesFixer: ~
# In array declaration, there MUST be a whitespace after each comma.
PhpCsFixer\Fixer\ArrayNotation\WhitespaceAfterCommaInArrayFixer: ~
# Strings
# Convert `heredoc` to `nowdoc` where possible.
PhpCsFixer\Fixer\StringNotation\HeredocToNowdocFixer: ~
# Convert double quotes to single quotes for simple strings.
PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer: ~
# Keywords and True/False/Null - https://nette.org/en/coding-standard#toc-keywords-and-true-false-null
# PHP keywords must be in lower case
PhpCsFixer\Fixer\Casing\LowercaseKeywordsFixer: ~
# The PHP constants `true`, `false`, and `null` MUST be in lower case
PhpCsFixer\Fixer\Casing\LowercaseConstantsFixer: ~
# Method and Functions Calls - https://nette.org/en/coding-standard#toc-method-and-function-calls
# Function defined by PHP should be called using the correct casing
PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer: ~
# In the argument list, there must be one space after each comma, and there must no be a space before each comma
PhpCsFixer\Fixer\FunctionNotation\MethodArgumentSpaceFixer: ~
# This sniff checks that there are two blank lines between functions declarations and single between signatures.
#Nette\CodingStandard\Sniffs\WhiteSpace\FunctionSpacingSniff: ~
# Classes - https://nette.org/en/coding-standard#toc-classes
# Inside a classy element "self" should be preferred to the class name itself.
PhpCsFixer\Fixer\ClassNotation\SelfAccessorFixer: ~
# class element order: constants, properties, from public to private
PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer:
order:
- use_trait
- constant
- constant_public
- constant_protected
- constant_private
- property_public
- property_protected
- property_private
# Constants - https://nette.org/en/coding-standard#toc-constants
# constant names are CAPITALIZED (manuall fixing only :()
PHP_CodeSniffer\Standards\Generic\Sniffs\NamingConventions\UpperCaseConstantNameSniff: ~
# Class Properties - https://nette.org/en/coding-standard#toc-class-properties
# There MUST NOT be more than one property declared per statement.
PhpCsFixer\Fixer\ClassNotation\SingleClassElementPerStatementFixer:
elements: ['property']
# Methods - https://nette.org/en/coding-standard#toc-methods
# They must be declared in camelCase.
PHP_CodeSniffer\Standards\PSR1\Sniffs\Methods\CamelCapsMethodNameSniff: ~
# Checks that there's a single space between a typehint and a parameter name and no whitespace between a nullability symbol and a typehint
SlevomatCodingStandard\Sniffs\TypeHints\ParameterTypeHintSpacingSniff: ~
# Spaces should be properly placed in a function declaration.
PhpCsFixer\Fixer\FunctionNotation\FunctionDeclarationFixer: ~
# In function arguments there must not be arguments with default values before non-default ones.
PhpCsFixer\Fixer\FunctionNotation\NoUnreachableDefaultArgumentValueFixer: ~
# Constans, Class Properties, Methods
# Constants and Properties should be separated by 1 blank line
#PhpCsFixer\Fixer\ClassNotation\ClassAttributesSeparationFixer:
# elements: [const, property]
# Last property and 1st method should be separated by 2 spaces
Nette\CodingStandard\Fixer\ClassNotation\LastPropertyAndFirstMethodSeparationFixer:
space_count: 2
# Control Statements - https://nette.org/en/coding-standard#toc-control-statements
# The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
PhpCsFixer\Fixer\ControlStructure\ElseifFixer: ~
# Remove useless semicolon statements.
PhpCsFixer\Fixer\Semicolon\NoEmptyStatementFixer: ~
# Remove trailing commas in list() calls.
PhpCsFixer\Fixer\ControlStructure\NoTrailingCommaInListCallFixer: ~
# Removes unneeded parentheses around control statements.
PhpCsFixer\Fixer\ControlStructure\NoUnneededControlParenthesesFixer: ~
# A case should be followed by a colon and not a semicolon.
PhpCsFixer\Fixer\ControlStructure\SwitchCaseSemicolonToColonFixer: ~
# The structure body must be indented once.
# The closing brace must be on the next line after the body.
# There should not be more than one statement per line.
#Nette\CodingStandard\Fixer\Basic\BracesFixer:
# allow_single_line_closure: true
# changes if (1 === $cond) to if ($cond === 1)
#SlevomatCodingStandard\Sniffs\ControlStructures\DisallowYodaComparisonSniff: ~
# finds unreachable catch blocks:
SlevomatCodingStandard\Sniffs\Exceptions\DeadCatchSniff: ~
# Casting
# A single space or none should be between cast and variable (int) $val
PhpCsFixer\Fixer\CastNotation\CastSpacesFixer: ~
# Cast should be written in lower case.
PhpCsFixer\Fixer\CastNotation\LowercaseCastFixer: ~
# Replaces `intval`, `floatval`, `doubleval`, `strval` and `boolval` function calls with according type casting operator
PhpCsFixer\Fixer\CastNotation\ModernizeTypesCastingFixer: ~
# Short cast `bool` using double exclamation mark should not be used
PhpCsFixer\Fixer\CastNotation\NoShortBoolCastFixer: ~
# Cast `(boolean)` and `(integer)` should be written as `(bool)` and `(int)`, `(double)` and `(real)` as `(float)`
PhpCsFixer\Fixer\CastNotation\ShortScalarCastFixer: ~
# Language Whitespace
# Binary operators should be surrounded by at least one space. DO NOT USE
#PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer: ~
# Unary operators should be placed adjacent to their operands.
PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer: ~
# No space after the opening parenthesis and before the closing parenthesis
PhpCsFixer\Fixer\Whitespace\NoSpacesInsideParenthesisFixer: ~
# There MUST NOT be spaces around offset braces $a[0]
PhpCsFixer\Fixer\Whitespace\NoSpacesAroundOffsetFixer: ~
# There should not be space before or after object `T_OBJECT_OPERATOR` `->`.
PhpCsFixer\Fixer\Operator\ObjectOperatorWithoutWhitespaceFixer: ~
# Standardize spaces around ternary operator.
PhpCsFixer\Fixer\Operator\TernaryOperatorSpacesFixer: ~
# Concatenation $a . $b should be spaced according configuration
PhpCsFixer\Fixer\Operator\ConcatSpaceFixer:
spacing: one
# Removes extra spaces between colon and case value.
PhpCsFixer\Fixer\ControlStructure\SwitchCaseSpaceFixer: ~
# Comments
# Docblocks should have the same indentation as the documented subject.
PhpCsFixer\Fixer\Phpdoc\PhpdocIndentFixer: ~
# There should not be any empty comments.
PhpCsFixer\Fixer\Comment\NoEmptyCommentFixer: ~
# There should not be empty PHPDoc blocks.
#PhpCsFixer\Fixer\Phpdoc\NoEmptyPhpdocFixer: ~
# Phpdocs should start and end with content, excluding the very first and last line of the docblocks.
PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer: ~
# Single-line comments comments with only one line of actual content should use the `//` syntax.
PhpCsFixer\Fixer\Comment\SingleLineCommentStyleFixer:
comment_types: ['hash']
# Require comments with single-line content to be written as one-liners
SlevomatCodingStandard\Sniffs\Commenting\RequireOneLinePropertyDocCommentSniff: ~
# Properties MUST not be explicitly initialized with `null`.
#PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer: ~
PhpCsFixer\Fixer\ControlStructure\NoBreakCommentFixer:
comment_text: 'break omitted'
# declare(strict_types=1);
PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer: ~
# Enforces consistent formatting of return typehints: function foo(): ?int
SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSpacingSniff: ~
# Use `null` coalescing operator `??` where possible.
PhpCsFixer\Fixer\Operator\TernaryToNullCoalescingFixer: ~
Nette\CodingStandard\Fixer\ClassNotation\ClassAndTraitVisibilityRequiredFixer:
elements: ['const', 'property', 'method']
# short list() syntax []
PhpCsFixer\Fixer\ListNotation\ListSyntaxFixer:
syntax: short

19
.ci/phpstan.neon Normal file
View File

@@ -0,0 +1,19 @@
includes:
- ../vendor/nunomaduro/larastan/extension.neon
- ../vendor/ergebnis/phpstan-rules/rules.neon
- ../vendor/phpstan/phpstan-deprecation-rules/rules.neon
- ../vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon
parameters:
ignoreErrors:
- '#is not allowed to extend#'
- '#is neither abstract nor final#'
- '#Control structures using switch should not be used\.#'
paths:
- ../app
- ../database
- ../routes
- ../bootstrap/app.php
# The level 8 is the highest level. original was 5
level: 0

12
.ci/phpstan.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# Install composer packages
composer install --no-suggest --no-scripts --no-ansi
# enable test .env file.
cp .ci/.env.ci .env
# Do static code analysis.
./vendor/bin/phpstan analyse -c .ci/phpstan.neon --no-progress
exit 0

12
.ci/phpunit.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/usr/bin/env bash
# enable test .env file.
cp .ci/.env.ci ../.env
# download test database
wget --quiet https://raw.githubusercontent.com/firefly-iii/test-data/main/test_db.sqlite -o storage/database/test_db.sqlite
# run phpunit
./vendor/bin/phpunit --configuration phpunit.coverage.xml
exit 0

View File

@@ -5,77 +5,118 @@ APP_ENV=heroku
# Set to true if you want to see debug information in error screens.
APP_DEBUG=false
# This should be your email address
# This should be your email address.
# If you use Docker or similar, you can set this variable from a file by using SITE_OWNER_FILE
SITE_OWNER=heroku@example.com
# The encryption key for your database and sessions. Keep this very secure.
# If you generate a new one all existing data must be considered LOST.
# Change it to a string of exactly 32 chars or use command `php artisan key:generate` to generate it
# The encryption key for your sessions. Keep this very secure.
# If you generate a new one all existing attachments must be considered LOST.
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
APP_KEY=7ahyYVPVsmxjdhsweWCauGeJfwc92NP2
#
# 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
#
# If text is still in English, remember that not everything may have been translated.
DEFAULT_LANGUAGE=en_US
# The locale defines how numbers are formatted.
# by default this value is the same as whatever the language is.
DEFAULT_LOCALE=equal
# Change this value to your preferred time zone.
# Example: Europe/Amsterdam
# For a list of supported time zones, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TZ=UTC
# This variable must match your installation's external address but keep in mind that
# it's only used on the command line as a fallback value.
APP_URL=http://localhost
# TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy.
# Set it to ** and reverse proxies work just fine.
TRUSTED_PROXIES=**
# The log channel defines where your log entries go to.
# 'daily' is the default logging mode giving you 5 daily rotated log files in /storage/logs/.
# Several other options exist. You can use 'single' for one big fat error log (not recommended).
# Also available are 'syslog', 'errorlog' and 'stdout' which will log to the system itself.
# A rotating log option is 'daily', creates 5 files that (surprise) rotate.
# Default setting 'stack' will log to 'daily' and to 'stdout' at the same time.
# - Docker + versions <= 4.8.1.8 and before: use "stdout"
# - Docker + versions > 4.8.1.8 : use "docker_out"
# - Docker + versions >= 5.1.1 : use "stack"
# - For everything else (als not Docker) : use 'stack'
LOG_CHANNEL=stdout
# Log level. You can set this from least severe to most severe:
# debug, info, notice, warning, error, critical, alert, emergency
# If you set it to debug your logs will grow large, and fast. If you set it to emergency probably
# nothing will get logged, ever.
APP_LOG_LEVEL=debug
APP_LOG_LEVEL=notice
# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
# If you use SQLite, set connection to `sqlite` and remove the database, username and password settings.
# For other database types, please see the FAQ: https://docs.firefly-iii.org/support/faq
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
# Use "pgsql" for PostgreSQL
# Use "mysql" for MySQL and MariaDB.
# Use "sqlite" for SQLite.
DB_CONNECTION=pgsql
# MySQL supports SSL. You can configure it here.
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MYSQL_USE_SSL=false
MYSQL_SSL_VERIFY_SERVER_CERT=true
# You need to set at least of these options
MYSQL_SSL_CAPATH=/etc/ssl/certs/
MYSQL_SSL_CA=
MYSQL_SSL_CERT=
MYSQL_SSL_KEY=
MYSQL_SSL_CIPHER=
# PostgreSQL supports SSL. You can configure it here.
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
PGSQL_SSL_MODE=prefer
PGSQL_SSL_ROOT_CERT=null
PGSQL_SSL_CERT=null
PGSQL_SSL_KEY=null
PGSQL_SSL_CRL_FILE=null
# If you're looking for performance improvements, you could install memcached.
CACHE_DRIVER=file
SESSION_DRIVER=file
# You can configure another file storage backend if you cannot use the local storage option.
# To set this up, fill in the following variables. The upload path is used to store uploaded
# files and the export path is to store exported data (before download).
SFTP_HOST=
SFTP_PORT=
SFTP_UPLOAD_PATH=
SFTP_EXPORT_PATH=
# If you set either of these to 'redis', you might want to update these settings too
# If you use Docker or similar, you can set REDIS_HOST_FILE, REDIS_PASSWORD_FILE or
# REDIS_PORT_FILE to set the value from a file instead of from an environment variable
# SFTP uses either the username/password combination or the private key to authenticate.
SFTP_USERNAME=
SFTP_PASSWORD=
SFTP_PRIV_KEY=
# can be tcp, unix or http
REDIS_SCHEME=tcp
# use only when using 'unix' for REDIS_SCHEME. Leave empty otherwise.
REDIS_PATH=
# use only when using 'tcp' or 'http' for REDIS_SCHEME. Leave empty otherwise.
REDIS_HOST=127.0.0.1
REDIS_PORT=6379
REDIS_PASSWORD=null
# always use quotes and make sure redis db "0" and "1" exists. Otherwise change accordingly.
REDIS_DB="0"
REDIS_CACHE_DB="1"
# Cookie settings. Should not be necessary to change these.
# If you use Docker or similar, you can set COOKIE_DOMAIN_FILE to set
# the value from a file instead of from an environment variable
COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
# If you want Firefly III to mail you, update these settings
# For instructions, see: https://firefly-iii.readthedocs.io/en/latest/installation/mail.html
MAIL_DRIVER=log
MAIL_HOST=smtp.mailtrap.io
# For instructions, see: https://docs.firefly-iii.org/advanced-installation/email
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAIL_MAILER=log
MAIL_HOST=null
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
@@ -83,11 +124,20 @@ MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
# Other mail drivers:
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAILGUN_DOMAIN=
MAILGUN_SECRET=
# If you are on EU region in mailgun, use api.eu.mailgun.net, otherwise use api.mailgun.net
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
MAILGUN_ENDPOINT=api.mailgun.net
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MANDRILL_SECRET=
SPARKPOST_SECRET=
# Firefly III can send you the following messages
SEND_REGISTRATION_MAIL=true
SEND_ERROR_MESSAGE=true
@@ -96,53 +146,85 @@ SEND_ERROR_MESSAGE=true
SEND_REPORT_JOURNALS=true
# Set a Mapbox API key here (see mapbox.com) so there might be a map available at various places.
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
MAPBOX_API_KEY=
# The map will default to this location:
MAP_DEFAULT_LAT=51.983333
MAP_DEFAULT_LONG=5.916667
MAP_DEFAULT_ZOOM=6
# Firefly III currently supports two provider for live Currency Exchange Rates:
# "fixer" is the default (for backward compatibility), and "ratesapi" is the new one.
# "fixer", and "ratesapi".
# RatesApi.IO (see https://ratesapi.io) is a FREE and OPEN SOURCE live currency exchange rates,
# built compatible with Fixer.IO, based on data published by European Central Bank, and don't require API key.
CER_PROVIDER=fixer
# built compatible with Fixer.IO, based on data published by European Central Bank, and doesn't require API key.
CER_PROVIDER=ratesapi
# If you have select "fixer" as default currency exchange rates,
# set a Fixer IO API key here (see https://fixer.io) to enable live currency exchange rates.
# Please note that this WILL ONLY WORK FOR PAID fixer.io accounts because they severely limited
# the free API up to the point where you might as well offer nothing.
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
FIXER_API_KEY=
# If you wish to track your own behavior over Firefly III, set a valid analytics tracker ID here.
TRACKER_SITE_ID=
TRACKER_URL=
# Most parts of the database are encrypted by default, but you can turn this off if you want to.
# This makes it easier to migrate your database. Not that some fields will never be decrypted.
USE_ENCRYPTION=true
# Firefly III has two options for user authentication. "eloquent" is the default,
# and "ldap" for LDAP servers.
# For full instructions on these settings please visit:
# https://firefly-iii.readthedocs.io/en/latest/installation/authentication.html
# https://docs.firefly-iii.org/advanced-installation/authentication
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
LOGIN_PROVIDER=eloquent
#
# It's also possible to change the way users are authenticated. You could use Authelia for example.
# Authentication via the REMOTE_USER header is supported. Change the value below to "remote_user_guard".
#
# If you do this please read the documentation for instructions and warnings:
# https://docs.firefly-iii.org/advanced-installation/authentication
#
# This function is available in Firefly III v5.3.0 and higher.
AUTHENTICATION_GUARD=web
#
# Likewise, it's impossible to log out users who's authentication is handled by an external system.
# Enter a custom URL here that will force a logout (your authentication provider can tell you).
# Setting this variable only works when AUTHENTICATION_GUARD != web
#
CUSTOM_LOGOUT_URI=
# LDAP connection configuration
# OpenLDAP, FreeIPA or ActiveDirectory
# # If you use Docker or similar, you can set this variable from a file by appending it with _FILE
ADLDAP_CONNECTION_SCHEME=OpenLDAP
ADLDAP_AUTO_CONNECT=true
# LDAP connection settings
# You can set the following variables from a file by appending them with _FILE:
# ADLDAP_CONTROLLERS, ADLDAP_PORT, ADLDAP_BASEDN
ADLDAP_CONTROLLERS=
ADLDAP_PORT=389
ADLDAP_TIMEOUT=5
ADLDAP_BASEDN=""
ADLDAP_FOLLOW_REFFERALS=false
# SSL/TLS settings
ADLDAP_USE_SSL=false
ADLDAP_USE_TLS=false
ADLDAP_SSL_CACERTDIR=
ADLDAP_SSL_CACERTFILE=
ADLDAP_SSL_CERTFILE=
ADLDAP_SSL_KEYFILE=
ADLDAP_SSL_CIPHER_SUITE=
ADLDAP_SSL_REQUIRE_CERT=
# You can set the following variables from a file by appending them with _FILE:
ADLDAP_ADMIN_USERNAME=
ADLDAP_ADMIN_PASSWORD=
# You can set the following variables from a file by appending them with _FILE:
ADLDAP_ACCOUNT_PREFIX=
ADLDAP_ACCOUNT_SUFFIX=
# LDAP authentication settings.
ADLDAP_PASSWORD_SYNC=false
ADLDAP_LOGIN_FALLBACK=false
@@ -151,25 +233,76 @@ ADLDAP_DISCOVER_FIELD=distinguishedname
ADLDAP_AUTH_FIELD=distinguishedname
# Will allow SSO if your server provides an AUTH_USER field.
# You can set the following variables from a file by appending them with _FILE:
WINDOWS_SSO_ENABLED=false
WINDOWS_SSO_DISCOVER=samaccountname
WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
# You can set the following variable from a file by appending it with _FILE:
ADLDAP_SYNC_FIELD=userprincipalname
# You can disable the X-Frame-Options header if it interfears with tools like
# Organizr. This is at your own risk.
# You can disable the X-Frame-Options header if it interferes with tools like
# Organizr. This is at your own risk. Applications running in frames run the risk
# of leaking information to their parent frame.
DISABLE_FRAME_HEADER=false
# You can disable the Content Security Policy header when you're using an ancient browser
# or any version of Microsoft Edge / Internet Explorer (which amounts to the same thing really)
# This leaves you with the risk of not being able to stop XSS bugs should they ever surface.
# This is at your own risk.
DISABLE_CSP_HEADER=false
# If you wish to track your own behavior over Firefly III, set valid analytics tracker information here.
# Nobody uses this except for me on the demo site. But hey, feel free to use this if you want to.
# Do not prepend the TRACKER_URL with http:// or https://
# The only tracker supported is Matomo.
# You can set the following variables from a file by appending them with _FILE:
TRACKER_SITE_ID=
TRACKER_URL=
#
# Firefly III can collect telemetry on how you use Firefly III. This is opt-in.
# In order to allow this, change the following variable to true.
# To read more about this feature, go to this page: https://docs.firefly-iii.org/support/telemetry
SEND_TELEMETRY=false
# You can fine tune the start-up of a Docker container by editing these environment variables.
# Use this at your own risk. Disabling certain checks and features may result in lost of inconsistent data.
# However if you know what you're doing you can significantly speed up container start times.
# Set each value to true to enable, or false to disable.
# Check if the SQLite database exists. Can be skipped if you're not using SQLite.
# Won't significantly speed up things.
DKR_CHECK_SQLITE=true
# Run database creation and migration commands. Disable this only if you're 100% sure the DB exists
# and is up to date.
DKR_RUN_MIGRATION=true
# Run database upgrade commands. Disable this only when you're 100% sure your DB is up-to-date
# with the latest fixes (outside of migrations!)
DKR_RUN_UPGRADE=true
# Verify database integrity. Includes all data checks and verifications.
# Disabling this makes Firefly III assume your DB is intact.
DKR_RUN_VERIFY=true
# Run database reporting commands. When disabled, Firefly III won't go over your data to report current state.
# Disabling this should have no impact on data integrity or safety but it won't warn you of possible issues.
DKR_RUN_REPORT=true
# Generate OAuth2 keys.
# When disabled, Firefly III won't attempt to generate OAuth2 Passport keys. This won't be an issue, IFF (if and only if)
# you had previously generated keys already and they're stored in your database for restoration.
DKR_RUN_PASSPORT_INSTALL=true
# Leave the following configuration vars as is.
# Unless you like to tinker and know what you're doing.
APP_NAME=FireflyIII
ADLDAP_CONNECTION=default
BROADCAST_DRIVER=log
QUEUE_DRIVER=sync
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
CACHE_PREFIX=firefly
SEARCH_RESULT_LIMIT=50
PUSHER_KEY=
@@ -177,7 +310,18 @@ PUSHER_SECRET=
PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
IS_SANDSTORM=false
IS_HEROKU=true
BUNQ_USE_SANDBOX=false
FFIII_LAYOUT=v1
USE_ENCRYPTION=false
IS_HEROKU=false
FIREFLY_III_LAYOUT=v1
#
# If you have trouble configuring your Firefly III installation, DON'T BOTHER setting this variable.
# It won't work. It doesn't do ANYTHING. Don't believe the lies you read online. I'm not joking.
# This configuration value WILL NOT HELP.
#
# This variable is ONLY used in some of the emails Firefly III sends around. Nowhere else.
# So when configuring anything WEB related this variable doesn't do anything. Nothing
#
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
#
APP_URL=http://localhost

View File

@@ -10,14 +10,13 @@ APP_DEBUG=false
SITE_OWNER=mail@example.com
# The encryption key for your sessions. Keep this very secure.
# If you generate a new one existing data must be considered LOST.
# If you generate a new one all existing attachments must be considered LOST.
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
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/master/resources/lang
# For a list of available languages: https://github.com/firefly-iii/firefly-iii/tree/main/resources/lang
#
# If text is still in English, remember that not everything may have been translated.
DEFAULT_LANGUAGE=en_US
@@ -57,7 +56,9 @@ APP_LOG_LEVEL=notice
# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
# For other database types, please see the FAQ: https://docs.firefly-iii.org/support/faq
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
# Use "mysql" for MySQL and MariaDB. Use "sqlite" for SQLite.
# Use "pgsql" for PostgreSQL
# Use "mysql" for MySQL and MariaDB.
# Use "sqlite" for SQLite.
DB_CONNECTION=mysql
DB_HOST=fireflyiiidb
DB_PORT=3306
@@ -91,9 +92,18 @@ SESSION_DRIVER=file
# If you set either of these to 'redis', you might want to update these settings too
# If you use Docker or similar, you can set REDIS_HOST_FILE, REDIS_PASSWORD_FILE or
# REDIS_PORT_FILE to set the value from a file instead of from an environment variable
# can be tcp, unix or http
REDIS_SCHEME=tcp
# use only when using 'unix' for REDIS_SCHEME. Leave empty otherwise.
REDIS_PATH=
# use only when using 'tcp' or 'http' for REDIS_SCHEME. Leave empty otherwise.
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
REDIS_PASSWORD=null
# always use quotes and make sure redis db "0" and "1" exists. Otherwise change accordingly.
REDIS_DB="0"
REDIS_CACHE_DB="1"
@@ -108,8 +118,8 @@ COOKIE_SECURE=false
# If you want Firefly III to mail you, update these settings
# For instructions, see: https://docs.firefly-iii.org/advanced-installation/email
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAIL_DRIVER=log
MAIL_HOST=smtp.mailtrap.io
MAIL_MAILER=log
MAIL_HOST=null
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
@@ -130,7 +140,6 @@ MAILGUN_ENDPOINT=api.mailgun.net
MANDRILL_SECRET=
SPARKPOST_SECRET=
# Firefly III can send you the following messages
SEND_REGISTRATION_MAIL=true
SEND_ERROR_MESSAGE=true
@@ -147,19 +156,6 @@ MAP_DEFAULT_LAT=51.983333
MAP_DEFAULT_LONG=5.916667
MAP_DEFAULT_ZOOM=6
# Firefly III currently supports two provider for live Currency Exchange Rates:
# "fixer", and "ratesapi".
# RatesApi.IO (see https://ratesapi.io) is a FREE and OPEN SOURCE live currency exchange rates,
# built compatible with Fixer.IO, based on data published by European Central Bank, and doesn't require API key.
CER_PROVIDER=ratesapi
# If you have select "fixer" as default currency exchange rates,
# set a Fixer IO API key here (see https://fixer.io) to enable live currency exchange rates.
# Please note that this WILL ONLY WORK FOR PAID fixer.io accounts because they severely limited
# the free API up to the point where you might as well offer nothing.
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
FIXER_API_KEY=
# Firefly III has two options for user authentication. "eloquent" is the default,
# and "ldap" for LDAP servers.
# For full instructions on these settings please visit:
@@ -167,6 +163,32 @@ FIXER_API_KEY=
# If you use Docker or similar, you can set this variable from a file by appending it with _FILE
LOGIN_PROVIDER=eloquent
# It's also possible to change the way users are authenticated. You could use Authelia for example.
# Authentication via the REMOTE_USER header is supported. Change the value below to "remote_user_guard".
#
# This will also allow Windows SSO.
#
# If you do this please read the documentation for instructions and warnings:
# https://docs.firefly-iii.org/advanced-installation/authentication
#
# This function is available in Firefly III v5.3.0 and higher.
AUTHENTICATION_GUARD=web
# If the guard is changed, Firefly III uses the 'REMOTE_USER' header as per RFC 3875.
# You can also use another header, like AUTH_USER when using Windows SSO.
# Some systems use X-Auth headers. In that case, use HTTP_X_AUTH_USERNAME or HTTP_X_AUTH_EMAIL
# Depending on your system, REMOTE_USER may need to be changed to HTTP_REMOTE_USER
#
# Firefly III won't be able to send emails when the header you use isn't an email address.
#
AUTHENTICATION_GUARD_HEADER=REMOTE_USER
# Likewise, it's impossible to log out users who's authentication is handled by an external system.
# Enter a custom URL here that will force a logout (your authentication provider can tell you).
# Setting this variable only works when AUTHENTICATION_GUARD != web
#
CUSTOM_LOGOUT_URI=
# LDAP connection configuration
# OpenLDAP, FreeIPA or ActiveDirectory
# # If you use Docker or similar, you can set this variable from a file by appending it with _FILE
@@ -200,7 +222,6 @@ ADLDAP_ADMIN_PASSWORD=
ADLDAP_ACCOUNT_PREFIX=
ADLDAP_ACCOUNT_SUFFIX=
# LDAP authentication settings.
ADLDAP_PASSWORD_SYNC=false
ADLDAP_LOGIN_FALLBACK=false
@@ -208,12 +229,6 @@ ADLDAP_LOGIN_FALLBACK=false
ADLDAP_DISCOVER_FIELD=distinguishedname
ADLDAP_AUTH_FIELD=distinguishedname
# Will allow SSO if your server provides an AUTH_USER field.
# You can set the following variables from a file by appending them with _FILE:
WINDOWS_SSO_ENABLED=false
WINDOWS_SSO_DISCOVER=samaccountname
WINDOWS_SSO_KEY=AUTH_USER
# field to sync as local username.
# You can set the following variable from a file by appending it with _FILE:
ADLDAP_SYNC_FIELD=userprincipalname
@@ -237,7 +252,6 @@ DISABLE_CSP_HEADER=false
TRACKER_SITE_ID=
TRACKER_URL=
#
# Firefly III can collect telemetry on how you use Firefly III. This is opt-in.
# In order to allow this, change the following variable to true.
# To read more about this feature, go to this page: https://docs.firefly-iii.org/support/telemetry
@@ -280,16 +294,13 @@ ADLDAP_CONNECTION=default
BROADCAST_DRIVER=log
QUEUE_DRIVER=sync
CACHE_PREFIX=firefly
SEARCH_RESULT_LIMIT=50
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_ID=
DEMO_USERNAME=
DEMO_PASSWORD=
USE_ENCRYPTION=false
IS_SANDSTORM=false
IS_HEROKU=false
BUNQ_USE_SANDBOX=false
FIREFLY_III_LAYOUT=v1
#
# If you have trouble configuring your Firefly III installation, DON'T BOTHER setting this variable.

View File

@@ -8,7 +8,7 @@ I am always interested in expanding Firefly III's many features. Just open a tic
## Pull requests
When contributing to Firefly III, please first discuss the change you wish to make via issue, email, or any other method. I can only accept pull requests against the `develop` branch, never the `master` branch.
When contributing to Firefly III, please first discuss the change you wish to make via issue, email, or any other method. I can only accept pull requests against the `develop` branch, never the `main` branch.
## Translations :us: :fr: :de:

26
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,26 @@
version: 2
updates:
# composer updates
- package-ecosystem: "composer"
directory: "/" # Location of package manifests
target-branch: develop
labels: ["bug"]
schedule:
interval: "weekly"
# yarn / JS updates
- package-ecosystem: "npm"
directory: "/"
target-branch: develop
labels: ["bug"]
schedule:
interval: "weekly"
# yarn / JS updates for new frontend
- package-ecosystem: "npm"
directory: "/frontend"
target-branch: develop
labels: ["bug"]
schedule:
interval: "weekly"

2
.github/funding.yml vendored
View File

@@ -2,4 +2,4 @@
github: jc5
patreon: JC5
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=44UKUT455HUFA
custom: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=L62W7DVD5ETPC&source=url

View File

@@ -1,8 +1,9 @@
<!--
Before you create a new PR, please consider the following two considerations.
Before you create a new PR, please consider:
1) Pull request for the MASTER branch will be closed.
1) Pull requests for the MAIN branch will be closed.
2) We cannot accept pull requests to add new currencies.
3) DO NOT include translations in your PR. Only English US sentences.
Thanks.
-->

50
.github/security.md vendored
View File

@@ -1,12 +1,54 @@
# Security Policy
Firefly III is an application to manage your personal finances. As such, the developer has adopted this security disclosure and response policy to ensure that critical issues are responsibly handled.
## Supported Versions
Only the latest Firefly III release is maintained. Applicable fixes, including security fixes, will not backported to older release branches. Please refer to [releases.md](https://github.com/firefly-iii/firefly-iii/blob/main/releases.md) for details.
Only the latest version of Firefly III is supported. If you're not running the latest version of Firefly III, please upgrade at your earliest convenience.
## Reporting a Vulnerability - Private Disclosure Process
Security is of the highest importance and all security vulnerabilities or suspected security vulnerabilities should be reported to Firefly III privately, to minimize attacks against current users of Firefly III before they are fixed. Vulnerabilities will be investigated and patched on the next patch (or minor) release as soon as possible. This information could be kept entirely internal to the project.
## Reporting a Vulnerability
If you know of a publicly disclosed security vulnerability for Firefly III, please **IMMEDIATELY** contact james@firefly-iii.org to inform the Firefly III developer. You can use my [GPG key](https://keybase.io/jc5) for extra security.
If you find something that compromises the security of Firefly III, you should [send me a message](mailto:james@firefly-iii.org) as soon as possible. These issues will be fixed immediately. You can also open an issue, but if you feel the issue is sensitive, please drop me a message instead.
**IMPORTANT: Do not file public issues on GitHub for security vulnerabilities**
You can use my [GPG key](https://keybase.io/jc5) for extra security. My [GitHub commits](https://github.com/firefly-iii/firefly-iii/commits/master) are almost always signed with this key.
To report a vulnerability or a security-related issue, please email the private address james@firefly-iii.org with the details of the vulnerability. The email will be received by the developer of Firefly III. Emails will be addressed within 3 business days, including a detailed plan to investigate the issue and any potential workarounds to perform in the meantime. Do not report non-security-impacting bugs through this channel. Use [GitHub issues](https://github.com/firefly-iii/firefly-iii/issues/new/choose) instead.
### Proposed Email Content
Provide a descriptive subject line and in the body of the email include the following information:
* Basic identity information, such as your name and your affiliation or company.
* Detailed steps to reproduce the vulnerability (POC scripts, screenshots, and compressed packet captures are all helpful to us).
* Description of the effects of the vulnerability on Firefly III and the related hardware and software configurations, so that the developer can reproduce it.
* How the vulnerability affects Firefly III usage and an estimation of the attack surface, if there is one.
* List other projects or dependencies that were used in conjunction with Firefly III to produce the vulnerability.
## When to report a vulnerability
* When you think Firefly III has a potential security vulnerability.
* When you suspect a potential vulnerability but you are unsure that it impacts Firefly III.
* When you know of or suspect a potential vulnerability on another project that is used by Firefly III. For example Firefly III has a dependency on Docker, MySQL, etc.
## Patch, Release, and Disclosure
The Firefly III developer will respond to vulnerability reports as follows:
1. The developer will investigate the vulnerability and determine its effects and criticality.
2. If the issue is not deemed to be a vulnerability, the developer will follow up with a detailed reason for rejection.
3. The developer will initiate a conversation with the reporter within 3 business days.
4. If a vulnerability is acknowledged and the timeline for a fix is determined, the developer will work on a plan to communicate with the appropriate community, including identifying mitigating steps that affected users can take to protect themselves until the fix is rolled out.
5. The developer will also create a [CVSS](https://www.first.org/cvss/specification-document) using the [CVSS Calculator](https://www.first.org/cvss/calculator/3.0). The developer makes the final call on the calculated CVSS; it is better to move quickly than making the CVSS perfect. Issues may also be reported to [Mitre](https://cve.mitre.org/) using this [scoring calculator](https://nvd.nist.gov/vuln-metrics/cvss/v3-calculator). The CVE will initially be set to private.
6. The developer will work on fixing the vulnerability and perform internal testing before preparing to roll out the fix.
7. A public disclosure date is negotiated by the Firefly III developer and the bug submitter. We prefer to fully disclose the bug as soon as possible once a user mitigation or patch is available. It is reasonable to delay disclosure when the bug or the fix is not yet fully understood, the solution is not well-tested, or for distributor coordination. The timeframe for disclosure is from immediate (especially if its already publicly known) to a few weeks. For a critical vulnerability with a straightforward mitigation, we expect report date to public disclosure date to be on the order of 14 business days. The Firefly III developer holds the final say when setting a public disclosure date.
9. Once the fix is confirmed, the developer will patch the vulnerability in the next patch or minor release. Upon release of the patched version of Firefly III, we will follow the **Public Disclosure Process**.
### Public Disclosure Process
The developer publishes a public [advisory](https://github.com/firefly-iii/firefly-iii/security/advisories) to the Firefly III community via GitHub. In most cases, additional communication via Twitter, reddit and other channels will assist in educating Firefly III users and rolling out the patched release to affected users.
The develop will also publish any mitigating steps users can take until the fix can be applied to their Firefly III instances.
## Confidentiality, integrity and availability
We consider vulnerabilities leading to the compromise of data confidentiality, elevation of privilege, or integrity to be our highest priority concerns. Availability, in particular in areas relating to DoS and resource exhaustion, is also a serious security concern. The Firefly III developer takes all vulnerabilities, potential vulnerabilities, and suspected vulnerabilities seriously and will investigate them in an urgent and expeditious manner.
Note that we do not currently consider the default settings for Firefly III to be secure-by-default. It is necessary for operators to explicitly configure settings, role based access control, and other resource related features in Firefly III to provide a hardened Firefly III environment. We will not act on any security disclosure that relates to a lack of safe defaults. Over time, we will work towards improved safe-by-default configuration, taking into account backwards compatibility.
## Credits
This security policy is based on [Harbor](https://github.com/goharbor/harbor)'s security policy.

146
.github/workflows/laravel.yml vendored Normal file
View File

@@ -0,0 +1,146 @@
name: Firefly III
on:
push:
branches-ignore:
- '**'
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp .ci/.env.ci .env
- name: Prepare dependencies
run: |
set -euxo pipefail
export PATH=$PATH:$HOME/.composer/vendor/bin/
composer global require hirak/prestissimo --no-plugins --no-scripts
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
touch ./storage/database/database.sqlite
- name: Prepare Firefly III
run: |
chmod -R 777 storage bootstrap/cache
php artisan migrate --seed
php artisan firefly-iii:upgrade-database
- name: Upload database
uses: actions/upload-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Upload cache
uses: actions/upload-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Upload composer cache
uses: actions/upload-artifact@v2
with:
name: composer
path: ~/.composer
laravel-tests:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp .ci/.env.ci .env
- name: Download database
uses: actions/download-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Download cache
uses: actions/download-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Download vendor
uses: actions/download-artifact@v2
with:
name: composer
path: ~/.composer
- name: Install composer
run: composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
- name: PHPUnit tests
uses: php-actions/phpunit@v1
with:
config: phpunit.xml
memory: 512M
coding-standards:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp .ci/.env.ci .env
- name: Download database
uses: actions/download-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Download cache
uses: actions/download-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Download vendor
uses: actions/download-artifact@v2
with:
name: composer
path: ~/.composer
- name: install depenencies
run: |
composer global require nette/coding-standard
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
- name: Execute code standard
run: /home/runner/.composer/vendor/bin/ecs check app tests --config ./.ci/firefly-iii-standard.yml
phpstan:
runs-on: ubuntu-latest
needs:
- prepare
steps:
- uses: actions/checkout@v2
- name: Copy .env
run: test -f .env || cp .ci/.env.ci .env
- name: Download database
uses: actions/download-artifact@v2
with:
name: database
path: storage/database/database.sqlite
- name: Download cache
uses: actions/download-artifact@v2
with:
name: cache
path: bootstrap/cache/
- name: Download vendor
uses: actions/download-artifact@v2
with:
name: composer
path: ~/.composer
- name: Install depenencies
run: |
composer install --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist --no-suggest
- name: Execute PHPStan
run: vendor/bin/phpstan analyse -c .ci/phpstan.neon

1
.gitignore vendored
View File

@@ -1,5 +1,6 @@
/node_modules
/frontend/node_modules
/frontend/fonts
/public/hot
/public/storage
/storage/*.key

21
.travis.yml Normal file
View File

@@ -0,0 +1,21 @@
language: php
php:
- '7.4'
dist: xenial
os: linux
cache:
directories:
- "/home/travis/.config"
- "/home/travis/build/firefly-iii/firefly-iii/vendor"
branches:
only:
- develop
before_script:
- phpenv config-rm xdebug.ini || return 0
- composer global require hirak/prestissimo --no-plugins --no-scripts
script:
- "./.ci/phpstan.sh"
- "./.ci/phpunit.sh"

View File

@@ -3,7 +3,7 @@
"description": "A free and open source personal finances manager",
"repository": "https://github.com/firefly-iii/firefly-iii",
"website": "https://firefly-iii.org/",
"logo": "https://raw.githubusercontent.com/firefly-iii/firefly-iii/master/public/mstile-150x150.png",
"logo": "https://raw.githubusercontent.com/firefly-iii/firefly-iii/main/public/mstile-150x150.png",
"keywords": [
"finance",
"finances",
@@ -41,7 +41,7 @@
{
"plan": "heroku-postgresql",
"options": {
"version": "9.5"
"version": "12"
}
}
],
@@ -58,8 +58,8 @@
],
"env": {
"APP_KEY": {
"description": "This key is used to encrypt your data.",
"description": "This key is used to create app cookies en secure attachments.",
"value": "base64:If1gJN4pyycXTq+WS5TjneDympKuu+8SKvTl6RZnhJg="
}
}
}
}

View File

@@ -45,13 +45,15 @@ use League\Fractal\Resource\Item;
/**
* Class AccountController.
*
*/
class AccountController extends Controller
{
use AccountFilter, TransactionFilter;
/** @var AccountRepositoryInterface The account repository */
private $repository;
public const RESOURCE_KEY = 'accounts';
private AccountRepositoryInterface $repository;
/**
* AccountController constructor.
@@ -150,7 +152,7 @@ class AccountController extends Controller
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($accounts, $transformer, 'accounts');
$resource = new FractalCollection($accounts, $transformer, self::RESOURCE_KEY);
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
@@ -164,7 +166,6 @@ class AccountController extends Controller
*
* @return JsonResponse
* @codeCoverageIgnore
*
*/
public function piggyBanks(Account $account): JsonResponse
{
@@ -208,7 +209,7 @@ class AccountController extends Controller
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($account, $transformer, 'accounts');
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
@@ -230,7 +231,7 @@ class AccountController extends Controller
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($account, $transformer, 'accounts');
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
@@ -244,7 +245,6 @@ class AccountController extends Controller
* @param Account $account
*
* @return JsonResponse
*
*/
public function transactions(Request $request, Account $account): JsonResponse
{
@@ -304,7 +304,7 @@ class AccountController extends Controller
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($account, $transformer, 'accounts');
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}

View File

@@ -28,7 +28,6 @@ use FireflyIII\Api\V1\Requests\AttachmentStoreRequest;
use FireflyIII\Api\V1\Requests\AttachmentUpdateRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Models\Attachment;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use FireflyIII\Transformers\AttachmentTransformer;
@@ -45,13 +44,13 @@ use function strlen;
/**
* Class AttachmentController.
*
*/
class AttachmentController extends Controller
{
/** @var AttachmentRepositoryInterface The attachment repository */
private $repository;
/**
* AccountController constructor.
*

View File

@@ -0,0 +1,119 @@
<?php
/**
* AccountController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Http\Api\AccountFilter;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class AccountController
*/
class AccountController extends Controller
{
use AccountFilter;
private array $balanceTypes;
private AccountRepositoryInterface $repository;
/**
* AccountController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(AccountRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
$this->balanceTypes = [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE,];
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function accounts(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$types = $data['types'];
$query = $data['query'];
$date = $data['date'] ?? today(config('app.timezone'));
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$return = [];
$result = $repository->searchAccount((string) $query, $types, $data['limit']);
$defaultCurrency = app('amount')->getDefaultCurrency();
/** @var Account $account */
foreach ($result as $account) {
$nameWithBalance = $account->name;
$currency = $repository->getAccountCurrency($account) ?? $defaultCurrency;
if (in_array($account->accountType->type, $this->balanceTypes, true)) {
$balance = app('steam')->balance($account, $date);
$nameWithBalance = sprintf('%s (%s)', $account->name, app('amount')->formatAnything($currency, $balance, false));
}
$return[] = [
'id' => $account->id,
'name' => $account->name,
'name_with_balance' => $nameWithBalance,
'type' => $account->accountType->type,
'currency_id' => $currency->id,
'currency_name' => $currency->name,
'currency_code' => $currency->code,
'currency_decimal_places' => $currency->decimal_places,
];
}
// custom order.
$order = [AccountType::ASSET, AccountType::REVENUE, AccountType::EXPENSE];
usort($return, function ($a, $b) use ($order) {
$pos_a = array_search($a['type'], $order);
$pos_b = array_search($b['type'], $order);
return $pos_a - $pos_b;
});
return response()->json($return);
}
}

View File

@@ -0,0 +1,83 @@
<?php
/**
* BillController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class BillController
*/
class BillController extends Controller
{
private BillRepositoryInterface $repository;
/**
* BillController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(BillRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* TODO add limit
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function bills(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = $this->repository->searchBill($data['query'], $data['limit']);
$filtered = $result->map(
static function (Bill $item) {
return [
'id' => $item->id,
'name' => $item->name,
];
}
);
return response()->json($filtered->toArray());
}
}

View File

@@ -0,0 +1,81 @@
<?php
/**
* BudgetController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class BudgetController
*/
class BudgetController extends Controller
{
private BudgetRepositoryInterface $repository;
/**
* BudgetController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(BudgetRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* TODO add limit
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function budgets(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = $this->repository->searchBudget($data['query'], $data['limit']);
$filtered = $result->map(
static function (Budget $item) {
return [
'id' => $item->id,
'name' => $item->name,
];
}
);
return response()->json($filtered);
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* CategoryController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class CategoryController
*/
class CategoryController extends Controller
{
private CategoryRepositoryInterface $repository;
/**
* CategoryController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(CategoryRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function categories(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = $this->repository->searchCategory($data['query'], $data['limit']);
$filtered = $result->map(
static function (Category $item) {
return [
'id' => $item->id,
'name' => $item->name,
];
}
);
return response()->json($filtered);
}
}

View File

@@ -0,0 +1,109 @@
<?php
/**
* CurrencyController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class CurrencyController
*/
class CurrencyController extends Controller
{
private CurrencyRepositoryInterface $repository;
/**
* CurrencyController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(CurrencyRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function currenciesWithCode(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$collection = $this->repository->searchCurrency($data['query'], $data['limit']);
$result = [];
/** @var TransactionCurrency $currency */
foreach ($collection as $currency) {
$result[] = [
'id' => $currency->id,
'name' => sprintf('%s (%s)', $currency->name, $currency->code),
'code' => $currency->code,
'symbol' => $currency->symbol,
'decimal_places' => $currency->decimal_places,
];
}
return response()->json($result);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function currencies(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$collection = $this->repository->searchCurrency($data['query'], $data['limit']);
$result = [];
/** @var TransactionCurrency $currency */
foreach ($collection as $currency) {
$result[] = [
'id' => $currency->id,
'name' => $currency->name,
'code' => $currency->code,
'symbol' => $currency->symbol,
'decimal_places' => $currency->decimal_places,
];
}
return response()->json($result);
}
}

View File

@@ -0,0 +1,83 @@
<?php
/**
* ObjectGroupController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\ObjectGroup;
use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class ObjectGroupController
*/
class ObjectGroupController extends Controller
{
private ObjectGroupRepositoryInterface $repository;
/**
* CurrencyController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(ObjectGroupRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function objectGroups(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$return = [];
$result = $this->repository->search($data['query'], $data['limit']);
/** @var ObjectGroup $account */
foreach ($result as $objectGroup) {
$return[] = [
'id' => $objectGroup->id,
'name' => $objectGroup->title,
'title' => $objectGroup->title,
];
}
return response()->json($return);
}
}

View File

@@ -0,0 +1,125 @@
<?php
/**
* PiggyBankController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class PiggyBankController
*/
class PiggyBankController extends Controller
{
private PiggyBankRepositoryInterface $piggyRepository;
private AccountRepositoryInterface $accountRepository;
/**
* PiggyBankController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->piggyRepository = app(PiggyBankRepositoryInterface::class);
$this->accountRepository = app(AccountRepositoryInterface::class);
$this->piggyRepository->setUser($user);
$this->accountRepository->setUser($user);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function piggyBanks(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$piggies = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']);
$defaultCurrency = app('amount')->getDefaultCurrency();
$response = [];
/** @var PiggyBank $piggy */
foreach ($piggies as $piggy) {
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
$response[] = [
'id' => $piggy->id,
'name' => $piggy->name,
'currency_id' => $currency->id,
'currency_name' => $currency->name,
'currency_code' => $currency->code,
'currency_decimal_places' => $currency->decimal_places,
];
}
return response()->json($response);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function piggyBanksWithBalance(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$piggies = $this->piggyRepository->searchPiggyBank($data['query'], $data['limit']);
$defaultCurrency = app('amount')->getDefaultCurrency();
$response = [];
/** @var PiggyBank $piggy */
foreach ($piggies as $piggy) {
$currency = $this->accountRepository->getAccountCurrency($piggy->account) ?? $defaultCurrency;
$currentAmount = $this->piggyRepository->getRepetition($piggy)->currentamount ?? '0';
$response[] = [
'id' => $piggy->id,
'name' => $piggy->name,
'name_with_balance' => sprintf(
'%s (%s / %s)', $piggy->name, app('amount')->formatAnything($currency, $currentAmount, false),
app('amount')->formatAnything($currency, $piggy->targetamount, false),
),
'currency_id' => $currency->id,
'currency_name' => $currency->name,
'currency_code' => $currency->code,
'currency_decimal_places' => $currency->decimal_places,
];
}
return response()->json($response);
}
}

View File

@@ -1,7 +1,7 @@
<?php
/**
* SpectreObject.php
* Copyright (c) 2019 james@firefly-iii.org
* RecurrenceController.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -18,15 +18,18 @@
* 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\Services\Spectre\Object;
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
/**
* @codeCoverageIgnore
* Class SpectreObject
* @deprecated
* Class RecurrenceController
*/
class SpectreObject
class RecurrenceController extends Controller
{
}

View File

@@ -1,7 +1,7 @@
<?php
/**
* GithubRequest.php
* Copyright (c) 2019 james@firefly-iii.org
* RuleController.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -21,14 +21,15 @@
declare(strict_types=1);
namespace FireflyIII\Services\Github\Request;
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
/**
* Interface GithubRequest
* @deprecated
* Class RuleController
*/
interface GithubRequest
class RuleController extends Controller
{
public function call(): void;
}

View File

@@ -1,7 +1,7 @@
<?php
/**
* SpectreException.php
* Copyright (c) 2019 james@firefly-iii.org
* RuleGroupController.php
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -21,16 +21,15 @@
declare(strict_types=1);
namespace FireflyIII\Services\Spectre\Exception;
namespace FireflyIII\Api\V1\Controllers\Autocomplete;
use Exception;
use FireflyIII\Api\V1\Controllers\Controller;
/**
* @codeCoverageIgnore
* Class SpectreException
* @deprecated
* Class RuleGroupController
*/
class SpectreException extends Exception
class RuleGroupController extends Controller
{
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* TagController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
/**
* Class TagController
*/
class TagController extends Controller
{
private TagRepositoryInterface $repository;
/**
* TagController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(TagRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function tags(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = $this->repository->searchTags($data['query'], $data['limit']);
$array = [];
/** @var Tag $tag */
foreach ($result as $tag) {
$array[] = [
'id' => $tag->id,
'name' => $tag->tag,
'tag' => $tag->tag,
];
}
return response()->json($array);
}
}

View File

@@ -0,0 +1,132 @@
<?php
/**
* TransactionController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
/**
* Class TransactionController
*/
class TransactionController extends Controller
{
private JournalRepositoryInterface $repository;
private TransactionGroupRepositoryInterface $groupRepository;
/**
* TransactionController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(JournalRepositoryInterface::class);
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
$this->repository->setUser($user);
$this->groupRepository->setUser($user);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function transactions(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
// limit and unique
$filtered = $result->unique('description');
$array = [];
/** @var TransactionJournal $journal */
foreach ($filtered as $journal) {
$array[] = [
'id' => $journal->id,
'transaction_group_id' => $journal->transaction_group_id,
'name' => $journal->description,
'description' => $journal->description,
];
}
return response()->json($array);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
*/
public function transactionsWithID(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$result = new Collection;
if (is_numeric($data['query'])) {
// search for group, not journal.
$firstResult = $this->groupRepository->find((int) $data['query']);
if (null !== $firstResult) {
// group may contain multiple journals, each a result:
foreach ($firstResult->transactionJournals as $journal) {
$result->push($journal);
}
}
}
if (!is_numeric($data['query'])) {
$result = $this->repository->searchJournalDescriptions($data['query'], $data['limit']);
}
// limit and unique
$array = [];
/** @var TransactionJournal $journal */
foreach ($result as $journal) {
$array[] = [
'id' => $journal->id,
'transaction_group_id' => $journal->transaction_group_id,
'name' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
'description' => sprintf('#%d: %s', $journal->transaction_group_id, $journal->description),
];
}
return response()->json($array);
}
}

View File

@@ -0,0 +1,80 @@
<?php
/**
* TransactionTypeController.php
* Copyright (c) 2020 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\Autocomplete;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Autocomplete\AutocompleteRequest;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\TransactionType\TransactionTypeRepositoryInterface;
use Illuminate\Http\JsonResponse;
/**
* Class TransactionTypeController
*/
class TransactionTypeController extends Controller
{
private TransactionTypeRepositoryInterface $repository;
/**
* TransactionTypeController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
$this->repository = app(TransactionTypeRepositoryInterface::class);
return $next($request);
}
);
}
/**
* @param AutocompleteRequest $request
*
* @return JsonResponse
* @codeCoverageIgnore
*/
public function transactionTypes(AutocompleteRequest $request): JsonResponse
{
$data = $request->getData();
$types = $this->repository->searchTypes($data['query'], $data['limit']);
$array = [];
/** @var TransactionType $type */
foreach ($types as $type) {
// different key for consistency.
$array[] = [
'id' => $type->id,
'name' => $type->type,
'type' => $type->type,
];
}
return response()->json($array);
}
}

View File

@@ -38,12 +38,10 @@ use League\Fractal\Resource\Item;
/**
* Class AvailableBudgetController.
*
*/
class AvailableBudgetController extends Controller
{
/** @var AvailableBudgetRepositoryInterface */
private $abRepository;
private AvailableBudgetRepositoryInterface $abRepository;
/**
* AvailableBudgetController constructor.

View File

@@ -44,14 +44,15 @@ use League\Fractal\Resource\Item;
/**
* Class BillController.
*
*/
class BillController extends Controller
{
use TransactionFilter;
/** @var BillRepositoryInterface The bill repository */
private $repository;
/**
* BillController constructor.
*

View File

@@ -47,16 +47,18 @@ use League\Fractal\Resource\Item;
/**
* Class BudgetController.
*
*/
class BudgetController extends Controller
{
use TransactionFilter;
/** @var BudgetLimitRepositoryInterface */
private $blRepository;
/** @var BudgetRepositoryInterface The budget repository */
private $repository;
/**
* BudgetController constructor.
*
@@ -230,31 +232,6 @@ class BudgetController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* Store a newly created resource in storage.
*
* @param BudgetLimitRequest $request
* @param Budget $budget
*
* @throws Exception
* @return JsonResponse
*/
public function storeBudgetLimit(BudgetLimitRequest $request, Budget $budget): JsonResponse
{
$data = $request->getAll();
$data['budget'] = $budget;
$budgetLimit = $this->blRepository->storeBudgetLimit($data);
$manager = $this->getManager();
/** @var BudgetLimitTransformer $transformer */
$transformer = app(BudgetLimitTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($budgetLimit, $transformer, 'budget_limits');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* Show all transactions.
*

View File

@@ -44,16 +44,18 @@ use League\Fractal\Resource\Item;
/**
* Class BudgetLimitController.
*
*/
class BudgetLimitController extends Controller
{
use TransactionFilter;
/** @var BudgetLimitRepositoryInterface */
private $blRepository;
/** @var BudgetRepositoryInterface The budget repository */
private $repository;
/**
* BudgetLimitController constructor.
*
@@ -156,20 +158,19 @@ class BudgetLimitController extends Controller
*
* @param BudgetLimitRequest $request
*
* @return JsonResponse
* @throws FireflyException
*
* @return JsonResponse
*/
public function store(BudgetLimitRequest $request): JsonResponse
{
$data = $request->getAll();
$budget = $this->repository->findNull($data['budget_id']);
if (null === $budget) {
throw new FireflyException('200004: Budget does not exist.'); // @codeCoverageIgnore
}
$data['budget'] = $budget;
$budgetLimit = $this->blRepository->storeBudgetLimit($data);
$manager = $this->getManager();
$data = $request->getAll();
$data['start_date'] = $data['start'];
$data['end_date'] = $data['end'];
$budgetLimit = $this->blRepository->store($data);
$manager = $this->getManager();
/** @var BudgetLimitTransformer $transformer */
$transformer = app(BudgetLimitTransformer::class);
@@ -244,8 +245,7 @@ class BudgetLimitController extends Controller
public function update(BudgetLimitRequest $request, BudgetLimit $budgetLimit): JsonResponse
{
$data = $request->getAll();
$data['budget'] = $budgetLimit->budget;
$budgetLimit = $this->blRepository->updateBudgetLimit($budgetLimit, $data);
$budgetLimit = $this->blRepository->update($budgetLimit, $data);
$manager = $this->getManager();
/** @var BudgetLimitTransformer $transformer */

View File

@@ -42,14 +42,15 @@ use League\Fractal\Resource\Item;
/**
* Class CategoryController.
*
*/
class CategoryController extends Controller
{
use TransactionFilter;
/** @var CategoryRepositoryInterface The category repository */
private $repository;
/**
* CategoryController constructor.
*

View File

@@ -42,10 +42,11 @@ use Illuminate\Http\JsonResponse;
class AccountController extends Controller
{
use ApiSupport;
/** @var CurrencyRepositoryInterface */
private $currencyRepository;
/** @var AccountRepositoryInterface */
private $repository;
private CurrencyRepositoryInterface $currencyRepository;
private AccountRepositoryInterface $repository;
/**
* AccountController constructor.
@@ -196,6 +197,8 @@ class AccountController extends Controller
'currency_code' => $currency->code,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => $currency->decimal_places,
'start_date' => $start->format('Y-m-d'),
'end_date' => $end->format('Y-m-d'),
'type' => 'line', // line, area or bar
'yAxisID' => 0, // 0, 1, 2
'entries' => [],
@@ -207,7 +210,7 @@ class AccountController extends Controller
while ($currentStart <= $end) {
$format = $currentStart->format('Y-m-d');
$label = $currentStart->format('Y-m-d');
$balance = isset($range[$format]) ? round($range[$format], 12) : $previous;
$balance = array_key_exists($format, $range) ? round($range[$format], 12) : $previous;
$previous = $balance;
$currentStart->addDay();
$currentSet['entries'][$label] = $balance;

View File

@@ -38,10 +38,8 @@ use Illuminate\Support\Collection;
*/
class AvailableBudgetController extends Controller
{
/** @var OperationsRepositoryInterface */
private $opsRepository;
/** @var BudgetRepositoryInterface */
private $repository;
private OperationsRepositoryInterface $opsRepository;
private BudgetRepositoryInterface $repository;
/**
* AvailableBudgetController constructor.
@@ -72,18 +70,18 @@ class AvailableBudgetController extends Controller
*/
public function overview(AvailableBudget $availableBudget): JsonResponse
{
$currency = $availableBudget->transactionCurrency;
$budgets = $this->repository->getActiveBudgets();
$budgetInformation = $this->opsRepository->spentInPeriodMc($budgets, new Collection, $availableBudget->start_date, $availableBudget->end_date);
$spent = 0.0;
$currency = $availableBudget->transactionCurrency;
$budgets = $this->repository->getActiveBudgets();
$newBudgetInformation = $this->opsRepository->sumExpenses($availableBudget->start_date, $availableBudget->end_date, null, $budgets);
$spent = '0';
// get for current currency
foreach ($budgetInformation as $spentInfo) {
if ($spentInfo['currency_id'] === $availableBudget->transaction_currency_id) {
$spent = $spentInfo['amount'];
foreach ($newBudgetInformation as $currencyId => $info) {
if ($currencyId === (int) $availableBudget->transaction_currency_id) {
$spent = $info['sum'];
}
}
$left = bcadd($availableBudget->amount, (string) $spent);
$left = bcadd($availableBudget->amount, $spent);
// left less than zero? Set to zero.
if (-1 === bccomp($left, '0')) {
$left = '0';

View File

@@ -0,0 +1,301 @@
<?php
/**
* BudgetController.php
* Copyright (c) 2020 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\Chart;
use Carbon\Carbon;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\DateRequest;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\OperationsRepositoryInterface;
use Illuminate\Http\JsonResponse;
use Illuminate\Support\Collection;
/**
* Class BudgetController
*/
class BudgetController extends Controller
{
private BudgetLimitRepositoryInterface $blRepository;
private OperationsRepositoryInterface $opsRepository;
private BudgetRepositoryInterface $repository;
/**
* BudgetController constructor.
*
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
//$this->generator = app(GeneratorInterface::class);
$this->repository = app(BudgetRepositoryInterface::class);
$this->opsRepository = app(OperationsRepositoryInterface::class);
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
//$this->nbRepository = app(NoBudgetRepositoryInterface::class);
return $next($request);
}
);
}
/**
* [
* 'label' => 'label for entire set'
* 'currency_id' => 0,
* 'currency_code' => 'EUR',
* 'currency_symbol' => '$',
* 'currency_decimal_places' => 2,
* 'type' => 'bar', // line, area or bar
* 'yAxisID' => 0, // 0, 1, 2
* 'entries' => ['a' => 1, 'b' => 4],
* ],
*
* @param DateRequest $request
*
* @return JsonResponse
*/
public function overview(DateRequest $request): JsonResponse
{
$dates = $request->getAll();
$budgets = $this->repository->getActiveBudgets();
$budgetNames = [];
$currencyNames = [];
$sets = [];
/** @var Budget $budget */
foreach ($budgets as $budget) {
$expenses = $this->getExpenses($budget, $dates['start'], $dates['end']);
$expenses = $this->filterNulls($expenses);
foreach ($expenses as $set) {
$budgetNames[] = $set['budget_name'];
$currencyNames[] = $set['currency_name'];
$sets[] = $set;
}
}
$budgetNames = array_unique($budgetNames);
$currencyNames = array_unique($currencyNames);
$basic = $this->createSets($budgetNames, $currencyNames);
$filled = $this->fillSets($basic, $sets);
$keys = array_values($filled);
return response()->json($keys);
}
/**
* @param Collection $limits
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
protected function getExpenses(Budget $budget, Carbon $start, Carbon $end): array
{
$limits = $this->blRepository->getBudgetLimits($budget, $start, $end);
if (0 === $limits->count()) {
return $this->getExpenseInRange($budget, $start, $end);
}
$arr = [];
/** @var BudgetLimit $limit */
foreach ($limits as $limit) {
$arr[] = $this->getExpensesForLimit($limit);
}
return $arr;
}
/**
* @param array $budgetNames
* @param array $currencyNames
*
* @return array
*/
private function createSets(array $budgetNames, array $currencyNames): array
{
$return = [];
foreach ($currencyNames as $currencyName) {
$entries = [];
foreach ($budgetNames as $budgetName) {
$label = sprintf('%s (%s)', $budgetName, $currencyName);
$entries[$label] = '0';
}
// left
$return['left'] = [
'label' => sprintf('%s (%s)', trans('firefly.left'), $currencyName),
'data_type' => 'left',
'currency_name' => $currencyName,
'type' => 'bar',
'yAxisID' => 0, // 0, 1, 2
'entries' => $entries,
];
// spent_capped
$return['spent_capped'] = [
'label' => sprintf('%s (%s)', trans('firefly.spent'), $currencyName),
'data_type' => 'spent_capped',
'currency_name' => $currencyName,
'type' => 'bar',
'yAxisID' => 0, // 0, 1, 2
'entries' => $entries,
];
// overspent
$return['overspent'] = [
'label' => sprintf('%s (%s)', trans('firefly.overspent'), $currencyName),
'data_type' => 'overspent',
'currency_name' => $currencyName,
'type' => 'bar',
'yAxisID' => 0, // 0, 1, 2
'entries' => $entries,
];
}
return $return;
}
/**
* @param array $basic
* @param array $sets
*
* @return array
*/
private function fillSets(array $basic, array $sets): array
{
foreach ($sets as $set) {
$label = $set['label'];
//$basic['spent']['entries'][$label] = $set['entries']['spent'];
$basic['spent_capped']['entries'][$label] = $set['entries']['spent_capped'];
$basic['left']['entries'][$label] = $set['entries']['left'];
$basic['overspent']['entries'][$label] = $set['entries']['overspent'];
}
return $basic;
}
/**
* @param array $expenses
*
* @return array
*/
private function filterNulls(array $expenses): array
{
$return = [];
/** @var array|null $arr */
foreach ($expenses as $arr) {
if ([] !== $arr) {
$return[] = $arr;
}
}
return $return;
}
/**
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
private function getExpenseInRange(Budget $budget, Carbon $start, Carbon $end): array
{
$spent = $this->opsRepository->sumExpenses($start, $end, null, new Collection([$budget]), null);
$return = [];
/** @var array $set */
foreach ($spent as $set) {
$current = [
'label' => sprintf('%s (%s)', $budget->name, $set['currency_name']),
'budget_name' => $budget->name,
'start_date' => $start->format('Y-m-d'),
'end_date' => $end->format('Y-m-d'),
'currency_id' => (int) $set['currency_id'],
'currency_code' => $set['currency_code'],
'currency_name' => $set['currency_name'],
'currency_symbol' => $set['currency_symbol'],
'currency_decimal_places' => (int) $set['currency_decimal_places'],
'type' => 'bar', // line, area or bar,
'entries' => [],
];
$sumSpent = bcmul($set['sum'], '-1'); // spent
$current['entries']['spent'] = $sumSpent;
$current['entries']['amount'] = '0';
$current['entries']['spent_capped'] = $sumSpent;
$current['entries']['left'] = '0';
$current['entries']['overspent'] = '0';
$return[] = $current;
}
return $return;
}
/**
* @param BudgetLimit $limit
*
* @return array
*/
private function getExpensesForLimit(BudgetLimit $limit): array
{
$budget = $limit->budget;
$spent = $this->opsRepository->sumExpenses($limit->start_date, $limit->end_date, null, new Collection([$budget]), $limit->transactionCurrency);
$currency = $limit->transactionCurrency;
// when limited to a currency, the count is always one. Or it's empty.
$set = array_shift($spent);
if (null === $set) {
return [];
}
$return = [
'label' => sprintf('%s (%s)', $budget->name, $set['currency_name']),
'budget_name' => $budget->name,
'start_date' => $limit->start_date->format('Y-m-d'),
'end_date' => $limit->end_date->format('Y-m-d'),
'currency_id' => (int) $currency->id,
'currency_code' => $currency->code,
'currency_name' => $currency->name,
'currency_symbol' => $currency->symbol,
'currency_decimal_places' => (int) $currency->decimal_places,
'type' => 'bar', // line, area or bar,
'entries' => [],
];
$sumSpent = bcmul($set['sum'], '-1'); // spent
$return['entries']['spent'] = $sumSpent;
$return['entries']['amount'] = $limit->amount;
$return['entries']['spent_capped'] = 1 === bccomp($sumSpent, $limit->amount) ? $limit->amount : $sumSpent;
$return['entries']['left'] = 1 === bccomp($limit->amount, $sumSpent) ? bcadd($set['sum'], $limit->amount) : '0'; // left
$return['entries']['overspent'] = 1 === bccomp($limit->amount, $sumSpent) ? '0' : bcmul(bcadd($set['sum'], $limit->amount), '-1'); // overspent
return $return;
}
}

View File

@@ -40,11 +40,14 @@ class CategoryController extends Controller
{
/** @var CategoryRepositoryInterface */
private $categoryRepository;
/** @var NoCategoryRepositoryInterface */
private $noCatRepository;
/** @var OperationsRepositoryInterface */
private $opsRepository;
/**
* AccountController constructor.
*
@@ -74,8 +77,6 @@ class CategoryController extends Controller
* @param DateRequest $request
*
* @return JsonResponse
*
* TODO after 4.8,0, simplify
*/
public function overview(DateRequest $request): JsonResponse
{
@@ -89,32 +90,15 @@ class CategoryController extends Controller
$tempData = [];
$spentWith = $this->opsRepository->listExpenses($start, $end);
$earnedWith = $this->opsRepository->listIncome($start, $end);
$spentWithout = $this->noCatRepository->listExpenses($start, $end);
$earnedWithout = $this->noCatRepository->listIncome($start, $end);
$categories = [];
foreach ([$spentWith, $earnedWith, $spentWithout, $earnedWithout] as $set) {
foreach ([$spentWith, $spentWithout, ] as $set) {
foreach ($set as $currency) {
foreach ($currency['categories'] as $category) {
$categories[] = $category['name'];
$inKey = sprintf('%d-i', $currency['currency_id']);
$outKey = sprintf('%d-e', $currency['currency_id']);
// make data arrays if not yet present.
$tempData[$inKey] = $tempData[$inKey] ?? [
'currency_id' => $currency['currency_id'],
'label' => (string) trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
'currency_code' => $currency['currency_code'],
'currency_symbol' => $currency['currency_symbol'],
'currency_decimal_places' => $currency['currency_decimal_places'],
'type' => 'bar', // line, area or bar
'yAxisID' => 0, // 0, 1, 2
'entries' => [
// per category:
// "category" => 5,
],
];
$tempData[$outKey] = $tempData[$outKey] ?? [
'currency_id' => $currency['currency_id'],
'label' => (string) trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
@@ -123,16 +107,12 @@ class CategoryController extends Controller
'currency_decimal_places' => $currency['currency_decimal_places'],
'type' => 'bar', // line, area or bar
'yAxisID' => 0, // 0, 1, 2
'entries' => [
// per category:
// "category" => 5,
],
'entries' => [],
];
foreach ($category['transaction_journals'] as $journal) {
// is it expense or income?
$letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i';
$currentKey = sprintf('%d-%s', $currency['currency_id'], $letter);
$currentKey = sprintf('%d-%s', $currency['currency_id'], 'e');
$name = $category['name'];
$tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0';
$tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']);
@@ -141,49 +121,6 @@ class CategoryController extends Controller
}
}
// foreach ([] as $set) {
// foreach ($set as $currency) {
// $inKey = sprintf('%d-i', $currency['currency_id']);
// $outKey = sprintf('%d-e', $currency['currency_id']);
// $categories[] = (string)trans('firefly.no_category');
// // make data arrays if not yet present.
// $tempData[$inKey] = $tempData[$inKey] ?? [
// 'currency_id' => $currency['currency_id'],
// 'label' => (string)trans('firefly.box_earned_in_currency', ['currency' => $currency['currency_name']]),
// 'currency_code' => $currency['currency_code'],
// 'currency_symbol' => $currency['currency_symbol'],
// 'currency_decimal_places' => $currency['currency_decimal_places'],
// 'type' => 'bar', // line, area or bar
// 'yAxisID' => 0, // 0, 1, 2
// 'entries' => [
// // per category:
// // "category" => 5,
// ],
// ];
// $tempData[$outKey] = $tempData[$outKey] ?? [
// 'currency_id' => $currency['currency_id'],
// 'label' => (string)trans('firefly.box_spent_in_currency', ['currency' => $currency['currency_name']]),
// 'currency_code' => $currency['currency_code'],
// 'currency_symbol' => $currency['currency_symbol'],
// 'currency_decimal_places' => $currency['currency_decimal_places'],
// 'type' => 'bar', // line, area or bar
// 'yAxisID' => 0, // 0, 1, 2
// 'entries' => [
// // per category:
// // "category" => 5,
// ],
// ];
// foreach ($currency['transaction_journals'] as $journal) {
// // is it expense or income?
// $letter = -1 === bccomp($journal['amount'], '0') ? 'e' : 'i';
// $currentKey = sprintf('%d-%s', $currency['currency_id'], $letter);
// $name = (string)trans('firefly.no_category');
// $tempData[$currentKey]['entries'][$name] = $tempData[$currentKey]['entries'][$name] ?? '0';
// $tempData[$currentKey]['entries'][$name] = bcadd($tempData[$currentKey]['entries'][$name], $journal['amount']);
// }
// }
// }
// re-sort every spent array and add 0 for missing entries.
foreach ($tempData as $index => $set) {
$oldSet = $set['entries'];

View File

@@ -37,14 +37,12 @@ use Illuminate\Http\JsonResponse;
*/
class ConfigurationController extends Controller
{
/** @var UserRepositoryInterface The user repository */
private $repository;
/**
* ConfigurationController constructor.
*
*/
public function __construct()
{

View File

@@ -39,18 +39,16 @@ use Symfony\Component\HttpFoundation\ParameterBag;
* Class Controller.
*
* @codeCoverageIgnore
*
*/
class Controller extends BaseController
abstract class Controller extends BaseController
{
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
/** @var ParameterBag Parameters from the URI are stored here. */
protected $parameters;
protected ParameterBag $parameters;
/**
* Controller constructor.
*
*/
public function __construct()
{
@@ -62,9 +60,8 @@ class Controller extends BaseController
* Method to help build URI's.
*
* @return string
*
*/
protected function buildParams(): string
final protected function buildParams(): string
{
$return = '?';
$params = [];
@@ -86,7 +83,7 @@ class Controller extends BaseController
/**
* @return Manager
*/
protected function getManager(): Manager
final protected function getManager(): Manager
{
// create some objects:
$manager = new Manager;

View File

@@ -21,7 +21,6 @@
declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers;
use FireflyIII\Api\V1\Requests\CurrencyRequest;
@@ -64,16 +63,18 @@ use League\Fractal\Resource\Item;
/**
* Class CurrencyController.
*
*/
class CurrencyController extends Controller
{
use AccountFilter, TransactionFilter;
/** @var CurrencyRepositoryInterface The currency repository */
private $repository;
/** @var UserRepositoryInterface The user repository */
private $userRepository;
/**
* CurrencyRepository constructor.
*
@@ -577,6 +578,7 @@ class CurrencyController extends Controller
{
$manager = $this->getManager();
$currency = app('amount')->getDefaultCurrencyByUser(auth()->user());
$this->parameters->set('defaultCurrency', $currency);
/** @var CurrencyTransformer $transformer */
$transformer = app(CurrencyTransformer::class);

View File

@@ -43,9 +43,9 @@ class CurrencyExchangeRateController extends Controller
/** @var CurrencyRepositoryInterface The currency repository */
private $repository;
/**
* CurrencyExchangeRateController constructor.
*
*/
public function __construct()
{

View File

@@ -0,0 +1,278 @@
<?php
/**
* DestroyController.php
* Copyright (c) 2020 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\Data;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\DataDestroyRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\AvailableBudgetRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use FireflyIII\Repositories\Recurring\RecurringRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\AccountDestroyService;
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
use Illuminate\Http\JsonResponse;
/**
* Class DestroyController
*/
class DestroyController extends Controller
{
/**
* @return JsonResponse
*/
public function destroy(DataDestroyRequest $request): JsonResponse
{
$objects = $request->getObjects();
switch ($objects) {
default:
throw new FireflyException(sprintf('This endpoint can\'t handle object "%s"', $objects));
case 'budgets':
$this->destroyBudgets();
break;
case 'bills':
$this->destroyBills();
break;
case 'piggy_banks':
$this->destroyPiggyBanks();
break;
case 'rules':
$this->destroyRules();
break;
case 'recurring':
$this->destroyRecurringTransactions();
break;
case 'categories':
$this->destroyCategories();
break;
case 'tags':
$this->destroyTags();
break;
case 'object_groups':
$this->destroyObjectGroups();
break;
case 'accounts':
$this->destroyAccounts(
[
AccountType::ASSET, AccountType::DEFAULT,
AccountType::BENEFICIARY, AccountType::EXPENSE,
AccountType::REVENUE, AccountType::INITIAL_BALANCE,
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD,
]
);
break;
case 'asset_accounts':
$this->destroyAccounts(
[
AccountType::ASSET, AccountType::DEFAULT,
]
);
break;
case 'expense_accounts':
$this->destroyAccounts(
[
AccountType::BENEFICIARY, AccountType::EXPENSE,
]
);
break;
case 'revenue_accounts':
$this->destroyAccounts(
[
AccountType::REVENUE,
]
);
break;
case 'liabilities':
$this->destroyAccounts(
[
AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE, AccountType::CREDITCARD,
]
);
break;
case 'transactions':
$this->destroyTransactions(
[
TransactionType::WITHDRAWAL,
TransactionType::DEPOSIT,
TransactionType::TRANSFER,
TransactionType::RECONCILIATION,
TransactionType::OPENING_BALANCE,
]
);
break;
case 'withdrawals':
$this->destroyTransactions(
[
TransactionType::WITHDRAWAL,
]
);
break;
case 'deposits':
$this->destroyTransactions(
[
TransactionType::DEPOSIT,
]
);
break;
case 'transfers':
$this->destroyTransactions(
[
TransactionType::TRANSFER,
]
);
break;
}
return response()->json([], 204);
}
/**
* @param array $types
*/
private function destroyAccounts(array $types): void
{
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$collection = $repository->getAccountsByType($types);
$service = app(AccountDestroyService::class);
/** @var Account $account */
foreach ($collection as $account) {
$service->destroy($account, null);
}
}
/**
*
*/
private function destroyBills(): void
{
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->destroyAll();
}
/**
*
*/
private function destroyBudgets(): void
{
/** @var AvailableBudgetRepositoryInterface $abRepository */
$abRepository = app(AvailableBudgetRepositoryInterface::class);
$abRepository->destroyAll();
/** @var BudgetLimitRepositoryInterface $blRepository */
$blRepository = app(BudgetLimitRepositoryInterface::class);
$blRepository->destroyAll();
/** @var BudgetRepositoryInterface $budgetRepository */
$budgetRepository = app(BudgetRepositoryInterface::class);
$budgetRepository->destroyAll();
}
/**
*
*/
private function destroyCategories(): void
{
/** @var CategoryRepositoryInterface $categoryRepos */
$categoryRepos = app(CategoryRepositoryInterface::class);
$categoryRepos->destroyAll();
}
private function destroyObjectGroups(): void
{
/** @var ObjectGroupRepositoryInterface $repository */
$repository = app(ObjectGroupRepositoryInterface::class);
$repository->deleteAll();
}
/**
*
*/
private function destroyPiggyBanks(): void
{
/** @var PiggyBankRepositoryInterface $repository */
$repository = app(PiggyBankRepositoryInterface::class);
$repository->destroyAll();
}
/**
*
*/
private function destroyRecurringTransactions(): void
{
/** @var RecurringRepositoryInterface $repository */
$repository = app(RecurringRepositoryInterface::class);
$repository->destroyAll();
}
/**
*
*/
private function destroyRules(): void
{
/** @var RuleGroupRepositoryInterface $repository */
$repository = app(RuleGroupRepositoryInterface::class);
$repository->destroyAll();
}
/**
*
*/
private function destroyTags(): void
{
/** @var TagRepositoryInterface $tagRepository */
$tagRepository = app(TagRepositoryInterface::class);
$tagRepository->destroyAll();
}
/**
* @param array $types
*/
private function destroyTransactions(array $types): void
{
/** @var JournalRepositoryInterface $repository */
$repository = app(JournalRepositoryInterface::class);
$journals = $repository->findByType($types);
$service = app(JournalDestroyService::class);
/** @var TransactionJournal $journal */
foreach($journals as $journal) {
$service->destroy($journal);
}
}
}

View File

@@ -1,181 +0,0 @@
<?php
/**
* ImportController.php
* Copyright (c) 2019 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;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\ImportJob;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\ImportJobTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
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;
/**
* Class ImportController
*
* @deprecated
* @codeCoverageIgnore
*/
class ImportController extends Controller
{
use TransactionFilter;
/** @var ImportJobRepositoryInterface Import job repository. */
private $repository;
/**
* ImportController constructor.
*
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(ImportJobRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* @return JsonResponse
* @codeCoverageIgnore
*/
public function listAll(): JsonResponse
{
// create some objects:
$manager = $this->getManager();
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
// get list of accounts. Count it and split it.
$collection = $this->repository->get();
$count = $collection->count();
$importJobs = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// make paginator:
$paginator = new LengthAwarePaginator($importJobs, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.import.list') . $this->buildParams());
/** @var ImportJobTransformer $transformer */
$transformer = app(ImportJobTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($importJobs, $transformer, 'import_jobs');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* @param ImportJob $importJob
*
* @return JsonResponse
* @codeCoverageIgnore
*/
public function show(ImportJob $importJob): JsonResponse
{
$manager = $this->getManager();
/** @var ImportJobTransformer $transformer */
$transformer = app(ImportJobTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($importJob, $transformer, 'import_jobs');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* Show all transactions
*
* @param Request $request
* @param ImportJob $importJob
*
* @return JsonResponse
* @codeCoverageIgnore
*/
public function transactions(Request $request, ImportJob $importJob): JsonResponse
{
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$type = $request->get('type') ?? 'default';
$this->parameters->set('type', $type);
$types = $this->mapTransactionTypes($this->parameters->get('type'));
$manager = $this->getManager();
$tag = $importJob->tag;
$transactions = new Collection();
$paginator = new LengthAwarePaginator($transactions, 0, $pageSize);
$paginator->setPath(route('api.v1.import.transactions', [$importJob->key]) . $this->buildParams());
if (null !== $tag) {
/** @var User $admin */
$admin = auth()->user();
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector
->setUser($admin)
// filter on tag.
->setTag($tag)
// all info needed for the API:
->withAPIInformation()
// set page size:
->setLimit($pageSize)
// set page to retrieve
->setPage($this->parameters->get('page'))
// set types of transactions to return.
->setTypes($types);
if (null !== $this->parameters->get('start') && null !== $this->parameters->get('end')) {
$collector->setRange($this->parameters->get('start'), $this->parameters->get('end'));
}
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.transactions.index') . $this->buildParams());
$transactions = $paginator->getCollection();
}
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
}

View File

@@ -42,17 +42,18 @@ use League\Fractal\Resource\Item;
/**
* Class LinkTypeController.
*
*/
class LinkTypeController extends Controller
{
use TransactionFilter;
/** @var LinkTypeRepositoryInterface The link type repository */
private $repository;
/** @var UserRepositoryInterface The user repository */
private $userRepository;
/**
* LinkTypeController constructor.
*

View File

@@ -0,0 +1,195 @@
<?php
/**
* GroupController.php
* Copyright (c) 2019 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;
use FireflyIII\Api\V1\Requests\ObjectGroupUpdateRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\ObjectGroup;
use FireflyIII\Repositories\ObjectGroup\ObjectGroupRepositoryInterface;
use FireflyIII\Transformers\ObjectGroupTransformer;
use FireflyIII\Transformers\PiggyBankTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Pagination\LengthAwarePaginator;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
/**
* Class GroupController.
*/
class ObjectGroupController extends Controller
{
private ObjectGroupRepositoryInterface $repository;
/**
* ObjectGroupController constructor.
*
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
/** @var User $user */
$user = auth()->user();
$this->repository = app(ObjectGroupRepositoryInterface::class);
$this->repository->setUser($user);
return $next($request);
}
);
}
/**
* Remove the specified resource from storage.
*
* @param ObjectGroup $objectGroup
*
* @codeCoverageIgnore
* @return JsonResponse
*/
public function delete(ObjectGroup $objectGroup): JsonResponse
{
$this->repository->destroy($objectGroup);
return response()->json([], 204);
}
/**
* Display a listing of the resource.
*
* @param Request $request
*
* @codeCoverageIgnore
* @return JsonResponse
*/
public function index(Request $request): JsonResponse
{
$manager = $this->getManager();
// types to get, page size:
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
// get list of accounts. Count it and split it.
$collection = $this->repository->get();
$count = $collection->count();
$objectGroups = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// make paginator:
$paginator = new LengthAwarePaginator($objectGroups, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.object-groups.index') . $this->buildParams());
/** @var ObjectGroupTransformer $transformer */
$transformer = app(ObjectGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($objectGroups, $transformer, 'object_groups');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* List all piggies under the object group.
*
* @param ObjectGroup $objectGroup
*
* @return JsonResponse
* @codeCoverageIgnore
*/
public function piggyBanks(ObjectGroup $objectGroup): JsonResponse
{
// create some objects:
$manager = $this->getManager();
// types to get, page size:
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
// get list of piggy banks. Count it and split it.
$collection = $this->repository->getPiggyBanks($objectGroup);
$count = $collection->count();
$piggyBanks = $collection->slice(($this->parameters->get('page') - 1) * $pageSize, $pageSize);
// make paginator:
$paginator = new LengthAwarePaginator($piggyBanks, $count, $pageSize, $this->parameters->get('page'));
$paginator->setPath(route('api.v1.object-groups.piggy_banks', [$objectGroup->id]) . $this->buildParams());
/** @var PiggyBankTransformer $transformer */
$transformer = app(PiggyBankTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($piggyBanks, $transformer, 'piggy_banks');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* Show single instance.
*
* @param ObjectGroup $objectGroup
*
* @return JsonResponse
*/
public function show(ObjectGroup $objectGroup): JsonResponse
{
$manager = $this->getManager();
/** @var ObjectGroupTransformer $transformer */
$transformer = app(ObjectGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($objectGroup, $transformer, 'object_groups');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* Update object.
*
* @param ObjectGroupUpdateRequest $request
* @param Account $account
*
* @return JsonResponse
*/
public function update(ObjectGroupUpdateRequest $request, ObjectGroup $objectGroup): JsonResponse
{
$data = $request->getUpdateData();
$this->repository->update($objectGroup, $data);
$this->repository->sort();
$manager = $this->getManager();
/** @var ObjectGroupTransformer $transformer */
$transformer = app(ObjectGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Item($objectGroup, $transformer, 'object_groups');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
}

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers;
use FireflyIII\Api\V1\Requests\PiggyBankRequest;
use FireflyIII\Api\V1\Requests\PiggyBankStoreRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
@@ -39,14 +40,13 @@ use League\Fractal\Resource\Item;
/**
* Class PiggyBankController.
*
*/
class PiggyBankController extends Controller
{
/** @var PiggyBankRepositoryInterface The piggy bank repository */
private $repository;
/**
* PiggyBankController constructor.
*
@@ -204,12 +204,12 @@ class PiggyBankController extends Controller
/**
* Store new object.
*
* @param PiggyBankRequest $request
* @param PiggyBankStoreRequest $request
*
* @throws FireflyException
* @return JsonResponse
*/
public function store(PiggyBankRequest $request): JsonResponse
public function store(PiggyBankStoreRequest $request): JsonResponse
{
$piggyBank = $this->repository->store($request->getAll());
$manager = $this->getManager();
@@ -240,7 +240,6 @@ class PiggyBankController extends Controller
$this->repository->setCurrentAmount($piggyBank, $data['current_amount']);
}
$manager = $this->getManager();
/** @var PiggyBankTransformer $transformer */
$transformer = app(PiggyBankTransformer::class);

View File

@@ -35,7 +35,6 @@ use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
/**
*
* Class PreferenceController
*/
class PreferenceController extends Controller

View File

@@ -48,9 +48,11 @@ use Log;
class RecurrenceController extends Controller
{
use TransactionFilter;
/** @var RecurringRepositoryInterface The recurring transaction repository */
private $repository;
/**
* RecurrenceController constructor.
*
@@ -236,7 +238,7 @@ class RecurrenceController extends Controller
$result = $recurring->fire();
} catch (FireflyException $e) {
Log::error($e->getMessage());
throw new FireflyException('200022: Error in cron job.');
throw new FireflyException('200022: Error in cron job.',0, $e);
}
if (false === $result) {
return response()->json([], 204);

View File

@@ -46,15 +46,16 @@ use Log;
/**
* Class RuleController
*
*/
class RuleController extends Controller
{
/** @var AccountRepositoryInterface Account repository */
private $accountRepository;
/** @var RuleRepositoryInterface The rule repository */
private $ruleRepository;
/**
* RuleController constructor.
*

View File

@@ -54,9 +54,11 @@ class RuleGroupController extends Controller
{
/** @var AccountRepositoryInterface Account repository */
private $accountRepository;
/** @var RuleGroupRepositoryInterface The rule group repository */
private $ruleGroupRepository;
/**
* RuleGroupController constructor.
*

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
* AccountController.php
* Copyright (c) 2019 james@firefly-iii.org
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -20,6 +20,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Search;
use FireflyIII\Api\V1\Controllers\Controller;
@@ -41,8 +43,8 @@ class AccountController extends Controller
{
use AccountFilter;
/** @var array */
private $validFields;
private array $validFields;
public function __construct()
{

View File

@@ -1,8 +1,8 @@
<?php
declare(strict_types=1);
/**
* TransactionController.php
* Copyright (c) 2019 james@firefly-iii.org
* Copyright (c) 2020 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
@@ -20,45 +20,51 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers\Search;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Support\Search\SearchInterface;
use FireflyIII\Transformers\TransactionGroupTransformer;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection;
/**
* Class TransactionController
*/
class TransactionController extends Controller
{
/** @var string */
public const SEARCH_ALL = 'all';
/** @var string */
public const SEARCH_DESCRIPTION = 'description';
/** @var string */
public const SEARCH_NOTES = 'notes';
/** @var string */
public const SEARCH_ACCOUNTS = 'accounts';
/** @var array */
private $validFields;
public function __construct()
{
parent::__construct();
$this->validFields = [
self::SEARCH_ALL,
self::SEARCH_DESCRIPTION,
self::SEARCH_NOTES,
self::SEARCH_ACCOUNTS,
];
}
/**
* @param Request $request
* @param Request $request
* @param SearchInterface $searcher
*
* @return void
* @return JsonResponse
*/
public function search(Request $request): void
public function search(Request $request, SearchInterface $searcher): JsonResponse
{
die('the route is present but nobody\'s home.');
$manager = $this->getManager();
$fullQuery = (string) $request->get('query');
$page = 0 === (int) $request->get('page') ? 1 : (int) $request->get('page');
$searcher->parseQuery($fullQuery);
$searcher->setPage($page);
$searcher->setLimit((int) config('firefly.search_result_limit'));
$groups = $searcher->searchTransactions();
$parameters = ['search' => $fullQuery];
$url = route('api.v1.search.transactions') . '?' . http_build_query($parameters);
$groups->setPath($url);
$transactions = $groups->getCollection();
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new Collection($transactions, $transformer, 'transactions');
$resource->setPaginator(new IlluminatePaginatorAdapter($groups));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
}

View File

@@ -1,113 +0,0 @@
<?php
declare(strict_types=1);
/**
* TransferController.php
* Copyright (c) 2019 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace FireflyIII\Api\V1\Controllers\Search;
use FireflyIII\Api\V1\Controllers\Controller;
use FireflyIII\Api\V1\Requests\Search\TransferRequest;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Support\Search\TransferSearch;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Response;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
/**
* Class TransferController
*/
class TransferController extends Controller
{
/**
* @param TransferRequest $request
*
* @return JsonResponse|Response
*/
public function search(TransferRequest $request)
{
// configure transfer search to search for a > b
$search = app(TransferSearch::class);
$search->setSource($request->get('source'));
$search->setDestination($request->get('destination'));
$search->setAmount($request->get('amount'));
$search->setDescription($request->get('description'));
$search->setDate($request->get('date'));
$left = $search->search();
// configure transfer search to search for b > a
$search->setSource($request->get('destination'));
$search->setDestination($request->get('source'));
$search->setAmount($request->get('amount'));
$search->setDescription($request->get('description'));
$search->setDate($request->get('date'));
$right = $search->search();
// add parameters to URL:
$this->parameters->set('source', $request->get('source'));
$this->parameters->set('destination', $request->get('destination'));
$this->parameters->set('amount', $request->get('amount'));
$this->parameters->set('description', $request->get('description'));
$this->parameters->set('date', $request->get('date'));
// get all journal ID's.
$total = $left->merge($right)->unique('id')->pluck('id')->toArray();
if (0 === count($total)) {
// forces search to be empty.
$total = [-1];
}
// collector to return results.
$pageSize = (int) app('preferences')->getForUser(auth()->user(), 'listPageSize', 50)->data;
$manager = $this->getManager();
/** @var User $admin */
$admin = auth()->user();
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector
->setUser($admin)
// all info needed for the API:
->withAPIInformation()
// set page size:
->setLimit($pageSize)
// set page to retrieve
->setPage(1)
->setJournalIds($total);
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.search.transfers') . $this->buildParams());
$transactions = $paginator->getCollection();
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
}

View File

@@ -49,18 +49,23 @@ class SummaryController extends Controller
{
/** @var AvailableBudgetRepositoryInterface */
private $abRepository;
/** @var AccountRepositoryInterface */
private $accountRepository;
/** @var BillRepositoryInterface */
private $billRepository;
/** @var BudgetRepositoryInterface */
private $budgetRepository;
/** @var CurrencyRepositoryInterface */
private $currencyRepos;
/** @var OperationsRepositoryInterface */
private $opsRepository;
/**
* SummaryController constructor.
*

View File

@@ -23,8 +23,6 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers;
use Carbon\Carbon;
use FireflyIII\Api\V1\Requests\DateRequest;
use FireflyIII\Api\V1\Requests\TagStoreRequest;
use FireflyIII\Api\V1\Requests\TagUpdateRequest;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
@@ -38,7 +36,6 @@ use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
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;
@@ -53,6 +50,7 @@ class TagController extends Controller
/** @var TagRepositoryInterface The tag repository */
private $repository;
/**
* TagController constructor.
*
@@ -74,25 +72,6 @@ class TagController extends Controller
);
}
/**
* @param DateRequest $request
*
* @return JsonResponse
*/
public function cloud(DateRequest $request): JsonResponse
{
// parameters for boxes:
$dates = $request->getAll();
$start = $dates['start'];
$end = $dates['end'];
// get all tags:
$tags = $this->repository->get();
$cloud = $this->getTagCloud($tags, $start, $end);
return response()->json($cloud);
}
/**
* Delete the resource.
*
@@ -284,56 +263,4 @@ class TagController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* @param array $cloud
* @param float $min
* @param float $max
*
* @return array
*/
private function analyseTagCloud(array $cloud, float $min, float $max): array
{
foreach (array_keys($cloud['tags']) as $index) {
$cloud['tags'][$index]['relative'] = round($cloud['tags'][$index]['size'] / $max, 4);
}
$cloud['min'] = $min;
$cloud['max'] = $max;
return $cloud;
}
/**
* @param Collection $tags
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
private function getTagCloud(Collection $tags, Carbon $start, Carbon $end): array
{
$min = null;
$max = 0;
$cloud = [
'tags' => [],
];
/** @var Tag $tag */
foreach ($tags as $tag) {
$earned = (float) $this->repository->earnedInPeriod($tag, $start, $end);
$spent = (float) $this->repository->spentInPeriod($tag, $start, $end);
$size = ($spent * -1) + $earned;
$min = $min ?? $size;
if ($size > 0) {
$max = $size > $max ? $size : $max;
$cloud['tags'][] = [
'tag' => $tag->tag,
'id' => $tag->id,
'size' => $size,
];
}
}
$cloud = $this->analyseTagCloud($cloud, $min, $max);
return $cloud;
}
}

View File

@@ -40,6 +40,7 @@ use FireflyIII\Support\Http\Api\TransactionFilter;
use FireflyIII\Transformers\AttachmentTransformer;
use FireflyIII\Transformers\PiggyBankEventTransformer;
use FireflyIII\Transformers\TransactionGroupTransformer;
use FireflyIII\Transformers\TransactionLinkTransformer;
use FireflyIII\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
@@ -57,12 +58,12 @@ class TransactionController extends Controller
{
use TransactionFilter;
/** @var TransactionGroupRepositoryInterface Group repository. */
private $groupRepository;
/** @var JournalAPIRepositoryInterface Journal API repos */
private $journalAPIRepository;
/** @var JournalRepositoryInterface The journal repository */
private $repository;
private TransactionGroupRepositoryInterface $groupRepository;
private JournalAPIRepositoryInterface $journalAPIRepository;
private JournalRepositoryInterface $repository;
/**
* TransactionController constructor.
@@ -112,6 +113,26 @@ class TransactionController extends Controller
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* @param TransactionJournal $transactionJournal
*
* @return JsonResponse
* @codeCoverageIgnore
*/
public function transactionLinks(TransactionJournal $transactionJournal): JsonResponse
{
$manager = $this->getManager();
$journalLinks = $this->journalAPIRepository->getJournalLinks($transactionJournal);
/** @var TransactionLinkTransformer $transformer */
$transformer = app(TransactionLinkTransformer::class);
$transformer->setParameters($this->parameters);
$resource = new FractalCollection($journalLinks, $transformer, 'transaction_links');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', 'application/vnd.api+json');
}
/**
* Remove the specified resource from storage.
*
@@ -269,8 +290,8 @@ class TransactionController extends Controller
*
* @param TransactionStoreRequest $request
*
* @throws FireflyException
* @return JsonResponse
* @throws FireflyException
*/
public function store(TransactionStoreRequest $request): JsonResponse
{

View File

@@ -47,9 +47,11 @@ class TransactionLinkController extends Controller
/** @var JournalRepositoryInterface The journal repository */
private $journalRepository;
/** @var LinkTypeRepositoryInterface The link type repository */
private $repository;
/**
* TransactionLinkController constructor.
*

View File

@@ -39,13 +39,11 @@ use League\Fractal\Resource\Item;
/**
* Class UserController.
*
*/
class UserController extends Controller
{
private UserRepositoryInterface $repository;
/** @var UserRepositoryInterface The user repository */
private $repository;
/**
* UserController constructor.

View File

@@ -48,12 +48,9 @@ class ApiDemoUser
if (null === $user) {
return $next($request);
}
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if ($repository->hasRole($user, 'demo')) {
if ($user->hasRole('demo')) {
return response('', 403);
}
return $next($request);

View File

@@ -26,14 +26,18 @@ namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\Location;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\AppendsLocationData;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class AccountStoreRequest
*
* @codeCoverageIgnore
*/
class AccountStoreRequest extends Request
class AccountStoreRequest extends FormRequest
{
use ConvertsDataTypes, AppendsLocationData;
/**
* Authorize logged in users.
@@ -66,6 +70,7 @@ class AccountStoreRequest extends Request
'account_type' => $this->string('type'),
'account_type_id' => null,
'currency_id' => $this->integer('currency_id'),
'order' => $this->integer('order'),
'currency_code' => $this->string('currency_code'),
'virtual_balance' => $this->string('virtual_balance'),
'iban' => $this->string('iban'),
@@ -75,7 +80,7 @@ class AccountStoreRequest extends Request
'opening_balance' => $this->string('opening_balance'),
'opening_balance_date' => $this->date('opening_balance_date'),
'cc_type' => $this->string('credit_card_type'),
'cc_Monthly_payment_date' => $this->string('monthly_payment_date'),
'cc_monthly_payment_date' => $this->string('monthly_payment_date'),
'notes' => $this->nlString('notes'),
'interest' => $this->string('interest'),
'interest_period' => $this->string('interest_period'),
@@ -112,6 +117,7 @@ class AccountStoreRequest extends Request
'opening_balance' => 'numeric|required_with:opening_balance_date|nullable',
'opening_balance_date' => 'date|required_with:opening_balance|nullable',
'virtual_balance' => 'numeric|nullable',
'order' => 'numeric|nullable',
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'active' => [new IsBoolean],

View File

@@ -26,15 +26,18 @@ namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\Location;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\AppendsLocationData;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class AccountUpdateRequest
*
* @codeCoverageIgnore
*/
class AccountUpdateRequest extends Request
class AccountUpdateRequest extends FormRequest
{
use ConvertsDataTypes, AppendsLocationData;
/**
* Authorize logged in users.
*
@@ -66,6 +69,7 @@ class AccountUpdateRequest extends Request
'account_type' => $this->nullableString('type'),
'account_type_id' => null,
'currency_id' => $this->nullableInteger('currency_id'),
'order' => $this->integer('order'),
'currency_code' => $this->nullableString('currency_code'),
'virtual_balance' => $this->nullableString('virtual_balance'),
'iban' => $this->nullableString('iban'),
@@ -75,7 +79,7 @@ class AccountUpdateRequest extends Request
'opening_balance' => $this->nullableString('opening_balance'),
'opening_balance_date' => $this->date('opening_balance_date'),
'cc_type' => $this->nullableString('credit_card_type'),
'cc_Monthly_payment_date' => $this->nullableString('monthly_payment_date'),
'cc_monthly_payment_date' => $this->nullableString('monthly_payment_date'),
'notes' => $this->nullableNlString('notes'),
'interest' => $this->nullableString('interest'),
'interest_period' => $this->nullableString('interest_period'),
@@ -114,6 +118,7 @@ class AccountUpdateRequest extends Request
'opening_balance' => 'numeric|required_with:opening_balance_date|nullable',
'opening_balance_date' => 'date|required_with:opening_balance|nullable',
'virtual_balance' => 'numeric|nullable',
'order' => 'numeric|nullable',
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'active' => [new IsBoolean],

View File

@@ -24,14 +24,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsValidAttachmentModel;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class AttachmentStoreRequest
*
* @codeCoverageIgnore
*/
class AttachmentStoreRequest extends Request
class AttachmentStoreRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -23,13 +23,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* ClassAttachmentUpdateRequest
*
* @codeCoverageIgnore
*/
class AttachmentUpdateRequest extends Request
class AttachmentUpdateRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -0,0 +1,78 @@
<?php
/**
* AutocompleteRequest.php
* Copyright (c) 2020 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\Requests\Autocomplete;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class AutocompleteRequest
*/
class AutocompleteRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
* @return bool
*/
public function authorize(): bool
{
// Only allow authenticated users
return auth()->check();
}
/**
* @return array
*/
public function getData(): array
{
$types = $this->string('types');
$array = [];
if ('' !== $types) {
$array = explode(',', $types);
}
$limit = $this->integer('limit');
$limit = 0 === $limit ? 10 : $limit;
return [
'types' => $array,
'query' => $this->string('query'),
'date' => $this->date('date'),
'limit' => $limit,
];
}
/**
* @return array
*/
public function rules(): array
{
return [
'limit' => 'min:0|max:1337',
];
}
}

View File

@@ -23,13 +23,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class AvailableBudgetRequest
*
* @codeCoverageIgnore
*/
class AvailableBudgetRequest extends Request
class AvailableBudgetRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -67,7 +71,7 @@ class AvailableBudgetRequest extends Request
return [
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'amount' => 'required|numeric|more:0',
'amount' => 'required|numeric|gt:0',
'start' => 'required|date|before:end',
'end' => 'required|date|after:start',
];

View File

@@ -25,6 +25,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
/**
@@ -34,9 +36,9 @@ use Illuminate\Validation\Validator;
*
* @codeCoverageIgnore
*/
class BillRequest extends Request
class BillRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -70,6 +72,7 @@ class BillRequest extends Request
'repeat_freq' => $this->string('repeat_freq'),
'skip' => $this->integer('skip'),
'active' => $active,
'order' => $this->integer('order'),
'notes' => $this->nlString('notes'),
];
}
@@ -78,18 +81,17 @@ class BillRequest extends Request
* The rules that the incoming request must be matched against.
*
* @return array
*
*/
public function rules(): array
{
$rules = [
'name' => 'required|between:1,255|uniqueObjectForUser:bills,name',
'amount_min' => 'required|numeric|more:0',
'amount_max' => 'required|numeric|more:0',
'name' => 'between:1,255|uniqueObjectForUser:bills,name',
'amount_min' => 'numeric|gt:0',
'amount_max' => 'numeric|gt:0',
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'date' => 'required|date',
'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',
'date' => 'date',
'repeat_freq' => 'in:weekly,monthly,quarterly,half-year,yearly',
'skip' => 'between:0,31',
'active' => [new IsBoolean],
'notes' => 'between:1,65536',

View File

@@ -23,14 +23,19 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class BudgetLimitRequest
*
* @codeCoverageIgnore
* TODO AFTER 4.8,0: split this into two request classes.
*/
class BudgetLimitRequest extends Request
class BudgetLimitRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -49,7 +54,7 @@ class BudgetLimitRequest extends Request
*/
public function getAll(): array
{
return [
$data = [
'budget_id' => $this->integer('budget_id'),
'start' => $this->date('start'),
'end' => $this->date('end'),
@@ -57,6 +62,12 @@ class BudgetLimitRequest extends Request
'currency_id' => $this->integer('currency_id'),
'currency_code' => $this->string('currency_code'),
];
// if request has a budget already, drop the rule.
$budget = $this->route()->parameter('budget');
if (null !== $budget) {
$data['budget_id'] = $budget->id;
}
return $data;
}
/**
@@ -70,7 +81,7 @@ class BudgetLimitRequest extends Request
'budget_id' => 'required|exists:budgets,id|belongsToUser:budgets,id',
'start' => 'required|before:end|date',
'end' => 'required|after:start|date',
'amount' => 'required|more:0',
'amount' => 'required|gt:0',
'currency_id' => 'numeric|exists:transaction_currencies,id',
'currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
];

View File

@@ -24,6 +24,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
/**
@@ -31,8 +34,9 @@ use Illuminate\Validation\Validator;
*
* @codeCoverageIgnore
*/
class BudgetStoreRequest extends Request
class BudgetStoreRequest extends FormRequest
{
use ConvertsDataTypes, ValidatesAutoBudgetRequest;
/**
* Authorize logged in users.
*

View File

@@ -24,6 +24,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\AutoBudget\ValidatesAutoBudgetRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
/**
@@ -31,8 +34,9 @@ use Illuminate\Validation\Validator;
*
* @codeCoverageIgnore
*/
class BudgetUpdateRequest extends Request
class BudgetUpdateRequest extends FormRequest
{
use ConvertsDataTypes, ValidatesAutoBudgetRequest;
/**
* Authorize logged in users.
*

View File

@@ -24,6 +24,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\Category;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class CategoryRequest
@@ -31,8 +33,9 @@ use FireflyIII\Models\Category;
* @codeCoverageIgnore
* TODO AFTER 4.8,0: split this into two request classes.
*/
class CategoryRequest extends Request
class CategoryRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -25,15 +25,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class ConfigurationRequest
*
* @codeCoverageIgnore
*/
class ConfigurationRequest extends Request
class ConfigurationRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -24,6 +24,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
@@ -32,8 +34,9 @@ use FireflyIII\Rules\IsBoolean;
* @codeCoverageIgnore
* TODO AFTER 4.8,0: split this into two request classes.
*/
class CurrencyRequest extends Request
class CurrencyRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -0,0 +1,70 @@
<?php
/**
* DataDestroyRequest.php
* Copyright (c) 2020 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\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class DataDestroyRequest
*/
class DataDestroyRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
* @return bool
*/
public function authorize(): bool
{
// Only allow authenticated users
return auth()->check() && !auth()->user()->hasRole('demo');
}
/**
* Get all data from the request.
*
* @return string
*/
public function getObjects(): string
{
return $this->get('objects') ?? '';
}
/**
* The rules that the incoming request must be matched against.
*
* @return array
*/
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';
return [
'objects' => sprintf('min:1|string|in:%s', $valid),
];
}
}

View File

@@ -25,13 +25,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Request class for end points that require date parameters.
*
* Class DateRequest
*/
class DateRequest extends Request
class DateRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -24,17 +24,19 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\LinkType;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
/**
*
* Class LinkTypeRequest
*
* @codeCoverageIgnore
* TODO AFTER 4.8,0: split this into two request classes.
*/
class LinkTypeRequest extends Request
class LinkTypeRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -1,7 +1,7 @@
<?php
declare(strict_types=1);
/**
* TransferRequest.php
* ObjectGroupUpdateRequest.php
* Copyright (c) 2019 james@firefly-iii.org
*
* This file is part of Firefly III (https://github.com/firefly-iii).
@@ -20,16 +20,21 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
namespace FireflyIII\Api\V1\Requests\Search;
declare(strict_types=1);
use FireflyIII\Api\V1\Requests\Request;
use FireflyIII\Rules\IsTransferAccount;
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class TransferRequest
* Class AccountObjectGroupUpdateRequestUpdateRequest
*
* @codeCoverageIgnore
*/
class TransferRequest extends Request
class ObjectGroupUpdateRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -44,14 +49,26 @@ class TransferRequest extends Request
/**
* @return array
*/
public function rules(): array
public function getUpdateData(): array
{
return [
'source' => ['required', new IsTransferAccount],
'destination' => ['required', new IsTransferAccount],
'amount' => 'required|numeric|more:0',
'description' => 'required|min:1',
'date' => 'required|date',
'title' => $this->string('title'),
'order' => $this->integer('order'),
];
}
/**
* The rules that the incoming request must be matched against.
*
* @return array
*/
public function rules(): array
{
$objectGroup = $this->route()->parameter('objectGroup');
return [
'title' => sprintf('min:1|uniqueObjectGroup:%d', $objectGroup->id),
'order' => 'numeric',
];
}
}

View File

@@ -27,16 +27,19 @@ use FireflyIII\Models\PiggyBank;
use FireflyIII\Rules\IsAssetAccountId;
use FireflyIII\Rules\LessThanPiggyTarget;
use FireflyIII\Rules\ZeroOrMore;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
*
* Class PiggyBankRequest
*
* @codeCoverageIgnore
* TODO AFTER 4.8,0: split this into two request classes.
*/
class PiggyBankRequest extends Request
class PiggyBankRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -63,6 +66,7 @@ class PiggyBankRequest extends Request
'startdate' => $this->date('start_date'),
'targetdate' => $this->date('target_date'),
'notes' => $this->nlString('notes'),
'order' => $this->integer('order'),
];
}
@@ -90,7 +94,7 @@ class PiggyBankRequest extends Request
$piggyBank = $this->route()->parameter('piggyBank');
$rules['name'] = 'between:1,255|uniquePiggyBankForUser:' . $piggyBank->id;
$rules['account_id'] = ['belongsToUser:accounts', new IsAssetAccountId];
$rules['target_amount'] = 'numeric|more:0';
$rules['target_amount'] = 'numeric|gt:0';
$rules['current_amount'] = ['numeric', new ZeroOrMore, new LessThanPiggyTarget];
break;
}

View File

@@ -0,0 +1,88 @@
<?php
/**
* PiggyBankStoreRequest.php
* Copyright (c) 2019 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\Requests;
use FireflyIII\Rules\ZeroOrMore;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class PiggyBankStoreRequest
*
* @codeCoverageIgnore
*/
class PiggyBankStoreRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
* @return bool
*/
public function authorize(): bool
{
// Only allow authenticated users
return auth()->check();
}
/**
* Get all data from the request.
*
* @return array
*/
public function getAll(): array
{
return [
'name' => $this->string('name'),
'account_id' => $this->integer('account_id'),
'targetamount' => $this->string('target_amount'),
'current_amount' => $this->string('current_amount'),
'startdate' => $this->date('start_date'),
'targetdate' => $this->date('target_date'),
'notes' => $this->nlString('notes'),
'object_group_id' => $this->integer('object_group_id'),
'object_group' => $this->string('object_group_name'),
];
}
/**
* The rules that the incoming request must be matched against.
*
* @return array
*/
public function rules(): array
{
return [
'name' => 'required|between:1,255|uniquePiggyBankForUser',
'current_amount' => ['numeric', new ZeroOrMore, 'lte:target_amount'],
'account_id' => 'required|numeric|belongsToUser:accounts,id',
'object_group_id' => 'numeric|belongsToUser:object_groups,id',
'target_amount' => ['numeric', new ZeroOrMore, 'lte:target_amount', 'required'],
'start_date' => 'date|nullable',
'target_date' => 'date|nullable|after:start_date',
'notes' => 'max:65000',
];
}
}

View File

@@ -23,15 +23,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
*
* Class PreferenceRequest
*
* @codeCoverageIgnore
*/
class PreferenceRequest extends Request
class PreferenceRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.

View File

@@ -26,18 +26,20 @@ namespace FireflyIII\Api\V1\Requests;
use Carbon\Carbon;
use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Support\Request\GetRecurrenceData;
use FireflyIII\Validation\CurrencyValidation;
use FireflyIII\Validation\RecurrenceValidation;
use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
/**
* Class RecurrenceStoreRequest
*/
class RecurrenceStoreRequest extends Request
class RecurrenceStoreRequest extends FormRequest
{
use RecurrenceValidation, TransactionValidation, CurrencyValidation;
use ConvertsDataTypes, RecurrenceValidation, TransactionValidation, CurrencyValidation, GetRecurrenceData;
/**
* Authorize logged in users.
*
@@ -104,8 +106,8 @@ class RecurrenceStoreRequest extends Request
'repetitions.*.skip' => 'required|numeric|between:0,31',
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|more:0',
'transactions.*.foreign_amount' => 'numeric|more:0',
'transactions.*.amount' => 'required|numeric|gt:0',
'transactions.*.foreign_amount' => 'numeric|gt:0',
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',

View File

@@ -26,17 +26,20 @@ namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\Recurrence;
use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Support\Request\GetRecurrenceData;
use FireflyIII\Validation\CurrencyValidation;
use FireflyIII\Validation\RecurrenceValidation;
use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
/**
* Class RecurrenceUpdateRequest
*/
class RecurrenceUpdateRequest extends Request
class RecurrenceUpdateRequest extends FormRequest
{
use RecurrenceValidation, TransactionValidation, CurrencyValidation;
use ConvertsDataTypes, RecurrenceValidation, TransactionValidation, CurrencyValidation, GetRecurrenceData;
/**
* Authorize logged in users.
@@ -107,8 +110,8 @@ class RecurrenceUpdateRequest extends Request
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|more:0',
'transactions.*.foreign_amount' => 'numeric|more:0',
'transactions.*.amount' => 'required|numeric|gt:0',
'transactions.*.foreign_amount' => 'numeric|gt:0',
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
@@ -154,16 +157,16 @@ class RecurrenceUpdateRequest extends Request
/**
* Returns the repetition data as it is found in the submitted data.
*
* @return array|null
* @return array
*/
private function getRepetitionData(): ?array
private function getRepetitionData(): array
{
$return = [];
// repetition data:
/** @var array $repetitions */
$repetitions = $this->get('repetitions');
if (null === $repetitions) {
return null;
return [];
}
/** @var array $repetition */
foreach ($repetitions as $repetition) {
@@ -182,16 +185,16 @@ class RecurrenceUpdateRequest extends Request
* Returns the transaction data as it is found in the submitted data. It's a complex method according to code
* standards but it just has a lot of ??-statements because of the fields that may or may not exist.
*
* @return array|null
* @return array
*/
private function getTransactionData(): ?array
private function getTransactionData(): array
{
$return = [];
// transaction data:
/** @var array $transactions */
$transactions = $this->get('transactions');
if (null === $transactions) {
return null;
return [];
}
/** @var array $transaction */
foreach ($transactions as $transaction) {

View File

@@ -25,6 +25,8 @@ namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
@@ -32,8 +34,9 @@ use FireflyIII\Rules\IsBoolean;
* Class RuleGroupRequest
* TODO AFTER 4.8,0: split this into two request classes.
*/
class RuleGroupRequest extends Request
class RuleGroupRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -22,7 +22,6 @@
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -30,14 +29,17 @@ use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Log;
/**
* Class RuleGroupTestRequest
*/
class RuleGroupTestRequest extends Request
class RuleGroupTestRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -22,7 +22,6 @@
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -30,14 +29,17 @@ use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Log;
/**
* Class RuleGroupTriggerRequest
*/
class RuleGroupTriggerRequest extends Request
class RuleGroupTriggerRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -24,16 +24,18 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
use function is_array;
/**
* Class RuleStoreRequest
*
*/
class RuleStoreRequest extends Request
class RuleStoreRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -22,7 +22,6 @@
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -30,14 +29,17 @@ use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Log;
/**
* Class RuleTestRequest
*/
class RuleTestRequest extends Request
class RuleTestRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -29,14 +29,17 @@ use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Collection;
use Log;
/**
* Class RuleTriggerRequest
*/
class RuleTriggerRequest extends Request
class RuleTriggerRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -24,16 +24,18 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
use function is_array;
/**
* Class RuleUpdateRequest
*
*/
class RuleUpdateRequest extends Request
class RuleUpdateRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -24,16 +24,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\Location;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class TagStoreRequest
*
* @codeCoverageIgnore
*
*/
class TagStoreRequest extends Request
class TagStoreRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -25,16 +25,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\Location;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class TagUpdateRequest
*
* @codeCoverageIgnore
*
*/
class TagUpdateRequest extends Request
class TagUpdateRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*

View File

@@ -25,15 +25,17 @@ namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\LinkType\LinkTypeRepositoryInterface;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\User;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
/**
*
* Class TransactionLinkRequest
*/
class TransactionLinkRequest extends Request
class TransactionLinkRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -62,7 +64,6 @@ class TransactionLinkRequest extends Request
}
/**
*
* The rules that the incoming request must be matched against.
*
* @return array

View File

@@ -28,18 +28,20 @@ use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsDateOrTime;
use FireflyIII\Support\NullArrayObject;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\CurrencyValidation;
use FireflyIII\Validation\GroupValidation;
use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
use Log;
/**
* Class TransactionStoreRequest
*/
class TransactionStoreRequest extends Request
class TransactionStoreRequest extends FormRequest
{
use TransactionValidation, GroupValidation, CurrencyValidation;
use TransactionValidation, GroupValidation, CurrencyValidation, ConvertsDataTypes;
/**
* Authorize logged in users.
@@ -98,7 +100,7 @@ class TransactionStoreRequest extends Request
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code|nullable',
// amount
'transactions.*.amount' => 'required|numeric|more:0',
'transactions.*.amount' => 'required|numeric|gt:0',
'transactions.*.foreign_amount' => 'numeric',
// description
@@ -138,6 +140,7 @@ class TransactionStoreRequest extends Request
'transactions.*.external_id' => 'min:1,max:255|nullable',
'transactions.*.recurrence_id' => 'min:1,max:255|nullable',
'transactions.*.bunq_payment_id' => 'min:1,max:255|nullable',
'transactions.*.external_uri' => 'min:1,max:255|nullable|url',
// SEPA fields:
'transactions.*.sepa_cc' => 'min:1,max:255|nullable',
@@ -221,7 +224,7 @@ class TransactionStoreRequest extends Request
// foreign currency info:
'foreign_currency_id' => $this->integerFromValue((string) $object['foreign_currency_id']),
'foreign_currency_code' => $this->stringFromValue($object['foreign_currency_code']),
'foreign_currency_code' => $this->stringFromValue((string) $object['foreign_currency_code']),
// amount and foreign amount. Cannot be 0.
'amount' => $this->stringFromValue((string) $object['amount']),
@@ -232,37 +235,37 @@ class TransactionStoreRequest extends Request
// source of transaction. If everything is null, assume cash account.
'source_id' => $this->integerFromValue((string) $object['source_id']),
'source_name' => $this->stringFromValue($object['source_name']),
'source_iban' => $this->stringFromValue($object['source_iban']),
'source_number' => $this->stringFromValue($object['source_number']),
'source_bic' => $this->stringFromValue($object['source_bic']),
'source_name' => $this->stringFromValue((string) $object['source_name']),
'source_iban' => $this->stringFromValue((string) $object['source_iban']),
'source_number' => $this->stringFromValue((string) $object['source_number']),
'source_bic' => $this->stringFromValue((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->stringFromValue($object['destination_name']),
'destination_iban' => $this->stringFromValue($object['destination_iban']),
'destination_number' => $this->stringFromValue($object['destination_number']),
'destination_bic' => $this->stringFromValue($object['destination_bic']),
'destination_name' => $this->stringFromValue((string) $object['destination_name']),
'destination_iban' => $this->stringFromValue((string) $object['destination_iban']),
'destination_number' => $this->stringFromValue((string) $object['destination_number']),
'destination_bic' => $this->stringFromValue((string) $object['destination_bic']),
// budget info
'budget_id' => $this->integerFromValue((string) $object['budget_id']),
'budget_name' => $this->stringFromValue($object['budget_name']),
'budget_name' => $this->stringFromValue((string) $object['budget_name']),
// category info
'category_id' => $this->integerFromValue((string) $object['category_id']),
'category_name' => $this->stringFromValue($object['category_name']),
'category_name' => $this->stringFromValue((string) $object['category_name']),
// journal bill reference. Optional. Will only work for withdrawals
'bill_id' => $this->integerFromValue((string) $object['bill_id']),
'bill_name' => $this->stringFromValue($object['bill_name']),
'bill_name' => $this->stringFromValue((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->stringFromValue($object['piggy_bank_name']),
'piggy_bank_name' => $this->stringFromValue((string) $object['piggy_bank_name']),
// some other interesting properties
'reconciled' => $this->convertBoolean((string) $object['reconciled']),
'notes' => $this->nlStringFromValue($object['notes']),
'notes' => $this->nlStringFromValue((string) $object['notes']),
'tags' => $this->arrayFromValue($object['tags']),
// all custom fields:
@@ -271,6 +274,7 @@ class TransactionStoreRequest extends Request
'original_source' => sprintf('ff3-v%s|api-v%s', config('firefly.version'), config('firefly.api_version')),
'recurrence_id' => $this->integerFromValue($object['recurrence_id']),
'bunq_payment_id' => $this->stringFromValue((string) $object['bunq_payment_id']),
'external_uri' => $this->stringFromValue((string) $object['external_uri']),
'sepa_cc' => $this->stringFromValue($object['sepa_cc']),
'sepa_ct_op' => $this->stringFromValue($object['sepa_ct_op']),

View File

@@ -28,31 +28,39 @@ use FireflyIII\Models\TransactionGroup;
use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Rules\IsDateOrTime;
use FireflyIII\Support\Request\ConvertsDataTypes;
use FireflyIII\Validation\GroupValidation;
use FireflyIII\Validation\TransactionValidation;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Validator;
use Log;
/**
* Class TransactionUpdateRequest
*/
class TransactionUpdateRequest extends Request
class TransactionUpdateRequest extends FormRequest
{
use TransactionValidation, GroupValidation;
use TransactionValidation, GroupValidation, ConvertsDataTypes;
/** @var array Array values. */
private $arrayFields;
/** @var array Boolean values. */
private $booleanFields;
/** @var array Fields that contain date values. */
private $dateFields;
/** @var array Fields that contain integer values. */
private $integerFields;
/** @var array Fields that contain string values. */
private $stringFields;
/** @var array Fields that contain text (with newlines) */
private $textareaFields;
/**
* Authorize logged in users.
*
@@ -127,6 +135,7 @@ class TransactionUpdateRequest extends Request
'sepa_ep',
'sepa_ci',
'sepa_batch_id',
'external_uri',
];
$this->booleanFields = [
'reconciled',
@@ -172,7 +181,7 @@ class TransactionUpdateRequest extends Request
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
// amount
'transactions.*.amount' => 'numeric|more:0|max:100000000000',
'transactions.*.amount' => 'numeric|gt:0|max:100000000000',
'transactions.*.foreign_amount' => 'numeric|gte:0',
// description
@@ -204,6 +213,7 @@ class TransactionUpdateRequest extends Request
'transactions.*.external_id' => 'min:1,max:255|nullable',
'transactions.*.recurrence_id' => 'min:1,max:255|nullable',
'transactions.*.bunq_payment_id' => 'min:1,max:255|nullable',
'transactions.*.external_uri' => 'min:1,max:255|nullable|url',
// SEPA fields:
'transactions.*.sepa_cc' => 'min:1,max:255|nullable',
@@ -263,17 +273,13 @@ class TransactionUpdateRequest extends Request
// TODO if the transaction_journal_id is empty, some fields are mandatory, like the amount!
// all journals must have a description
//$this->validateDescriptions($validator);
// // validate foreign currency info
// $this->validateForeignCurrencyInformation($validator);
//
//
// // make sure all splits have valid source + dest info
// $this->validateSplitAccounts($validator);
// the group must have a description if > 1 journal.
// $this->validateGroupDescription($validator);
}
);
}

View File

@@ -24,16 +24,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\User;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class UserStoreRequest
*/
class UserStoreRequest extends Request
class UserStoreRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -41,21 +42,7 @@ class UserStoreRequest extends Request
*/
public function authorize(): bool
{
$result = false;
// Only allow authenticated users
if (auth()->check()) {
/** @var User $user */
$user = auth()->user();
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if ($repository->hasRole($user, 'owner')) {
$result = true; // @codeCoverageIgnore
}
}
return $result;
return auth()->check() && auth()->user()->hasRole('owner');
}
/**

View File

@@ -24,16 +24,17 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\User;
use FireflyIII\Support\Request\ConvertsDataTypes;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class UserUpdateRequest
*/
class UserUpdateRequest extends Request
class UserUpdateRequest extends FormRequest
{
use ConvertsDataTypes;
/**
* Authorize logged in users.
*
@@ -41,21 +42,7 @@ class UserUpdateRequest extends Request
*/
public function authorize(): bool
{
$result = false;
// Only allow authenticated users
if (auth()->check()) {
/** @var User $user */
$user = auth()->user();
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if ($repository->hasRole($user, 'owner')) {
$result = true; // @codeCoverageIgnore
}
}
return $result;
return auth()->check() && auth()->user()->hasRole('owner');
}
/**

View File

@@ -48,6 +48,7 @@ class CorrectDatabase extends Command
*/
protected $signature = 'firefly-iii:correct-database';
/**
* Execute the console command.
*/
@@ -70,11 +71,13 @@ class CorrectDatabase extends Command
'firefly-iii:delete-empty-journals',
'firefly-iii:delete-empty-groups',
'firefly-iii:fix-account-types',
'firefly-iii:fix-account-order',
'firefly-iii:rename-meta-fields',
'firefly-iii:fix-ob-currencies',
'firefly-iii:fix-long-descriptions',
'firefly-iii:fix-recurring-transactions',
'firefly-iii:restore-oauth-keys',
'firefly-iii:fix-transaction-types',
];
foreach ($commands as $command) {
$this->line(sprintf('Now executing %s', $command));

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types=1);
/**
* CorrectOpeningBalanceCurrencies.php
* Copyright (c) 2020 james@firefly-iii.org
@@ -20,6 +20,8 @@ declare(strict_types=1);
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Models\Account;
@@ -50,6 +52,7 @@ class CorrectOpeningBalanceCurrencies extends Command
*/
protected $signature = 'firefly-iii:fix-ob-currencies';
/**
* Execute the console command.
*

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