Compare commits

...

285 Commits
4.3.4 ... 4.3.5

Author SHA1 Message Date
James Cole
41596feb56 Merge branch 'release/4.3.5' 2017-02-19 16:49:45 +01:00
James Cole
cf1813b413 Updated composer.lock 2017-02-19 16:48:49 +01:00
James Cole
5b267c0e95 Update to version 4.3.5 2017-02-19 16:36:03 +01:00
James Cole
3741f70c29 Merge pull request #576 from firefly-iii/l10n_develop
New Crowdin translations
2017-02-19 16:33:54 +01:00
James Cole
1f37ea3d3c Translated 2017-02-19 12:30:11 +01:00
James Cole
283ee076c7 Expand view [skip ci] 2017-02-19 12:19:30 +01:00
James Cole
b13a878927 Slightly expanded modifiers [skip ci] 2017-02-19 12:17:07 +01:00
James Cole
364eb2838e Translated 2017-02-19 12:12:59 +01:00
James Cole
94631ca8d7 Approved. Step name: Proofread 2017-02-19 12:12:58 +01:00
James Cole
2ed095d58f Approved. Step name: Proofread 2017-02-19 12:12:56 +01:00
James Cole
9c10e3970d Approved. Step name: Proofread 2017-02-19 12:12:55 +01:00
James Cole
0cf4f44e95 Approved. Step name: Proofread 2017-02-19 12:12:54 +01:00
James Cole
89638a0094 Approved. Step name: Proofread 2017-02-19 12:12:52 +01:00
James Cole
d7531cf4ff Approved. Step name: Proofread 2017-02-19 12:12:51 +01:00
James Cole
2c5acb8ecd Approved. Step name: Proofread 2017-02-19 12:12:50 +01:00
James Cole
824c317f74 Translated 2017-02-19 12:12:49 +01:00
James Cole
d208fd1772 New translations 2017-02-19 12:12:48 +01:00
James Cole
f145aaded9 New translations 2017-02-19 12:12:46 +01:00
James Cole
c7043478f6 New translations 2017-02-19 12:12:45 +01:00
James Cole
d16bb7f394 Approved. Step name: Proofread 2017-02-19 12:12:44 +01:00
James Cole
3ed314dbc6 New translations 2017-02-19 12:12:43 +01:00
James Cole
e8c5942e33 Approved. Step name: Proofread 2017-02-19 12:12:42 +01:00
James Cole
96c704760c Approved. Step name: Proofread 2017-02-19 12:12:40 +01:00
James Cole
70c99f18e1 New translations 2017-02-19 12:12:39 +01:00
James Cole
5e2bdb6356 Translated 2017-02-19 12:12:38 +01:00
James Cole
dd13285f04 Translated 2017-02-19 12:12:37 +01:00
James Cole
561a5bf699 New translations 2017-02-19 12:12:35 +01:00
James Cole
f2d794e372 New translations 2017-02-19 12:12:34 +01:00
James Cole
f0931b8438 New translations 2017-02-19 12:12:33 +01:00
James Cole
aadb9addd5 New translations 2017-02-19 12:12:31 +01:00
James Cole
66abb50d23 Translated 2017-02-19 12:12:30 +01:00
James Cole
4eca99b745 New translations 2017-02-19 12:12:29 +01:00
James Cole
a95a265d47 Translated 2017-02-19 12:12:27 +01:00
James Cole
b0e70c25d0 New translations 2017-02-19 12:12:26 +01:00
James Cole
8914bd6b9a New translations 2017-02-19 12:12:25 +01:00
James Cole
26751e10ee Expand modifiers 2017-02-19 12:12:24 +01:00
James Cole
579ee9f199 New translations 2017-02-19 12:12:22 +01:00
James Cole
48fcb76ba4 New translations 2017-02-19 12:12:21 +01:00
James Cole
b872bbbb42 New translations 2017-02-19 12:12:19 +01:00
James Cole
73c88aa11f Translated 2017-02-19 12:12:18 +01:00
James Cole
aa1700b7b4 New translations 2017-02-19 12:12:16 +01:00
James Cole
1aa8e43bdf New translations 2017-02-19 12:12:15 +01:00
James Cole
fa8200d3e2 New translations 2017-02-19 12:12:14 +01:00
James Cole
bd9fcc6e8d New translations 2017-02-19 12:12:12 +01:00
James Cole
6167667f9a Translated 2017-02-19 12:12:11 +01:00
James Cole
1081379689 New translations 2017-02-19 12:12:10 +01:00
James Cole
712526f1c3 New translations 2017-02-19 12:12:08 +01:00
James Cole
7c0cfc5596 Translated 2017-02-19 12:12:07 +01:00
James Cole
edd0dcbcef New translations 2017-02-19 12:12:06 +01:00
James Cole
b322d67ffc New translations 2017-02-19 12:12:05 +01:00
James Cole
38dbac199d Translated 2017-02-19 12:12:02 +01:00
James Cole
6eb695c5eb New translations 2017-02-19 12:12:00 +01:00
James Cole
b0fd5889aa New translations 2017-02-19 12:11:58 +01:00
James Cole
b181f2edf0 New translations 2017-02-19 12:11:57 +01:00
James Cole
376940e089 New translations 2017-02-19 12:11:56 +01:00
James Cole
1c0762a3df New translations 2017-02-19 12:11:55 +01:00
James Cole
df39f5ab98 New translations 2017-02-19 12:11:54 +01:00
James Cole
9cd1ae1220 New translations 2017-02-19 12:11:52 +01:00
James Cole
3ddef6fe78 New translations 2017-02-19 12:11:50 +01:00
James Cole
b8c78217e8 New translations 2017-02-19 12:11:49 +01:00
James Cole
3a1b514982 New translations 2017-02-19 12:11:47 +01:00
James Cole
5d34dab2ef New translations 2017-02-19 12:11:46 +01:00
James Cole
541ed1e764 New translations 2017-02-19 12:11:45 +01:00
James Cole
5e764a345e New translations 2017-02-19 12:11:42 +01:00
James Cole
33de51c4aa New translations 2017-02-19 12:11:41 +01:00
James Cole
5aa038e195 New translations 2017-02-19 12:11:40 +01:00
James Cole
0fe437c66b New translations 2017-02-19 12:11:38 +01:00
James Cole
790d156503 Translated 2017-02-19 12:11:37 +01:00
James Cole
9f515bea20 Translated 2017-02-19 12:11:36 +01:00
James Cole
1422adac3f New translations 2017-02-19 12:11:35 +01:00
James Cole
5f17e41190 New translations 2017-02-19 12:11:33 +01:00
James Cole
0d9daaffe8 New translations 2017-02-19 12:11:32 +01:00
James Cole
e1f3bf8d45 New translations 2017-02-19 12:11:31 +01:00
James Cole
20a7723e63 New translations 2017-02-19 12:11:30 +01:00
James Cole
5ffa6d9500 New translations 2017-02-19 12:11:29 +01:00
James Cole
86956969ce New translations 2017-02-19 12:11:28 +01:00
James Cole
13beb888c1 Translated 2017-02-19 12:11:26 +01:00
James Cole
c1d4caf1a9 New translations 2017-02-19 12:11:25 +01:00
James Cole
5e9a605ae4 New translations 2017-02-19 12:11:23 +01:00
James Cole
c79d0ed276 Translated 2017-02-19 12:11:22 +01:00
James Cole
6204e575a2 New translations 2017-02-19 12:11:21 +01:00
James Cole
19f181723a New translations 2017-02-19 12:11:18 +01:00
James Cole
4a49bf8799 New translations 2017-02-19 12:11:17 +01:00
James Cole
8128c6aed6 New translations 2017-02-19 12:11:16 +01:00
James Cole
45dfc74ab3 New translations 2017-02-19 12:11:14 +01:00
James Cole
72c4ecced7 New translations 2017-02-19 12:11:13 +01:00
James Cole
d21187df6a Approved. Step name: Proofread 2017-02-19 12:11:12 +01:00
James Cole
bf33025569 Translated 2017-02-19 12:11:09 +01:00
James Cole
065620aec9 Translated 2017-02-19 12:11:08 +01:00
James Cole
e8e0fbc988 New translations 2017-02-19 12:11:07 +01:00
James Cole
21e61d08dd New translations 2017-02-19 12:11:06 +01:00
James Cole
ca9cc50423 New translations 2017-02-19 12:11:05 +01:00
James Cole
0fde74883f New translations 2017-02-19 12:11:03 +01:00
James Cole
c1d12e5129 New translations 2017-02-19 12:11:02 +01:00
James Cole
8ee6cd6c41 New translations 2017-02-19 12:10:59 +01:00
James Cole
bb09ea5fa2 New translations 2017-02-19 12:10:57 +01:00
James Cole
6b92ef9d71 New translations 2017-02-19 12:10:56 +01:00
James Cole
a49f8a27e2 Translated 2017-02-19 12:10:55 +01:00
James Cole
d0b3b4b186 Translated 2017-02-19 12:10:54 +01:00
James Cole
0bd688962b New translations 2017-02-19 12:10:52 +01:00
James Cole
c737ceb63f New translations 2017-02-19 12:10:51 +01:00
James Cole
d24e5b9eca Translated 2017-02-19 12:10:50 +01:00
James Cole
d68c2b5b8f New translations 2017-02-19 12:10:49 +01:00
James Cole
6803707b1f Translated 2017-02-19 12:10:47 +01:00
James Cole
13574d812f Translated 2017-02-19 12:10:46 +01:00
James Cole
f4e95bdbca Translated 2017-02-19 12:10:45 +01:00
James Cole
eb83023864 Translated 2017-02-19 12:10:44 +01:00
James Cole
10c81fdfba Translated 2017-02-19 12:10:42 +01:00
James Cole
7c47723992 New translations 2017-02-19 12:10:41 +01:00
James Cole
0154183800 New translations 2017-02-19 12:10:38 +01:00
James Cole
a2b0ea9c5b Translated 2017-02-19 12:10:37 +01:00
James Cole
c49caf663c Translated 2017-02-19 12:10:35 +01:00
James Cole
17e6698133 New translations 2017-02-19 12:10:34 +01:00
James Cole
a7b99b1bb5 New translations 2017-02-19 12:10:33 +01:00
James Cole
8d6a217f22 Translated 2017-02-19 12:10:30 +01:00
James Cole
d5b1722c0c Translated 2017-02-19 12:10:28 +01:00
James Cole
0d9a81f0e4 New translations 2017-02-19 12:10:27 +01:00
James Cole
821a443e44 New translations 2017-02-19 12:10:24 +01:00
James Cole
9d8d54e5c8 New translations 2017-02-19 12:10:23 +01:00
James Cole
411739277d Translated 2017-02-19 12:10:21 +01:00
James Cole
fa71feb9fb Translated 2017-02-19 12:10:20 +01:00
James Cole
00f9194bfa New translations 2017-02-19 12:10:19 +01:00
James Cole
a3e955400f Translated 2017-02-19 12:10:17 +01:00
James Cole
05060cee5b New translations 2017-02-19 12:10:16 +01:00
James Cole
c10148753a New translations 2017-02-19 12:10:14 +01:00
James Cole
53bb64641b Translated 2017-02-19 12:10:13 +01:00
James Cole
9a124bb3b2 New translations 2017-02-19 12:10:12 +01:00
James Cole
91568cf919 Translated 2017-02-19 12:10:10 +01:00
James Cole
b149a816dd Make search work. [skip ci] 2017-02-19 09:36:51 +01:00
James Cole
bf35ecc07a Fixed tests 2017-02-19 09:17:02 +01:00
James Cole
711a1a1d4f Final modifiers. 2017-02-19 09:07:14 +01:00
James Cole
a27b686446 Add budget keyword. 2017-02-19 07:41:12 +01:00
James Cole
1f6180ce5d Updated search modifiers. 2017-02-19 07:38:51 +01:00
James Cole
b5032a7597 Added a new helper function. 2017-02-19 07:34:39 +01:00
James Cole
5073fd937c Expand search with a bunch of keywords for #510 2017-02-18 20:10:03 +01:00
James Cole
f0cb63fd48 Some small optimisations. 2017-02-18 09:32:10 +01:00
James Cole
f7642beb7c Better 2fa handling 2017-02-17 20:15:17 +01:00
James Cole
48c26c5837 Update test coverage 2017-02-17 20:14:38 +01:00
James Cole
65a899bf25 Clean up session code 2017-02-17 20:14:22 +01:00
James Cole
5d0cdc4ffa Various code cleanup. 2017-02-17 06:42:36 +01:00
James Cole
1d979778e8 Merge pull request #573 from firefly-iii/l10n_develop
New Crowdin translations
2017-02-16 22:42:35 +01:00
James Cole
917b8b40cf Merge branch 'develop' into l10n_develop 2017-02-16 22:42:24 +01:00
James Cole
466ec92492 Remove some commented code. 2017-02-16 22:34:37 +01:00
James Cole
4ff5f526ba Add new lines to files. 2017-02-16 22:33:32 +01:00
James Cole
8460ee2dc4 Small fix in read me [skip ci] 2017-02-16 22:30:57 +01:00
James Cole
fa39330ceb New change log [skip ci] 2017-02-16 22:30:46 +01:00
James Cole
1857bb17d9 Approved. Step name: Proofread 2017-02-16 22:30:14 +01:00
James Cole
fe54b2fa3a Names are now links [skip ci] 2017-02-16 22:13:04 +01:00
James Cole
4fbf0291e6 Updated composer things. 2017-02-16 21:06:31 +01:00
James Cole
8bfcc3315a This fixes #572 2017-02-16 21:01:22 +01:00
James Cole
c8f6b42ce6 Fix tests 2017-02-15 22:02:02 +01:00
James Cole
8f5289b7dc Fixed some transaction list filter issues. 2017-02-15 21:55:50 +01:00
James Cole
281e3f706b New translations 2017-02-15 20:12:02 +01:00
James Cole
6dfa027ae2 New translations 2017-02-15 20:11:48 +01:00
James Cole
623cd51b1c New translations 2017-02-15 20:11:39 +01:00
James Cole
3d9e723a0e New translations 2017-02-15 20:11:33 +01:00
James Cole
4a2b7cfc4e New translations 2017-02-15 20:11:15 +01:00
James Cole
c15bee4511 New translations 2017-02-15 20:11:05 +01:00
James Cole
f4afcd29e0 New translations 2017-02-15 20:10:56 +01:00
James Cole
770e77a862 New translations 2017-02-15 20:10:41 +01:00
James Cole
684d1dc432 New translations 2017-02-15 20:10:33 +01:00
James Cole
ec9ddb2bfb New translations 2017-02-15 20:10:27 +01:00
James Cole
a5f8aa914f Build code for tag report. 2017-02-15 20:07:10 +01:00
James Cole
ae06f1b8f0 Yeah never mind. [skip ci] 2017-02-15 18:16:07 +01:00
James Cole
e8f76d896b Expand code climate config [skip ci] 2017-02-15 17:25:36 +01:00
James Cole
07ecb3f0e8 Expand code climate config [skip ci] 2017-02-15 17:23:56 +01:00
James Cole
893f2d2c55 Include code climate config [skip ci] 2017-02-15 17:17:15 +01:00
James Cole
395a7bb33c This should fix the tests 2017-02-15 17:07:56 +01:00
James Cole
636b371b86 Fixes #553 2017-02-15 16:20:16 +01:00
James Cole
f0783df123 This should fix #566 2017-02-15 15:24:01 +01:00
James Cole
fa54763425 This fixes #570 2017-02-15 15:22:04 +01:00
James Cole
cf2cd9680b This fixes #569 2017-02-15 15:18:52 +01:00
James Cole
47aa996b6b This fixes #567 2017-02-15 15:12:46 +01:00
James Cole
6442887c1a Merge pull request #562 from patrickkostjens/develop
Use Docker volumes created by docker-compose to persist data
2017-02-13 20:54:22 +01:00
James Cole
7a34536c80 Fixes #565 2017-02-13 20:39:23 +01:00
Patrick Kostjens
e9a67b1c82 Bugfix: Mount app in app container instead of db container 2017-02-12 21:38:58 +01:00
Patrick Kostjens
bc4cf1a367 Incorporate comments: Use Docker storage instead of local folder for app storage 2017-02-12 21:04:15 +01:00
Patrick Kostjens
a1d40a5748 Mount local code base in development docker-compose 2017-02-12 20:52:26 +01:00
Patrick Kostjens
e42f858166 Incorporate review comment: Remove unneeded container name setting in docker-compose 2017-02-12 20:41:29 +01:00
Patrick Kostjens
75e0d19b4e Refactored docker-compose files to use base with dev/prod overrides 2017-02-12 19:37:37 +01:00
James Cole
5801eba22a Updated composer.lock file. 2017-02-12 18:47:17 +01:00
James Cole
fd3f756640 Restored most pre-5.4 tests. 2017-02-12 18:40:39 +01:00
Patrick Kostjens
bd1672fd7b Use Docker volume for mysql data storage 2017-02-12 18:07:48 +01:00
James Cole
2c36820622 New tests 2017-02-12 17:58:16 +01:00
Patrick Kostjens
ff1d1e5b8f Revert docker-compose to development version and create separate production file 2017-02-12 17:55:56 +01:00
James Cole
de0371dd1c New translations 2017-02-12 17:51:53 +01:00
James Cole
d6f4bbf4bc New translations 2017-02-12 17:51:44 +01:00
James Cole
5fc1e6ad64 New translations 2017-02-12 17:51:37 +01:00
James Cole
c37d772759 New translations 2017-02-12 17:51:32 +01:00
James Cole
fe2efd88cf New translations 2017-02-12 17:51:21 +01:00
James Cole
5a2f48f529 Approved. Step name: Proofread 2017-02-12 17:51:16 +01:00
James Cole
4459d09a90 New translations 2017-02-12 17:51:10 +01:00
James Cole
79fcd874f7 New translations 2017-02-12 17:51:00 +01:00
James Cole
643655a612 New translations 2017-02-12 17:50:54 +01:00
James Cole
adb0717ade New translations 2017-02-12 17:50:50 +01:00
Patrick Kostjens
1feae802c2 Use local folders in containers created by docker-compose to persist data 2017-02-12 17:30:24 +01:00
James Cole
ec146d4cbe Make sure the /javascript/ url’s are ignored. 2017-02-12 16:50:35 +01:00
James Cole
3399b133ae New user controller tests. 2017-02-12 13:23:08 +01:00
James Cole
1637190c27 Fix various tests. 2017-02-12 13:15:23 +01:00
James Cole
79f94771c3 Make tests compatible with laravel 5.4 2017-02-12 12:32:13 +01:00
James Cole
018af62826 First set of new tests. 2017-02-12 12:21:44 +01:00
James Cole
69bd292ed8 Initial set of empty controller tests 2017-02-12 12:00:11 +01:00
James Cole
ac63a082aa Update attachment controller test. 2017-02-12 11:53:04 +01:00
James Cole
e15bb05823 New test for attachments. 2017-02-12 11:47:22 +01:00
James Cole
5528663727 Re-implemented basic account controller tests. 2017-02-12 11:25:17 +01:00
James Cole
1a204d31e7 Small fix for opening balance issues in reports. 2017-02-12 10:58:37 +01:00
James Cole
0fe4273d4d Merge pull request #560 from elamperti/fix-smooth-curves
Fix smooth curves around data points in graphs
2017-02-12 08:42:51 +01:00
Enrico Lamperti
abf0fdcf35 Fix smooth curves in graphs 2017-02-11 17:38:04 -03:00
James Cole
78074a5a54 Code for #553 2017-02-11 18:38:38 +01:00
James Cole
dcc2b9c1cb This fixes #559 2017-02-11 18:35:16 +01:00
James Cole
b5a005dcc5 Better 404 page [skip ci] 2017-02-11 16:32:03 +01:00
James Cole
4c2d9e0eee Small code cleanup. 2017-02-11 15:52:55 +01:00
James Cole
fb73baca6a Merge pull request #558 from crash7/improve-docker
Improve docker support
2017-02-11 10:13:51 +01:00
James Cole
0be3dd4fe4 Add EOF 2017-02-11 10:12:11 +01:00
James Cole
8e89899070 Add EOF 2017-02-11 10:11:57 +01:00
James Cole
5e47492318 Clean up budget report partial 2017-02-11 10:05:58 +01:00
James Cole
aa2d78f36a Expand filter 2017-02-11 09:34:04 +01:00
Christian Musa
0cbed2d5d2 Improve docker support
- Add docker-compose file
- Add environment variable to initialize the database
- Add custom entrypoint that generates the .env file based on the environment variables
- Update Dockerfile (gettext-base package)
2017-02-11 00:36:38 -03:00
James Cole
3914796e4e Experimental new transfer filter. 2017-02-10 17:21:44 +01:00
James Cole
b9dac5ff55 Merge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop
* 'develop' of https://github.com/firefly-iii/firefly-iii:
  Update config.php, see #521
2017-02-08 22:24:20 +01:00
James Cole
1285a88660 Different value for title field [skip ci] 2017-02-08 22:07:47 +01:00
James Cole
96e0d4e29f Translated 2017-02-06 13:20:57 +01:00
James Cole
9bb8a9ccd1 New translations 2017-02-06 13:20:54 +01:00
James Cole
d9611bd84f New translations 2017-02-06 13:20:51 +01:00
James Cole
915afa4534 Translated 2017-02-06 13:20:47 +01:00
James Cole
5105c94233 New translations 2017-02-06 13:12:31 +01:00
James Cole
899d4fe611 New translations 2017-02-06 13:12:04 +01:00
James Cole
d45a12e544 New translations 2017-02-06 13:11:44 +01:00
James Cole
302fc876d9 Translated 2017-02-06 13:11:28 +01:00
James Cole
f6a25db17c New translations 2017-02-06 13:11:26 +01:00
James Cole
da11303539 New translations 2017-02-06 13:11:25 +01:00
James Cole
07ebe71839 New translations 2017-02-06 13:11:23 +01:00
James Cole
eba9c4e039 New translations 2017-02-06 13:11:12 +01:00
James Cole
7d80120611 Approved. Step name: Proofread 2017-02-06 08:32:09 +01:00
James Cole
f2ea5fb253 New translations 2017-02-06 08:31:57 +01:00
James Cole
451ab6c531 New translations 2017-02-06 08:31:48 +01:00
James Cole
796b63fcc5 New translations 2017-02-06 08:31:42 +01:00
James Cole
7d8b3e6513 New translations 2017-02-06 08:31:40 +01:00
James Cole
b2026106ec Update config.php, see #521 2017-02-06 08:29:18 +01:00
James Cole
dba92d73c4 Include new line at the end of the file. 2017-02-05 19:51:58 +01:00
James Cole
b09a250a03 Better link for issues. [skip ci] 2017-02-05 18:50:19 +01:00
James Cole
c6f69f63fc Friendly error message. [skip ci] 2017-02-05 18:49:13 +01:00
James Cole
3a7faa7368 Small fixes for laravel 5.4 2017-02-05 18:44:37 +01:00
James Cole
f863c01a1d Merge laravel 5.4 into develop. 2017-02-05 16:20:02 +01:00
James Cole
8a98204a69 Update app() calls 2017-02-05 16:16:15 +01:00
James Cole
77e52f42a6 Update export routine. 2017-02-05 16:14:23 +01:00
James Cole
704c0922e8 Update collector classes 2017-02-05 15:58:55 +01:00
James Cole
371ce37be4 Update export classes 2017-02-05 15:58:42 +01:00
James Cole
152fb3f885 Update the last providers. 2017-02-05 15:58:27 +01:00
James Cole
3ff83cd431 Remove speed trap. 2017-02-05 15:43:56 +01:00
James Cole
a9d5b6ef92 Update to laravel 5.4 style tests 2017-02-05 15:42:00 +01:00
James Cole
229f718754 Update Composer files. 2017-02-05 15:41:41 +01:00
James Cole
646b65918d Remove tests since they’ve been changed in Laravel 5.4. 2017-02-05 15:41:23 +01:00
James Cole
5e596a9cb7 Remove speedtrap from oh-unit file. 2017-02-05 08:47:37 +01:00
James Cole
353db6c4a5 Updated composer.lock file. 2017-02-05 08:35:17 +01:00
James Cole
959a1a08f0 Tell view whether we’re in Sandstorm.IO mode. 2017-02-05 08:27:23 +01:00
James Cole
3e510bd3f6 This fixes #549 2017-02-05 08:26:54 +01:00
James Cole
b68d5c4374 Include CSRF token for Sandstorm. 2017-02-04 09:02:07 +01:00
James Cole
dc348a72c8 Various new scripts to improve sandstorm.io experience. 2017-02-04 08:42:06 +01:00
James Cole
5e5d4eca4b Update some sandstorm.io files. 2017-02-04 03:22:19 +01:00
James Cole
96b5d174d1 Initial code base for Sandstorm.IO support. Very beta. 2017-02-04 03:04:55 +01:00
James Cole
df1da32745 Update composer [skip ci] 2017-02-04 02:26:16 +01:00
James Cole
a7c198048e Add app log method. [skip ci] 2017-02-04 02:20:17 +01:00
James Cole
e3599c002b Updated contribution instructions [skip ci] 2017-02-04 02:19:47 +01:00
James Cole
615d90c8f4 Update various service providers. 2017-02-02 07:35:53 +01:00
James Cole
e057c4d79c Removed reference to crud service provider. 2017-01-30 17:29:18 +01:00
James Cole
8263fa41dd Rewrote currency and export/import job service provider 2017-01-30 17:29:05 +01:00
James Cole
eeae4d215d Removed old service provider. 2017-01-30 17:20:00 +01:00
James Cole
646ed0d4dd Rewrote attachment, budget and category service providers. 2017-01-30 17:19:51 +01:00
James Cole
ac54032f55 Need to call everything from collector to work. 2017-01-30 17:10:23 +01:00
James Cole
3aaf356054 Rewrote bill service provider 2017-01-30 17:10:08 +01:00
James Cole
2c786e6a38 Small fixes to collector because constructor is gone. 2017-01-30 17:09:44 +01:00
James Cole
355baa7fef Rewrote account service provider. 2017-01-30 16:59:55 +01:00
James Cole
01468c2663 Rewrote journal service provider 2017-01-30 16:58:10 +01:00
James Cole
c7341c9194 Also extend collector. 2017-01-30 16:57:00 +01:00
James Cole
1e947870a6 Remove all constructors. 2017-01-30 16:46:30 +01:00
James Cole
311c1a3c84 Implement all setUser methods. 2017-01-30 16:42:58 +01:00
James Cole
84e380e4d0 Give all repositories a new setUser function. 2017-01-30 16:40:49 +01:00
James Cole
4cad2eb0c4 Upgraded validator 2017-01-30 16:35:41 +01:00
James Cole
4bc3af7176 Updated composer.lock file for change to bread crumbs. 2017-01-30 16:35:31 +01:00
James Cole
e80298f815 Include laravel bread crumbs and custom repository. 2017-01-30 16:31:41 +01:00
James Cole
14971cf249 Overrule logging. 2017-01-30 16:30:35 +01:00
James Cole
b79dcd7f23 Disable ConfigureLogging class. 2017-01-30 16:27:33 +01:00
James Cole
395aaad9c6 New class name. 2017-01-30 16:21:01 +01:00
James Cole
29f763d4e4 Update composer files. 2017-01-30 16:20:23 +01:00
344 changed files with 7028 additions and 5162 deletions

55
.env.docker Normal file
View File

@@ -0,0 +1,55 @@
APP_ENV=${FF_APP_ENV}
APP_DEBUG=false
APP_FORCE_SSL=false
APP_FORCE_ROOT=
APP_KEY=${FF_APP_KEY}
APP_LOG=daily
APP_LOG_LEVEL=warning
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=${FF_DB_HOST}
DB_PORT=3306
DB_DATABASE=${FF_DB_NAME}
DB_USERNAME=${FF_DB_USER}
DB_PASSWORD=${FF_DB_PASSWORD}
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SEND_REGISTRATION_MAIL=true
SEND_ERROR_MESSAGE=true
SHOW_INCOMPLETE_TRANSLATIONS=false
CACHE_PREFIX=firefly
GOOGLE_MAPS_API_KEY=
ANALYTICS_ID=
SITE_OWNER=mail@example.com
USE_ENCRYPTION=true
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_APP_ID=
DEMO_USERNAME=
DEMO_PASSWORD=

View File

@@ -3,6 +3,7 @@ APP_DEBUG=false
APP_FORCE_SSL=false
APP_FORCE_ROOT=
APP_KEY=SomeRandomStringOf32CharsExactly
APP_LOG=daily
APP_LOG_LEVEL=warning
APP_URL=http://localhost

55
.env.sandstorm Executable file
View File

@@ -0,0 +1,55 @@
APP_ENV=production
APP_DEBUG=true
APP_FORCE_SSL=false
APP_FORCE_ROOT=
APP_KEY=SomeRandomStringOf32CharsExactly
APP_LOG=syslog
APP_LOG_LEVEL=debug
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=firefly
DB_USERNAME=firefly
DB_PASSWORD=firefly
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SEND_REGISTRATION_MAIL=true
SEND_ERROR_MESSAGE=true
SHOW_INCOMPLETE_TRANSLATIONS=false
CACHE_PREFIX=firefly
GOOGLE_MAPS_API_KEY=
ANALYTICS_ID=
SITE_OWNER=mail@example.com
USE_ENCRYPTION=true
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_APP_ID=
DEMO_USERNAME=
DEMO_PASSWORD=

View File

@@ -8,7 +8,7 @@ If you are requesting a new feature, please check out the list of [often request
## Bugs
If you find a bug, include as many log files and details as you think are necessary.
If you find a bug, please take the time and see if the [demo site](https://firefly-iii.nder.be/) is also suffering from this bug. Include as many log files and details as you think are necessary.
## Installation problems
@@ -16,4 +16,4 @@ Take the time to read the [installation guide FAQ](https://firefly-iii.github.io
## Pull requests
I can only accept pull requests against the `develop` branch, never the `master` branch
I can only accept pull requests against the `develop` branch, never the `master` branch.

5
.sandstorm/.gitattributes vendored Normal file
View File

@@ -0,0 +1,5 @@
# vagrant-spk creates shell scripts, which must end in \n, even on a \r\n system.
*.sh text eol=lf

5
.sandstorm/.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
# This file stores a list of sub-paths of .sandstorm/ that should be ignored by git.
.vagrant

103
.sandstorm/Vagrantfile vendored Normal file
View File

@@ -0,0 +1,103 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Guess at a reasonable name for the VM based on the folder vagrant-spk is
# run from. The timestamp is there to avoid conflicts if you have multiple
# folders with the same name.
VM_NAME = File.basename(File.dirname(File.dirname(__FILE__))) + "_sandstorm_#{Time.now.utc.to_i}"
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Base on the Sandstorm snapshots of the official Debian 8 (jessie) box.
config.vm.box = "sandstorm/debian-jessie64"
if Vagrant.has_plugin?("vagrant-vbguest") then
# vagrant-vbguest is a Vagrant plugin that upgrades
# the version of VirtualBox Guest Additions within each
# guest. If you have the vagrant-vbguest plugin, then it
# needs to know how to compile kernel modules, etc., and so
# we give it this hint about operating system type.
config.vm.guest = "debian"
end
# We forward port 6080, the Sandstorm web port, so that developers can
# visit their sandstorm app from their browser as local.sandstorm.io:6080
# (aka 127.0.0.1:6080).
config.vm.network :forwarded_port, guest: 6080, host: 6080
# Use a shell script to "provision" the box. This installs Sandstorm using
# the bundled installer.
config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/global-setup.sh", keep_color: true
# Then, do stack-specific and app-specific setup.
config.vm.provision "shell", inline: "sudo bash /opt/app/.sandstorm/setup.sh", keep_color: true
# Shared folders are configured per-provider since vboxsf can't handle >4096 open files,
# NFS requires privilege escalation every time you bring a VM up,
# and 9p is only available on libvirt.
# Calculate the number of CPUs and the amount of RAM the system has,
# in a platform-dependent way; further logic below.
cpus = nil
total_kB_ram = nil
host = RbConfig::CONFIG['host_os']
if host =~ /darwin/
cpus = `sysctl -n hw.ncpu`.to_i
total_kB_ram = `sysctl -n hw.memsize`.to_i / 1024
elsif host =~ /linux/
cpus = `nproc`.to_i
total_kB_ram = `grep MemTotal /proc/meminfo | awk '{print $2}'`.to_i
elsif host =~ /mingw/
# powershell may not be available on Windows XP and Vista, so wrap this in a rescue block
begin
cpus = `powershell -Command "(Get-WmiObject Win32_Processor -Property NumberOfLogicalProcessors | Select-Object -Property NumberOfLogicalProcessors | Measure-Object NumberOfLogicalProcessors -Sum).Sum"`.to_i
total_kB_ram = `powershell -Command "Get-CimInstance -class cim_physicalmemory | % $_.Capacity}"`.to_i / 1024
rescue
end
end
# Use the same number of CPUs within Vagrant as the system, with 1
# as a default.
#
# Use at least 512MB of RAM, and if the system has more than 2GB of
# RAM, use 1/4 of the system RAM. This seems a reasonable compromise
# between having the Vagrant guest operating system not run out of
# RAM entirely (which it basically would if we went much lower than
# 512MB) and also allowing it to use up a healthily large amount of
# RAM so it can run faster on systems that can afford it.
if cpus.nil? or cpus.zero?
cpus = 1
end
if total_kB_ram.nil? or total_kB_ram < 2048000
assign_ram_mb = 512
else
assign_ram_mb = (total_kB_ram / 1024 / 4)
end
# Actually apply these CPU/memory values to the providers.
config.vm.provider :virtualbox do |vb, override|
vb.cpus = cpus
vb.memory = assign_ram_mb
vb.name = VM_NAME
vb.customize ["modifyvm", :id, "--nictype1", "Am79C973"]
# /opt/app and /host-dot-sandstorm are used by vagrant-spk
override.vm.synced_folder "..", "/opt/app"
override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm"
# /vagrant is not used by vagrant-spk; we need this line so it gets disabled; if we removed the
# line, vagrant would automatically insert a synced folder in /vagrant, which is not what we want.
override.vm.synced_folder "..", "/vagrant", disabled: true
end
config.vm.provider :libvirt do |libvirt, override|
libvirt.cpus = cpus
libvirt.memory = assign_ram_mb
libvirt.default_prefix = VM_NAME
# /opt/app and /host-dot-sandstorm are used by vagrant-spk
override.vm.synced_folder "..", "/opt/app", type: "9p", accessmode: "passthrough"
override.vm.synced_folder ENV["HOME"] + "/.sandstorm", "/host-dot-sandstorm", type: "9p", accessmode: "passthrough"
# /vagrant is not used by vagrant-spk; we need this line so it gets disabled; if we removed the
# line, vagrant would automatically insert a synced folder in /vagrant, which is not what we want.
override.vm.synced_folder "..", "/vagrant", type: "9p", accessmode: "passthrough", disabled: true
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

21
.sandstorm/build.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Checks if there's a composer.json, and if so, installs/runs composer.
# This script only runs once, when the app connects to sandstorm.
set -euo pipefail
cd /opt/app
cp .env.sandstorm .env
if [ -f /opt/app/composer.json ] ; then
if [ ! -f composer.phar ] ; then
curl -sS https://getcomposer.org/installer | php
fi
php composer.phar install --no-dev --no-suggest
fi
# link storage folder
rm -rf /opt/app/storage
ln -s /var/storage /opt/app

3
.sandstorm/changelog.md Normal file
View File

@@ -0,0 +1,3 @@
# 3.4.3
* Initial release on Sandstorm.io

View File

@@ -0,0 +1,3 @@
"Firefly III" is a financial manager. It can help you keep track of expenses, income, budgets and everything in between. It even supports credit cards, shared household accounts and savings accounts! Its pretty fancy. You should use it to save and organise money.
Firefly works on the principle that if you know where youre money is going, you can stop it from going there.

44
.sandstorm/global-setup.sh Executable file
View File

@@ -0,0 +1,44 @@
#!/bin/bash
set -euo pipefail
# Set options for curl. Since we only want to show errors from these curl commands, we also use
# 'cat' to buffer the output; for more information:
# https://github.com/sandstorm-io/vagrant-spk/issues/158
CURL_OPTS="--silent --show-error"
echo localhost > /etc/hostname
hostname localhost
# The following line copies stderr through stderr to cat without accidentally leaving it in the
# output file. Be careful when changing. See: https://github.com/sandstorm-io/vagrant-spk/pull/159
curl $CURL_OPTS https://install.sandstorm.io/ 2>&1 > /host-dot-sandstorm/caches/install.sh | cat
SANDSTORM_CURRENT_VERSION=$(curl $CURL_OPTS -f "https://install.sandstorm.io/dev?from=0&type=install")
SANDSTORM_PACKAGE="sandstorm-$SANDSTORM_CURRENT_VERSION.tar.xz"
if [[ ! -f /host-dot-sandstorm/caches/$SANDSTORM_PACKAGE ]] ; then
echo -n "Downloading Sandstorm version ${SANDSTORM_CURRENT_VERSION}..."
curl $CURL_OPTS --output "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE.partial" "https://dl.sandstorm.io/$SANDSTORM_PACKAGE" 2>&1 | cat
mv "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE.partial" "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE"
echo "...done."
fi
if [ ! -e /opt/sandstorm/latest/sandstorm ] ; then
echo -n "Installing Sandstorm version ${SANDSTORM_CURRENT_VERSION}..."
bash /host-dot-sandstorm/caches/install.sh -d -e "/host-dot-sandstorm/caches/$SANDSTORM_PACKAGE" >/dev/null
echo "...done."
fi
modprobe ip_tables
# Make the vagrant user part of the sandstorm group so that commands like
# `spk dev` work.
usermod -a -G 'sandstorm' 'vagrant'
# Bind to all addresses, so the vagrant port-forward works.
sudo sed --in-place='' \
--expression='s/^BIND_IP=.*/BIND_IP=0.0.0.0/' \
/opt/sandstorm/sandstorm.conf
sudo service sandstorm restart
# Enable apt-cacher-ng proxy to make things faster if one appears to be running on the gateway IP
GATEWAY_IP=$(ip route | grep ^default | cut -d ' ' -f 3)
if nc -z "$GATEWAY_IP" 3142 ; then
echo "Acquire::http::Proxy \"http://$GATEWAY_IP:3142\";" > /etc/apt/apt.conf.d/80httpproxy
fi
# Configure apt to retry fetching things that fail to download.
echo "APT::Acquire::Retries \"10\";" > /etc/apt/apt.conf.d/80sandstorm-retry

62
.sandstorm/launcher.sh Executable file
View File

@@ -0,0 +1,62 @@
#!/bin/bash
# Runs every time we create a new grain!
# Create a bunch of folders under the clean /var that php, nginx, and mysql expect to exist
mkdir -p /var/lib/mysql
mkdir -p /var/lib/nginx
mkdir -p /var/lib/php/sessions/
mkdir -p /var/log
mkdir -p /var/log/mysql
mkdir -p /var/log/nginx
# Wipe /var/run, since pidfiles and socket files from previous launches should go away
# TODO someday: I'd prefer a tmpfs for these.
rm -rf /var/run
mkdir -p /var/run
rm -rf /var/tmp
mkdir -p /var/tmp
mkdir -p /var/run/mysqld
# make storage directories
rm -rf /var/storage
mkdir -p /var/storage/app/public
mkdir -p /var/storage/build
mkdir -p /var/storage/database
mkdir -p /var/storage/debugbar
mkdir -p /var/storage/export
mkdir -p /var/storage/framework/cache
mkdir -p /var/storage/framework/sessions
mkdir -p /var/storage/framework/views
mkdir -p /var/storage/logs
mkdir -p /var/storage/upload
# Ensure mysql tables created
HOME=/etc/mysql /usr/bin/mysql_install_db --force
# Spawn mysqld, php
HOME=/etc/mysql /usr/sbin/mysqld &
/usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf &
# Wait until mysql and php have bound their sockets, indicating readiness
while [ ! -e /var/run/mysqld/mysqld.sock ] ; do
echo "waiting for mysql to be available at /var/run/mysqld/mysqld.sock"
sleep .5
done
while [ ! -e /var/run/php7.0-fpm.sock ] ; do
echo "waiting for php7.0-fpm to be available at /var/run/php7.0-fpm.sock"
sleep .5
done
echo "Installing database.."
# Install database for Firefly III
echo "CREATE DATABASE IF NOT EXISTS firefly; GRANT ALL on firefly.* TO 'firefly'@'localhost' IDENTIFIED BY 'firefly';" | mysql -uroot
echo "Done!"
echo "Migrating..."
php /opt/app/artisan migrate --seed --force
echo "Done!"
# Start nginx.
/usr/sbin/nginx -c /opt/app/.sandstorm/service-config/nginx.conf -g "daemon off;"

BIN
.sandstorm/pgp-keyring Normal file

Binary file not shown.

BIN
.sandstorm/pgp-signature Normal file

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,188 @@
@0x9411e6c8b3c8a4b6;
using Spk = import "/sandstorm/package.capnp";
# This imports:
# $SANDSTORM_HOME/latest/usr/include/sandstorm/package.capnp
# Check out that file to see the full, documented package definition format.
const pkgdef :Spk.PackageDefinition = (
# The package definition. Note that the spk tool looks specifically for the
# "pkgdef" constant.
id = "uws252ya9mep4t77tevn85333xzsgrpgth8q4y1rhknn1hammw70",
# Your app ID is actually its public key. The private key was placed in
# your keyring. All updates must be signed with the same key.
manifest = (
appTitle = (defaultText = "Firefly III"),
appVersion = 1,
appMarketingVersion = (defaultText = "3.4.3"),
actions = [
# Define your "new document" handlers here.
( nounPhrase = (defaultText = "administration"),
command = .myCommand
# The command to run when starting for the first time. (".myCommand"
# is just a constant defined at the bottom of the file.)
)
],
continueCommand = .myCommand,
# This is the command called to start your app back up after it has been
# shut down for inactivity. Here we're using the same command as for
# starting a new instance, but you could use different commands for each
# case.
metadata = (
icons = (
appGrid = (png = (dpi1x = embed "app-graphics/firefly-iii-128.png")),
grain = (png = (dpi1x = embed "app-graphics/firefly-iii-24.png",
dpi2x = embed "app-graphics/firefly-iii-48.png")),
market = (png = (dpi1x = embed "app-graphics/firefly-iii-150.png"))
),
website = "https://firefly-iii.github.io/",
codeUrl = "https://github.com/firefly-iii/firefly-iii",
#license = (openSource = mit),
license = (proprietary = (defaultText = embed "../LICENSE")),
# The license this package is distributed under. See
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#license
categories = [productivity],
# A list of categories/genres to which this app belongs, sorted with best fit first.
# See the list of categories at
# https://docs.sandstorm.io/en/latest/developing/publishing-apps/#categories
author = (
contactEmail = "thegrumpydictator@gmail.com",
upstreamAuthor = "James Cole",
pgpSignature = embed "pgp-signature",
),
pgpKeyring = embed "pgp-keyring",
description = (defaultText = embed "description.md"),
shortDescription = (defaultText = "Financial management"),
screenshots = [
# Screenshots to use for marketing purposes. Examples below.
# Sizes are given in device-independent pixels, so if you took these
# screenshots on a Retina-style high DPI screen, divide each dimension by two.
(width = 1200, height = 1000, png = embed "screenshots/screenshot-1.png"),
(width = 1200, height = 1000, png = embed "screenshots/screenshot-2.png"),
(width = 1200, height = 1518, png = embed "screenshots/screenshot-3.png"),
],
changeLog = (defaultText = embed "changelog.md"),
),
),
sourceMap = (
# Here we defined where to look for files to copy into your package. The
# `spk dev` command actually figures out what files your app needs
# automatically by running it on a FUSE filesystem. So, the mappings
# here are only to tell it where to find files that the app wants.
searchPath = [
( sourcePath = "." ), # Search this directory first.
( sourcePath = "/", # Then search the system root directory.
hidePaths = [ "home", "proc", "sys",
"etc/passwd", "etc/hosts", "etc/host.conf",
"etc/nsswitch.conf", "etc/resolv.conf" ]
# You probably don't want the app pulling files from these places,
# so we hide them. Note that /dev, /var, and /tmp are implicitly
# hidden because Sandstorm itself provides them.
)
]
),
fileList = "sandstorm-files.list",
# `spk dev` will write a list of all the files your app uses to this file.
# You should review it later, before shipping your app.
alwaysInclude = [],
# Fill this list with more names of files or directories that should be
# included in your package, even if not listed in sandstorm-files.list.
# Use this to force-include stuff that you know you need but which may
# not have been detected as a dependency during `spk dev`. If you list
# a directory here, its entire contents will be included recursively.
#bridgeConfig = (
# # Used for integrating permissions and roles into the Sandstorm shell
# # and for sandstorm-http-bridge to pass to your app.
# # Uncomment this block and adjust the permissions and roles to make
# # sense for your app.
# # For more information, see high-level documentation at
# # https://docs.sandstorm.io/en/latest/developing/auth/
# # and advanced details in the "BridgeConfig" section of
# # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/package.capnp
# viewInfo = (
# # For details on the viewInfo field, consult "ViewInfo" in
# # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/grain.capnp
#
# permissions = [
# # Permissions which a user may or may not possess. A user's current
# # permissions are passed to the app as a comma-separated list of `name`
# # fields in the X-Sandstorm-Permissions header with each request.
# #
# # IMPORTANT: only ever append to this list! Reordering or removing fields
# # will change behavior and permissions for existing grains! To deprecate a
# # permission, or for more information, see "PermissionDef" in
# # https://github.com/sandstorm-io/sandstorm/blob/master/src/sandstorm/grain.capnp
# (
# name = "editor",
# # Name of the permission, used as an identifier for the permission in cases where string
# # names are preferred. Used in sandstorm-http-bridge's X-Sandstorm-Permissions HTTP header.
#
# title = (defaultText = "editor"),
# # Display name of the permission, e.g. to display in a checklist of permissions
# # that may be assigned when sharing.
#
# description = (defaultText = "grants ability to modify data"),
# # Prose describing what this role means, suitable for a tool tip or similar help text.
# ),
# ],
# roles = [
# # Roles are logical collections of permissions. For instance, your app may have
# # a "viewer" role and an "editor" role
# (
# title = (defaultText = "editor"),
# # Name of the role. Shown in the Sandstorm UI to indicate which users have which roles.
#
# permissions = [true],
# # An array indicating which permissions this role carries.
# # It should be the same length as the permissions array in
# # viewInfo, and the order of the lists must match.
#
# verbPhrase = (defaultText = "can make changes to the document"),
# # Brief explanatory text to show in the sharing UI indicating
# # what a user assigned this role will be able to do with the grain.
#
# description = (defaultText = "editors may view all site data and change settings."),
# # Prose describing what this role means, suitable for a tool tip or similar help text.
# ),
# (
# title = (defaultText = "viewer"),
# permissions = [false],
# verbPhrase = (defaultText = "can view the document"),
# description = (defaultText = "viewers may view what other users have written."),
# ),
# ],
# ),
# #apiPath = "/api",
# # Apps can export an API to the world. The API is to be used primarily by Javascript
# # code and native apps, so it can't serve out regular HTML to browsers. If a request
# # comes in to your app's API, sandstorm-http-bridge will prefix the request's path with
# # this string, if specified.
#),
);
const myCommand :Spk.Manifest.Command = (
# Here we define the command used to start up your server.
argv = ["/sandstorm-http-bridge", "8000", "--", "/opt/app/.sandstorm/launcher.sh"],
environ = [
# Note that this defines the *entire* environment seen by your app.
(key = "PATH", value = "/usr/local/bin:/usr/bin:/bin"),
(key = "SANDSTORM", value = "1"),
# Export SANDSTORM=1 into the environment, so that apps running within Sandstorm
# can detect if $SANDSTORM="1" at runtime, switching UI and/or backend to use
# the app's Sandstorm-specific integration code.
]
);

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

View File

@@ -0,0 +1,89 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@@ -0,0 +1,87 @@
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
# multi_accept on;
}
http {
# Basic Settings
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_names_hash_bucket_size 64;
server_tokens off;
server_name_in_redirect off;
include mime.types;
default_type application/octet-stream;
# Logging
access_log off;
error_log stderr;
# Prevent nginx from adding compression; this interacts badly with Sandstorm
# WebSession due to https://github.com/sandstorm-io/sandstorm/issues/289
gzip off;
# Trust the sandstorm-http-bridge's X-Forwarded-Proto.
map $http_x_forwarded_proto $fe_https {
default "";
https on;
}
server {
listen 8000 default_server;
listen [::]:8000 default_server ipv6only=on;
# Allow arbitrarily large bodies - Sandstorm can handle them, and requests
# are authenticated already, so there's no reason for apps to add additional
# limits by default.
client_max_body_size 0;
server_name localhost;
root /opt/app/public;
location / {
index index.php;
try_files $uri $uri/ /index.php?$query_string;
autoindex on;
sendfile off;
}
location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param HTTPS $fe_https if_not_empty;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx/$nginx_version;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
# PHP only, required if PHP was built with --enable-force-cgi-redirect
#fastcgi_param REDIRECT_STATUS 200;
}
}
}

61
.sandstorm/setup.sh Executable file
View File

@@ -0,0 +1,61 @@
#!/bin/bash
# When you change this file, you must take manual action. Read this doc:
# - https://docs.sandstorm.io/en/latest/vagrant-spk/customizing/#setupsh
set -euo pipefail
export DEBIAN_FRONTEND=noninteractive
# install packages so we can install apt-add-repository.
apt-get update
apt-get install -y python-software-properties software-properties-common
# actually add repository
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys E9C74FEEA2098A6E
add-apt-repository "deb http://packages.dotdeb.org jessie all"
# install packages.
apt-get update
apt-get install -y nginx php7.0-fpm php7.0-mysql php7.0-cli php7.0-curl git php7.0-dev php7.0-intl php7.0-dom php7.0-mbstring php7.0-bcmath mysql-server
service nginx stop
service php7.0-fpm stop
service mysql stop
systemctl disable nginx
systemctl disable php7.0-fpm
systemctl disable mysql
# patch /etc/php/7.0/fpm/pool.d/www.conf to not change uid/gid to www-data
sed --in-place='' \
--expression='s/^listen.owner = www-data/;listen.owner = www-data/' \
--expression='s/^listen.group = www-data/;listen.group = www-data/' \
/etc/php/7.0/fpm/pool.d/www.conf
# patch /etc/php/7.0/fpm/php-fpm.conf to not have a pidfile
sed --in-place='' \
--expression='s/^pid =/;pid =/' \
/etc/php/7.0/fpm/php-fpm.conf
# move sock file to better dir:
sed --in-place='' \
--expression='s/^listen = \/run\/php\/php7.0-fpm.sock/listen = \/var\/run\/php7.0-fpm.sock/' \
/etc/php/7.0/fpm/pool.d/www.conf
# patch /etc/php/7.0/fpm/pool.d/www.conf to no clear environment variables
# so we can pass in SANDSTORM=1 to apps
sed --in-place='' \
--expression='s/^;clear_env = no/clear_env=no/' \
/etc/php/7.0/fpm/pool.d/www.conf
# patch mysql conf to not change uid, and to use /var/tmp over /tmp
# for secure-file-priv see https://github.com/sandstorm-io/vagrant-spk/issues/195
sed --in-place='' \
--expression='s/^user\t\t= mysql/#user\t\t= mysql/' \
--expression='s,^tmpdir\t\t= /tmp,tmpdir\t\t= /var/tmp,' \
--expression='/\[mysqld]/ a\ secure-file-priv = ""\' \
/etc/mysql/my.cnf
# patch mysql conf to use smaller transaction logs to save disk space
cat <<EOF > /etc/mysql/conf.d/sandstorm.cnf
[mysqld]
# Set the transaction log file to the minimum allowed size to save disk space.
# innodb_log_file_size = 1048576
# Set the main data file to grow by 1MB at a time, rather than 8MB at a time.
innodb_autoextend_increment = 1
EOF

1
.sandstorm/stack Normal file
View File

@@ -0,0 +1 @@
lemp

View File

@@ -2,18 +2,42 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [4.3.5] - 2017-02-19
### Added
- Beta support for Sandstorm.IO
- Docker support by [@schoentoon](https://github.com/schoentoon), [@elohmeier](https://github.com/elohmeier), [@patrickkostjens](https://github.com/patrickkostjens) and [@crash7](https://github.com/crash7)!
- Can now use special keywords in the search to search for specic dates, categories, etc.
### Changed
- Updated to laravel 5.4!
- User friendly error message
- Updated locales to support more operating systems, first reported in #536 by [dabenzel](https://github.com/dabenzel)
- Updated budget report
- Improved 404 page
- Smooth curves, improved by [elamperti](https://github.com/elamperti).
## [4.3.3] - 2017-02-02
### Fixed
- Fixed bug #550, reported by @worldworm!
- Fixed bug #551, reported by @t-me!
- #549
- #553
- Fixed #559 reported by [elamperti](https://github.com/elamperti).
- #565, as reported by a user over the mail
- #566, as reported by [dspeckmann](https://github.com/dspeckmann)
- #567, as reported by [winsomniak](https://github.com/winsomniak)
- #569, as reported by [winsomniak](https://github.com/winsomniak)
- #572, as reported by [zjean](https://github.com/zjean)
- Many issues with the transaction filters which will fix reports (they tended to display the wrong amount).
## [4.3.4] - 2017-02-02
### Fixed
- Fixed bug #550, reported by [worldworm](https://github.com/worldworm)!
- Fixed bug #551, reported by [t-me](https://github.com/t-me)!
## [4.3.3] - 2017-01-30
_The 100th release of Firefly!_
### Added
- Add locales to Docker (#534) by @elohmeier.
- Add locales to Docker (#534) by [elohmeier](https://github.com/elohmeier).
- Optional database encryption. On by default.
- Datepicker for Firefox and other browsers.
- New instruction block for updating and installing.
@@ -44,35 +68,35 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- The password reset routine was broken.
- Issue #522, thanks to @xpfgsyb
- Issue #524, thanks to @worldworm
- Issue #526, thanks to @worldworm
- Issue #528, thanks to @skibbipl
- Issue #522, thanks to [xpfgsyb](https://github.com/xpfgsyb)
- Issue #524, thanks to [worldworm](https://github.com/worldworm)
- Issue #526, thanks to [worldworm](https://github.com/worldworm)
- Issue #528, thanks to [skibbipl](https://github.com/skibbipl)
- Various other fixes.
## [4.3.1] - 2017-01-04
### Added
- Support for Russian and Polish.
- Support for a proper demo website.
- Support for custom decimal places in currencies (#506, suggested by @xpfgsyb).
- Most amounts are now right-aligned (#511, suggested by @xpfgsyb).
- Support for custom decimal places in currencies (#506, suggested by [xpfgsyb](https://github.com/xpfgsyb)).
- Most amounts are now right-aligned (#511, suggested by [xpfgsyb](https://github.com/xpfgsyb)).
- German is now a "complete" language, more than 75% translated!
### Changed
- **[New Github repository!](github.com/firefly-iii/firefly-iii)**
- Better category overview.
- #502, thanks to @zjean
- #502, thanks to [zjean](https://github.com/zjean)
### Removed
- Removed a lot of administration functions.
- Removed ability to activate users.
### Fixed
- #501, thanks to @zjean
- #513, thanks to @skibbipl
- #501, thanks to [zjean](https://github.com/zjean)
- #513, thanks to [skibbipl](https://github.com/skibbipl)
### Security
- #519, thanks to @xpfgsyb
- #519, thanks to [xpfgsyb](https://github.com/xpfgsyb)
## [4.3.0] - 2015-12-26
### Added
@@ -105,7 +129,7 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Various bugs
- Issue #472 thanks to @zjean
- Issue #472 thanks to [zjean](https://github.com/zjean)
## [4.2.1] - 2016-12-09
### Added
@@ -140,10 +164,10 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Issue #408
- Various issues with split journals
- Issue #414, thx @zjean
- Issue #419, thx @schwalberich
- Issue #422, thx @xzaz
- Various import bugs, such as #416 (@zjean)
- Issue #414, thx [zjean](https://github.com/zjean)
- Issue #419, thx [schwalberich](https://github.com/schwalberich)
- Issue #422, thx [xzaz](https://github.com/xzaz)
- Various import bugs, such as #416 ([zjean](https://github.com/zjean))
### Security
@@ -165,9 +189,9 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Made all pages more mobile friendly.
- Fixed #395 found by @marcoveeneman.
- Fixed #398 found by @marcoveeneman.
- Fixed #401 found by @marcoveeneman.
- Fixed #395 found by [marcoveeneman](https://github.com/marcoveeneman).
- Fixed #398 found by [marcoveeneman](https://github.com/marcoveeneman).
- Fixed #401 found by [marcoveeneman](https://github.com/marcoveeneman).
- Many optimizations.
- Updated many libraries.
- Various bugs found by myself.
@@ -179,13 +203,13 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Changed
- Greatly expanded help pages and their function.
- Built a new transaction collector, which I think was the idea of @roberthorlings originally.
- Built a new transaction collector, which I think was the idea of [roberthorlings](https://github.com/roberthorlings) originally.
- Rebuilt seach engine.
### Fixed
- #375, thanks to @schoentoon which made it impossible to resurrect currencies.
- #370 thanks to @ksmolder
- #378, thanks to @HomelessAvatar
- #375, thanks to [schoentoon](https://github.com/schoentoon) which made it impossible to resurrect currencies.
- #370 thanks to [ksmolder](https://github.com/ksmolder)
- #378, thanks to [HomelessAvatar](https://github.com/HomelessAvatar)
## [4.1.5] - 2016-11-01
### Changed
@@ -198,7 +222,7 @@ An intermediate release because something in the Twig and Twigbridge libraries i
## [4.1.4] - 2016-10-30
### Added
- New Dockerfile thanks to @schoentoon
- New Dockerfile thanks to [schoentoon](https://github.com/schoentoon)
- Added changing the destination account as rule action.
- Added changing the source account as rule action.
- Can convert transactions into different types.
@@ -211,10 +235,10 @@ An intermediate release because something in the Twig and Twigbridge libraries i
- Change error message to refer to solution.
### Fixed
- #367 thanks to @HungryFeline
- #366 thanks to @3mz3t
- #362 and #341 thanks to @bnw
- #355 thanks to @roberthorlings
- #367 thanks to [HungryFeline](https://github.com/HungryFeline)
- #366 thanks to [3mz3t](https://github.com/3mz3t)
- #362 and #341 thanks to [bnw](https://github.com/bnw)
- #355 thanks to [roberthorlings](https://github.com/roberthorlings)
## [4.1.3] - 2016-10-22
### Fixed
@@ -246,29 +270,29 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- #357, where non utf-8 files would break Firefly.
- Tab delimiter is not properly loaded from import configuration (@roberthorlings)
- Tab delimiter is not properly loaded from import configuration ([roberthorlings](https://github.com/roberthorlings))
- System response to yearly bills
## [4.0.2] - 2016-10-14
### Added
- Added ``intl`` dependency to composer file to ease installation (thanks @telyn)
- Added ``intl`` dependency to composer file to ease installation (thanks [telyn](https://github.com/telyn))
- Added support for Croatian.
### Changed
- Updated all copyright notices to refer to the [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/)
- Fixed #344
- Fixed #346, thanks to @SanderKleykens
- Fixed #346, thanks to [SanderKleykens](https://github.com/SanderKleykens)
- #351
- Did some internal remodelling.
### Fixed
- PostgreSQL compatibility thanks to @SanderKleykens
- @RobertHorlings fixed a bug in the ABN Amro import specific.
- PostgreSQL compatibility thanks to [SanderKleykens](https://github.com/SanderKleykens)
- [roberthorlings](https://github.com/roberthorlings) fixed a bug in the ABN Amro import specific.
## [4.0.1] - 2016-10-04
### Added
- New ING import specific by @tomwerf
- New ING import specific by [tomwerf](https://github.com/tomwerf)
- New Presidents Choice specific to fix #307
- Added some trimming (#335)
@@ -283,10 +307,10 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Fixed a bug where incoming transactions would not be properly filtered in several reports.
- #334 by @cyberkov
- #334 by [cyberkov](https://github.com/cyberkov)
- #337
- #336
- #338 found by @roberthorlings
- #338 found by [roberthorlings](https://github.com/roberthorlings)
### Security
- Initial release.
@@ -297,29 +321,29 @@ An intermediate release because something in the Twig and Twigbridge libraries i
## [4.0.0] - 2015-09-26
### Added
- Upgraded to Laravel 5.3, most other libraries upgraded as well.
- Added GBP as currency, thanks to @Mortalife
- Added GBP as currency, thanks to [Mortalife](https://github.com/Mortalife)
### Changed
- Jump to version 4.0.0.
- Firefly III is now subject to a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) license. Previous versions of this software are still MIT licensed.
### Fixed
- Support for specific decimal places, thanks to @Mortalife
- Support for specific decimal places, thanks to [Mortalife](https://github.com/Mortalife)
- Various CSS fixes
- Various bugs, thanks to @fuf, @sandermulders and @vissert
- Various bugs, thanks to [fuf](https://github.com/fuf), [sandermulders](https://github.com/sandermulders) and [vissert](https://github.com/vissert)
- Various queries optimized for MySQL 5.7
## [3.10.4] - 2015-09-14
### Fixed
- Migration fix by @sandermulders
- Tricky import bug fix thanks to @vissert
- Currency preference will be correctly pulled from user settings, thanks to @fuf
- Migration fix by [sandermulders](https://github.com/sandermulders)
- Tricky import bug fix thanks to [vissert](https://github.com/vissert)
- Currency preference will be correctly pulled from user settings, thanks to [fuf](https://github.com/fuf)
- Simplified code for upgrade instructions.
## [3.10.3] - 2016-08-29
### Added
- More fields for mass-edit, thanks to @Vissert (#282)
- More fields for mass-edit, thanks to [vissert](https://github.com/vissert) (#282)
- First start of German translation
### Changed
@@ -330,7 +354,7 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- A bug in the translation routine broke the import.
- It was possible to destroy your Firefly installation by removing all currencies. Thanks @mondjef
- It was possible to destroy your Firefly installation by removing all currencies. Thanks [mondjef](https://github.com/mondjef)
- Translation bugs.
- Import bug.
@@ -350,8 +374,8 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Bug in the mass edit routines.
- Firefly III over a proxy will now work (see [issue #290](https://github.com/firefly-iii/firefly-iii/issues/290)), thanks @dfiel for reporting.
- Sneaky bug in the import routine, fixed by @Bonno
- Firefly III over a proxy will now work (see [issue #290](https://github.com/firefly-iii/firefly-iii/issues/290)), thanks [dfiel](https://github.com/dfiel) for reporting.
- Sneaky bug in the import routine, fixed by [Bonno](https://github.com/Bonno)
## [3.10.1] - 2016-08-25
### Added
@@ -389,15 +413,15 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Issue #264
- Issue #265
- Fixed amount calculation problems, #266, thanks @xzaz
- Fixed amount calculation problems, #266, thanks [xzaz](https://github.com/xzaz)
- Issue #271
- Issue #278, #273, thanks @StevenReitsma and @rubella
- Issue #278, #273, thanks [StevenReitsma](https://github.com/StevenReitsma) and [rubella](https://github.com/rubella)
- Bug in attachment download routine would report the wrong size to the user's browser.
- Various NULL errors fixed.
- Various strict typing errors fixed.
- Fixed pagination problems, #276, thanks @xzaz
- Fixed pagination problems, #276, thanks [xzaz](https://github.com/xzaz)
- Fixed a bug where an expense would be assigned to a piggy bank if you created a transfer first.
- Bulk update problems, #280, thanks @stickgrinder
- Bulk update problems, #280, thanks [stickgrinder](https://github.com/stickgrinder)
- Fixed various problems with amount reporting of split transactions.
## [3.9.1]
@@ -406,8 +430,8 @@ An intermediate release because something in the Twig and Twigbridge libraries i
## [3.9.0]
### Added
- @zjean has added code that allows you to force "https://"-URL's.
- @tonicospinelli has added Portuguese (Brazil) translations.
- [zjean](https://github.com/zjean) has added code that allows you to force "https://"-URL's.
- [tonicospinelli](https://github.com/tonicospinelli) has added Portuguese (Brazil) translations.
- Firefly III supports the *splitting* of transactions:
- A withdrawal (expense) can be split into multiple sub-transactions (with multiple destinations)
- Likewise for deposits (incomes). You can set multiple sources.
@@ -438,7 +462,7 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Fixed
- Several CSV related bugs.
- Several other bugs.
- Bugs fixed by @Bonno.
- Bugs fixed by [Bonno](https://github.com/Bonno).
## [3.8.3] - 2016-04-17
### Added
@@ -485,7 +509,7 @@ An intermediate release because something in the Twig and Twigbridge libraries i
### Added
- Two factor authentication, thanks to the excellent work of [zjean](https://github.com/zjean).
- A new chart showing your net worth in year and multi-year reports.
- You can now see if your current or future rules actually match any transactions, thanks to the excellent work of @roberthorlings.
- You can now see if your current or future rules actually match any transactions, thanks to the excellent work of [roberthorlings](https://github.com/roberthorlings).
- New date fields for transactions. They are not used yet in reports or anything, but they can be filled in.
- New routine to export your data.
- Firefly III will mail the site owner when blocked users try to login, or when blocked domains are used in registrations.

View File

@@ -12,6 +12,7 @@ RUN apt-get update -y && \
libxml2-dev \
libsqlite3-dev \
libbz2-dev \
gettext-base \
locales && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
@@ -44,3 +45,5 @@ WORKDIR /var/www/firefly-iii
RUN composer install --no-scripts --no-dev
USER root
ENTRYPOINT ["/var/www/firefly-iii/docker/entrypoint.sh"]

View File

@@ -26,7 +26,7 @@ Firefly works on the principle that if you know where you're money is going, you
- Firefly can import any CSV file, so migrating from other systems is easy.
- Firefly runs on your own server, so you are fully in control of your data. Remember, there is no such thing as "the cloud", its just somebody elses computer!
- Firefly has lots of features without becoming fancy or bloated.
- Firefly has lots of features without being fancy or bloated.
- If you feel you're missing something you can just ask me and I'll add it!
Firefly is pretty awesome. [You can read more about Firefly III, and its features, on the Github Pages](https://firefly-iii.github.io/).

View File

@@ -79,8 +79,9 @@ class CreateImport extends Command
$this->info(sprintf('Type of import: %s', $type));
/** @var ImportJobRepositoryInterface $jobRepository */
$jobRepository = app(ImportJobRepositoryInterface::class, [$user]);
$job = $jobRepository->create($type);
$jobRepository = app(ImportJobRepositoryInterface::class);
$jobRepository->setUser($user);
$job = $jobRepository->create($type);
$this->line(sprintf('Created job "%s"...', $job->key));
Artisan::call('firefly:encrypt', ['file' => $file, 'key' => $job->key]);

View File

@@ -84,21 +84,8 @@ class UpgradeFireflyInstructions extends Command
}
}
/**
* Show a line
*/
private function showLine()
private function installInstructions()
{
$line = '+';
for ($i = 0; $i < 78; $i++) {
$line .= '-';
}
$line .= '+';
$this->line($line);
}
private function installInstructions() {
/** @var string $version */
$version = config('firefly.version');
$config = config('upgrade.text.install');
@@ -120,6 +107,7 @@ class UpgradeFireflyInstructions extends Command
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
$this->showLine();
return;
}
@@ -129,6 +117,20 @@ class UpgradeFireflyInstructions extends Command
$this->showLine();
}
/**
* Show a line
*/
private function showLine()
{
$line = '+';
for ($i = 0; $i < 78; $i++) {
$line .= '-';
}
$line .= '+';
$this->line($line);
}
private function updateInstructions()
{
/** @var string $version */
@@ -152,6 +154,7 @@ class UpgradeFireflyInstructions extends Command
$this->boxed('Firefly III should be ready for use.');
$this->boxed('');
$this->showLine();
return;
}

View File

@@ -39,9 +39,9 @@ class Kernel extends ConsoleKernel
*/
protected $bootstrappers
= [
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables',
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
'FireflyIII\Bootstrap\ConfigureLogging',
//'FireflyIII\Bootstrap\ConfigureLogging',
'Illuminate\Foundation\Bootstrap\HandleExceptions',
'Illuminate\Foundation\Bootstrap\RegisterFacades',
'Illuminate\Foundation\Bootstrap\SetRequestForConsole',

View File

@@ -16,7 +16,6 @@ namespace FireflyIII\Export\Collector;
use Carbon\Carbon;
use Crypt;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\ExportJob;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Collection;
@@ -43,10 +42,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
/**
* AttachmentCollector constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
public function __construct()
{
/** @var AttachmentRepositoryInterface repository */
$this->repository = app(AttachmentRepositoryInterface::class);
@@ -54,7 +51,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
$this->uploadDisk = Storage::disk('upload');
$this->exportDisk = Storage::disk('export');
parent::__construct($job);
parent::__construct();
}
/**

View File

@@ -31,13 +31,10 @@ class BasicCollector
/**
* BasicCollector constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
public function __construct()
{
$this->entries = new Collection;
$this->job = $job;
}
/**
@@ -56,5 +53,13 @@ class BasicCollector
$this->entries = $entries;
}
/**
* @param ExportJob $job
*/
public function setJob(ExportJob $job)
{
$this->job = $job;
}
}

View File

@@ -13,6 +13,7 @@ declare(strict_types = 1);
namespace FireflyIII\Export\Collector;
use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
@@ -40,4 +41,11 @@ interface CollectorInterface
*/
public function setEntries(Collection $entries);
/**
* @param ExportJob $job
*
* @return mixed
*/
public function setJob(ExportJob $job);
}

View File

@@ -19,6 +19,7 @@ use DB;
use FireflyIII\Models\Transaction;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
use Steam;
/**
* Class JournalExportCollector
@@ -118,7 +119,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
$obj->name = Steam::decrypt(intval($obj->encrypted), $obj->name);
}
);
$array = [];
@@ -159,7 +160,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
$obj->name = Steam::decrypt(intval($obj->encrypted), $obj->name);
}
);
$array = [];
@@ -202,7 +203,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
$obj->name = Steam::decrypt(intval($obj->encrypted), $obj->name);
}
);
$array = [];
@@ -243,7 +244,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
$obj->name = Steam::decrypt(intval($obj->encrypted), $obj->name);
}
);
$array = [];

View File

@@ -14,7 +14,6 @@ declare(strict_types = 1);
namespace FireflyIII\Export\Collector;
use Crypt;
use FireflyIII\Models\ExportJob;
use Illuminate\Contracts\Encryption\DecryptException;
use Log;
use Storage;
@@ -35,22 +34,12 @@ class UploadCollector extends BasicCollector implements CollectorInterface
/**
* AttachmentCollector constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
public function __construct()
{
parent::__construct($job);
Log::debug('Going to collect attachments', ['key' => $job->key]);
// make storage:
parent::__construct();
$this->uploadDisk = Storage::disk('upload');
$this->exportDisk = Storage::disk('export');
// file names associated with the old import routine.
$this->vintageFormat = sprintf('csv-upload-%d-', auth()->user()->id);
}
/**
@@ -60,6 +49,11 @@ class UploadCollector extends BasicCollector implements CollectorInterface
*/
public function run(): bool
{
Log::debug('Going to collect attachments', ['key' => $this->job->key]);
// file names associated with the old import routine.
$this->vintageFormat = sprintf('csv-upload-%d-', $this->job->user->id);
// collect old upload files (names beginning with "csv-upload".
$this->collectVintageUploads();

View File

@@ -14,6 +14,7 @@ declare(strict_types = 1);
namespace FireflyIII\Export\Entry;
use Crypt;
use Steam;
/**
* To extend the exported object, in case of new features in Firefly III for example,
@@ -73,15 +74,15 @@ final class Entry
{
$entry = new self;
$entry->journal_id = $object->transaction_journal_id;
$entry->description = self::decrypt(intval($object->journal_encrypted), $object->journal_description);
$entry->description = Steam::decrypt(intval($object->journal_encrypted), $object->journal_description);
$entry->amount = $object->amount;
$entry->date = $object->date;
$entry->transaction_type = $object->transaction_type;
$entry->currency_code = $object->transaction_currency_code;
$entry->source_account_id = $object->account_id;
$entry->source_account_name = self::decrypt(intval($object->account_name_encrypted), $object->account_name);
$entry->source_account_name = Steam::decrypt(intval($object->account_name_encrypted), $object->account_name);
$entry->destination_account_id = $object->opposing_account_id;
$entry->destination_account_name = self::decrypt(intval($object->opposing_account_encrypted), $object->opposing_account_name);
$entry->destination_account_name = Steam::decrypt(intval($object->opposing_account_encrypted), $object->opposing_account_name);
$entry->category_id = $object->category_id ?? '';
$entry->category_name = $object->category_name ?? '';
$entry->budget_id = $object->budget_id ?? '';
@@ -95,19 +96,5 @@ final class Entry
return $entry;
}
/**
* @param int $isEncrypted
* @param $value
*
* @return string
*/
protected static function decrypt(int $isEncrypted, $value)
{
if ($isEncrypted === 1) {
return Crypt::decrypt($value);
}
return $value;
}
}

View File

@@ -26,17 +26,15 @@ class BasicExporter
{
/** @var ExportJob */
protected $job;
private $entries;
/** @var Collection */
private $entries;
/**
* BasicExporter constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
public function __construct()
{
$this->entries = new Collection;
$this->job = $job;
}
/**
@@ -55,5 +53,13 @@ class BasicExporter
$this->entries = $entries;
}
/**
* @param ExportJob $job
*/
public function setJob(ExportJob $job)
{
$this->job = $job;
}
}

View File

@@ -14,7 +14,6 @@ declare(strict_types = 1);
namespace FireflyIII\Export\Exporter;
use FireflyIII\Export\Entry\Entry;
use FireflyIII\Models\ExportJob;
use League\Csv\Writer;
use SplFileObject;
@@ -30,13 +29,10 @@ class CsvExporter extends BasicExporter implements ExporterInterface
/**
* CsvExporter constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
public function __construct()
{
parent::__construct($job);
parent::__construct();
}
/**

View File

@@ -13,6 +13,7 @@ declare(strict_types = 1);
namespace FireflyIII\Export\Exporter;
use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
@@ -45,4 +46,9 @@ interface ExporterInterface
*/
public function setEntries(Collection $entries);
/**
* @param ExportJob $job
*/
public function setJob(ExportJob $job);
}

View File

@@ -19,7 +19,6 @@ use FireflyIII\Export\Collector\JournalExportCollector;
use FireflyIII\Export\Collector\UploadCollector;
use FireflyIII\Export\Entry\Entry;
use FireflyIII\Models\ExportJob;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Collection;
use Log;
use Storage;
@@ -54,21 +53,12 @@ class Processor implements ProcessorInterface
/**
* Processor constructor.
*
* @param array $settings
*/
public function __construct(array $settings)
public function __construct()
{
// save settings
$this->settings = $settings;
$this->accounts = $settings['accounts'];
$this->exportFormat = $settings['exportFormat'];
$this->includeAttachments = $settings['includeAttachments'];
$this->includeOldUploads = $settings['includeOldUploads'];
$this->job = $settings['job'];
$this->journals = new Collection;
$this->exportEntries = new Collection;
$this->files = new Collection;
$this->journals = new Collection;
$this->exportEntries = new Collection;
$this->files = new Collection;
}
@@ -78,7 +68,8 @@ class Processor implements ProcessorInterface
public function collectAttachments(): bool
{
/** @var AttachmentCollector $attachmentCollector */
$attachmentCollector = app(AttachmentCollector::class, [$this->job]);
$attachmentCollector = app(AttachmentCollector::class);
$attachmentCollector->setJob($this->job);
$attachmentCollector->setDates($this->settings['startDate'], $this->settings['endDate']);
$attachmentCollector->run();
$this->files = $this->files->merge($attachmentCollector->getEntries());
@@ -92,7 +83,8 @@ class Processor implements ProcessorInterface
public function collectJournals(): bool
{
/** @var JournalExportCollector $collector */
$collector = app(JournalExportCollector::class, [$this->job]);
$collector = app(JournalExportCollector::class);
$collector->setJob($this->job);
$collector->setDates($this->settings['startDate'], $this->settings['endDate']);
$collector->setAccounts($this->settings['accounts']);
$collector->run();
@@ -108,7 +100,8 @@ class Processor implements ProcessorInterface
public function collectOldUploads(): bool
{
/** @var UploadCollector $uploadCollector */
$uploadCollector = app(UploadCollector::class, [$this->job]);
$uploadCollector = app(UploadCollector::class);
$uploadCollector->setJob($this->job);
$uploadCollector->run();
$this->files = $this->files->merge($uploadCollector->getEntries());
@@ -166,7 +159,8 @@ class Processor implements ProcessorInterface
public function exportJournals(): bool
{
$exporterClass = config('firefly.export_formats.' . $this->exportFormat);
$exporter = app($exporterClass, [$this->job]);
$exporter = app($exporterClass);
$exporter->setJob($this->job);
$exporter->setEntries($this->exportEntries);
$exporter->run();
$this->files->push($exporter->getFileName());
@@ -182,6 +176,20 @@ class Processor implements ProcessorInterface
return $this->files;
}
/**
* @param array $settings
*/
public function setSettings(array $settings)
{
// save settings
$this->settings = $settings;
$this->accounts = $settings['accounts'];
$this->exportFormat = $settings['exportFormat'];
$this->includeAttachments = $settings['includeAttachments'];
$this->includeOldUploads = $settings['includeOldUploads'];
$this->job = $settings['job'];
}
/**
*
*/

View File

@@ -25,11 +25,8 @@ interface ProcessorInterface
/**
* Processor constructor.
*
* @param array $settings
*
*/
public function __construct(array $settings);
public function __construct();
/**
* @return bool
@@ -65,4 +62,9 @@ interface ProcessorInterface
* @return Collection
*/
public function getFiles(): Collection;
/**
* @param array $settings
*/
public function setSettings(array $settings);
}

View File

@@ -14,6 +14,7 @@ declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\Basic;
use FireflyIII\Support\ChartColour;
use Steam;
/**
* Class ChartJsGenerator
@@ -108,11 +109,7 @@ class ChartJsGenerator implements GeneratorInterface
foreach ($data as $key => $value) {
// make larger than 0
if (bccomp($value, '0') === -1) {
$value = bcmul($value, '-1');
}
$chartData['datasets'][0]['data'][] = $value;
$chartData['datasets'][0]['data'][] = floatval(Steam::positive($value));
$chartData['datasets'][0]['backgroundColor'][] = ChartColour::getColour($index);
$chartData['labels'][] = $key;
$index++;

View File

@@ -129,6 +129,16 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $this;
}
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface
{
return $this;
}
/**
* @param Account $account
* @param Carbon $date
@@ -139,7 +149,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end);
$journals = $collector->getJournals();
$journals = $journals->reverse();

View File

@@ -131,6 +131,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
return $this;
}
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface
{
return $this;
}
/**
* @param Collection $collection
* @param int $sortFlag
@@ -185,7 +195,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
->setTypes([TransactionType::WITHDRAWAL])
->setBudgets($this->budgets)->withOpposingAccount()->disableFilter();

View File

@@ -141,6 +141,16 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
return $this;
}
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface
{
return $this;
}
/**
* @param Collection $collection
* @param int $sortFlag
@@ -195,7 +205,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
->setCategories($this->categories)->withOpposingAccount()->disableFilter();
@@ -218,7 +228,7 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
->setCategories($this->categories)->withOpposingAccount();

View File

@@ -64,4 +64,11 @@ interface ReportGeneratorInterface
*/
public function setStartDate(Carbon $date): ReportGeneratorInterface;
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface;
}

View File

@@ -106,4 +106,14 @@ class MonthReportGenerator implements ReportGeneratorInterface
return $this;
}
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface
{
return $this;
}
}

View File

@@ -103,4 +103,14 @@ class MultiYearReportGenerator implements ReportGeneratorInterface
return $this;
}
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface
{
return $this;
}
}

View File

@@ -103,4 +103,14 @@ class YearReportGenerator implements ReportGeneratorInterface
return $this;
}
/**
* @param Collection $tags
*
* @return ReportGeneratorInterface
*/
public function setTags(Collection $tags): ReportGeneratorInterface
{
return $this;
}
}

View File

@@ -19,7 +19,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Mail\Message;
use Log;
use Mail;
use Session;
use Swift_TransportException;
/**
@@ -54,20 +53,6 @@ class UserEventHandler
return true;
}
/**
* Handle user logout events.
*
* @return bool
*/
public function logoutUser(): bool
{
// dump stuff from the session:
Session::forget('twofactor-authenticated');
Session::forget('twofactor-authenticated-date');
return true;
}
/**
* @param RequestedNewPassword $event
*

View File

@@ -45,7 +45,7 @@ class AttachmentHelper implements AttachmentHelperInterface
public function __construct()
{
$this->maxUploadSize = intval(config('firefly.maxUploadSize'));
$this->allowedMimes = (array) config('firefly.allowedMimes');
$this->allowedMimes = (array)config('firefly.allowedMimes');
$this->errors = new MessageBag;
$this->messages = new MessageBag;
$this->uploadDisk = Storage::disk('upload');

View File

@@ -21,6 +21,7 @@ use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Steam;
/**
* Class MetaPieChart
@@ -85,7 +86,8 @@ class MetaPieChart implements MetaPieChartInterface
// also collect all other transactions
if ($this->collectOtherObjects && $direction === 'expense') {
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [$this->user]);
$collector = app(JournalCollectorInterface::class);
$collector->setUser($this->user);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::WITHDRAWAL]);
$journals = $collector->getJournals();
$sum = strval($journals->sum('transaction_amount'));
@@ -96,7 +98,7 @@ class MetaPieChart implements MetaPieChartInterface
if ($this->collectOtherObjects && $direction === 'income') {
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::DEPOSIT]);
$journals = $collector->getJournals();
$sum = strval($journals->sum('transaction_amount'));
@@ -201,7 +203,7 @@ class MetaPieChart implements MetaPieChartInterface
$modifier = 1;
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($this->accounts);
$collector->setRange($this->start, $this->end);
$collector->setTypes($types);
@@ -258,16 +260,13 @@ class MetaPieChart implements MetaPieChartInterface
{
$chartData = [];
$names = [];
$repository = app($this->repositories[$type], [$this->user]);
$repository = app($this->repositories[$type]);
foreach ($array as $objectId => $amount) {
if (!isset($names[$objectId])) {
$object = $repository->find(intval($objectId));
$names[$objectId] = $object->name;
}
if (bccomp($amount, '0') === -1) {
$amount = bcmul($amount, '-1');
}
$amount = Steam::positive($amount);
$this->total = bcadd($this->total, $amount);
$chartData[$names[$objectId]] = $amount;
}
@@ -275,4 +274,4 @@ class MetaPieChart implements MetaPieChartInterface
return $chartData;
}
}
}

View File

@@ -79,4 +79,4 @@ interface MetaPieChartInterface
*/
public function setUser(User $user): MetaPieChartInterface;
}
}

View File

@@ -1,193 +0,0 @@
<?php
/**
* Budget.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
*
* Class Budget
*
* @package FireflyIII\Helpers\Collection
*/
class Budget
{
/** @var Collection */
protected $budgetLines;
/** @var string */
protected $budgeted = '0';
/** @var string */
protected $left = '0';
/** @var string */
protected $overspent = '0';
/** @var string */
protected $spent = '0';
/**
*
*/
public function __construct()
{
$this->budgetLines = new Collection;
}
/**
* @param BudgetLine $budgetLine
*
* @return Budget
*/
public function addBudgetLine(BudgetLine $budgetLine): Budget
{
$this->budgetLines->push($budgetLine);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addBudgeted(string $add): Budget
{
$this->budgeted = bcadd($this->budgeted, $add);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addLeft(string $add): Budget
{
$this->left = bcadd($this->left, $add);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addOverspent(string $add): Budget
{
$this->overspent = bcadd($this->overspent, $add);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addSpent(string $add): Budget
{
$this->spent = bcadd($this->spent, $add);
return $this;
}
/**
* @return \Illuminate\Support\Collection
*/
public function getBudgetLines(): Collection
{
return $this->budgetLines;
}
/**
* @return string
*/
public function getBudgeted(): string
{
return $this->budgeted;
}
/**
* @param string $budgeted
*
* @return Budget
*/
public function setBudgeted(string $budgeted): Budget
{
$this->budgeted = $budgeted;
return $this;
}
/**
* @return string
*/
public function getLeft(): string
{
return $this->left;
}
/**
* @param string $left
*
* @return Budget
*/
public function setLeft(string $left): Budget
{
$this->left = $left;
return $this;
}
/**
* @return string
*/
public function getOverspent(): string
{
return $this->overspent;
}
/**
* @param string $overspent
*
* @return Budget
*/
public function setOverspent(string $overspent): Budget
{
$this->overspent = $overspent;
return $this;
}
/**
* @return string
*/
public function getSpent(): string
{
return $this->spent;
}
/**
* @param string $spent
*
* @return Budget
*/
public function setSpent(string $spent): Budget
{
$this->spent = $spent;
return $this;
}
}

View File

@@ -1,161 +0,0 @@
<?php
/**
* BudgetLine.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\BudgetLimit;
/**
*
* Class BudgetLine
*
* @package FireflyIII\Helpers\Collection
*/
class BudgetLine
{
/** @var BudgetModel */
protected $budget;
/** @var BudgetLimit */
protected $budgetLimit;
/** @var string */
protected $budgeted = '0';
/** @var string */
protected $left = '0';
/** @var string */
protected $overspent = '0';
/** @var string */
protected $spent = '0';
/**
* @return BudgetModel
*/
public function getBudget(): BudgetModel
{
return $this->budget ?? new BudgetModel;
}
/**
* @param BudgetModel $budget
*
* @return BudgetLine
*/
public function setBudget(BudgetModel $budget): BudgetLine
{
$this->budget = $budget;
return $this;
}
/**
* @return BudgetLimit
*/
public function getBudgetLimit(): BudgetLimit
{
return $this->budgetLimit ?? new BudgetLimit;
}
/**
* @param BudgetLimit $budgetLimit
*
* @return BudgetLimit
*/
public function setBudgetLimit(BudgetLimit $budgetLimit): BudgetLine
{
$this->budgetLimit = $budgetLimit;
return $this;
}
/**
* @return string
*/
public function getBudgeted(): string
{
return $this->budgeted;
}
/**
* @param string $budgeted
*
* @return BudgetLine
*/
public function setBudgeted(string $budgeted): BudgetLine
{
$this->budgeted = $budgeted;
return $this;
}
/**
* @return string
*/
public function getLeft(): string
{
return $this->left;
}
/**
* @param string $left
*
* @return BudgetLine
*/
public function setLeft(string $left): BudgetLine
{
$this->left = $left;
return $this;
}
/**
* @return string
*/
public function getOverspent(): string
{
return $this->overspent;
}
/**
* @param string $overspent
*
* @return BudgetLine
*/
public function setOverspent(string $overspent): BudgetLine
{
$this->overspent = $overspent;
return $this;
}
/**
* @return string
*/
public function getSpent(): string
{
return $this->spent;
}
/**
* @param string $spent
*
* @return BudgetLine
*/
public function setSpent(string $spent): BudgetLine
{
$this->spent = $spent;
return $this;
}
}

View File

@@ -32,6 +32,7 @@ use Illuminate\Database\Query\JoinClause;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Log;
use Steam;
/**
* Maybe this is a good idea after all...
@@ -54,9 +55,7 @@ class JournalCollector implements JournalCollectorInterface
'transaction_journals.description',
'transaction_journals.date',
'transaction_journals.encrypted',
//'transaction_journals.transaction_currency_id',
'transaction_currencies.code as transaction_currency_code',
//'transaction_currencies.symbol as transaction_currency_symbol',
'transaction_types.type as transaction_type_type',
'transaction_journals.bill_id',
'bills.name as bill_name',
@@ -96,17 +95,6 @@ class JournalCollector implements JournalCollectorInterface
/** @var User */
private $user;
/**
* JournalCollector constructor.
*
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
$this->query = $this->startQuery();
}
/**
* @return int
* @throws FireflyException
@@ -168,7 +156,7 @@ class JournalCollector implements JournalCollectorInterface
{
$this->run = true;
/** @var Collection $set */
$set = $this->query->get(array_values($this->fields));
$set = $this->query->get(array_values($this->fields));
Log::debug(sprintf('Count of set is %d', $set->count()));
$set = $this->filterTransfers($set);
Log::debug(sprintf('Count of set after filterTransfers() is %d', $set->count()));
@@ -182,10 +170,10 @@ class JournalCollector implements JournalCollectorInterface
$set->each(
function (Transaction $transaction) {
$transaction->date = new Carbon($transaction->date);
$transaction->description = $transaction->encrypted ? Crypt::decrypt($transaction->description) : $transaction->description;
$transaction->description = Steam::decrypt(intval($transaction->encrypted), $transaction->description);
if (!is_null($transaction->bill_name)) {
$transaction->bill_name = $transaction->bill_name_encrypted ? Crypt::decrypt($transaction->bill_name) : $transaction->bill_name;
$transaction->bill_name = Steam::decrypt(intval($transaction->bill_name_encrypted), $transaction->bill_name);
}
try {
@@ -244,8 +232,9 @@ class JournalCollector implements JournalCollectorInterface
public function setAllAssetAccounts(): JournalCollectorInterface
{
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class, [$this->user]);
$accounts = $repository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]);
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
$accounts = $repository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]);
if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereIn('transactions.account_id', $accountIds);
@@ -456,6 +445,37 @@ class JournalCollector implements JournalCollectorInterface
return $this;
}
/**
* @param User $user
*/
public function setUser(User $user)
{
$this->user = $user;
}
/**
*
*/
public function startQuery()
{
/** @var EloquentBuilder $query */
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
$this->query = $query;
}
/**
* @return JournalCollectorInterface
*/
@@ -484,36 +504,6 @@ class JournalCollector implements JournalCollectorInterface
{
$this->joinOpposingTables();
$accountIds = $this->accountIds;
$this->query->where(
function (EloquentBuilder $q1) use ($accountIds) {
// set 1:
// where source is in the set of $accounts
// but destination is not.
$q1->where(
function (EloquentBuilder $q2) use ($accountIds) {
// transactions.account_id in set
$q2->whereIn('transactions.account_id', $accountIds);
// opposing.account_id not in set
$q2->whereNotIn('opposing.account_id', $accountIds);
}
);
// set 1:
// where source is not in the set of $accounts
// but destination is.
$q1->orWhere(
function (EloquentBuilder $q3) use ($accountIds) {
// transactions.account_id not in set
$q3->whereNotIn('transactions.account_id', $accountIds);
// B in set
// opposing.account_id not in set
$q3->whereIn('opposing.account_id', $accountIds);
}
);
}
);
return $this;
}
@@ -597,7 +587,7 @@ class JournalCollector implements JournalCollectorInterface
* account, chances are the set include double entries: transfers get selected
* on both the source, and then again on the destination account.
*
* This method filters them out.
* This method filters them out by removing transfers that have been selected twice.
*
* @param Collection $set
*
@@ -606,36 +596,29 @@ class JournalCollector implements JournalCollectorInterface
private function filterTransfers(Collection $set): Collection
{
if ($this->filterTransfers) {
$set = $set->filter(
function (Transaction $transaction) {
if (!($transaction->transaction_type_type === TransactionType::TRANSFER && bccomp($transaction->transaction_amount, '0') === -1)) {
Log::debug(
sprintf(
'Included journal #%d (transaction #%d) because its a %s with amount %f',
$transaction->transaction_journal_id,
$transaction->id,
$transaction->transaction_type_type,
$transaction->transaction_amount
)
);
return $transaction;
}
Log::debug(
sprintf(
'Removed journal #%d (transaction #%d) because its a %s with amount %f',
$transaction->transaction_journal_id,
$transaction->id,
$transaction->transaction_type_type,
$transaction->transaction_amount
)
);
return false;
$count = [];
$new = new Collection;
/** @var Transaction $transaction */
foreach ($set as $transaction) {
if ($transaction->transaction_type_type !== TransactionType::TRANSFER) {
$new->push($transaction);
continue;
}
);
// make property string:
$journalId = $transaction->transaction_journal_id;
$amount = Steam::positive($transaction->transaction_amount);
$accountIds = [intval($transaction->account_id), intval($transaction->opposing_account_id)];
sort($accountIds);
$key = $journalId . '-' . join(',', $accountIds) . '-' . $amount;
Log::debug(sprintf('Key is %s', $key));
if (!isset($count[$key])) {
// not yet counted? add to new set and count it:
$new->push($transaction);
$count[$key] = 1;
}
}
return $new;
}
return $set;
@@ -729,27 +712,4 @@ class JournalCollector implements JournalCollectorInterface
$this->query->leftJoin('tag_transaction_journal', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
}
}
/**
* @return EloquentBuilder
*/
private function startQuery(): EloquentBuilder
{
/** @var EloquentBuilder $query */
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
return $query;
}
}

View File

@@ -17,6 +17,7 @@ use Carbon\Carbon;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use FireflyIII\User;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
@@ -27,7 +28,6 @@ use Illuminate\Support\Collection;
*/
interface JournalCollectorInterface
{
/**
* @return int
*/
@@ -84,7 +84,6 @@ interface JournalCollectorInterface
*/
public function setBudget(Budget $budget): JournalCollectorInterface;
/**
* @param Collection $budgets
*
@@ -149,6 +148,13 @@ interface JournalCollectorInterface
*/
public function setTypes(array $types): JournalCollectorInterface;
public function setUser(User $user);
/**
*
*/
public function startQuery();
/**
* @return JournalCollectorInterface
*/

View File

@@ -158,7 +158,9 @@ class BalanceReportHelper implements BalanceReportHelperInterface
foreach ($accounts as $account) {
$balanceEntry = new BalanceEntry;
$balanceEntry->setAccount($account);
$spent = $this->budgetRepository->spentInPeriod(new Collection([$budgetLimit->budget]), new Collection([$account]), $budgetLimit->start_date, $budgetLimit->end_date);
$spent = $this->budgetRepository->spentInPeriod(
new Collection([$budgetLimit->budget]), new Collection([$account]), $budgetLimit->start_date, $budgetLimit->end_date
);
$balanceEntry->setSpent($spent);
$line->addBalanceEntry($balanceEntry);
}

View File

@@ -15,8 +15,6 @@ namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\BudgetLine;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
@@ -48,44 +46,63 @@ class BudgetReportHelper implements BudgetReportHelperInterface
* @param Carbon $end
* @param Collection $accounts
*
* @return BudgetCollection
* @return array
*/
public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts): BudgetCollection
public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts): array
{
$object = new BudgetCollection;
$set = $this->repository->getBudgets();
$set = $this->repository->getBudgets();
$array = [];
/** @var Budget $budget */
foreach ($set as $budget) {
$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);
if ($budgetLimits->count() == 0) { // no budget limit(s) for this budget
$spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range
if ($spent > 0) {
$budgetLine = new BudgetLine;
$budgetLine->setBudget($budget)->setOverspent($spent);
$object->addOverspent($spent)->addBudgetLine($budgetLine);
if (bccomp($spent, '0') === -1) {
$line = [
'type' => 'budget',
'id' => $budget->id,
'name' => $budget->name,
'budgeted' => '0',
'spent' => $spent,
'left' => '0',
'overspent' => '0',
];
$array[] = $line;
}
continue;
}
/** @var BudgetLimit $budgetLimit */
foreach ($budgetLimits as $budgetLimit) { // one or more repetitions for budget
$data = $this->calculateExpenses($budget, $budgetLimit, $accounts);
$budgetLine = new BudgetLine;
$budgetLine->setBudget($budget)->setBudgetLimit($budgetLimit)
->setLeft($data['left'])->setSpent($data['expenses'])->setOverspent($data['overspent'])
->setBudgeted(strval($budgetLimit->amount));
$object->addBudgeted(strval($budgetLimit->amount))->addSpent($data['spent'])
->addLeft($data['left'])->addOverspent($data['overspent'])->addBudgetLine($budgetLine);
$data = $this->calculateExpenses($budget, $budgetLimit, $accounts);
$line = [
'type' => 'budget-line',
'start' => $budgetLimit->start_date,
'end' => $budgetLimit->end_date,
'limit' => $budgetLimit->id,
'id' => $budget->id,
'name' => $budget->name,
'budgeted' => strval($budgetLimit->amount),
'spent' => $data['expenses'],
'left' => $data['left'],
'overspent' => $data['overspent'],
];
$array[] = $line;
}
}
$noBudget = $this->repository->spentInPeriodWoBudget($accounts, $start, $end); // stuff outside of budgets
$budgetLine = new BudgetLine;
$budgetLine->setOverspent($noBudget)->setSpent($noBudget);
$object->addOverspent($noBudget)->addBudgetLine($budgetLine);
$noBudget = $this->repository->spentInPeriodWoBudget($accounts, $start, $end); // stuff outside of budgets
$line = [
'type' => 'no-budget',
'budgeted' => '0',
'spent' => $noBudget,
'left' => '0',
'overspent' => '0',
];
$array[] = $line;
return $object;
return $array;
}
/**

View File

@@ -15,7 +15,6 @@ namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use Illuminate\Support\Collection;
/**
@@ -31,9 +30,9 @@ interface BudgetReportHelperInterface
* @param Carbon $end
* @param Collection $accounts
*
* @return BudgetCollection
* @return array
*/
public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts): BudgetCollection;
public function getBudgetReport(Carbon $start, Carbon $end, Collection $accounts): array;
/**
* @param Carbon $start

View File

@@ -16,15 +16,12 @@ namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\BillLine;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\FiscalHelperInterface;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Category;
use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Support\Collection;
/**
@@ -68,7 +65,7 @@ class ReportHelper implements ReportHelperInterface
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$bills = $repository->getBillsForAccounts($accounts);
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($start, $end)->setBills($bills);
$journals = $collector->getJournals();
$collection = new BillCollection;

View File

@@ -15,7 +15,6 @@ namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income;
use Illuminate\Support\Collection;

View File

@@ -23,7 +23,6 @@ use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Support\CacheProperties;
@@ -32,9 +31,7 @@ use Illuminate\Support\Collection;
use Log;
use Navigation;
use Preferences;
use Session;
use Steam;
use URL;
use View;
/**
@@ -63,11 +60,12 @@ class AccountController extends Controller
}
/**
* @param string $what
* @param Request $request
* @param string $what
*
* @return \Illuminate\View\View|\Illuminate\Contracts\View\Factory|View
* @return View
*/
public function create(string $what = 'asset')
public function create(Request $request, string $what = 'asset')
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
@@ -82,27 +80,28 @@ class AccountController extends Controller
// pre fill some data
Session::flash('preFilled', ['currency_id' => $defaultCurrency->id,]);
$request->session()->flash('preFilled', ['currency_id' => $defaultCurrency->id,]);
// put previous url in session if not redirect from store (not "create another").
if (session('accounts.create.fromStore') !== true) {
Session::put('accounts.create.url', URL::previous());
$this->rememberPreviousUri('accounts.create.uri');
}
Session::forget('accounts.create.fromStore');
Session::flash('gaEventCategory', 'accounts');
Session::flash('gaEventAction', 'create-' . $what);
$request->session()->forget('accounts.create.fromStore');
$request->session()->flash('gaEventCategory', 'accounts');
$request->session()->flash('gaEventAction', 'create-' . $what);
return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle', 'currencies', 'roles'));
}
/**
* @param ARI $repository
* @param Account $account
* @param Request $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
public function delete(ARI $repository, Account $account)
public function delete(Request $request, AccountRepositoryInterface $repository, Account $account)
{
$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
@@ -110,48 +109,42 @@ class AccountController extends Controller
unset($accountList[$account->id]);
// put previous url in session
Session::put('accounts.delete.url', URL::previous());
Session::flash('gaEventCategory', 'accounts');
Session::flash('gaEventAction', 'delete-' . $typeName);
$this->rememberPreviousUri('accounts.delete.uri');
$request->session()->flash('gaEventCategory', 'accounts');
$request->session()->flash('gaEventAction', 'delete-' . $typeName);
return view('accounts.delete', compact('account', 'subTitle', 'accountList'));
}
/**
* @param Request $request
* @param ARI $repository
* @param Account $account
* @param Request $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function destroy(Request $request, ARI $repository, Account $account)
public function destroy(Request $request, AccountRepositoryInterface $repository, Account $account)
{
$type = $account->accountType->type;
$typeName = config('firefly.shortNamesByFullName.' . $type);
$name = $account->name;
$accountId = $account->id;
$moveTo = $repository->find(intval($request->get('move_account_before_delete')));
$type = $account->accountType->type;
$typeName = config('firefly.shortNamesByFullName.' . $type);
$name = $account->name;
$moveTo = $repository->find(intval($request->get('move_account_before_delete')));
$repository->destroy($account, $moveTo);
Session::flash('success', strval(trans('firefly.' . $typeName . '_deleted', ['name' => $name])));
$request->session()->flash('success', strval(trans('firefly.' . $typeName . '_deleted', ['name' => $name])));
Preferences::mark();
$uri = session('accounts.delete.url');
if (!(strpos($uri, sprintf('accounts/show/%s', $accountId)) === false)) {
// uri would point back to account
$uri = route('accounts.index', [$typeName]);
}
return redirect($uri);
return redirect($this->getPreviousUri('accounts.delete.uri'));
}
/**
* @param Request $request
* @param Account $account
*
* @return View
*/
public function edit(Account $account)
public function edit(Request $request, Account $account)
{
$what = config('firefly.shortNamesByFullName')[$account->accountType->type];
@@ -168,9 +161,9 @@ class AccountController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('accounts.edit.fromUpdate') !== true) {
Session::put('accounts.edit.url', URL::previous());
$this->rememberPreviousUri('accounts.edit.uri');
}
Session::forget('accounts.edit.fromUpdate');
$request->session()->forget('accounts.edit.fromUpdate');
// pre fill some useful values.
@@ -191,20 +184,20 @@ class AccountController extends Controller
'virtualBalance' => $account->virtual_balance,
'currency_id' => $account->getMeta('currency_id'),
];
Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'accounts');
Session::flash('gaEventAction', 'edit-' . $what);
$request->session()->flash('preFilled', $preFilled);
$request->session()->flash('gaEventCategory', 'accounts');
$request->session()->flash('gaEventAction', 'edit-' . $what);
return view('accounts.edit', compact('currencies', 'account', 'subTitle', 'subTitleIcon', 'openingBalance', 'what', 'roles'));
}
/**
* @param ARI $repository
* @param string $what
* @param AccountRepositoryInterface $repository
* @param string $what
*
* @return View
*/
public function index(ARI $repository, string $what)
public function index(AccountRepositoryInterface $repository, string $what)
{
$what = $what ?? 'asset';
$subTitle = trans('firefly.' . $what . '_accounts');
@@ -269,9 +262,9 @@ class AccountController extends Controller
}
/**
* @param Request $request
* @param ARI $repository
* @param Account $account
* @param Request $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
@@ -284,7 +277,8 @@ class AccountController extends Controller
// replace with journal collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setUser(auth()->user());
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
$journals = $collector->getPaginatedJournals();
$journals->setPath('accounts/show/' . $account->id . '/all');
@@ -318,7 +312,7 @@ class AccountController extends Controller
// replace with journal collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);
$journals = $collector->getPaginatedJournals();
$journals->setPath('accounts/show/' . $account->id . '/' . $date);
@@ -331,18 +325,18 @@ class AccountController extends Controller
}
/**
* @param AccountFormRequest $request
* @param ARI $repository
* @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*
*/
public function store(AccountFormRequest $request, ARI $repository)
public function store(AccountFormRequest $request, AccountRepositoryInterface $repository)
{
$data = $request->getAccountData();
$account = $repository->store($data);
Session::flash('success', strval(trans('firefly.stored_new_account', ['name' => $account->name])));
$request->session()->flash('success', strval(trans('firefly.stored_new_account', ['name' => $account->name])));
Preferences::mark();
// update preferences if necessary:
@@ -354,39 +348,39 @@ class AccountController extends Controller
if (intval($request->get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('accounts.create.fromStore', true);
$request->session()->put('accounts.create.fromStore', true);
return redirect(route('accounts.create', [$request->input('what')]))->withInput();
}
// redirect to previous URL.
return redirect(session('accounts.create.url'));
return redirect($this->getPreviousUri('accounts.create.uri'));
}
/**
* @param AccountFormRequest $request
* @param ARI $repository
* @param Account $account
* @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(AccountFormRequest $request, ARI $repository, Account $account)
public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account)
{
$data = $request->getAccountData();
$repository->update($account, $data);
Session::flash('success', strval(trans('firefly.updated_account', ['name' => $account->name])));
$request->session()->flash('success', strval(trans('firefly.updated_account', ['name' => $account->name])));
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('accounts.edit.fromUpdate', true);
$request->session()->put('accounts.edit.fromUpdate', true);
return redirect(route('accounts.edit', [$account->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return redirect(session('accounts.edit.url'));
return redirect($this->getPreviousUri('accounts.edit.uri'));
}
@@ -417,8 +411,8 @@ class AccountController extends Controller
*/
private function periodEntries(Account $account): Collection
{
/** @var ARI $repository */
$repository = app(ARI::class);
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
/** @var AccountTaskerInterface $tasker */
$tasker = app(AccountTaskerInterface::class);

View File

@@ -20,7 +20,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User;
use Preferences;
use Session;
use URL;
use View;
/**
@@ -57,7 +56,7 @@ class UserController extends Controller
{
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('users.edit.fromUpdate') !== true) {
Session::put('users.edit.url', URL::previous());
$this->rememberPreviousUri('users.edit.uri');
}
Session::forget('users.edit.fromUpdate');
@@ -156,7 +155,7 @@ class UserController extends Controller
}
// redirect to previous URL.
return redirect(session('users.edit.url'));
return redirect($this->getPreviousUri('users.edit.uri'));
}

View File

@@ -18,11 +18,10 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Requests\AttachmentFormRequest;
use FireflyIII\Models\Attachment;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Http\Response as LaravelResponse;
use Preferences;
use Response;
use Session;
use URL;
use View;
/**
@@ -54,38 +53,40 @@ class AttachmentController extends Controller
}
/**
* @param Request $request
* @param Attachment $attachment
*
* @return View
*/
public function delete(Attachment $attachment)
public function delete(Request $request, Attachment $attachment)
{
$subTitle = trans('firefly.delete_attachment', ['name' => $attachment->filename]);
// put previous url in session
Session::put('attachments.delete.url', URL::previous());
Session::flash('gaEventCategory', 'attachments');
Session::flash('gaEventAction', 'delete-attachment');
$this->rememberPreviousUri('attachments.delete.uri');
$request->session()->flash('gaEventCategory', 'attachments');
$request->session()->flash('gaEventAction', 'delete-attachment');
return view('attachments.delete', compact('attachment', 'subTitle'));
}
/**
* @param Request $request
* @param AttachmentRepositoryInterface $repository
* @param Attachment $attachment
*
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function destroy(AttachmentRepositoryInterface $repository, Attachment $attachment)
public function destroy(Request $request, AttachmentRepositoryInterface $repository, Attachment $attachment)
{
$name = $attachment->filename;
$repository->destroy($attachment);
Session::flash('success', strval(trans('firefly.attachment_deleted', ['name' => $name])));
$request->session()->flash('success', strval(trans('firefly.attachment_deleted', ['name' => $name])));
Preferences::mark();
return redirect(session('attachments.delete.url'));
return redirect($this->getPreviousUri('attachments.delete.uri'));
}
/**
@@ -120,20 +121,21 @@ class AttachmentController extends Controller
}
/**
* @param Request $request
* @param Attachment $attachment
*
* @return View
*/
public function edit(Attachment $attachment)
public function edit(Request $request, Attachment $attachment)
{
$subTitleIcon = 'fa-pencil';
$subTitle = trans('firefly.edit_attachment', ['name' => $attachment->filename]);
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('attachments.edit.fromUpdate') !== true) {
Session::put('attachments.edit.url', URL::previous());
$this->rememberPreviousUri('attachments.edit.uri');
}
Session::forget('attachments.edit.fromUpdate');
$request->session()->forget('attachments.edit.fromUpdate');
return view('attachments.edit', compact('attachment', 'subTitleIcon', 'subTitle'));
}
@@ -170,18 +172,18 @@ class AttachmentController extends Controller
$data = $request->getAttachmentData();
$repository->update($attachment, $data);
Session::flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));
$request->session()->flash('success', strval(trans('firefly.attachment_updated', ['name' => $attachment->filename])));
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('attachments.edit.fromUpdate', true);
$request->session()->put('attachments.edit.fromUpdate', true);
return redirect(route('attachments.edit', [$attachment->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return redirect(session('attachments.edit.url'));
return redirect($this->getPreviousUri('attachments.edit.uri'));
}

View File

@@ -16,6 +16,7 @@ use Config;
use FireflyConfig;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\User;
use Illuminate\Cookie\CookieJar;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
use Illuminate\Http\Request;
use Lang;
@@ -30,13 +31,6 @@ class LoginController extends Controller
use AuthenticatesUsers;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/';
/**
* Create a new controller instance.
*
@@ -80,6 +74,37 @@ class LoginController extends Controller
return $this->sendFailedLoginResponse($request, $errorMessage);
}
/**
* @param Request $request
* @param CookieJar $cookieJar
*
* @return $this
*/
public function logout(Request $request, CookieJar $cookieJar)
{
if (intval(getenv('SANDSTORM')) === 1) {
return view('error')->with('message', strval(trans('firefly.sandstorm_not_available')));
}
$cookie = $cookieJar->forever('twoFactorAuthenticated', 'false');
$this->guard()->logout();
$request->session()->flush();
$request->session()->regenerate();
return redirect('/')->withCookie($cookie);
}
/**
* @return string
*/
public function redirectTo(): string
{
return route('index');
}
/**
* Show the application login form.
*

View File

@@ -13,13 +13,13 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Controllers\Auth;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\TokenFormRequest;
use Illuminate\Cookie\CookieJar;
use Illuminate\Http\Request;
use Log;
use Preferences;
use Session;
/**
* Class TwoFactorController
@@ -30,11 +30,14 @@ class TwoFactorController extends Controller
{
/**
* @return mixed
* @param Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
* @throws FireflyException
*/
public function index()
public function index(Request $request)
{
$user = auth()->user();
// to make sure the validator in the next step gets the secret, we push it in session
@@ -50,7 +53,7 @@ class TwoFactorController extends Controller
if (strlen(strval($secret)) === 0) {
throw new FireflyException('Your two factor authentication secret is empty, which it cannot be at this point. Please check the log files.');
}
Session::flash('two-factor-secret', $secret);
$request->session()->flash('two-factor-secret', $secret);
return view('auth.two-factor', compact('user', 'title'));
}
@@ -80,12 +83,12 @@ class TwoFactorController extends Controller
*
* @return mixed
*/
public function postIndex(TokenFormRequest $request)
public function postIndex(TokenFormRequest $request, CookieJar $cookieJar)
{
Session::put('twofactor-authenticated', true);
Session::put('twofactor-authenticated-date', new Carbon);
// set cookie!
$cookie = $cookieJar->forever('twoFactorAuthenticated', 'true');
return redirect(route('home'));
return redirect(route('home'))->withCookie($cookie);
}
}

View File

@@ -22,7 +22,6 @@ use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Preferences;
use Session;
use URL;
use View;
@@ -53,9 +52,11 @@ class BillController extends Controller
}
/**
* @param Request $request
*
* @return View
*/
public function create()
public function create(Request $request)
{
$periods = [];
foreach (config('firefly.bill_periods') as $current) {
@@ -66,61 +67,57 @@ class BillController extends Controller
// put previous url in session if not redirect from store (not "create another").
if (session('bills.create.fromStore') !== true) {
Session::put('bills.create.url', URL::previous());
$this->rememberPreviousUri('bills.create.uri');
}
Session::forget('bills.create.fromStore');
Session::flash('gaEventCategory', 'bills');
Session::flash('gaEventAction', 'create');
$request->session()->forget('bills.create.fromStore');
$request->session()->flash('gaEventCategory', 'bills');
$request->session()->flash('gaEventAction', 'create');
return view('bills.create', compact('periods', 'subTitle'));
}
/**
* @param Bill $bill
* @param Request $request
* @param Bill $bill
*
* @return View
*/
public function delete(Bill $bill)
public function delete(Request $request, Bill $bill)
{
// put previous url in session
Session::put('bills.delete.url', URL::previous());
Session::flash('gaEventCategory', 'bills');
Session::flash('gaEventAction', 'delete');
$this->rememberPreviousUri('bills.delete.uri');
$request->session()->flash('gaEventCategory', 'bills');
$request->session()->flash('gaEventAction', 'delete');
$subTitle = trans('firefly.delete_bill', ['name' => $bill->name]);
return view('bills.delete', compact('bill', 'subTitle'));
}
/**
* @param Request $request
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function destroy(BillRepositoryInterface $repository, Bill $bill)
public function destroy(Request $request, BillRepositoryInterface $repository, Bill $bill)
{
$name = $bill->name;
$billId = $bill->id;
$name = $bill->name;
$repository->destroy($bill);
Session::flash('success', strval(trans('firefly.deleted_bill', ['name' => $name])));
$request->session()->flash('success', strval(trans('firefly.deleted_bill', ['name' => $name])));
Preferences::mark();
$uri = session('bills.delete.url');
if (!(strpos($uri, sprintf('bills/show/%s', $billId)) === false)) {
// uri would point back to bill
$uri = route('bills.index');
}
return redirect($uri);
return redirect($this->getPreviousUri('bills.delete.uri'));
}
/**
* @param Bill $bill
* @param Request $request
* @param Bill $bill
*
* @return View
*/
public function edit(Bill $bill)
public function edit(Request $request, Bill $bill)
{
$periods = [];
foreach (config('firefly.bill_periods') as $current) {
@@ -130,11 +127,11 @@ class BillController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('bills.edit.fromUpdate') !== true) {
Session::put('bills.edit.url', URL::previous());
$this->rememberPreviousUri('bills.edit.uri');
}
Session::forget('bills.edit.fromUpdate');
Session::flash('gaEventCategory', 'bills');
Session::flash('gaEventAction', 'edit');
$request->session()->forget('bills.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'bills');
$request->session()->flash('gaEventAction', 'edit');
return view('bills.edit', compact('subTitle', 'periods', 'bill'));
}
@@ -170,15 +167,16 @@ class BillController extends Controller
}
/**
* @param Request $request
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function rescan(BillRepositoryInterface $repository, Bill $bill)
public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill)
{
if (intval($bill->active) == 0) {
Session::flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));
$request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));
return redirect(URL::previous());
}
@@ -190,7 +188,7 @@ class BillController extends Controller
}
Session::flash('success', strval(trans('firefly.rescanned_bill')));
$request->session()->flash('success', strval(trans('firefly.rescanned_bill')));
Preferences::mark();
return redirect(URL::previous());
@@ -215,7 +213,7 @@ class BillController extends Controller
// use collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation()
->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
@@ -238,18 +236,18 @@ class BillController extends Controller
{
$billData = $request->getBillData();
$bill = $repository->store($billData);
Session::flash('success', strval(trans('firefly.stored_new_bill', ['name' => e($bill->name)])));
$request->session()->flash('success', strval(trans('firefly.stored_new_bill', ['name' => e($bill->name)])));
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('bills.create.fromStore', true);
$request->session()->put('bills.create.fromStore', true);
return redirect(route('bills.create'))->withInput();
}
// redirect to previous URL.
return redirect(session('bills.create.url'));
return redirect($this->getPreviousUri('bills.create.uri'));
}
@@ -265,18 +263,17 @@ class BillController extends Controller
$billData = $request->getBillData();
$bill = $repository->update($bill, $billData);
Session::flash('success', strval(trans('firefly.updated_bill', ['name' => e($bill->name)])));
$request->session()->flash('success', strval(trans('firefly.updated_bill', ['name' => e($bill->name)])));
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('bills.edit.fromUpdate', true);
$request->session()->put('bills.edit.fromUpdate', true);
return redirect(route('bills.edit', [$bill->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return redirect(session('bills.edit.url'));
return redirect($this->getPreviousUri('bills.edit.uri'));
}

View File

@@ -29,8 +29,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Preferences;
use Response;
use Session;
use URL;
use View;
/**
@@ -88,17 +86,19 @@ class BudgetController extends Controller
}
/**
* @param Request $request
*
* @return View
*/
public function create()
public function create(Request $request)
{
// put previous url in session if not redirect from store (not "create another").
if (session('budgets.create.fromStore') !== true) {
Session::put('budgets.create.url', URL::previous());
$this->rememberPreviousUri('budgets.create.uri');
}
Session::forget('budgets.create.fromStore');
Session::flash('gaEventCategory', 'budgets');
Session::flash('gaEventAction', 'create');
$request->session()->forget('budgets.create.fromStore');
$request->session()->flash('gaEventCategory', 'budgets');
$request->session()->flash('gaEventAction', 'create');
$subTitle = (string)trans('firefly.create_new_budget');
return view('budgets.create', compact('subTitle'));
@@ -109,59 +109,52 @@ class BudgetController extends Controller
*
* @return View
*/
public function delete(Budget $budget)
public function delete(Request $request, Budget $budget)
{
$subTitle = trans('firefly.delete_budget', ['name' => $budget->name]);
// put previous url in session
Session::put('budgets.delete.url', URL::previous());
Session::flash('gaEventCategory', 'budgets');
Session::flash('gaEventAction', 'delete');
$this->rememberPreviousUri('budgets.delete.uri');
$request->session()->flash('gaEventCategory', 'budgets');
$request->session()->flash('gaEventAction', 'delete');
return view('budgets.delete', compact('budget', 'subTitle'));
}
/**
* @param Budget $budget
* @param Request $request
* @param Budget $budget
*
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function destroy(Budget $budget)
public function destroy(Request $request, Budget $budget)
{
$name = $budget->name;
$budgetId = $budget->id;
$name = $budget->name;
$this->repository->destroy($budget);
Session::flash('success', strval(trans('firefly.deleted_budget', ['name' => e($name)])));
$request->session()->flash('success', strval(trans('firefly.deleted_budget', ['name' => e($name)])));
Preferences::mark();
$uri = session('budgets.delete.url');
if (!(strpos($uri, sprintf('budgets/show/%s', $budgetId)) === false)) {
// uri would point back to budget
$uri = route('budgets.index');
}
return redirect($uri);
return redirect($this->getPreviousUri('budgets.delete.uri'));
}
/**
* @param Budget $budget
* @param Request $request
* @param Budget $budget
*
* @return View
*/
public function edit(Budget $budget)
public function edit(Request $request, Budget $budget)
{
$subTitle = trans('firefly.edit_budget', ['name' => $budget->name]);
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('budgets.edit.fromUpdate') !== true) {
Session::put('budgets.edit.url', URL::previous());
$this->rememberPreviousUri('budgets.edit.uri');
}
Session::forget('budgets.edit.fromUpdate');
Session::flash('gaEventCategory', 'budgets');
Session::flash('gaEventAction', 'edit');
$request->session()->forget('budgets.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'budgets');
$request->session()->flash('gaEventAction', 'edit');
return view('budgets.edit', compact('budget', 'subTitle'));
@@ -212,7 +205,7 @@ class BudgetController extends Controller
// collector
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutBudget();
$journals = $collector->getPaginatedJournals();
$journals->setPath('/budgets/list/noBudget');
@@ -253,7 +246,7 @@ class BudgetController extends Controller
$repetition = null;
// collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('/budgets/show/' . $budget->id);
@@ -278,9 +271,9 @@ class BudgetController extends Controller
throw new FireflyException('This budget limit is not part of this budget.');
}
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$subTitle = trans(
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$subTitle = trans(
'firefly.budget_in_period', [
'name' => $budget->name,
'start' => $budgetLimit->start_date->formatLocalized($this->monthAndDayFormat),
@@ -290,7 +283,7 @@ class BudgetController extends Controller
// collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date)
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
@@ -315,19 +308,17 @@ class BudgetController extends Controller
$data = $request->getBudgetData();
$budget = $this->repository->store($data);
Session::flash('success', strval(trans('firefly.stored_new_budget', ['name' => e($budget->name)])));
$request->session()->flash('success', strval(trans('firefly.stored_new_budget', ['name' => e($budget->name)])));
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('budgets.create.fromStore', true);
$request->session()->put('budgets.create.fromStore', true);
return redirect(route('budgets.create'))->withInput();
}
// redirect to previous URL.
return redirect(session('budgets.create.url'));
return redirect($this->getPreviousUri('budgets.create.uri'));
}
/**
@@ -341,19 +332,17 @@ class BudgetController extends Controller
$data = $request->getBudgetData();
$this->repository->update($budget, $data);
Session::flash('success', strval(trans('firefly.updated_budget', ['name' => e($budget->name)])));
$request->session()->flash('success', strval(trans('firefly.updated_budget', ['name' => e($budget->name)])));
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('budgets.edit.fromUpdate', true);
$request->session()->put('budgets.edit.fromUpdate', true);
return redirect(route('budgets.edit', [$budget->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return redirect(session('budgets.edit.url'));
return redirect($this->getPreviousUri('budgets.edit.uri'));
}
/**

View File

@@ -25,8 +25,6 @@ use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Navigation;
use Preferences;
use Session;
use URL;
use View;
/**
@@ -56,80 +54,78 @@ class CategoryController extends Controller
}
/**
* @param Request $request
*
* @return View
*/
public function create()
public function create(Request $request)
{
if (session('categories.create.fromStore') !== true) {
Session::put('categories.create.url', URL::previous());
$this->rememberPreviousUri('categories.create.uri');
}
Session::forget('categories.create.fromStore');
Session::flash('gaEventCategory', 'categories');
Session::flash('gaEventAction', 'create');
$request->session()->forget('categories.create.fromStore');
$request->session()->flash('gaEventCategory', 'categories');
$request->session()->flash('gaEventAction', 'create');
$subTitle = trans('firefly.create_new_category');
return view('categories.create', compact('subTitle'));
}
/**
* @param Request $request
* @param Category $category
*
* @return View
*/
public function delete(Category $category)
public function delete(Request $request, Category $category)
{
$subTitle = trans('firefly.delete_category', ['name' => $category->name]);
// put previous url in session
Session::put('categories.delete.url', URL::previous());
Session::flash('gaEventCategory', 'categories');
Session::flash('gaEventAction', 'delete');
$this->rememberPreviousUri('categories.delete.uri');
$request->session()->flash('gaEventCategory', 'categories');
$request->session()->flash('gaEventAction', 'delete');
return view('categories.delete', compact('category', 'subTitle'));
}
/**
* @param Request $request
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function destroy(CategoryRepositoryInterface $repository, Category $category)
public function destroy(Request $request, CategoryRepositoryInterface $repository, Category $category)
{
$name = $category->name;
$categoryId = $category->id;
$name = $category->name;
$repository->destroy($category);
Session::flash('success', strval(trans('firefly.deleted_category', ['name' => e($name)])));
$request->session()->flash('success', strval(trans('firefly.deleted_category', ['name' => e($name)])));
Preferences::mark();
$uri = session('categories.delete.url');
if (!(strpos($uri, sprintf('categories/show/%s', $categoryId)) === false)) {
// uri would point back to category
$uri = route('categories.index');
}
return redirect($uri);
return redirect($this->getPreviousUri('categories.delete.uri'));
}
/**
* @param Request $request
* @param Category $category
*
* @return View
*/
public function edit(Category $category)
public function edit(Request $request, Category $category)
{
$subTitle = trans('firefly.edit_category', ['name' => $category->name]);
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('categories.edit.fromUpdate') !== true) {
Session::put('categories.edit.url', URL::previous());
$this->rememberPreviousUri('categories.edit.uri');
}
Session::forget('categories.edit.fromUpdate');
Session::flash('gaEventCategory', 'categories');
Session::flash('gaEventAction', 'edit');
$request->session()->forget('categories.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'categories');
$request->session()->flash('gaEventAction', 'edit');
return view('categories.edit', compact('category', 'subTitle'));
@@ -165,7 +161,7 @@ class CategoryController extends Controller
// new collector:
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->withoutCategory();//->groupJournals();
$journals = $collector->getJournals();
$subTitle = trans(
@@ -277,11 +273,11 @@ class CategoryController extends Controller
$data = $request->getCategoryData();
$category = $repository->store($data);
Session::flash('success', strval(trans('firefly.stored_category', ['name' => e($category->name)])));
$request->session()->flash('success', strval(trans('firefly.stored_category', ['name' => e($category->name)])));
Preferences::mark();
if (intval($request->get('create_another')) === 1) {
Session::put('categories.create.fromStore', true);
$request->session()->put('categories.create.fromStore', true);
return redirect(route('categories.create'))->withInput();
}
@@ -302,18 +298,16 @@ class CategoryController extends Controller
$data = $request->getCategoryData();
$repository->update($category, $data);
Session::flash('success', strval(trans('firefly.updated_category', ['name' => e($category->name)])));
$request->session()->flash('success', strval(trans('firefly.updated_category', ['name' => e($category->name)])));
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
Session::put('categories.edit.fromUpdate', true);
$request->session()->put('categories.edit.fromUpdate', true);
return redirect(route('categories.edit', [$category->id]));
}
// redirect to previous URL.
return redirect(session('categories.edit.url'));
return redirect($this->getPreviousUri('categories.edit.uri'));
}
/**

View File

@@ -416,7 +416,7 @@ class BudgetController extends Controller
{
// collector
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$types = [TransactionType::WITHDRAWAL];
$collector->setAllAssetAccounts()->setTypes($types)->setRange($start, $end)->withoutBudget();
$journals = $collector->getJournals();

View File

@@ -80,7 +80,6 @@ class BudgetReportController extends Controller
$helper = app(MetaPieChartInterface::class);
$helper->setAccounts($accounts);
$helper->setBudgets($budgets);
$helper->setUser(auth()->user());
$helper->setStart($start);
$helper->setEnd($end);
$helper->setCollectOtherObjects(intval($others) === 1);
@@ -106,7 +105,6 @@ class BudgetReportController extends Controller
$helper = app(MetaPieChartInterface::class);
$helper->setAccounts($accounts);
$helper->setBudgets($budgets);
$helper->setUser(auth()->user());
$helper->setStart($start);
$helper->setEnd($end);
$helper->setCollectOtherObjects(intval($others) === 1);
@@ -239,7 +237,7 @@ class BudgetReportController extends Controller
private function getExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Collection
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
->setBudgets($budgets)->withOpposingAccount()->disableFilter();
$accountIds = $accounts->pluck('id')->toArray();

View File

@@ -80,7 +80,6 @@ class CategoryReportController extends Controller
$helper = app(MetaPieChartInterface::class);
$helper->setAccounts($accounts);
$helper->setCategories($categories);
$helper->setUser(auth()->user());
$helper->setStart($start);
$helper->setEnd($end);
$helper->setCollectOtherObjects(intval($others) === 1);
@@ -105,7 +104,6 @@ class CategoryReportController extends Controller
$helper = app(MetaPieChartInterface::class);
$helper->setAccounts($accounts);
$helper->setCategories($categories);
$helper->setUser(auth()->user());
$helper->setStart($start);
$helper->setEnd($end);
$helper->setCollectOtherObjects(intval($others) === 1);
@@ -130,7 +128,6 @@ class CategoryReportController extends Controller
$helper = app(MetaPieChartInterface::class);
$helper->setAccounts($accounts);
$helper->setCategories($categories);
$helper->setUser(auth()->user());
$helper->setStart($start);
$helper->setEnd($end);
$helper->setCollectOtherObjects(intval($others) === 1);
@@ -156,7 +153,6 @@ class CategoryReportController extends Controller
$helper = app(MetaPieChartInterface::class);
$helper->setAccounts($accounts);
$helper->setCategories($categories);
$helper->setUser(auth()->user());
$helper->setStart($start);
$helper->setEnd($end);
$helper->setCollectOtherObjects(intval($others) === 1);
@@ -284,7 +280,7 @@ class CategoryReportController extends Controller
private function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
->setCategories($categories)->withOpposingAccount()->disableFilter();
$accountIds = $accounts->pluck('id')->toArray();
@@ -305,7 +301,7 @@ class CategoryReportController extends Controller
private function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
{
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
->setCategories($categories)->withOpposingAccount();
$accountIds = $accounts->pluck('id')->toArray();

View File

@@ -23,6 +23,7 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Session;
use URL;
use View;
/**
@@ -56,7 +57,6 @@ class Controller extends BaseController
View::share('DEMO_PASSWORD', env('DEMO_PASSWORD', ''));
// translations:
$this->middleware(
function ($request, $next) {
$this->monthFormat = (string)trans('config.month');
@@ -69,6 +69,29 @@ class Controller extends BaseController
}
/**
* Functionality:
*
* - If the $identifier contains the word "delete" then a remembered uri with the text "/show/" in it will not be returned but instead the index (/)
* will be returned.
* - If the remembered uri contains "javascript/" the remembered uri will not be returned but instead the index (/) will be returned.
*
* @param string $identifier
*
* @return string
*/
protected function getPreviousUri(string $identifier): string
{
$uri = strval(session($identifier));
if (!(strpos($identifier, 'delete') === false) && !(strpos($uri, '/show/') === false)) {
$uri = route('index');
}
if (!(strpos($uri, 'javascript') === false)) {
$uri = route('index');
}
return $uri;
}
/**
* @param TransactionJournal $journal
@@ -102,4 +125,12 @@ class Controller extends BaseController
return redirect(route('index'));
}
/**
* @param string $identifier
*/
protected function rememberPreviousUri(string $identifier)
{
Session::put($identifier, URL::previous());
}
}

View File

@@ -17,10 +17,9 @@ use Cache;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Http\Request;
use Log;
use Preferences;
use Session;
use URL;
use View;
/**
@@ -53,34 +52,35 @@ class CurrencyController extends Controller
/**
* @return View
*/
public function create()
public function create(Request $request)
{
$subTitleIcon = 'fa-plus';
$subTitle = trans('firefly.create_currency');
// put previous url in session if not redirect from store (not "create another").
if (session('currencies.create.fromStore') !== true) {
Session::put('currencies.create.url', URL::previous());
$this->rememberPreviousUri('currencies.create.uri');
}
Session::forget('currencies.create.fromStore');
Session::flash('gaEventCategory', 'currency');
Session::flash('gaEventAction', 'create');
$request->session()->forget('currencies.create.fromStore');
$request->session()->flash('gaEventCategory', 'currency');
$request->session()->flash('gaEventAction', 'create');
return view('currencies.create', compact('subTitleIcon', 'subTitle'));
}
/**
* @param Request $request
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function defaultCurrency(TransactionCurrency $currency)
public function defaultCurrency(Request $request, TransactionCurrency $currency)
{
Preferences::set('currencyPreference', $currency->code);
Preferences::mark();
Session::flash('success', trans('firefly.new_default_currency', ['name' => $currency->name]));
$request->session()->flash('success', trans('firefly.new_default_currency', ['name' => $currency->name]));
Cache::forget('FFCURRENCYSYMBOL');
Cache::forget('FFCURRENCYCODE');
@@ -95,19 +95,19 @@ class CurrencyController extends Controller
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function delete(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
public function delete(Request $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
if (!$repository->canDeleteCurrency($currency)) {
Session::flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
$request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
return redirect(route('currencies.index'));
}
// put previous url in session
Session::put('currencies.delete.url', URL::previous());
Session::flash('gaEventCategory', 'currency');
Session::flash('gaEventAction', 'delete');
$this->rememberPreviousUri('currencies.delete.uri');
$request->session()->flash('gaEventCategory', 'currency');
$request->session()->flash('gaEventAction', 'delete');
$subTitle = trans('form.delete_currency', ['name' => $currency->name]);
@@ -120,26 +120,27 @@ class CurrencyController extends Controller
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
public function destroy(Request $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
if (!$repository->canDeleteCurrency($currency)) {
Session::flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
$request->session()->flash('error', trans('firefly.cannot_delete_currency', ['name' => $currency->name]));
return redirect(route('currencies.index'));
}
$repository->destroy($currency);
Session::flash('success', trans('firefly.deleted_currency', ['name' => $currency->name]));
$request->session()->flash('success', trans('firefly.deleted_currency', ['name' => $currency->name]));
return redirect(session('currencies.delete.url'));
return redirect($this->getPreviousUri('currencies.delete.uri'));
}
/**
* @param Request $request
* @param TransactionCurrency $currency
*
* @return View
*/
public function edit(TransactionCurrency $currency)
public function edit(Request $request, TransactionCurrency $currency)
{
$subTitleIcon = 'fa-pencil';
$subTitle = trans('breadcrumbs.edit_currency', ['name' => $currency->name]);
@@ -147,29 +148,30 @@ class CurrencyController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('currencies.edit.fromUpdate') !== true) {
Session::put('currencies.edit.url', URL::previous());
$this->rememberPreviousUri('currencies.edit.uri');
}
Session::forget('currencies.edit.fromUpdate');
Session::flash('gaEventCategory', 'currency');
Session::flash('gaEventAction', 'edit');
$request->session()->forget('currencies.edit.fromUpdate');
$request->session()->flash('gaEventCategory', 'currency');
$request->session()->flash('gaEventAction', 'edit');
return view('currencies.edit', compact('currency', 'subTitle', 'subTitleIcon'));
}
/**
* @param Request $request
* @param CurrencyRepositoryInterface $repository
*
* @return View
*/
public function index(CurrencyRepositoryInterface $repository)
public function index(Request $request, CurrencyRepositoryInterface $repository)
{
$currencies = $repository->get();
$defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', config('firefly.default_currency', 'EUR')));
if (!auth()->user()->hasRole('owner')) {
Session::flash('info', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
$request->session()->flash('info', trans('firefly.ask_site_owner', ['owner' => env('SITE_OWNER')]));
}
@@ -188,23 +190,20 @@ class CurrencyController extends Controller
if (!auth()->user()->hasRole('owner')) {
Log::error('User ' . auth()->user()->id . ' is not admin, but tried to store a currency.');
return redirect(session('currencies.create.url'));
return redirect($this->getPreviousUri('currencies.create.uri'));
}
$data = $request->getCurrencyData();
$currency = $repository->store($data);
Session::flash('success', trans('firefly.created_currency', ['name' => $currency->name]));
$request->session()->flash('success', trans('firefly.created_currency', ['name' => $currency->name]));
if (intval($request->get('create_another')) === 1) {
Session::put('currencies.create.fromStore', true);
$request->session()->put('currencies.create.fromStore', true);
return redirect(route('currencies.create'))->withInput();
}
// redirect to previous URL.
return redirect(session('currencies.create.url'));
return redirect($this->getPreviousUri('currencies.create.uri'));
}
/**
@@ -220,18 +219,16 @@ class CurrencyController extends Controller
if (auth()->user()->hasRole('owner')) {
$currency = $repository->update($currency, $data);
}
Session::flash('success', trans('firefly.updated_currency', ['name' => $currency->name]));
$request->session()->flash('success', trans('firefly.updated_currency', ['name' => $currency->name]));
Preferences::mark();
if (intval($request->get('return_to_edit')) === 1) {
Session::put('currencies.edit.fromUpdate', true);
$request->session()->put('currencies.edit.fromUpdate', true);
return redirect(route('currencies.edit', [$currency->id]));
}
// redirect to previous URL.
return redirect(session('currencies.edit.url'));
return redirect($this->getPreviousUri('currencies.edit.uri'));
}
}

View File

@@ -150,7 +150,8 @@ class ExportController extends Controller
$jobs->changeStatus($job, 'export_status_make_exporter');
/** @var ProcessorInterface $processor */
$processor = app(ProcessorInterface::class, [$settings]);
$processor = app(ProcessorInterface::class);
$processor->setSettings($settings);
/*
* Collect journals:

View File

@@ -58,7 +58,8 @@ class HelpController extends Controller
return Response::json($content);
}
$content = $help->getFromGithub($language, $route);
$content = $help->getFromGithub($language, $route);
$notYourLanguage = '<p><em>' . strval(trans('firefly.help_may_not_be_your_language')) . '</em></p>';
// get backup language content (try English):
if (strlen($content) === 0) {
@@ -68,12 +69,11 @@ class HelpController extends Controller
$content = $help->getFromCache($route, $language);
}
if (!$help->inCache($route, $language)) {
$content = $help->getFromGithub($language, $route);
$content = '<p><em>' . strval(trans('firefly.help_may_not_be_your_language')) . '</em></p>' . $content;
$content = trim($notYourLanguage . $help->getFromGithub($language, $route));
}
}
if (strlen($content) === 0) {
if ($content === $notYourLanguage) {
$content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
}

View File

@@ -17,15 +17,12 @@ use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Log;
use Preferences;
use Route;
use Session;
use View;
@@ -86,30 +83,14 @@ class HomeController extends Controller
}
/**
* @param TagRepositoryInterface $repository
* @param Request $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function flush(TagRepositoryInterface $repository)
public function flush(Request $request)
{
Preferences::mark();
// get all tags.
// update all counts:
$tags = $repository->get();
/** @var Tag $tag */
foreach ($tags as $tag) {
foreach ($tag->transactionJournals()->get() as $journal) {
$count = $journal->tags()->count();
$journal->tag_count = $count;
$journal->save();
}
}
Session::forget(['start', 'end', 'viewRange', 'range', 'is_custom_range']);
Session::clear();
$request->session()->forget(['start', 'end', '_previous', 'viewRange', 'range', 'is_custom_range']);
Artisan::call('cache:clear');
return redirect(route('index'));
@@ -159,74 +140,6 @@ class HomeController extends Controller
);
}
/**
* Display a list of named routes. Excludes some that cannot be "shown". This method
* is used to generate help files (down the road).
*/
public function routes()
{
// these routes are not relevant for the help pages:
$ignore = [
// login and two-factor routes:
'login',
'registe',
'password.rese',
'logout',
'two-fac',
'lost-two',
// test troutes
'test-flash',
'all-routes',
// json routes
'json.',
// routes that point to modals or that redirect immediately.
'piggy-banks.add',
'piggy-banks.remove',
'rules.rule.up',
'attachments.download',
'bills.rescan',
'rules.rule.down',
'rules.rule-group.up',
'rules.rule-group.down',
'popup.',
'error',
'flush',
//'preferences.',
'admin.users.domains.block-',
'help.',
// ajax routes:
'import.json',
// charts:
'chart.',
// report data:
'report-data.',
// others:
'debugbar',
'attachments.preview',
'budgets.income',
'currencies.default',
];
$routes = Route::getRoutes();
$return = '<pre>';
/** @var \Illuminate\Routing\Route $route */
foreach ($routes as $route) {
$name = $route->getName();
$methods = $route->getMethods();
if (!is_null($name) && strlen($name) > 0 && in_array('GET', $methods) && !$this->startsWithAny($ignore, $name)) {
$return .= sprintf('touch %s.md', $name) . "\n";
}
}
$return .= '</pre><hr />';
return $return;
}
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
@@ -240,21 +153,4 @@ class HomeController extends Controller
return redirect(route('home'));
}
/**
* @param array $array
* @param string $needle
*
* @return bool
*/
private function startsWithAny(array $array, string $needle): bool
{
foreach ($array as $entry) {
if ((substr($needle, 0, strlen($entry)) === $entry)) {
return true;
}
}
return false;
}
}

View File

@@ -13,6 +13,7 @@ namespace FireflyIII\Http\Controllers;
use Amount;
use FireflyIII\Exceptions\FireflyException;
use Illuminate\Http\Request;
use Navigation;
use Preferences;
use Session;
@@ -28,7 +29,7 @@ class JavascriptController extends Controller
/**
*
*/
public function variables()
public function variables(Request $request)
{
$picker = $this->getDateRangePicker();
$start = Session::get('start');
@@ -52,6 +53,7 @@ class JavascriptController extends Controller
'localeconv' => $localeconv,
'language' => $lang,
];
$request->session()->keep(['two-factor-secret']);
return response()
->view('javascript.variables', $data, 200)
@@ -129,4 +131,4 @@ class JavascriptController extends Controller
];
}
}
}

View File

@@ -27,7 +27,6 @@ use Preferences;
use Response;
use Session;
use Steam;
use URL;
use View;
/**
@@ -116,7 +115,7 @@ class PiggyBankController extends Controller
// put previous url in session if not redirect from store (not "create another").
if (session('piggy-banks.create.fromStore') !== true) {
Session::put('piggy-banks.create.url', URL::previous());
$this->rememberPreviousUri('piggy-banks.create.uri');
}
Session::forget('piggy-banks.create.fromStore');
Session::flash('gaEventCategory', 'piggy-banks');
@@ -135,7 +134,7 @@ class PiggyBankController extends Controller
$subTitle = trans('firefly.delete_piggy_bank', ['name' => $piggyBank->name]);
// put previous url in session
Session::put('piggy-banks.delete.url', URL::previous());
$this->rememberPreviousUri('piggy-banks.delete.uri');
Session::flash('gaEventCategory', 'piggy-banks');
Session::flash('gaEventAction', 'delete');
@@ -152,16 +151,9 @@ class PiggyBankController extends Controller
{
Session::flash('success', strval(trans('firefly.deleted_piggy_bank', ['name' => e($piggyBank->name)])));
Preferences::mark();
$piggyBankId = $piggyBank->id;
$repository->destroy($piggyBank);
$uri = session('piggy-banks.delete.url');
if (!(strpos($uri, sprintf('piggy-banks/show/%s', $piggyBankId)) === false)) {
// uri would point back to piggy bank
$uri = route('piggy-banks.index');
}
return redirect($uri);
return redirect($this->getPreviousUri('piggy-banks.delete.uri'));
}
/**
@@ -197,7 +189,7 @@ class PiggyBankController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('piggy-banks.edit.fromUpdate') !== true) {
Session::put('piggy-banks.edit.url', URL::previous());
$this->rememberPreviousUri('piggy-banks.edit.uri');
}
Session::forget('piggy-banks.edit.fromUpdate');
@@ -404,9 +396,7 @@ class PiggyBankController extends Controller
return redirect(route('piggy-banks.create'))->withInput();
}
// redirect to previous URL.
return redirect(session('piggy-banks.create.url'));
return redirect($this->getPreviousUri('piggy-banks.edit.uri'));
}
/**
@@ -430,12 +420,6 @@ class PiggyBankController extends Controller
return redirect(route('piggy-banks.edit', [$piggyBank->id]));
}
// redirect to previous URL.
return redirect(session('piggy-banks.edit.url'));
return redirect($this->getPreviousUri('piggy-banks.edit.uri'));
}
}

View File

@@ -103,7 +103,7 @@ class ReportController extends Controller
switch (true) {
case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)):
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector
->setAccounts(new Collection([$account]))
->setRange($attributes['startDate'], $attributes['endDate'])
@@ -114,7 +114,7 @@ class ReportController extends Controller
case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)):
$budget->name = strval(trans('firefly.no_budget'));
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector
->setAccounts(new Collection([$account]))
->setTypes($types)
@@ -124,7 +124,7 @@ class ReportController extends Controller
break;
case ($role === BalanceLine::ROLE_DIFFROLE):
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector
->setAccounts(new Collection([$account]))
->setTypes($types)
@@ -169,7 +169,7 @@ class ReportController extends Controller
$repository = app(BudgetRepositoryInterface::class);
$budget = $repository->find(intval($attributes['budgetId']));
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector
->setAccounts($attributes['accounts'])
@@ -203,7 +203,7 @@ class ReportController extends Controller
$category = $repository->find(intval($attributes['categoryId']));
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts($attributes['accounts'])->setTypes($types)
->setRange($attributes['startDate'], $attributes['endDate'])
->setCategory($category);
@@ -230,7 +230,7 @@ class ReportController extends Controller
$account = $repository->find(intval($attributes['accountId']));
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);
$journals = $collector->getJournals();
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
@@ -266,7 +266,7 @@ class ReportController extends Controller
$account = $repository->find(intval($attributes['accountId']));
$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);
$journals = $collector->getJournals();
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report

View File

@@ -56,9 +56,9 @@ class PreferencesController extends Controller
{
$domain = $this->getDomain();
/** @noinspection PhpMethodParametersCountMismatchInspection */
$secret = $google2fa->generateSecretKey(16, auth()->user()->id);
$secret = $google2fa->generateSecretKey(32, auth()->user()->id);
Session::flash('two-factor-secret', $secret);
$image = $google2fa->getQRCodeInline('Firefly III at ' . $domain, null, $secret, 150);
$image = $google2fa->getQRCodeInline('Firefly III at ' . $domain, auth()->user()->email, $secret, 150);
return view('preferences.code', compact('image'));

View File

@@ -52,6 +52,10 @@ class ProfileController extends Controller
*/
public function changePassword()
{
if (intval(getenv('SANDSTORM')) === 1) {
return view('error')->with('message', strval(trans('firefly.sandstorm_not_available')));
}
if (auth()->user()->hasRole('demo')) {
Session::flash('info', strval(trans('firefly.cannot_change_demo')));
@@ -70,6 +74,10 @@ class ProfileController extends Controller
*/
public function deleteAccount()
{
if (intval(getenv('SANDSTORM')) === 1) {
return view('error')->with('message', strval(trans('firefly.sandstorm_not_available')));
}
if (auth()->user()->hasRole('demo')) {
Session::flash('info', strval(trans('firefly.cannot_delete_demo')));
@@ -103,6 +111,10 @@ class ProfileController extends Controller
*/
public function postChangePassword(ProfileFormRequest $request, UserRepositoryInterface $repository)
{
if (intval(getenv('SANDSTORM')) === 1) {
return view('error')->with('message', strval(trans('firefly.sandstorm_not_available')));
}
if (auth()->user()->hasRole('demo')) {
Session::flash('info', strval(trans('firefly.cannot_change_demo')));
@@ -139,6 +151,10 @@ class ProfileController extends Controller
*/
public function postDeleteAccount(UserRepositoryInterface $repository, DeleteAccountFormRequest $request)
{
if (intval(getenv('SANDSTORM')) === 1) {
return view('error')->with('message', strval(trans('firefly.sandstorm_not_available')));
}
if (auth()->user()->hasRole('demo')) {
Session::flash('info', strval(trans('firefly.cannot_delete_demo')));

View File

@@ -19,9 +19,11 @@ use FireflyIII\Generator\Report\ReportGeneratorFactory;
use FireflyIII\Helpers\Report\ReportHelperInterface;
use FireflyIII\Http\Requests\ReportFormRequest;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Collection;
use Preferences;
@@ -238,6 +240,9 @@ class ReportController extends Controller
case 'budget':
$result = $this->budgetReportOptions();
break;
case 'tag':
$result = $this->tagReportOptions();
break;
}
return Response::json(['html' => $result]);
@@ -258,6 +263,7 @@ class ReportController extends Controller
$accounts = join(',', $request->getAccountList()->pluck('id')->toArray());
$categories = join(',', $request->getCategoryList()->pluck('id')->toArray());
$budgets = join(',', $request->getBudgetList()->pluck('id')->toArray());
$tags = join(',', $request->getTagList()->pluck('tag')->toArray());
if ($request->getAccountList()->count() === 0) {
Session::flash('error', trans('firefly.select_more_than_one_account'));
@@ -277,6 +283,12 @@ class ReportController extends Controller
return redirect(route('reports.index'));
}
if ($request->getTagList()->count() === 0 && $reportType === 'tag') {
Session::flash('error', trans('firefly.select_more_than_one_tag'));
return redirect(route('reports.index'));
}
if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date'));
}
@@ -301,11 +313,50 @@ class ReportController extends Controller
case 'budget':
$uri = route('reports.report.budget', [$accounts, $budgets, $start, $end]);
break;
case 'tag':
$uri = route('reports.report.tag', [$accounts, $tags, $start, $end]);
break;
}
return redirect($uri);
}
/**
* @param Collection $accounts
* @param Collection $tags
* @param Carbon $start
* @param Carbon $end
*
* @return string
*/
public function tagReport(Collection $accounts, Collection $tags, Carbon $start, Carbon $end)
{
if ($end < $start) {
return view('error')->with('message', trans('firefly.end_after_start_date'));
}
if ($start < session('first')) {
$start = session('first');
}
View::share(
'subTitle', trans(
'firefly.report_tag',
[
'start' => $start->formatLocalized($this->monthFormat),
'end' => $end->formatLocalized($this->monthFormat),
]
)
);
$generator = ReportGeneratorFactory::reportGenerator('Tag', $start, $end);
$generator->setAccounts($accounts);
$generator->setTags($tags);
$result = $generator->generate();
return $result;
}
/**
* @return string
*/
@@ -341,4 +392,22 @@ class ReportController extends Controller
{
return view('reports.options.no-options')->render();
}
/**
* @return string
*/
private function tagReportOptions(): string
{
/** @var TagRepositoryInterface $repository */
$repository = app(TagRepositoryInterface::class);
$tags = $repository->get()->sortBy(
function (Tag $tag) {
return $tag->tag;
}
);
$result = view('reports.options.tag', compact('tags'))->render();
return $result;
}
}

View File

@@ -26,7 +26,6 @@ use Illuminate\Http\Request;
use Preferences;
use Response;
use Session;
use URL;
use View;
/**
@@ -88,7 +87,7 @@ class RuleController extends Controller
// put previous url in session if not redirect from store (not "create another").
if (session('rules.create.fromStore') !== true) {
Session::put('rules.create.url', URL::previous());
$this->rememberPreviousUri('rules.create.uri');
}
Session::forget('rules.create.fromStore');
Session::flash('gaEventCategory', 'rules');
@@ -111,7 +110,7 @@ class RuleController extends Controller
$subTitle = trans('firefly.delete_rule', ['title' => $rule->title]);
// put previous url in session
Session::put('rules.delete.url', URL::previous());
$this->rememberPreviousUri('rules.delete.uri');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'delete-rule');
@@ -135,8 +134,7 @@ class RuleController extends Controller
Session::flash('success', trans('firefly.deleted_rule', ['title' => $title]));
Preferences::mark();
return redirect(session('rules.delete.url'));
return redirect($this->getPreviousUri('rules.delete.uri'));
}
/**
@@ -181,7 +179,7 @@ class RuleController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('rules.edit.fromUpdate') !== true) {
Session::put('rules.edit.url', URL::previous());
$this->rememberPreviousUri('rules.edit.uri');
}
Session::forget('rules.edit.fromUpdate');
Session::flash('gaEventCategory', 'rules');
@@ -263,9 +261,7 @@ class RuleController extends Controller
return redirect(route('rules.create', [$ruleGroup]))->withInput();
}
// redirect to previous URL.
return redirect(session('rules.create.url'));
return redirect($this->getPreviousUri('rules.create.uri'));
}
/**
@@ -293,7 +289,7 @@ class RuleController extends Controller
$range = config('firefly.test-triggers.range');
/** @var TransactionMatcher $matcher */
$matcher = app('FireflyIII\Rules\TransactionMatcher');
$matcher = app(TransactionMatcher::class);
$matcher->setLimit($limit);
$matcher->setRange($range);
$matcher->setTriggers($triggers);
@@ -350,14 +346,13 @@ class RuleController extends Controller
return redirect(route('rules.edit', [$rule->id]))->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return redirect(session('rules.edit.url'));
return redirect($this->getPreviousUri('rules.edit.uri'));
}
private function createDefaultRule()
{
/** @var RuleRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Rule\RuleRepositoryInterface');
$repository = app(RuleRepositoryInterface::class);
if ($repository->count() === 0) {
$data = [

View File

@@ -25,7 +25,6 @@ use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use Illuminate\Http\Request;
use Preferences;
use Session;
use URL;
use View;
/**
@@ -63,7 +62,7 @@ class RuleGroupController extends Controller
// put previous url in session if not redirect from store (not "create another").
if (session('rule-groups.create.fromStore') !== true) {
Session::put('rule-groups.create.url', URL::previous());
$this->rememberPreviousUri('rule-groups.create.uri');
}
Session::forget('rule-groups.create.fromStore');
Session::flash('gaEventCategory', 'rules');
@@ -86,7 +85,7 @@ class RuleGroupController extends Controller
unset($ruleGroupList[$ruleGroup->id]);
// put previous url in session
Session::put('rule-groups.delete.url', URL::previous());
$this->rememberPreviousUri('rule-groups.delete.uri');
Session::flash('gaEventCategory', 'rules');
Session::flash('gaEventAction', 'delete-rule-group');
@@ -112,8 +111,7 @@ class RuleGroupController extends Controller
Session::flash('success', strval(trans('firefly.deleted_rule_group', ['title' => $title])));
Preferences::mark();
return redirect(session('rule-groups.delete.url'));
return redirect($this->getPreviousUri('rule-groups.delete.uri'));
}
/**
@@ -141,7 +139,7 @@ class RuleGroupController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('rule-groups.edit.fromUpdate') !== true) {
Session::put('rule-groups.edit.url', URL::previous());
$this->rememberPreviousUri('rule-groups.edit.uri');
}
Session::forget('rule-groups.edit.fromUpdate');
Session::flash('gaEventCategory', 'rules');
@@ -225,8 +223,7 @@ class RuleGroupController extends Controller
return redirect(route('rule-groups.create'))->withInput();
}
// redirect to previous URL.
return redirect(session('rule-groups.create.url'));
return redirect($this->getPreviousUri('rule-groups.create.uri'));
}
/**
@@ -271,7 +268,7 @@ class RuleGroupController extends Controller
}
// redirect to previous URL.
return redirect(session('rule-groups.edit.url'));
return redirect($this->getPreviousUri('rule-groups.edit.uri'));
}
}

View File

@@ -15,6 +15,8 @@ namespace FireflyIII\Http\Controllers;
use FireflyIII\Support\Search\SearchInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use View;
/**
* Class SearchController
@@ -30,44 +32,66 @@ class SearchController extends Controller
{
parent::__construct();
$this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-search');
View::share('title', trans('firefly.search'));
return $next($request);
}
);
}
/**
* Results always come in the form of an array [results, count, fullCount]
*
* @param Request $request
* @param SearchInterface $searcher
*
* @return $this
* @return View
*/
public function index(Request $request, SearchInterface $searcher)
{
$minSearchLen = 1;
$subTitle = null;
$query = null;
$result = [];
$title = trans('firefly.search');
$limit = 20;
$mainTitleIcon = 'fa-search';
// yes, hard coded values:
$minSearchLen = 1;
$limit = 20;
// set limit for search:
$searcher->setLimit($limit);
// ui stuff:
$subTitle = '';
// query stuff
$query = null;
$result = [];
$rawQuery = $request->get('q');
$hasModifiers = true;
$modifiers = [];
if (!is_null($request->get('q')) && strlen($request->get('q')) >= $minSearchLen) {
$query = trim(strtolower($request->get('q')));
$words = explode(' ', $query);
$subTitle = trans('firefly.search_results_for', ['query' => $query]);
// parse query, find modifiers:
// set limit for search
$searcher->setLimit($limit);
$searcher->parseQuery($request->get('q'));
$transactions = $searcher->searchTransactions($words);
$accounts = $searcher->searchAccounts($words);
$categories = $searcher->searchCategories($words);
$budgets = $searcher->searchBudgets($words);
$tags = $searcher->searchTags($words);
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
$transactions = $searcher->searchTransactions();
$accounts = new Collection;
$categories = new Collection;
$tags = new Collection;
$budgets = new Collection;
// no special search thing?
if (!$searcher->hasModifiers()) {
$hasModifiers = false;
$accounts = $searcher->searchAccounts();
$categories = $searcher->searchCategories();
$budgets = $searcher->searchBudgets();
$tags = $searcher->searchTags();
}
$query = $searcher->getWordsAsString();
$subTitle = trans('firefly.search_results_for', ['query' => $query]);
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
}
return view('search.index', compact('title', 'subTitle', 'limit', 'mainTitleIcon', 'query', 'result'));
return view('search.index', compact('rawQuery', 'hasModifiers', 'modifiers', 'subTitle', 'limit', 'query', 'result'));
}
}

View File

@@ -26,7 +26,6 @@ use Illuminate\Support\Collection;
use Navigation;
use Preferences;
use Session;
use URL;
use View;
/**
@@ -98,7 +97,7 @@ class TagController extends Controller
}
// put previous url in session if not redirect from store (not "create another").
if (session('tags.create.fromStore') !== true) {
Session::put('tags.create.url', URL::previous());
$this->rememberPreviousUri('tags.create.uri');
}
Session::forget('tags.create.fromStore');
Session::flash('gaEventCategory', 'tags');
@@ -117,7 +116,7 @@ class TagController extends Controller
$subTitle = trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]);
// put previous url in session
Session::put('tags.delete.url', URL::previous());
$this->rememberPreviousUri('tags.delete.uri');
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'delete');
@@ -138,7 +137,7 @@ class TagController extends Controller
Session::flash('success', strval(trans('firefly.deleted_tag', ['tag' => e($tagName)])));
Preferences::mark();
return redirect(route('tags.index'));
return redirect($this->getPreviousUri('tags.delete.uri'));
}
/**
@@ -174,7 +173,7 @@ class TagController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('tags.edit.fromUpdate') !== true) {
Session::put('tags.edit.url', URL::previous());
$this->rememberPreviousUri('tags.edit.uri');
}
Session::forget('tags.edit.fromUpdate');
Session::flash('gaEventCategory', 'tags');
@@ -289,8 +288,7 @@ class TagController extends Controller
return redirect(route('tags.create'))->withInput();
}
// redirect to previous URL.
return redirect(session('tags.create.url'));
return redirect($this->getPreviousUri('tags.create.uri'));
}
@@ -316,7 +314,7 @@ class TagController extends Controller
}
// redirect to previous URL.
return redirect(session('tags.edit.url'));
return redirect($this->getPreviousUri('tags.edit.uri'));
}
/**

View File

@@ -145,7 +145,7 @@ class ConvertController extends Controller
$errors = $repository->convert($journal, $destinationType, $source, $destination);
if ($errors->count() > 0) {
return redirect(route('transactions.convert', [strtolower($destinationType->type), $journal->id]))->withErrors($errors)->withInput();
return redirect(route('transactions.convert.index', [strtolower($destinationType->type), $journal->id]))->withErrors($errors)->withInput();
}
Session::flash('success', trans('firefly.converted_to_' . $destinationType->type));

View File

@@ -25,7 +25,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Support\Collection;
use Preferences;
use Session;
use URL;
use View;
/**
@@ -63,7 +62,7 @@ class MassController extends Controller
$subTitle = trans('firefly.mass_delete_journals');
// put previous url in session
Session::put('transactions.mass-delete.url', URL::previous());
$this->rememberPreviousUri('transactions.mass-delete.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'mass-delete');
@@ -104,7 +103,7 @@ class MassController extends Controller
Session::flash('success', trans('firefly.mass_deleted_transactions_success', ['amount' => $count]));
// redirect to previous URL:
return redirect(session('transactions.mass-delete.url'));
return redirect($this->getPreviousUri('transactions.mass-delete.uri'));
}
@@ -150,7 +149,7 @@ class MassController extends Controller
}
// put previous url in session
Session::put('transactions.mass-edit.url', URL::previous());
$this->rememberPreviousUri('transactions.mass-edit.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'mass-edit');
@@ -236,7 +235,7 @@ class MassController extends Controller
Session::flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count]));
// redirect to previous URL:
return redirect(session('transactions.mass-edit.url'));
return redirect($this->getPreviousUri('transactions.mass-edit.uri'));
}
}

View File

@@ -31,7 +31,6 @@ use Log;
use Preferences;
use Session;
use Steam;
use URL;
use View;
/**
@@ -140,8 +139,7 @@ class SingleController extends Controller
// put previous url in session if not redirect from store (not "create another").
if (session('transactions.create.fromStore') !== true) {
$url = URL::previous();
Session::put('transactions.create.url', $url);
$this->rememberPreviousUri('transactions.create.uri');
}
Session::forget('transactions.create.fromStore');
Session::flash('gaEventCategory', 'transactions');
@@ -172,7 +170,7 @@ class SingleController extends Controller
$subTitle = trans('firefly.delete_' . $what, ['description' => $journal->description]);
// put previous url in session
Session::put('transactions.delete.url', URL::previous());
$this->rememberPreviousUri('transactions.delete.uri');
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'delete-' . $what);
@@ -192,21 +190,14 @@ class SingleController extends Controller
if ($this->isOpeningBalance($transactionJournal)) {
return $this->redirectToAccount($transactionJournal);
}
$journalId = $transactionJournal->id;
$type = TransactionJournal::transactionTypeStr($transactionJournal);
$type = TransactionJournal::transactionTypeStr($transactionJournal);
Session::flash('success', strval(trans('firefly.deleted_' . strtolower($type), ['description' => e($transactionJournal->description)])));
$repository->delete($transactionJournal);
Preferences::mark();
$uri = session('transactions.delete.url');
if (!(strpos($uri, sprintf('transactions/show/%s', $journalId)) === false)) {
// uri would point back to transaction
$uri = route('transactions.index', [strtolower($type)]);
}
return redirect($uri);
return redirect($this->getPreviousUri('transactions.delete.uri'));
}
/**
@@ -275,7 +266,7 @@ class SingleController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('transactions.edit.fromUpdate') !== true) {
Session::put('transactions.edit.url', URL::previous());
$this->rememberPreviousUri('transactions.edit.uri');
}
Session::forget('transactions.edit.fromUpdate');
@@ -336,7 +327,7 @@ class SingleController extends Controller
// redirect to previous URL.
return redirect(session('transactions.create.url'));
return redirect($this->getPreviousUri('transactions.create.uri'));
}
@@ -386,7 +377,6 @@ class SingleController extends Controller
}
// redirect to previous URL.
return redirect(session('transactions.edit.url'));
return redirect($this->getPreviousUri('transactions.edit.uri'));
}
}

View File

@@ -30,7 +30,6 @@ use Log;
use Preferences;
use Session;
use Steam;
use URL;
use View;
/**
@@ -107,7 +106,7 @@ class SplitController extends Controller
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('transactions.edit-split.fromUpdate') !== true) {
Session::put('transactions.edit-split.url', URL::previous());
$this->rememberPreviousUri('transactions.edit-split.uri');
}
Session::forget('transactions.edit-split.fromUpdate');
@@ -139,7 +138,7 @@ class SplitController extends Controller
$data = $this->arrayFromInput($request);
$journal = $repository->updateSplitJournal($journal, $data);
/** @var array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
// save attachments:
$this->attachments->saveAttachmentsForModel($journal, $files);
@@ -163,8 +162,7 @@ class SplitController extends Controller
}
// redirect to previous URL.
return redirect(session('transactions.edit-split.url'));
return redirect($this->getPreviousUri('transactions.edit-split.uri'));
}
/**

View File

@@ -72,16 +72,11 @@ class TransactionController extends Controller
$end = session('end', Navigation::endOfPeriod(new Carbon, $range));
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
$collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation();
// do not filter transfers if $what = transfer.
if (!in_array($what, ['transfer', 'transfers'])) {
Log::debug('Also get opposing account info.');
$collector->withOpposingAccount();
}
$collector = app(JournalCollectorInterface::class);
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->setRange($start, $end)->withBudgetInformation()
->withCategoryInformation();
$collector->withOpposingAccount();
$collector->disableInternalFilter();
$journals = $collector->getPaginatedJournals();
$journals->setPath('transactions/' . $what);
@@ -122,14 +117,11 @@ class TransactionController extends Controller
$subTitle = sprintf('%s (%s)', trans('firefly.title_' . $what), strtolower(trans('firefly.everything')));
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->withBudgetInformation()->withCategoryInformation();
// do not filter transfers if $what = transfer.
if (!in_array($what, ['transfer', 'transfers'])) {
Log::debug('Also get opposing account info.');
$collector->withOpposingAccount();
}
$collector->withOpposingAccount();
$collector->disableInternalFilter();
$journals = $collector->getPaginatedJournals();
$journals->setPath('transactions/' . $what . '/all');
@@ -161,16 +153,12 @@ class TransactionController extends Controller
Log::debug(sprintf('Transaction index by date will show between %s and %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
$collector = app(JournalCollectorInterface::class);
$collector->setUser(auth()->user());
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
$collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation();
// do not filter transfers if $what = transfer.
if (!in_array($what, ['transfer', 'transfers'])) {
Log::debug('Also get opposing account info.');
$collector->withOpposingAccount();
}
$collector->withOpposingAccount();
$collector->disableInternalFilter();
$journals = $collector->getPaginatedJournals();
$journals->setPath('transactions/' . $what . '/' . $date);

View File

@@ -20,6 +20,8 @@ use FireflyIII\Http\Middleware\IsAdmin;
use FireflyIII\Http\Middleware\Range;
use FireflyIII\Http\Middleware\RedirectIfAuthenticated;
use FireflyIII\Http\Middleware\RedirectIfTwoFactorAuthenticated;
use FireflyIII\Http\Middleware\Sandstorm;
use FireflyIII\Http\Middleware\StartFireflySession;
use FireflyIII\Http\Middleware\VerifyCsrfToken;
use Illuminate\Auth\Middleware\AuthenticateWithBasicAuth;
use Illuminate\Auth\Middleware\Authorize;
@@ -28,7 +30,6 @@ use Illuminate\Foundation\Http\Kernel as HttpKernel;
use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode;
use Illuminate\Routing\Middleware\SubstituteBindings;
use Illuminate\Routing\Middleware\ThrottleRequests;
use Illuminate\Session\Middleware\StartSession;
use Illuminate\View\Middleware\ShareErrorsFromSession;
/**
@@ -48,9 +49,8 @@ class Kernel extends HttpKernel
*/
protected $bootstrappers
= [
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables',
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
'FireflyIII\Bootstrap\ConfigureLogging',
'Illuminate\Foundation\Bootstrap\HandleExceptions',
'Illuminate\Foundation\Bootstrap\RegisterFacades',
'Illuminate\Foundation\Bootstrap\RegisterProviders',
@@ -79,19 +79,23 @@ class Kernel extends HttpKernel
// does not check login
// does not check 2fa
// does not check activation
'web' => [
'web' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
StartFireflySession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
],
// MUST NOT be logged in. Does not care about 2FA or confirmation.
'user-not-logged-in' => [
'user-not-logged-in' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
StartFireflySession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
@@ -100,37 +104,26 @@ class Kernel extends HttpKernel
// MUST be logged in.
// MUST NOT have 2FA
// don't care about confirmation:
'user-logged-in-no-2fa' => [
'user-logged-in-no-2fa' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
StartFireflySession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
Authenticate::class,
RedirectIfTwoFactorAuthenticated::class,
],
// MUST be logged in
// MUST have 2FA
// MUST NOT have confirmation.
'user-logged-in-2fa-no-activation' => [
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
Authenticate::class,
AuthenticateTwoFactor::class,
],
// MUST be logged in
// don't care about 2fa
// don't care about confirmation.
'user-simple-auth' => [
'user-simple-auth' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
StartFireflySession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
@@ -141,10 +134,11 @@ class Kernel extends HttpKernel
// MUST have 2fa
// MUST be confirmed.
// (this group includes the other Firefly middleware)
'user-full-auth' => [
'user-full-auth' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
StartFireflySession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,
@@ -158,10 +152,11 @@ class Kernel extends HttpKernel
// MUST be confirmed.
// MUST have owner role
// (this group includes the other Firefly middleware)
'admin' => [
'admin' => [
Sandstorm::class,
EncryptCookies::class,
AddQueuedCookiesToResponse::class,
StartSession::class,
StartFireflySession::class,
ShareErrorsFromSession::class,
VerifyCsrfToken::class,
SubstituteBindings::class,

View File

@@ -14,8 +14,10 @@ declare(strict_types = 1);
namespace FireflyIII\Http\Middleware;
use Closure;
use Cookie;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Log;
use Preferences;
use Session;
@@ -55,8 +57,13 @@ class AuthenticateTwoFactor
}
$is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data;
$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret'));
$is2faAuthed = Session::get('twofactor-authenticated');
// grab 2auth information from cookie, not from session.
$is2faAuthed = Cookie::get('twoFactorAuthenticated') === 'true';
if ($is2faEnabled && $has2faSecret && !$is2faAuthed) {
Log::debug('Does not seem to be 2 factor authed, redirect.');
return redirect(route('two-factor.index'));
}

View File

@@ -17,7 +17,6 @@ use Amount;
use App;
use Carbon\Carbon;
use Closure;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;

View File

@@ -17,7 +17,8 @@ use Closure;
use Illuminate\Support\Facades\Auth;
use Preferences;
use Session;
use Log;
use Cookie;
/**
* Class RedirectIfTwoFactorAuthenticated
*
@@ -40,7 +41,10 @@ class RedirectIfTwoFactorAuthenticated
$is2faEnabled = Preferences::get('twoFactorAuthEnabled', false)->data;
$has2faSecret = !is_null(Preferences::get('twoFactorAuthSecret'));
$is2faAuthed = Session::get('twofactor-authenticated');
// grab 2auth information from cookie
$is2faAuthed = Cookie::get('twoFactorAuthenticated') === 'true';
if ($is2faEnabled && $has2faSecret && $is2faAuthed) {
return redirect('/');
}

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