Compare commits

...

966 Commits
3.8.2 ... 4.1.6

Author SHA1 Message Date
James Cole
fdb8f61e37 Merge branch 'release/4.1.6' 2016-11-06 16:18:19 +01:00
James Cole
69422cc796 Code for 4.1.6 2016-11-06 16:17:22 +01:00
James Cole
5f9a9bc89a Change log for 4.1.6 2016-11-06 16:16:05 +01:00
James Cole
4d0d05e0f8 Merge pull request #383 from JC5/l10n_develop
New Crowdin translations
2016-11-06 16:14:05 +01:00
James Cole
0113fedbd4 Translated 2016-11-06 15:10:25 +01:00
James Cole
a7d35cd1c3 Fix multi year report. [skip ci] 2016-11-06 15:09:44 +01:00
James Cole
43600fe6cb Merge pull request #382 from JC5/l10n_develop
New Crowdin translations
2016-11-06 15:09:23 +01:00
James Cole
0b5e25960f Fix small JS bug. 2016-11-06 15:04:35 +01:00
James Cole
0c8a1b51e9 Quick bug fix: missing class. 2016-11-06 15:01:04 +01:00
James Cole
cb49f5e8d8 New translations 2016-11-06 15:01:02 +01:00
James Cole
a0e3088ca3 New translations 2016-11-06 15:00:54 +01:00
James Cole
b86be6f52f New translations 2016-11-06 15:00:47 +01:00
James Cole
4c573e1300 New translations 2016-11-06 15:00:43 +01:00
James Cole
1a3d77f117 New translations 2016-11-06 15:00:36 +01:00
James Cole
2656da13b1 Approved. Step name: Proofread 2016-11-06 15:00:29 +01:00
James Cole
d272ebd95c New translations 2016-11-06 15:00:18 +01:00
James Cole
7612f1f91a Small changes to twig files. 2016-11-06 14:52:48 +01:00
James Cole
22a2fe3f61 Improved search. 2016-11-06 14:52:31 +01:00
James Cole
1ebb59b352 Remove .twig extension. [skip ci] 2016-11-06 08:11:43 +01:00
James Cole
77e2cf40df Removed more getJournals functions in favour of the collector. 2016-11-06 08:08:06 +01:00
James Cole
0edffd8ea1 Lighter icon [skip ci] 2016-11-05 18:57:45 +01:00
James Cole
ee6e047596 Do not order the count query. 2016-11-05 18:55:09 +01:00
James Cole
bd55636b3f Add repository move info. 2016-11-05 18:51:26 +01:00
James Cole
b24e97a449 Update version and change log. 2016-11-05 18:50:13 +01:00
James Cole
d45355fc3f Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  Translated
2016-11-05 18:46:10 +01:00
James Cole
b2206f640a Merge pull request #381 from JC5/l10n_develop
New Crowdin translations
2016-11-05 18:45:42 +01:00
James Cole
962cad33e2 Code cleanup. 2016-11-05 18:43:18 +01:00
James Cole
d65214b75a Translated 2016-11-05 18:40:12 +01:00
James Cole
7b4c151df5 Merge pull request #380 from JC5/l10n_develop
New Crowdin translations
2016-11-05 18:30:52 +01:00
James Cole
28d6f51961 New translations 2016-11-05 18:10:55 +01:00
James Cole
d2f9deb82b New translations 2016-11-05 18:10:48 +01:00
James Cole
d9b05b5f59 New translations 2016-11-05 18:10:42 +01:00
James Cole
a8f4b33c57 New translations 2016-11-05 18:10:39 +01:00
James Cole
ee849ea12f New translations 2016-11-05 18:10:32 +01:00
James Cole
f9d3cf231f Approved. Step name: Proofread 2016-11-05 18:10:27 +01:00
James Cole
0713ca7709 New translations 2016-11-05 18:10:17 +01:00
James Cole
1e2124c5ed Moved more stuff to the journal collector. 2016-11-05 18:08:44 +01:00
James Cole
37435da459 Moved more stuff to the journal collector. 2016-11-05 17:47:50 +01:00
James Cole
05dbd30bbd Rename another collector. 2016-11-05 17:17:56 +01:00
James Cole
4b947638a7 Merge pull request #379 from JC5/l10n_develop
New Crowdin translations
2016-11-05 15:16:25 +01:00
James Cole
3d113b9aae New translations 2016-11-05 14:30:14 +01:00
James Cole
d1b3681bf3 New translations 2016-11-05 14:20:16 +01:00
James Cole
9dd4b07314 New translations 2016-11-05 14:20:15 +01:00
James Cole
3814f0f3c3 New translations 2016-11-05 14:20:13 +01:00
James Cole
b1e907fae9 New translations 2016-11-05 14:10:15 +01:00
James Cole
5c03a1a9c8 New translations 2016-11-05 14:10:14 +01:00
James Cole
20ac07a386 Translated 2016-11-05 14:10:11 +01:00
James Cole
13e1292bb7 Automated code cleanup [skip ci] 2016-11-05 11:47:21 +01:00
James Cole
8e542531b3 Move collecting journals to the collector. 2016-11-05 11:44:41 +01:00
James Cole
43afdb021a Move collecting journals to the collector. 2016-11-05 11:24:15 +01:00
James Cole
aeca2ef3b2 Move some code around 2016-11-05 10:42:31 +01:00
James Cole
205a593721 Removed unused method. 2016-11-05 10:28:10 +01:00
James Cole
46649fe228 Solved group thing. 2016-11-05 10:26:57 +01:00
James Cole
adb97fcb05 Fix small javascript bug. 2016-11-05 08:47:05 +01:00
James Cole
98160e9b63 Expand use of journal collector. 2016-11-05 08:46:55 +01:00
James Cole
9c5d192d90 Journal collector may not have been a bad idea after all! 2016-11-05 08:27:25 +01:00
James Cole
47bebb614e Only withdrawal can have a budget. 2016-11-05 07:43:23 +01:00
James Cole
5f7fb77db2 Code to fix #378 2016-11-04 16:04:36 +01:00
James Cole
1d15bc0b10 I am changing some string concatenations to sprintf() routines because they are more readable and safer. [skip ci] 2016-11-03 21:54:07 +01:00
James Cole
7bc4c6d115 Update change log [skip ci] 2016-11-03 21:49:08 +01:00
James Cole
45973a53f5 Merge pull request #376 from JC5/l10n_develop
New Crowdin translations
2016-11-03 21:45:55 +01:00
James Cole
8e5e3de8b0 Update change log (prematurely). [skip ci] 2016-11-03 21:45:35 +01:00
James Cole
8738cd4b04 Approved. Step name: Proofread 2016-11-03 21:40:29 +01:00
James Cole
24a7dac235 Approved. Step name: Proofread 2016-11-03 21:40:28 +01:00
James Cole
a3088f6806 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  Approved. Step name: Proofread
  Approved. Step name: Proofread
  New translations
  New translations
  New translations
  Translated
2016-11-03 21:07:48 +01:00
James Cole
72f7b5f3ea This fixes #375 2016-11-03 21:07:12 +01:00
James Cole
a636c508a2 Merge pull request #374 from JC5/l10n_develop
New Crowdin translations
2016-11-03 16:42:52 +01:00
James Cole
599db95f73 New translations 2016-11-02 22:31:16 +01:00
James Cole
f5f78ab79b New translations 2016-11-02 22:31:15 +01:00
James Cole
9af9383c29 New translations 2016-11-02 22:31:08 +01:00
James Cole
4b97b86c09 New translations 2016-11-02 22:31:07 +01:00
James Cole
11fb46830c New translations 2016-11-02 22:31:00 +01:00
James Cole
e8dec6d95c New translations 2016-11-02 22:31:00 +01:00
James Cole
bb4ee7470d New translations 2016-11-02 22:30:57 +01:00
James Cole
2e8071db9e New translations 2016-11-02 22:30:54 +01:00
James Cole
4d2901aa02 New translations 2016-11-02 22:30:50 +01:00
James Cole
37bbfab20a Approved. Step name: Proofread 2016-11-02 22:30:46 +01:00
James Cole
fb9161b82d Approved. Step name: Proofread 2016-11-02 22:30:43 +01:00
James Cole
000c9d8974 New translations 2016-11-02 22:30:36 +01:00
James Cole
878b664930 New translations 2016-11-02 22:30:33 +01:00
James Cole
afe28b5581 New translations 2016-11-02 22:30:33 +01:00
James Cole
4106b2e4c0 Remove some help entries in favour of help pages in the top right corner. 2016-11-02 22:23:40 +01:00
James Cole
e1be4909b9 Redirect when 0 accounts.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 21:24:16 +01:00
James Cole
7a0347c0c2 Translated 2016-11-02 21:00:38 +01:00
James Cole
a7e0e3fc15 Small additions and bug fixes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 20:52:40 +01:00
James Cole
5e480eca36 Clean up some report code.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 20:45:11 +01:00
James Cole
6c8d594df7 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  New translations
  New translations
  New translations
  New translations
  Approved. Step name: Proofread
  New translations
  New translations

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 20:08:38 +01:00
James Cole
e24f5ec9f3 Multi year report move to AJAX.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 20:08:11 +01:00
James Cole
1379c0652e Merge pull request #373 from JC5/l10n_develop
New Crowdin translations
2016-11-02 19:50:10 +01:00
James Cole
1f87b0bd2d New translations 2016-11-02 14:41:56 +01:00
James Cole
787a437ca4 New translations 2016-11-02 14:41:44 +01:00
James Cole
c0bdb35cb3 New translations 2016-11-02 14:41:34 +01:00
James Cole
4b9cf67413 New translations 2016-11-02 14:41:26 +01:00
James Cole
86ff3be741 Approved. Step name: Proofread 2016-11-02 14:41:09 +01:00
James Cole
8bc8e8d9fe New translations 2016-11-02 14:40:59 +01:00
James Cole
227a12d75d New translations 2016-11-02 14:40:54 +01:00
James Cole
2ddd4314f1 Extend help pages. 2016-11-02 14:33:57 +01:00
James Cole
b980b5baea Small optimisations.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 07:23:11 +01:00
James Cole
4ba34ab511 Show sum [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 07:16:46 +01:00
James Cole
5be317d73c sprintf ALL THE THINGS
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 07:04:14 +01:00
James Cole
af16205965 Merge branch 'master' into develop
* master:
  New budget table for multi year report.
  Removed everything pointless from multi year report.

Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 07:03:17 +01:00
James Cole
39917b77c1 New GitHub move repository instructions
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 07:02:22 +01:00
James Cole
124ecb1372 New budget table for multi year report.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-02 04:55:44 +01:00
James Cole
33c0c1bea6 Removed everything pointless from multi year report.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-01 19:06:35 +01:00
James Cole
a66990459e Merge branch 'release/4.1.5' 2016-11-01 18:45:25 +01:00
James Cole
fecbdc7fbf New version.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-11-01 18:44:26 +01:00
James Cole
0369ace5f7 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii: (28 commits)
  Approved. Step name: Proofread
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  New translations
  ...
2016-11-01 18:41:15 +01:00
James Cole
1657048181 Fixed bug #370 2016-11-01 18:40:35 +01:00
James Cole
b9bdaa7a56 Merge pull request #369 from JC5/l10n_develop
New Crowdin translations
2016-11-01 11:43:00 +01:00
James Cole
f28d07e17b Approved. Step name: Proofread 2016-11-01 11:40:36 +01:00
James Cole
8b8bf1debc New translations 2016-10-31 18:41:44 +01:00
James Cole
aff1c1e3ef New translations 2016-10-31 18:41:40 +01:00
James Cole
169bb2c9bb New translations 2016-10-31 18:41:29 +01:00
James Cole
fb1eafef43 New translations 2016-10-31 18:41:26 +01:00
James Cole
bfe26ceb39 New translations 2016-10-31 18:41:25 +01:00
James Cole
050f305e80 New translations 2016-10-31 18:41:24 +01:00
James Cole
63a6a4f823 New translations 2016-10-31 18:41:23 +01:00
James Cole
a3b167cab5 New translations 2016-10-31 18:41:23 +01:00
James Cole
48327948e2 New translations 2016-10-31 18:41:22 +01:00
James Cole
93856d4577 New translations 2016-10-31 18:41:21 +01:00
James Cole
7ff068aa95 New translations 2016-10-31 18:41:20 +01:00
James Cole
b2f00c869e New translations 2016-10-31 18:41:18 +01:00
James Cole
b717cab8f6 New translations 2016-10-31 18:41:17 +01:00
James Cole
adaff52707 New translations 2016-10-31 18:41:16 +01:00
James Cole
54050edcc6 New translations 2016-10-31 18:41:16 +01:00
James Cole
9acbb69a6a New translations 2016-10-31 18:41:15 +01:00
James Cole
a5e6de047a New translations 2016-10-31 18:41:14 +01:00
James Cole
3d8d35207b New translations 2016-10-31 18:41:13 +01:00
James Cole
0a95f59813 New translations 2016-10-31 18:41:10 +01:00
James Cole
43a3d28dbd New translations 2016-10-31 18:41:09 +01:00
James Cole
685cb7a505 Translated 2016-10-31 18:41:06 +01:00
James Cole
dd82466d07 Translated 2016-10-31 18:41:05 +01:00
James Cole
2cbe4a013e Translated 2016-10-31 18:41:04 +01:00
James Cole
fb85341844 Translated 2016-10-31 18:41:03 +01:00
James Cole
116b3ecdad Approved. Step name: Proofread 2016-10-31 18:40:58 +01:00
James Cole
af85fbf0a3 New translations 2016-10-31 18:40:50 +01:00
James Cole
1d250593c0 New translations 2016-10-31 18:40:45 +01:00
James Cole
ed33a054ad This update will make the help method fall back to the English content, if it is available. 2016-10-31 18:31:52 +01:00
James Cole
4e3e015912 Fix multi year account report [skip ci] 2016-10-30 20:13:49 +01:00
James Cole
7821c52842 Ajax some report parts. 2016-10-30 18:29:26 +01:00
James Cole
0a6f299ae6 Merge branch 'release/4.1.4' 2016-10-30 08:56:35 +01:00
James Cole
73f87e30c2 Changelog.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-30 08:52:09 +01:00
James Cole
838ece2c89 Merge pull request #368 from JC5/l10n_develop
New Crowdin translations
2016-10-30 07:32:23 +01:00
James Cole
d8b88ea2c0 New translations 2016-10-30 07:20:17 +01:00
James Cole
5908951b75 New translations 2016-10-30 07:20:17 +01:00
James Cole
0b41f4c4d2 New translations 2016-10-30 07:20:16 +01:00
James Cole
35439d4fbc New translations 2016-10-30 07:20:16 +01:00
James Cole
fdce40310f New translations 2016-10-30 07:20:15 +01:00
James Cole
6b4785ae32 New translations 2016-10-30 07:20:15 +01:00
James Cole
f74e8e9cb7 New translations 2016-10-30 07:20:13 +01:00
James Cole
5a4eb7e09e New translations 2016-10-30 07:20:12 +01:00
James Cole
3bc4df03cc New translations 2016-10-30 07:20:11 +01:00
James Cole
5d585132fb New translations 2016-10-30 07:20:11 +01:00
James Cole
eff4905883 New translations 2016-10-30 07:20:10 +01:00
James Cole
8923ac4fe3 New translations 2016-10-30 07:20:09 +01:00
James Cole
073535e5ed New translations 2016-10-30 07:20:09 +01:00
James Cole
d304b90ca6 New translations 2016-10-30 07:20:08 +01:00
James Cole
816c26e14e New translations 2016-10-30 07:20:07 +01:00
James Cole
b1244ffa01 New translations 2016-10-30 07:20:07 +01:00
James Cole
fc1342bff9 New translations 2016-10-30 07:20:06 +01:00
James Cole
d7b95194b5 New translations 2016-10-30 07:20:04 +01:00
James Cole
b58bdeccd2 New translations 2016-10-30 07:20:04 +01:00
James Cole
f260b9bdee New translations 2016-10-30 07:20:02 +01:00
James Cole
fb1bdc9ec5 New translations 2016-10-30 07:20:01 +01:00
James Cole
697eff48fc New translations 2016-10-30 07:20:00 +01:00
James Cole
c05019339a Approved. Step name: Proofread 2016-10-30 07:20:00 +01:00
James Cole
8438efaf41 Approved. Step name: Proofread 2016-10-30 07:19:59 +01:00
James Cole
81c019cc99 Translated 2016-10-30 07:19:59 +01:00
James Cole
c773fdc435 Approved. Step name: Proofread 2016-10-30 07:19:58 +01:00
James Cole
c1406f51f1 Approved. Step name: Proofread 2016-10-30 07:19:58 +01:00
James Cole
92affd3440 Approved. Step name: Proofread 2016-10-30 07:19:57 +01:00
James Cole
d3da0652ef Approved. Step name: Proofread 2016-10-30 07:19:57 +01:00
James Cole
e3fbbd6cf1 Translated 2016-10-30 07:19:56 +01:00
James Cole
fcff13470c Approved. Step name: Proofread 2016-10-30 07:19:56 +01:00
James Cole
e3061ee7e7 Approved. Step name: Proofread 2016-10-30 07:19:55 +01:00
James Cole
0ee305fc4a Approved. Step name: Proofread 2016-10-30 07:19:55 +01:00
James Cole
58b93fd0c4 Approved. Step name: Proofread 2016-10-30 07:19:53 +01:00
James Cole
b30217fa2d Approved. Step name: Proofread 2016-10-30 07:19:52 +01:00
James Cole
ae48eec3a2 Translated 2016-10-30 07:19:52 +01:00
James Cole
948233ba27 Translated 2016-10-30 07:19:52 +01:00
James Cole
c2db9b183a New translations 2016-10-30 07:19:51 +01:00
James Cole
6d2b88fa0b New translations 2016-10-30 07:19:51 +01:00
James Cole
1d5da825c5 New translations 2016-10-30 07:19:50 +01:00
James Cole
330c9b53d6 New translations 2016-10-30 07:19:50 +01:00
James Cole
751fe7d4fb New translations 2016-10-30 07:19:49 +01:00
James Cole
9df1fc6e5d New translations 2016-10-30 07:19:48 +01:00
James Cole
8d660f1701 New translations 2016-10-30 07:19:46 +01:00
James Cole
4d61d3c4aa New translations 2016-10-30 07:19:46 +01:00
James Cole
0457088c99 New translations 2016-10-30 07:19:45 +01:00
James Cole
8e575da74e New translations 2016-10-30 07:19:45 +01:00
James Cole
48ed28888e Translated 2016-10-30 07:19:43 +01:00
James Cole
4084b1124e Translated 2016-10-30 07:19:42 +01:00
James Cole
60ba607027 Translated 2016-10-30 07:19:42 +01:00
James Cole
3df2c11b4a Translated 2016-10-30 07:19:41 +01:00
James Cole
c93221923a Translated 2016-10-30 07:19:41 +01:00
James Cole
375317e932 New translations 2016-10-30 07:19:40 +01:00
James Cole
7ce527957a New translations 2016-10-30 07:19:40 +01:00
James Cole
6946521199 New translations 2016-10-30 07:19:39 +01:00
James Cole
18ee20e680 Update crowdin file [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-30 06:37:00 +01:00
James Cole
c53da15219 Update composer.lock in anticipation of new release.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-30 06:20:18 +01:00
James Cole
d4995e342f Fixed #330 2016-10-30 06:14:07 +01:00
James Cole
c9f14da294 Translations. 2016-10-29 17:30:55 +02:00
James Cole
e9c2446cba Debug log for #366 2016-10-29 16:16:10 +02:00
James Cole
35f179625c New queries for #366 2016-10-29 16:11:54 +02:00
James Cole
39749aa113 First code set for #330 2016-10-29 15:14:33 +02:00
James Cole
ba65e982fd Forgot to include model [skip ci] 2016-10-29 11:42:04 +02:00
James Cole
b50e5d7e59 Can also change destination in new rule. 2016-10-29 09:22:51 +02:00
James Cole
a3148dc172 Code for #321 2016-10-29 09:03:14 +02:00
James Cole
73f1491d2d Updates for translations. 2016-10-29 07:44:46 +02:00
James Cole
28eb54dc96 Initial split for report options. 2016-10-28 19:01:52 +02:00
James Cole
21fb426524 Make sure date is localised. 2016-10-28 18:16:30 +02:00
James Cole
d5710ca809 Update Crowdin configuration file 2016-10-28 14:06:41 +02:00
James Cole
0ba6cdda17 Merge pull request #364 from schoentoon/develop
Added dockerfile
2016-10-27 19:40:27 +02:00
James Cole
afdcfa8525 Tweak reports. 2016-10-26 19:45:10 +02:00
James Cole
5db4f8512b Tweak reports. 2016-10-26 19:37:19 +02:00
James Cole
dc0c1b73bc Better view for expenses. 2016-10-26 19:32:19 +02:00
James Cole
f999257095 New verify database routine. 2016-10-26 19:32:07 +02:00
James Cole
7182909e28 Keep the box [skip ci] 2016-10-26 16:54:52 +02:00
James Cole
fe3f015171 Add more stuff to ajax controllers, making report controller simpler. 2016-10-26 16:46:43 +02:00
Toon Schoenmakers
5bb668be63 Added dockerfile 2016-10-26 15:07:36 +02:00
James Cole
01de147900 Display message about common error. 2016-10-26 06:41:50 +02:00
James Cole
a7e5fcc806 Move some stuff over to AJAX thing. 2016-10-25 18:53:54 +02:00
James Cole
e2d187d74b Various small bug fixes. 2016-10-24 18:01:15 +02:00
James Cole
48b0620629 New help thing. 2016-10-23 17:33:53 +02:00
James Cole
19e9f382e4 Add some rounding to make forms more neat. 2016-10-23 16:56:18 +02:00
James Cole
446eaf6588 Some code cleanup [skip ci] 2016-10-23 14:58:39 +02:00
James Cole
78deb1420d Some fixes for bills. 2016-10-23 14:56:05 +02:00
James Cole
e092515dff Better export. 2016-10-23 12:55:07 +02:00
James Cole
81f6fef978 Add new line to files [skip ci] 2016-10-23 12:42:44 +02:00
James Cole
6a2f8fa9ee No use models directly. 2016-10-23 12:41:54 +02:00
James Cole
a79a8c8874 Various small upgrades. 2016-10-23 12:37:12 +02:00
James Cole
c39659b064 Remove a lot of references to user id. 2016-10-23 12:19:32 +02:00
James Cole
9a30fbd05a Move stuff to request classes for #339 2016-10-23 12:10:22 +02:00
James Cole
83f48418f6 Small updates [skip ci] 2016-10-23 09:57:04 +02:00
James Cole
bcd7b41c91 Simplified export. 2016-10-23 09:44:14 +02:00
James Cole
cefb7d12bc Merge branch 'release/4.1.3' 2016-10-22 22:45:27 +02:00
James Cole
3c0c15103e This fixes #361 2016-10-22 22:44:57 +02:00
James Cole
a8a8afc2be More for #339 2016-10-22 22:03:00 +02:00
James Cole
49e32abd3f Move some code for #339 2016-10-22 21:40:31 +02:00
James Cole
7977eefaca Merge branch 'release/4.1.2' 2016-10-22 20:52:54 +02:00
James Cole
f1fa6c3108 Fixed a bug in the store transaction routine. 2016-10-22 20:50:20 +02:00
James Cole
2fa0d55f39 Merge branch 'release/4.1.1' 2016-10-22 12:03:34 +02:00
James Cole
5bff509346 New translations.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-22 12:03:11 +02:00
James Cole
a147e9b74a Fix edit screen.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-22 11:53:34 +02:00
James Cole
0d87f7c4ca Better implementation of markdown.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-22 11:50:33 +02:00
James Cole
8c675615df Support markdown in notes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-22 11:47:47 +02:00
James Cole
7edd1bff40 Merge branch 'release/4.1.0' 2016-10-22 10:21:15 +02:00
James Cole
3bfcb1f3ab New change log. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-22 10:20:25 +02:00
James Cole
7b6c63e6a8 New version number [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-10-22 10:15:50 +02:00
James Cole
5500e5b0aa Remove debug classes 2016-10-22 10:13:56 +02:00
James Cole
e4d249e73c Piggy bank supports notes (#350) 2016-10-22 10:13:49 +02:00
James Cole
091f6e918b Fix some reported issues. 2016-10-22 09:44:47 +02:00
James Cole
5d9b68c3e7 Various code cleanup [skip ci] 2016-10-22 09:39:31 +02:00
James Cole
12a6a61100 Various code cleanup [skip ci] 2016-10-22 09:33:03 +02:00
James Cole
7ce3b8d4ef Updated events, fixes #345 2016-10-22 09:31:27 +02:00
James Cole
3d9b855849 Force larval 5.3.18 2016-10-22 07:52:17 +02:00
James Cole
2346d2ec05 Fine tuning split edit screens. 2016-10-22 07:28:31 +02:00
James Cole
a4c081c8a5 Fix unset variable. [skip ci] 2016-10-21 22:01:42 +02:00
James Cole
316980efbd Fix unset variable. [skip ci] 2016-10-21 22:00:45 +02:00
James Cole
a05bc0eed0 Fix route [skip ci] 2016-10-21 21:57:10 +02:00
James Cole
4d1c271da6 Renamed a route [skip ci] 2016-10-21 21:54:57 +02:00
James Cole
0dd7ecbfbe Remove code no longer used. 2016-10-21 21:43:12 +02:00
James Cole
0dc188b083 Removed old code 2016-10-21 21:41:50 +02:00
James Cole
6a553f77f3 Large update to fix split journals. 2016-10-21 21:41:31 +02:00
James Cole
a74cef439b For simplicity, split controller. 2016-10-21 19:20:03 +02:00
James Cole
9a3cd27700 Many updates to get split transactions and normal transactions working side by side. 2016-10-21 19:06:22 +02:00
James Cole
801c7c0ab6 Remove unused function. 2016-10-21 13:22:45 +02:00
James Cole
a95a4e783a Fix and simplify bill repos 2016-10-21 13:20:51 +02:00
James Cole
af1ee9db93 This fixes bills unpaid. 2016-10-21 07:29:25 +02:00
James Cole
fcdb6fd2a7 Do loop instead of while loop [skip ci] 2016-10-21 06:41:33 +02:00
James Cole
97c0fb389d More logs [skip ci] 2016-10-21 06:38:00 +02:00
James Cole
a9c3992331 Back to old method [skip ci] 2016-10-21 06:33:56 +02:00
James Cole
a38e057fa7 Rewrote some methods to fix #341 2016-10-21 06:26:12 +02:00
James Cole
f83aaf77f1 Improve bill things for issue #341 2016-10-20 21:40:45 +02:00
James Cole
d92768ecbf This code fixes #349 2016-10-20 19:10:43 +02:00
James Cole
b9308cd74a Test flash messages. 2016-10-20 16:51:05 +02:00
James Cole
78b577bc9d Better ip info [skip ci] 2016-10-18 06:50:35 +02:00
James Cole
7d247897ed Should correctly show user info. [skip ci] 2016-10-18 06:47:48 +02:00
James Cole
5dcbdec491 Update composer file and update routine. [skip ci] 2016-10-15 18:52:21 +02:00
James Cole
9bf980431e Remove unused methods. 2016-10-15 14:07:51 +02:00
James Cole
da60bfbcff Better text [skip ci] 2016-10-15 14:05:56 +02:00
James Cole
92553cbc7e Add icon, missing translation [skip ci] 2016-10-15 12:41:45 +02:00
James Cole
8e48e53f17 Restucturing some code. 2016-10-15 12:39:34 +02:00
James Cole
2f9a4bb79a Better text 2016-10-15 12:39:11 +02:00
James Cole
ac968dd6cd Extended the user admin. 2016-10-15 07:11:53 +02:00
James Cole
6e4f2c0c8a Small script to upgrade transactions. 2016-10-15 06:19:21 +02:00
James Cole
d662c18ed7 Fix sorting in chart. [skip ci] 2016-10-14 20:07:15 +02:00
James Cole
e4ea234707 New revenue accounts chart. 2016-10-14 20:01:17 +02:00
James Cole
0b526c0168 New revenue chart 2016-10-14 19:59:10 +02:00
James Cole
2acde5c72a Option to show deposit accounts on the front page. 2016-10-14 19:52:30 +02:00
James Cole
ec8cf2c459 New preferences screen. 2016-10-14 19:48:19 +02:00
James Cole
3598780d54 This should at least catch #357 2016-10-14 19:18:00 +02:00
James Cole
35dd8ac6e6 Revert "This should at least catch #357"
This reverts commit 5ff7c7ffab.
2016-10-14 19:16:39 +02:00
James Cole
5ff7c7ffab This should at least catch #357 2016-10-14 19:16:28 +02:00
James Cole
399db47826 Merge branch 'release/4.0.2' 2016-10-14 17:15:47 +02:00
James Cole
148956a60d Some code reformatting. 2016-10-14 17:14:54 +02:00
James Cole
3670053a58 Some code reformatting [skip ci] 2016-10-14 17:14:28 +02:00
James Cole
e8e2b9704f New translations. 2016-10-14 17:14:04 +02:00
James Cole
fcdeebcc06 Some last minute updated texts. 2016-10-14 16:51:38 +02:00
James Cole
586ed82e88 New changelog. 2016-10-14 16:26:05 +02:00
James Cole
cc400d1e2e Merge pull request #356 from telyn/require-intl
Require PHP intl extension
2016-10-12 10:32:28 +02:00
Telyn
6edbfb27aa Add ext-intl to dependencies 2016-10-12 09:22:21 +01:00
James Cole
8fc9251b93 Fix name of language. [skip ci] 2016-10-10 19:08:09 +02:00
James Cole
10af888a97 Expand view [skip ci] 2016-10-10 13:27:35 +02:00
James Cole
89f2328846 Forgot include [skip ci] 2016-10-10 13:25:27 +02:00
James Cole
48e8cd20b4 Removed unused Twig methods. 2016-10-10 13:08:02 +02:00
James Cole
394ef23eda New local names [skip ci] 2016-10-10 08:27:08 +02:00
James Cole
62aa1eb487 Updated translations [skip ci] 2016-10-10 08:19:00 +02:00
James Cole
1500018ccc A new language arrives! [skip ci] 2016-10-10 08:13:27 +02:00
James Cole
23fad62d46 Completely removed account crud class. 2016-10-10 08:03:03 +02:00
James Cole
3cbf00734f Remove storeMeta 2016-10-10 07:53:25 +02:00
James Cole
1dc17dd59d Move getActiveAccountsByType 2016-10-10 07:53:12 +02:00
James Cole
f8935c92ea Unrelated code cleanup. 2016-10-10 07:49:55 +02:00
James Cole
de6f838413 Moved getAccountsByType 2016-10-10 07:49:39 +02:00
James Cole
e8a095e543 Moved getAccountsById 2016-10-10 07:25:27 +02:00
James Cole
717c1d080e Copied (not yet removed) findByName 2016-10-10 07:20:49 +02:00
James Cole
0ae9afd325 Move findByIban 2016-10-10 07:16:05 +02:00
James Cole
d1b56c2afa Moved findByAccountNumber 2016-10-10 07:14:01 +02:00
James Cole
8ef7c5ac33 Moved find() method to new class. 2016-10-10 07:12:39 +02:00
James Cole
7180a40cd8 Refactored some methods surrounding the opening balance of an account. 2016-10-10 07:01:14 +02:00
James Cole
71804af624 Updated some model code. 2016-10-10 06:50:24 +02:00
James Cole
85dc7f3643 Moved another method. 2016-10-10 06:49:50 +02:00
James Cole
a866d13b75 Forgot to add argument 2016-10-10 06:49:39 +02:00
James Cole
fcb5e4eabc Moved leftOnAccount() 2016-10-10 06:47:42 +02:00
James Cole
ade1cf9c19 Fixed wrong listing. 2016-10-10 06:40:50 +02:00
James Cole
0f1ec7d003 Removed double method. 2016-10-09 21:49:31 +02:00
James Cole
7e038afece Must be unsigned 2016-10-09 21:36:22 +02:00
James Cole
9bb8e182fa Forgot a translation 2016-10-09 21:36:15 +02:00
James Cole
e94ae126fd Refactored accountRepository::getJournals > accountTasker > getJournals 2016-10-09 21:36:03 +02:00
James Cole
5bb8c6a366 This should fix #355 2016-10-09 20:18:46 +02:00
James Cole
30844df5d4 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  Fixed issue causing all imported transactions to have unknown opposing account with ABN AMRO specific
2016-10-09 20:18:14 +02:00
James Cole
63e4a410a7 Merge pull request #354 from roberthorlings/bugfix/abn-amro-specific
Bugfix for issue with ABN AMRO specific
2016-10-09 20:00:48 +02:00
Robert Horlings
ee9a5d91e2 Merge branch 'develop' into bugfix/abn-amro-specific 2016-10-09 19:53:11 +02:00
Robert Horlings
171ab8a4c3 Fixed issue causing all imported transactions to have unknown opposing account with ABN AMRO specific 2016-10-09 17:19:00 +02:00
James Cole
96740aaac4 Extend transaction model for #351 2016-10-09 17:06:52 +02:00
James Cole
2017720096 Experimental new getJournals method. 2016-10-09 16:22:08 +02:00
James Cole
b77ea6d316 Add some phpdoc 2016-10-09 11:21:41 +02:00
James Cole
f5adb4047f Remove methods no longer used. 2016-10-09 10:59:28 +02:00
James Cole
b082858866 Removed unused blocks from the front page. Savings and piggy banks. 2016-10-09 10:58:54 +02:00
James Cole
a8a014189d Removed method that was already there under another name. 2016-10-09 10:57:06 +02:00
James Cole
39ea9e85a7 Various code cleanup and refactoring. Restored cache. 2016-10-09 10:53:37 +02:00
James Cole
a4d2ed74fc Make sure all journals are included. 2016-10-09 09:41:03 +02:00
James Cole
90f2e27f1f Refactoring income and expense reports. 2016-10-09 09:32:12 +02:00
James Cole
a3359ba47a Moved destroy() method from CRUD to Account repos. 2016-10-09 08:20:29 +02:00
James Cole
1d2d3523d6 Move CRUD method count() to account repository 2016-10-09 08:18:47 +02:00
James Cole
3f40751a1a Forgot to exclude a method. 2016-10-09 08:06:49 +02:00
James Cole
b5b55e862c Clean up code. 2016-10-09 07:59:14 +02:00
James Cole
c64771b76b Move some methods around, refactoring. 2016-10-09 07:58:27 +02:00
James Cole
ea7ee7ee9a Moved a report out of the controller. 2016-10-08 16:24:07 +02:00
James Cole
a1f797c4d1 Moved a method around. 2016-10-08 16:04:05 +02:00
James Cole
d0c92a2244 Clean up account report helper. 2016-10-08 15:59:58 +02:00
James Cole
6e90c033b1 Start of some remodelling. 2016-10-08 14:54:32 +02:00
James Cole
24f62b8fce Some minor refactoring. 2016-10-08 10:02:33 +02:00
James Cole
d43936155c Removed some unused code. 2016-10-07 16:33:17 +02:00
James Cole
39dab4fdd9 Remove unused class. 2016-10-07 12:28:14 +02:00
James Cole
c0fdf44ad2 Small cleaning up. 2016-10-07 11:40:03 +02:00
James Cole
4d91f7d23a This fixes #344 2016-10-07 09:40:50 +02:00
James Cole
49af6522a8 Some code cleanup. 2016-10-07 05:44:21 +02:00
James Cole
3c5f9487a8 Prep change log for next version [skip ci] 2016-10-07 05:43:47 +02:00
James Cole
f5cb87f5c3 Merge pull request #348 from SanderKleykens/feature/postgres-compatibility
PostgreSQL compatibility
2016-10-07 05:32:10 +02:00
Sander Kleykens
cf543613c9 Fix the CSV importer failing when using PostgreSQL
Add ordered column to the list of columns that are selected so PostgreSQL doesn't throw an error
2016-10-06 23:49:33 +02:00
Sander Kleykens
5c239c91db Convert raw XORs to a construct compatible with Laravel's query builder 2016-10-06 22:27:10 +02:00
James Cole
9920504232 Fixes #346 2016-10-06 05:26:38 +02:00
James Cole
5540697dbd Removed a method no longer necessary. 2016-10-05 16:09:37 +02:00
James Cole
b355c18e0c Some code cleanup and copyright cleanup. [skip ci] 2016-10-05 06:52:15 +02:00
James Cole
1e90485c5f Merge branch 'master' into develop
* master:
  added some comments
  removed some debug commands
  Better descriptions for ING accounts
2016-10-05 06:31:47 +02:00
James Cole
dc784c53b5 Fix for #343 2016-10-04 21:51:46 +02:00
James Cole
5a47391a64 Merge branch 'release/4.0.1' 2016-10-04 20:13:50 +02:00
James Cole
8a106bd16a Merge branch 'release/4.0.1' into develop 2016-10-04 20:13:50 +02:00
James Cole
a31ac79173 New version. 2016-10-04 20:13:40 +02:00
James Cole
0d0a604254 Changelog for 4.0.1 [skip ci] 2016-10-04 20:13:09 +02:00
James Cole
724d25f2c2 Merge branch 'develop'
* develop:
  Fixed some rare bugs.
  Extra clear button to reapply rules #307
  Fix trim when null [skip ci]
  Fixed a bug where incoming transactions would not be properly filtered in several reports.
  Removed for #334
  Fix #337 [skip ci]
  Fix #335
  Remove account extra text #336 [skip ci]
  Fixes bug #338
  Refer to correct page [skip ci]
  Catch unset row.
2016-10-04 20:08:35 +02:00
James Cole
8ed22d452d Merge pull request #342 from tomwerf/master
ING Import
2016-10-04 20:02:34 +02:00
Tom van der Werf
d7fef45a56 added some comments 2016-10-04 17:50:01 +00:00
Tom van der Werf
dc22802dec removed some debug commands 2016-10-04 17:30:49 +00:00
Tom van der Werf
ce5af7b1d9 Better descriptions for ING accounts 2016-10-03 17:08:24 +00:00
James Cole
0a147e5c9c Fixed some rare bugs. 2016-10-02 15:09:43 +02:00
James Cole
7d21255f7f Extra clear button to reapply rules #307 2016-10-02 08:14:11 +02:00
James Cole
13f952f182 Fix trim when null [skip ci] 2016-10-01 09:41:16 +02:00
James Cole
b494be228b Fixed a bug where incoming transactions would not be properly filtered in several reports. 2016-10-01 09:37:18 +02:00
James Cole
0fdaac53d0 Removed for #334 2016-10-01 08:49:33 +02:00
James Cole
e1b3a08878 Fix #337 [skip ci] 2016-10-01 08:49:02 +02:00
James Cole
dc893588b0 Fix #335 2016-10-01 08:48:13 +02:00
James Cole
b9fcc443ec Remove account extra text #336 [skip ci] 2016-10-01 08:45:14 +02:00
James Cole
d8586c8043 Fixes bug #338 2016-09-29 19:17:24 +02:00
James Cole
4252a3e53b Refer to correct page [skip ci] 2016-09-29 07:04:58 +02:00
James Cole
dbb5cdb9cf Catch unset row. 2016-09-29 07:02:47 +02:00
James Cole
9bdfecbfdc Merge branch 'release/4.0.0' 2016-09-26 18:37:33 +02:00
James Cole
3ec8a8c375 Merge branch 'release/4.0.0' into develop 2016-09-26 18:37:33 +02:00
James Cole
f85e4a24e5 New license information. 2016-09-26 18:37:20 +02:00
James Cole
0dda87c78e New license. 2016-09-26 18:34:31 +02:00
James Cole
2fc09ff9d7 Fix empty pop-ups in report. 2016-09-25 14:47:55 +02:00
James Cole
e4e0e21293 Smaller method. 2016-09-25 08:59:27 +02:00
James Cole
15089f0d7e Some issues fixed for scrutiniser. 2016-09-25 08:50:12 +02:00
James Cole
7232c1d7bb partial fix for #307 2016-09-25 08:46:57 +02:00
James Cole
9a53d8c21c Some array_keys fixes. 2016-09-25 08:46:42 +02:00
James Cole
0d198193db Some issues fixed for scrutiniser. 2016-09-25 08:36:35 +02:00
James Cole
45bc23b8af Some issues fixed for scrutiniser. 2016-09-25 08:32:53 +02:00
James Cole
3323c31765 Some issues fixed for scrutiniser. 2016-09-25 08:24:03 +02:00
James Cole
bb7c26b77c Some issues fixed for scrutiniser. 2016-09-25 08:20:17 +02:00
James Cole
9101d6a2c0 Add lines to configuration on wiki. [skip ci] 2016-09-24 19:32:00 +02:00
James Cole
ad2b254be0 Fix for issue #328. Turns out the import routine converts accounts back and forth instead of creating new entries. 2016-09-24 18:59:31 +02:00
James Cole
abc4f856ce Fix nullable fields. 2016-09-24 17:22:42 +02:00
James Cole
b3b66a8f92 Merge pull request #329 from niekvanderkooy/develop
Fix assignment of array variables
2016-09-24 17:04:32 +02:00
Niek van der Kooy
2f7cf9b916 Fix assignment of array variables 2016-09-24 17:01:41 +02:00
James Cole
b822e0c6e7 Upgrade stuff for 4.0.0 2016-09-24 15:30:08 +02:00
James Cole
6fef9ee72b #315 2016-09-24 10:58:48 +02:00
James Cole
ab6dd0a1ec #314 2016-09-24 10:55:13 +02:00
James Cole
9deef5ac92 #325 2016-09-24 10:53:39 +02:00
James Cole
577187babe Fix #324 [skip ci] 2016-09-24 10:52:13 +02:00
James Cole
577290e813 add strtolower [skip ci] 2016-09-24 09:14:47 +02:00
James Cole
f3b9798216 Fix some rule things. 2016-09-24 09:12:17 +02:00
James Cole
4dcaa96d16 Fix group error. I hope. 2016-09-24 08:59:29 +02:00
James Cole
0dcbf451d6 Add verify command to composer.json 2016-09-24 08:59:14 +02:00
James Cole
e87f6ca40e Fix some possible NULL values. 2016-09-24 08:55:01 +02:00
James Cole
1f34e33d8c Update composer, improve verify routine. 2016-09-23 22:31:01 +02:00
James Cole
258e87e127 Merge pull request #323 from Mortalife/master
Adding GBP to Seed
2016-09-22 07:58:21 +02:00
Matthew Peck
3ec8efcfc1 Adding GBP to Seed 2016-09-21 20:45:36 +01:00
James Cole
70ea227bd0 Add logging to processor #322 2016-09-21 21:01:10 +02:00
James Cole
27c832ed58 Logging for rule triggers #322 2016-09-21 20:58:12 +02:00
James Cole
a31b4ccf01 Basic logging for willMatchEverything #322 2016-09-21 20:30:09 +02:00
James Cole
d221ea68d0 Gave all rule actions some logging. #322 2016-09-21 20:12:04 +02:00
James Cole
dc9fe58536 Fix tags input width. 2016-09-21 19:23:50 +02:00
James Cole
f871e29bdb Quick fix for broken attachments. 2016-09-21 19:16:47 +02:00
James Cole
1357352276 Merge pull request #320 from Mortalife/master
Decimal place fix on import
2016-09-20 20:21:02 +02:00
James Cole
e169754693 Fix display bug for attachments 2016-09-20 17:23:12 +02:00
James Cole
1cfe4f40ba Fix display bug for attachments 2016-09-20 17:22:07 +02:00
James Cole
5545d1c1ba Fix display bug for attachments 2016-09-20 17:21:26 +02:00
James Cole
e5f7228fa9 Fix future query problems (current users not affected either way) [skip ci] 2016-09-20 09:32:58 +02:00
James Cole
11385494eb Fix for income entry. 2016-09-20 08:57:08 +02:00
James Cole
ae328de469 Fix bug in year report. 2016-09-20 08:26:42 +02:00
James Cole
0574a706c8 Error in decrypt error (yes) 2016-09-20 07:57:04 +02:00
Matthew Peck
70bb85a75b Cleanup 2016-09-20 00:00:11 +01:00
Matthew Peck
8cd901b57b Added support for multiple decimal places 2016-09-19 23:53:51 +01:00
James Cole
8b9818c48e This will fix #316 2016-09-18 20:00:13 +02:00
James Cole
a95099fa46 Update FF configuration. 2016-09-18 19:57:21 +02:00
James Cole
221e4b7fc0 Fix some migrations [skip ci] 2016-09-18 18:14:07 +02:00
James Cole
6cff3eb61e Fix some migrations [skip ci] 2016-09-18 17:52:31 +02:00
James Cole
e4fd97ae77 Some code fixes. [skip ci] 2016-09-17 09:52:28 +02:00
James Cole
5ca9099654 Some code fixes. 2016-09-17 09:50:40 +02:00
James Cole
6e33e26ddf Update copyright notices, update German language. 2016-09-17 07:57:32 +02:00
James Cole
04461a4ab8 Updated composer.lock [skip ci] 2016-09-17 07:22:39 +02:00
James Cole
a4b9bbff54 Update AdminLTE template. 2016-09-17 07:19:09 +02:00
James Cole
4ad4252a77 Extend exclude path. Trigger a new inspection. 2016-09-17 07:10:29 +02:00
James Cole
aac0c9ab98 Various layout updates and tiny upgrade fixes [skip ci] 2016-09-16 13:29:56 +02:00
James Cole
c123e1044a Expand config so people won't get errors here [skip ci] 2016-09-16 12:19:29 +02:00
James Cole
d25d0454fc Code clean up 2016-09-16 12:15:58 +02:00
James Cole
f38984398d Code clean up [skip ci] 2016-09-16 12:07:45 +02:00
James Cole
a07799cfa4 MySQL 5.7 compatible query fixing. [skip ci] 2016-09-16 11:16:31 +02:00
James Cole
7c52f297ee MySQL 5.7 compatible query fixing. [skip ci] 2016-09-16 11:06:21 +02:00
James Cole
50a3279b30 MySQL 5.7 compatible query fixing. [skip ci] 2016-09-16 11:04:24 +02:00
James Cole
0ea14eb987 MySQL 5.7 compatible grouping. [skip ci] 2016-09-16 11:01:35 +02:00
James Cole
cf1b98e569 MySQL 5.7 compatible grouping. 2016-09-16 10:55:26 +02:00
James Cole
63fb435002 Expand code. 2016-09-16 10:50:19 +02:00
James Cole
2f8263f53a Possible fix for reports [skip ci] 2016-09-16 09:36:08 +02:00
James Cole
fb649779d6 Do not need to sort. Fix MySQL 5.7 compatibility. 2016-09-16 09:31:40 +02:00
James Cole
bb58f605f7 Some new login / logout routes 2016-09-16 09:21:36 +02:00
James Cole
fccdf56c5d Fixed some query things. 2016-09-16 09:09:54 +02:00
James Cole
bd53410c71 Some changes in login routes for 5.3 2016-09-16 09:02:35 +02:00
James Cole
7d63f124c4 Fixing some login routes 2016-09-16 07:22:57 +02:00
James Cole
9ffc5d857c Fixed some db bugs. These will only pop up when developing. 2016-09-16 07:16:09 +02:00
James Cole
2f93784acd More code for 5.3 2016-09-16 07:05:34 +02:00
James Cole
d00fbe4eb3 More code for 5.3 2016-09-16 06:48:38 +02:00
James Cole
51d9f041ae Changes for login routes. 2016-09-16 06:43:13 +02:00
James Cole
b872ab8b86 New code and new routes for 5.3 2016-09-16 06:40:45 +02:00
James Cole
3d25fd79ca First set of upgrade to 5.3 stuff. 2016-09-16 06:19:40 +02:00
James Cole
3aad78e6ef Lots of updated libraries.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-15 19:14:55 +02:00
James Cole
7d5bb72b0c Fix for #312
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-15 19:14:22 +02:00
James Cole
46e5aae8bb Fix changelog. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-15 19:00:22 +02:00
James Cole
b9e2ee7af3 Merge branch 'release/3.10.4' 2016-09-14 20:40:52 +02:00
James Cole
c1a2892788 New changelog.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-14 20:40:12 +02:00
James Cole
2078183e0d Update version and composer file. 2016-09-14 20:37:12 +02:00
James Cole
fab1d53714 Simplified upgrade instructions. 2016-09-14 20:35:45 +02:00
James Cole
3fe831c7d8 Bit of code cleanup courtesy of PHPStorm. 2016-09-13 19:20:09 +02:00
James Cole
6958f71cfd @fuf discovered a bug where FF3 will fall back to the hard-coded system default currency and not the set default currency. See #307 2016-09-13 19:19:58 +02:00
James Cole
a7351f348d Fixed a bug mentioned by @vissert and added some logging for @sandermulders
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-12 18:43:10 +02:00
James Cole
5379e03447 Merge pull request #311 from sandermulders/fix/nullable-values
add migration that correctly sets nullable for description fields on rules and rule_groups
2016-09-12 16:52:14 +02:00
Sander Mulders
539058e32d Fix for #310: add migration that correctly sets nullable for description fields on rules and rule_groups 2016-09-12 14:24:01 +02:00
James Cole
11b6b5a63c Merge branch 'release/3.10.3' into develop 2016-09-11 08:17:42 +02:00
James Cole
1155096226 Merge branch 'release/3.10.3' 2016-09-11 08:17:41 +02:00
James Cole
2920dd356e Updated translations.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-11 08:17:35 +02:00
James Cole
9c3dac8170 Config for new version.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-11 08:13:22 +02:00
James Cole
49f9909b15 New changelog.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-11 08:13:14 +02:00
James Cole
e4fef6dfc3 Fixed an import bug where a new transaction validation rule would break storing of the transaction, while the import would not notice this error happening. The importer will now also correctly set a date on the "import tag" and will not tag an incomplete journal as already imported.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-11 08:08:01 +02:00
James Cole
2da087401e Extend audit report
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-10 18:37:16 +02:00
James Cole
629baf9de5 Added invoice date
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-10 18:36:52 +02:00
James Cole
29a930dae5 Updated translations.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-09 11:36:19 +02:00
James Cole
d920537dd2 Updated translations.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-09 11:29:19 +02:00
James Cole
106b04a5da Update composer.lock [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-09 11:19:50 +02:00
James Cole
176752e219 Code for optional fields #301
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-09 11:19:40 +02:00
James Cole
8d19f60091 Various translation updates.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-09 11:19:19 +02:00
James Cole
e937aa2f74 Fix a bug in piggy bank display [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-09 06:17:50 +02:00
James Cole
c3ccc4ccdf This should fix #308
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-08 21:10:24 +02:00
James Cole
6c5cd705c0 Some code for new optional fields, see #301
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-04 16:21:51 +02:00
James Cole
ce003f217b Removed unused "budget maximum" preference 2016-09-03 21:13:08 +02:00
James Cole
8c7ef49eb6 New code by @vissert that allows category edit (see #282)
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-03 05:01:48 +02:00
James Cole
29af4bd1b9 This fixes #303 2016-09-03 04:54:57 +02:00
James Cole
2ce5142b06 Small fix for #303
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-01 19:01:08 +02:00
James Cole
f3a8a25872 Fixed #303
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-09-01 18:31:39 +02:00
James Cole
598e97d028 Forgot to escape things, which causes havoc in the Dutch translation.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-31 18:50:46 +02:00
James Cole
fa110279de Merge branch 'release/3.10.2' 2016-08-29 19:32:49 +02:00
James Cole
8fdeaf73cc Update composer.lock [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-29 19:32:03 +02:00
James Cole
a7ffdf062a Update changelog. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-29 19:26:31 +02:00
James Cole
3bad92dd6d Upgrade instructions and new version.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-29 19:25:21 +02:00
James Cole
2e88024bca Close #290
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-29 19:21:40 +02:00
James Cole
ca2301959c Merge pull request #298 from Bonno/develop
Fixed wrong conversion to revenue account
2016-08-29 14:49:46 +02:00
Bonno Nachtegaal-Karels
3285fae7f0 Fixed wrong conversion to revenue account 2016-08-29 14:39:43 +02:00
James Cole
312079657b Include files from new import routine in export routine. 2016-08-28 07:05:42 +02:00
James Cole
18c183afd6 Remove form tags in favour of raw html.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 09:38:58 +02:00
James Cole
f424d9cf20 Update change log
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 04:37:04 +02:00
James Cole
5c3da9fd9e New language files.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 04:34:59 +02:00
James Cole
1f321fadd4 Removed some form-tags in favour of plain HTML
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 04:18:02 +02:00
James Cole
65f5d27b12 New pages for administration. More settings will be web-based.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 04:00:48 +02:00
James Cole
cdb591de7f Remove unnecessary setting.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 04:00:19 +02:00
James Cole
a0ea3882e1 Various code cleanup.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-27 03:50:35 +02:00
James Cole
a9444ac702 Code cleanup.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 09:30:52 +02:00
James Cole
d0c6afc3a9 Various code clean up. [skip ci] 2016-08-26 08:21:31 +02:00
James Cole
e7a0a5937c Extend git ignore. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:41:13 +02:00
James Cole
08992b5298 Extend test-import data set to contain some rules.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:38:00 +02:00
James Cole
6490a4240d Remove references to ImportResult. Add the application of user rules.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:37:47 +02:00
James Cole
43a7544dd7 Catch empty (null) descriptions. Which never happens.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:37:27 +02:00
James Cole
0fe70dae17 Referring to Auth::user will not work from the command line.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:37:09 +02:00
James Cole
7079e76886 Remove some commented code.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:36:33 +02:00
James Cole
0ec021c375 No need to grab journals we don't need.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:36:26 +02:00
James Cole
ff3396e286 Removed the ImportResult class because it was lame.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-26 07:36:13 +02:00
James Cole
78912903ce Change signature of importstorage. 2016-08-26 06:47:12 +02:00
James Cole
4c015e2d12 Re-arrange code. No changes. 2016-08-26 06:44:24 +02:00
James Cole
172634a55a Add some comments. 2016-08-26 06:43:38 +02:00
James Cole
58ca7d551a Rename import procedure method name 2016-08-26 06:43:23 +02:00
James Cole
fd8ed4c9aa Fixed a bug in strict typing.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-25 19:19:12 +02:00
James Cole
c03f5f5ff0 Merge branch 'release/3.10.1' 2016-08-25 11:20:39 +02:00
James Cole
6775fc58c8 Change log and updated config.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-25 11:20:13 +02:00
James Cole
9f250fc61b Renamed migration. 2016-08-25 11:16:17 +02:00
James Cole
94609f1419 Clean up some code. 2016-08-25 06:44:48 +02:00
James Cole
53402aa5e2 Update composer file. 2016-08-25 06:44:41 +02:00
James Cole
5aadb29905 Add some forgotten code to the mobile piggy bank controller things.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-24 20:06:45 +02:00
James Cole
d4f8c41d80 This should fix a bug in the verification routine.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-24 19:36:09 +02:00
James Cole
a2e14f8b8d Various code clean up.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-24 19:33:58 +02:00
James Cole
98c4ac955a Finetune user feedback during import and add a tag to collect transactions. 2016-08-14 11:31:09 +02:00
James Cole
70b63e1736 Better report for finished import. 2016-08-14 10:11:49 +02:00
James Cole
106665a468 Better reporting for double imported rows. See also #164 2016-08-14 09:49:04 +02:00
James Cole
da5e48d769 More language lines. Add a check for double lines. 2016-08-14 09:10:47 +02:00
James Cole
85f484e73c Divide by zero. 2016-08-14 09:10:08 +02:00
James Cole
d287ae97f8 Prep for translations in JS. 2016-08-14 08:34:59 +02:00
James Cole
117bb602dc Extend ImportObject with row hash. 2016-08-14 08:34:51 +02:00
James Cole
e440d55034 Finetune import status page. 2016-08-14 08:10:42 +02:00
James Cole
7f5b94fe43 Fixed a bug in the verify routine. 2016-08-13 23:31:42 +02:00
James Cole
c58eea6654 Fine-tuning the import routine. 2016-08-13 23:28:01 +02:00
James Cole
bbed5d0701 First version of a web-based import status thing. 2016-08-13 21:51:01 +02:00
James Cole
2775690fc8 Extend model to allow for more data during the import. 2016-08-13 18:53:16 +02:00
James Cole
1fd9f6e724 First user interface elements and routes for web import. 2016-08-13 16:38:58 +02:00
James Cole
3d63903128 Make sure import errors end up where the user can read them. 2016-08-13 16:29:24 +02:00
James Cole
ef876a165a Some better feedback in the import process. 2016-08-13 14:22:40 +02:00
James Cole
c4d6aaeef3 Extend scrutinizer config. 2016-08-12 16:06:27 +02:00
James Cole
37b735c2e3 Remove code climate config 2016-08-12 16:06:17 +02:00
James Cole
62d30c7b0e Fix migration (call to empty table name) 2016-08-12 16:06:11 +02:00
James Cole
9cac7d46c0 Merge branch 'release/3.10' 2016-08-12 16:03:30 +02:00
James Cole
99b3e24836 Code optimalization 2016-08-12 15:50:52 +02:00
James Cole
ffb699cb06 Clean up code. 2016-08-12 15:34:15 +02:00
James Cole
2947ec0002 Small optimisations. 2016-08-12 15:27:44 +02:00
James Cole
5c4d010bde Code cleanup. 2016-08-12 15:10:03 +02:00
James Cole
955306d877 Remove travis file and fix NULL error in sqlite. 2016-08-12 14:50:25 +02:00
James Cole
015935ed55 Implemented ABN Amro specific import code. 2016-08-12 12:55:52 +02:00
James Cole
48f4cceb19 Mention new version. 2016-08-12 10:47:09 +02:00
James Cole
9850220aac Add new languages. 2016-08-12 10:46:22 +02:00
James Cole
c4ac1460f0 Expanded translations 2016-08-12 10:44:27 +02:00
James Cole
b9e1e01337 New translations. 2016-08-12 10:34:45 +02:00
James Cole
76649cb7de Extended views and language. 2016-08-12 10:07:53 +02:00
James Cole
5e310776b4 New change log 2016-08-12 09:50:54 +02:00
James Cole
4d7fa11172 Upgrade instructions for 3.10 2016-08-12 09:35:09 +02:00
James Cole
28962007c1 More code for new importer 2016-08-12 09:27:09 +02:00
James Cole
2111873bcf Fixed a bug in tag creation. 2016-08-11 19:01:23 +02:00
James Cole
0aaf9a6fda Extend rule set for import. 2016-08-11 18:44:11 +02:00
James Cole
186b704509 Lots of new code to test the import routine.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-11 10:21:32 +02:00
James Cole
efe9933721 Import storage routine is creating the first transaction journals.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-11 08:00:02 +02:00
James Cole
200366f5be Extended the validator and created more code to handle exceptions.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-10 18:49:16 +02:00
James Cole
c9bd72337d Some notes on the import process. 2016-08-06 09:31:32 +02:00
James Cole
d4510440b8 Split the importer and the setup routine. 2016-08-06 06:28:21 +02:00
James Cole
5a9cf698f7 Configuration for import routine. 2016-08-06 06:21:46 +02:00
James Cole
5826fec519 Some new import stuff. 2016-08-06 06:21:25 +02:00
James Cole
7035600984 Add some logging for #283 2016-08-05 21:50:49 +02:00
James Cole
b1dfb5811f Merge pull request #286 from niekvanderkooy/develop
Generalise Steam::phpBytes
2016-08-05 21:42:40 +02:00
Niek van der Kooy
51570a5d08 Allow phpBytes to work with configs where gigabyte file sizes are allowed 2016-08-05 20:54:59 +02:00
Niek van der Kooy
f065f3a0b8 Make phpBytes case insensitive, since php.ini can contain both capitals and small letters 2016-08-05 20:53:09 +02:00
James Cole
47376f1f35 Fix a problem mentioned in issue #283
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-05 19:29:44 +02:00
James Cole
bcfe2c6410 Fixes #284
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-05 18:52:16 +02:00
James Cole
09d63b584d Save old data; bread crumbs 2016-08-04 06:14:08 +02:00
James Cole
5f5469a7d4 Moved some files around. 2016-08-04 06:10:30 +02:00
James Cole
38800d61b0 New user related code. 2016-08-04 06:07:53 +02:00
James Cole
1186e95c51 Admin view will show some IP addresses.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-08-03 20:57:01 +02:00
James Cole
d870e0f42e Fix split query. 2016-08-02 19:42:41 +02:00
James Cole
0db9852769 This should fix a bug in split expenses. 2016-08-02 19:12:18 +02:00
James Cole
7e3f9048fe Fixed some fields in split thing. 2016-08-01 20:14:23 +02:00
James Cole
1ba88f182b Various CSV bugs and a config bug fixed. 2016-07-31 17:17:45 +02:00
James Cole
c8f5a6b7ad Ignore deleted columns. 2016-07-30 20:04:24 +02:00
James Cole
d26bbf3cdc Handling import values. This is a dead end but it seemed a good idea. 2016-07-30 19:09:58 +02:00
James Cole
0de72b6914 Ignore result.html 2016-07-30 16:29:49 +02:00
James Cole
e41c89bd59 Does not belong. 2016-07-30 16:29:17 +02:00
James Cole
541d9ebdd9 Optimised some code. 2016-07-30 16:29:04 +02:00
James Cole
1e724712e0 Bug fix in converter 2016-07-29 21:42:12 +02:00
James Cole
3682467ae3 Each CSV converter can set the certainty of their conversion. 2016-07-29 21:40:58 +02:00
James Cole
7707c81b2d Each CSV converter can set the certainty of their conversion. 2016-07-29 21:29:46 +02:00
James Cole
e434de72a3 Expand fields. 2016-07-26 20:40:46 +02:00
James Cole
ce191fa6d3 Fix split deposit. 2016-07-26 20:26:46 +02:00
James Cole
90865a5284 Fix recursive. 2016-07-24 19:24:02 +02:00
James Cole
684f6e0b5c Don't need these. 2016-07-24 19:07:47 +02:00
James Cole
c287bc139c Check new list. 2016-07-24 18:51:39 +02:00
James Cole
1392275b81 Lots of new code for importer and some preferences. 2016-07-24 18:47:55 +02:00
James Cole
87c0f1d86e More CSV related updates. 2016-07-23 21:37:06 +02:00
James Cole
a4a723cfc6 Fixed import error. 2016-07-20 15:57:42 +02:00
James Cole
921e2c06f4 Beta warning for import thing. 2016-07-20 15:47:30 +02:00
James Cole
cb9433f4b9 This should fix #280 2016-07-17 08:50:22 +02:00
James Cole
1be6af820e No map for tags. 2016-07-17 08:35:04 +02:00
James Cole
3b686b6d1c New but empty converters. 2016-07-16 08:25:39 +02:00
James Cole
697566fe42 New importers. 2016-07-16 07:58:25 +02:00
James Cole
5130ba7ea4 Working IBAN account import thing. 2016-07-15 22:37:47 +02:00
James Cole
c9e46a4dd1 Lots of import related code. 2016-07-15 22:26:08 +02:00
James Cole
f5b3dc36e3 Fix view. 2016-07-05 09:02:01 +02:00
James Cole
f1e8d1cf1e Show bill average. 2016-07-05 08:57:45 +02:00
James Cole
e8e7ab01d2 Merge branch 'develop' of github.com:JC5/firefly-iii into develop 2016-07-04 12:38:22 +02:00
James Cole
9244994233 Fix bug that would report wrong file size to browser. 2016-07-04 12:37:33 +02:00
James Cole
ae768a8525 Works up until actual import. 2016-07-02 23:08:47 +02:00
James Cole
162c762973 First set of data mappers. 2016-07-02 20:40:23 +02:00
James Cole
57b5981904 Fix #266 for period-chart. 2016-07-02 17:42:27 +02:00
James Cole
275d19e71d Fix #266 for all-chart. 2016-07-02 17:39:58 +02:00
James Cole
189b11befa Extra page number check for issue #276 2016-07-02 17:36:46 +02:00
James Cole
a56a5fc228 New code for import routine. 2016-07-02 17:33:57 +02:00
James Cole
cbe3fb73a8 Catch decrypt exceptions. 2016-06-27 16:36:28 +02:00
James Cole
3d58fbebec Should not have committed this. 2016-06-27 16:25:17 +02:00
James Cole
b947ff50ed Fix chart thing. 2016-06-27 16:11:49 +02:00
James Cole
18d2741814 More code for the new CSV import 2016-06-27 15:15:46 +02:00
James Cole
93a54780ab Fixes a bug in the 2FA activation thing. 2016-06-24 21:58:57 +02:00
James Cole
3d201db6fc More code for import. 2016-06-24 14:24:34 +02:00
James Cole
9ffc0936ee Merge branch 'feature/new-csv-import' into develop
# Conflicts:
#	app/Helpers/Csv/Importer.php
2016-06-23 12:15:19 +02:00
James Cole
fbf9e00208 Change preferences info. 2016-06-23 12:08:14 +02:00
James Cole
2c826451d1 Fix delete routine and some NULLs 2016-06-23 12:07:31 +02:00
James Cole
617a5c0606 Fix date range. 2016-06-23 08:01:15 +02:00
James Cole
8331a7e34a Rename stuff. 2016-06-18 07:37:12 +02:00
James Cole
8ee1676f0a New migrations. 2016-06-18 07:36:15 +02:00
James Cole
5dc8620c43 More new migrations. 2016-06-17 14:06:38 +02:00
James Cole
d2733a4df0 First attempt at rewriting all migrations. 2016-06-17 06:03:42 +02:00
James Cole
ae649223d8 Mobile add money to piggy routine 2016-06-16 20:52:59 +02:00
James Cole
6267930938 Work on new chart for year report. 2016-06-16 20:52:30 +02:00
James Cole
bdee8cde77 This fixes #273 2016-06-16 08:04:22 +02:00
James Cole
e63f216905 Fix small bug in reorder routine. 2016-06-15 09:58:33 +02:00
James Cole
ec18165698 Fixed #267 2016-06-11 07:38:30 +02:00
James Cole
307e6a2337 Renamed fields #267 2016-06-11 06:36:46 +02:00
James Cole
b80d8cf774 Move date picker stuff to new method. 2016-06-11 06:33:51 +02:00
James Cole
7a5ef6013a Fix #271 2016-06-11 06:31:56 +02:00
James Cole
13b92c47d9 Translations and fixes. 2016-06-11 06:31:40 +02:00
James Cole
5a79bc0a99 Initial code base for new CSV import. 2016-06-10 21:00:00 +02:00
James Cole
beda6ec3a9 Removed old CSV stuff. 2016-06-10 15:25:24 +02:00
James Cole
c619b8730b Implemented #264 2016-06-07 12:22:46 +02:00
James Cole
c14ec8b006 New change log. 2016-06-07 12:22:30 +02:00
James Cole
10c7786248 Merge branch 'release/3.9.1' 2016-06-06 20:25:55 +02:00
James Cole
08ff08685c Small updates for 3.9.1 2016-06-06 20:25:01 +02:00
James Cole
8091dbfdfa Restore views (#262) 2016-06-06 09:28:35 +02:00
James Cole
8dc106b79a Restore config (#262) 2016-06-06 09:28:25 +02:00
James Cole
7527433738 Restore provider (#262) 2016-06-06 09:25:29 +02:00
James Cole
1502e08a7a Restore routes (#262) 2016-06-06 09:24:51 +02:00
James Cole
c9679f1d4f Restore bread crumbs (#262) 2016-06-06 09:23:55 +02:00
James Cole
6b976dd6b9 Restore controller (#262) 2016-06-06 09:22:28 +02:00
James Cole
8da4abf655 Restore helpers (#262) 2016-06-06 09:22:20 +02:00
James Cole
2e26193333 This should fix #266 2016-05-24 16:08:43 +02:00
James Cole
ada43bc0dd Fix #265 2016-05-24 11:28:24 +02:00
James Cole
a447c886c4 Basic for for #262
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-22 21:11:30 +02:00
James Cole
288e713f94 Remove all code related to the CSV importer in preparation of #262
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-22 20:18:16 +02:00
James Cole
f8eb1fa44a Merge branch 'release/3.9.0'
Signed-off-by: James Cole <thegrumpydictator@gmail.com>

# Conflicts:
#	app/Helpers/Csv/Converter/BillName.php
2016-05-22 16:46:11 +02:00
James Cole
afc794513f last minute composer update [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-22 16:43:47 +02:00
James Cole
7e6d3c9d6b Various last minute bug fixes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-22 16:38:32 +02:00
James Cole
44960e8e42 Various last minute bug fixes. 2016-05-22 15:48:34 +02:00
James Cole
41430c3bb2 Same bug, another line. 2016-05-22 09:08:37 +02:00
James Cole
2f435019e0 Fix bug. 2016-05-22 09:04:16 +02:00
James Cole
480e70dfac Sharper spent in period. [skip ci] 2016-05-20 18:30:48 +02:00
James Cole
c4818334e7 Sharper spent in period. [skip ci] 2016-05-20 18:29:51 +02:00
James Cole
a5d5f86aed Some code cleanup and a better chart [skip ci] 2016-05-20 18:26:43 +02:00
James Cole
78afb771b1 Code cleanup [skip ci] 2016-05-20 17:58:10 +02:00
James Cole
a74a646777 Code cleanup. Moving closer to new release. 2016-05-20 17:53:03 +02:00
James Cole
87f9ca3bb2 Removed some old configuration values. 2016-05-20 17:28:07 +02:00
James Cole
d54e264a91 Cannot create empty tags.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-20 15:09:25 +02:00
James Cole
99aea5ce7a Fix bug in verification.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-20 15:08:24 +02:00
James Cole
e10d5e89e5 Last minute bug fixes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-20 15:02:52 +02:00
James Cole
0105456828 Copyright notices. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-20 12:42:21 +02:00
James Cole
5c7df5c04d Copyright notices. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-20 12:41:23 +02:00
James Cole
563ede822f Copyright notices. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-05-20 12:27:31 +02:00
James Cole
786cfc21c7 Make strval for bcadd [skip ci] 2016-05-20 12:08:48 +02:00
James Cole
8f0856e31a Make strval for bcadd [skip ci] 2016-05-20 12:07:55 +02:00
James Cole
bea075c74d Make strval for bcadd [skip ci] 2016-05-20 12:06:54 +02:00
James Cole
5f82accb61 Point to other library. [skip ci] 2016-05-20 12:03:28 +02:00
James Cole
95f50ca2fd Point to other library. [skip ci] 2016-05-20 12:02:19 +02:00
James Cole
d8b76bdfd2 Code cleanup [skip ci] 2016-05-20 11:59:54 +02:00
James Cole
74a9edaaf7 Bug fixes in strict types. 2016-05-20 11:53:34 +02:00
James Cole
7dd858be39 Fix bugs. 2016-05-20 11:27:41 +02:00
James Cole
7d7ff71384 New routes. 2016-05-20 11:09:09 +02:00
James Cole
003177fa49 Move stuff around. 2016-05-20 11:09:02 +02:00
James Cole
3c3a83330d More moving stuff around. 2016-05-20 11:02:07 +02:00
James Cole
724f423692 Move some stuff around. 2016-05-20 09:45:24 +02:00
James Cole
65b8882ed4 Clean up repository. 2016-05-20 09:25:17 +02:00
James Cole
66d7fd7d4c Declare strict types. 2016-05-20 08:57:45 +02:00
James Cole
782a6f289c Remove deprecated methods. 2016-05-20 08:11:54 +02:00
James Cole
70d936bb8f Fix filters and other methods that used deprecated methods. 2016-05-20 08:09:53 +02:00
James Cole
dda3082c7e Some code cleanup. 2016-05-20 08:00:35 +02:00
James Cole
ed948cc965 Allow user to split unsplit journal 2016-05-20 07:51:26 +02:00
James Cole
0347649f42 Fix some views. 2016-05-20 06:58:13 +02:00
James Cole
c66fe2b541 Fix some views [skip ci] 2016-05-20 06:27:48 +02:00
James Cole
8c1ae76c7a More tight report thing [skip ci] 2016-05-19 13:39:36 +02:00
James Cole
04dee404c0 More narrow result for popup. [skip ci] 2016-05-19 13:38:12 +02:00
James Cole
b22dd29835 Fix charts. [skip ci] 2016-05-19 08:57:25 +02:00
James Cole
536a5cd1c8 New translations. [skip ci] 2016-05-18 18:13:38 +02:00
James Cole
b7f1bcf7c9 Slightly larger screenshots. [skip ci] 2016-05-18 14:24:59 +02:00
James Cole
5e590072dd Slightly larger screenshots. [skip ci] 2016-05-18 14:24:31 +02:00
James Cole
d204b9b752 Slightly larger screenshots. [skip ci] 2016-05-18 14:23:54 +02:00
James Cole
22d1121193 New read me. [skip ci] 2016-05-18 14:22:48 +02:00
James Cole
e23c6521b9 Add expenses. [skip ci] 2016-05-18 14:19:33 +02:00
James Cole
b0cb9663a6 Updated read me [skip ci] 2016-05-18 07:23:11 +02:00
James Cole
95b7da89f0 Some code cleanup. 2016-05-18 07:01:27 +02:00
James Cole
b0a5b53abb Better number formatting. 2016-05-17 19:23:23 +02:00
James Cole
ce78c8993f Optimise query. [skip ci] 2016-05-17 16:47:43 +02:00
James Cole
2538b4a885 Small changes to audit report. 2016-05-17 16:11:19 +02:00
James Cole
109d96ad16 Small but expensive changes to audit report. 2016-05-17 16:10:32 +02:00
James Cole
4cbb0d9716 Fixed split journals views. 2016-05-17 16:00:27 +02:00
James Cole
65ecea3b1c Small fix to split data. 2016-05-17 15:25:03 +02:00
James Cole
495b80f5ef More code for the split journal support. 2016-05-17 15:19:07 +02:00
James Cole
e113736887 Should fix issue #263 2016-05-17 12:45:31 +02:00
James Cole
042b7a4966 Fix multi-year chart. [skip ci] 2016-05-16 12:51:52 +02:00
James Cole
5ab8cb38d3 Small change in report [skip ci] 2016-05-16 12:47:43 +02:00
James Cole
fc4ab29244 Fixed chart. [skip ci] 2016-05-16 09:05:06 +02:00
James Cole
5a43e6cb9f Better query for no budget. [skip ci] 2016-05-16 07:13:54 +02:00
James Cole
4effc95c5f Fixed some report bugs. 2016-05-15 19:23:19 +02:00
James Cole
962965b5b7 Code cleanup. 2016-05-15 18:36:40 +02:00
James Cole
260b611293 Various fixes in report pages. 2016-05-15 18:16:31 +02:00
James Cole
d2131c371b Fixed more report details. 2016-05-15 17:53:00 +02:00
James Cole
eedf6a07f0 Fixed the income report. 2016-05-15 17:46:53 +02:00
James Cole
5cd1e7c100 Fix charts. [skip ci] 2016-05-15 16:15:17 +02:00
James Cole
6a750a998f Remove category chart from report controller. 2016-05-15 16:13:05 +02:00
James Cole
bd818b2dea Code clean up. 2016-05-15 15:39:22 +02:00
James Cole
4164ebcc69 Added a lot of todo things. 2016-05-15 15:24:23 +02:00
James Cole
60d732067b Made some things less complex. 2016-05-15 15:08:59 +02:00
James Cole
b7b52707fb Fix Travis. 2016-05-15 15:02:07 +02:00
James Cole
f373c72679 Remove tests. 2016-05-15 15:01:29 +02:00
James Cole
ec2027b8db Update git ignore. [skip ci] 2016-05-15 14:48:52 +02:00
James Cole
a84de5db77 Enable caching. Remove stuff for development. 2016-05-15 14:48:21 +02:00
James Cole
5065b1ee03 Enable cache [skip ci] 2016-05-15 12:39:39 +02:00
James Cole
a0aa114ee6 Update balance view. [skip ci] 2016-05-15 12:32:18 +02:00
James Cole
823839fbf6 Better routes and titles. 2016-05-15 12:26:40 +02:00
James Cole
1c93d8bf79 More test data and better views. 2016-05-15 12:08:41 +02:00
James Cole
626404407e More support for #142 2016-05-15 09:00:49 +02:00
James Cole
446ab62d38 View updates. [skip ci] 2016-05-14 23:14:49 +02:00
James Cole
0d39161ec3 Fix iban in test data. 2016-05-14 22:23:55 +02:00
James Cole
29be16dcba Fix complex query. [skip ci] 2016-05-14 22:21:08 +02:00
James Cole
b0bb790386 Experimental query. [skip ci] 2016-05-14 22:12:16 +02:00
James Cole
e64b40d58b Experimental query. [skip ci] 2016-05-14 22:11:49 +02:00
James Cole
4870945af2 Remove references to unused library. 2016-05-14 21:55:43 +02:00
James Cole
a547a5f3f9 New Chart library. [skip ci] 2016-05-14 21:50:02 +02:00
James Cole
e5eabdf7e7 Clean up test data. 2016-05-14 21:49:16 +02:00
James Cole
f78d56b149 Will implement changes to test database. 2016-05-14 17:08:28 +02:00
James Cole
771926c779 No longer needed. 2016-05-14 14:02:37 +02:00
James Cole
6090efe2df Refactoring. 2016-05-14 14:02:12 +02:00
James Cole
863227c55c Some refactoring. 2016-05-14 13:51:33 +02:00
James Cole
5a6967cefd Better formatting for split transactions. 2016-05-13 19:40:13 +02:00
James Cole
5166171e5d More refactoring 2016-05-13 17:22:24 +02:00
James Cole
3e36a29c23 More refactoring. 2016-05-13 15:58:30 +02:00
James Cole
20e1e50032 Refactoring. 2016-05-13 15:53:39 +02:00
James Cole
36bc483edb Reorder some fields. 2016-05-13 10:50:19 +02:00
James Cole
aa59227786 Fixed transactions and attachments. 2016-05-13 09:55:06 +02:00
James Cole
2d8449ed68 This should just about finished split transaction editing. 2016-05-13 07:33:04 +02:00
James Cole
d7ab482ae1 Various updates for split transactions. 2016-05-12 22:44:31 +02:00
James Cole
cfcc4ce88a Let's leave this on false. 2016-05-12 16:34:44 +02:00
James Cole
eda44bbed0 Merge branch 'develop' of github.com:JC5/firefly-iii into develop 2016-05-12 12:13:42 +02:00
James Cole
988049061d Start with edit split journals routine. 2016-05-12 12:13:10 +02:00
James Cole
ebb1c5ae25 Merge pull request #260 from zjean/ssl
Force https schema if APP_FORCE_SSL=true in .env
2016-05-12 11:00:41 +02:00
James Cole
ce7eebac5c Build edit split transactions. 2016-05-12 10:38:44 +02:00
James Cole
b7c446f7db Start with edit and view screens. 2016-05-11 23:03:13 +02:00
James Cole
7c39a04c4b Cleanup. 2016-05-11 17:33:22 +02:00
James Cole
037d84b810 Fixes for transactions. 2016-05-11 17:17:43 +02:00
James Cole
529bf50c85 Removed some dead code. 2016-05-11 10:37:56 +02:00
James Cole
d2b4bd78a9 Removed some dead code. 2016-05-11 10:02:27 +02:00
James Cole
e1c146a5c1 Reinstate chart. 2016-05-11 09:17:47 +02:00
James Cole
ed9acbdfde Reinstate report. 2016-05-11 09:08:18 +02:00
James Cole
dc825d5a9c Fix queries. 2016-05-11 08:40:22 +02:00
James Cole
9f8faf15f1 Reinstate sorting. 2016-05-11 08:10:05 +02:00
James Cole
934656c954 Some small changes. 2016-05-11 07:57:16 +02:00
James Cole
d233a2df3c Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  Should fix frontpage.

# Conflicts:
#	app/Models/TransactionJournal.php
#	app/Repositories/Account/AccountRepository.php
2016-05-11 06:08:05 +02:00
James Cole
7c7740d3ba Should fix frontpage. 2016-05-10 09:33:23 +02:00
James Cole
cda6cfb4cd Fix more charts. 2016-05-09 20:15:26 +02:00
James Cole
a90d095609 More stuff for categories. 2016-05-09 18:06:53 +02:00
James Cole
98e683329e New stuff for categories and transactions. 2016-05-08 13:45:23 +02:00
James Cole
3588bd881c More chart cleanup. 2016-05-06 22:54:36 +02:00
James Cole
0460811e6c Fixed some more charts. 2016-05-06 22:53:08 +02:00
James Cole
27f5fe18df Moving stuff around, optimising charts. 2016-05-06 10:32:26 +02:00
James Cole
6d944ec98f More cleanup for budgets. 2016-05-06 06:15:46 +02:00
James Cole
adf6691470 This breaks everything budget-related. 2016-05-05 22:03:35 +02:00
James Cole
dd8b500efd These budget charts are the worst, I'm telling you. 2016-05-05 21:25:20 +02:00
James Cole
4e1ff8c4a3 Removed phpunit.xml 2016-05-05 19:07:46 +02:00
James Cole
e73d590ead Update composer.lock 2016-05-05 19:05:29 +02:00
James Cole
5cc22f49cf Fix tests. 2016-05-05 19:04:21 +02:00
James Cole
eb3d2b1749 Building split transactions and fixing tests. 2016-05-05 18:59:46 +02:00
James Cole
21a197ba46 More translations. 2016-05-05 07:46:19 +02:00
James Cole
0b74707638 Display and handle errors. 2016-05-05 07:46:11 +02:00
James Cole
16dc8b7d68 Translation for error. 2016-05-05 07:45:52 +02:00
James Cole
5a8abe004e Field rename 2016-05-05 07:45:40 +02:00
James Cole
b211d72c8b Static data must remain static data. 2016-05-05 07:45:29 +02:00
James Cole
36f3eb8b2f Small fix in journal handler. 2016-05-05 07:09:12 +02:00
zjean
cb1cb9f328 Force https schema if APP_FORCE_SSL=true in .env 2016-05-04 22:09:42 +02:00
James Cole
3344bb7263 Code cleanup. 2016-05-02 20:49:19 +02:00
James Cole
5e1167b8ae Code cleanup. 2016-05-01 15:05:29 +02:00
James Cole
b80db054e2 Remove journal collector. 2016-05-01 09:52:58 +02:00
James Cole
c66df3cb2c Code cleanup. 2016-05-01 09:42:08 +02:00
James Cole
ac8ff4e565 Clean up repository. 2016-05-01 07:09:58 +02:00
James Cole
bfa7ee90f4 Reverse stuff 2016-05-01 06:59:08 +02:00
James Cole
77c9e37584 Move some stuff around. 2016-05-01 06:37:47 +02:00
James Cole
80350f8423 Fix for transactions. 2016-04-30 22:30:11 +02:00
James Cole
3c1ff4d21f Fix query. 2016-04-30 22:05:58 +02:00
James Cole
55b8f03590 Some new data thing. 2016-04-30 21:20:39 +02:00
James Cole
1fd7852309 Fix query thing. 2016-04-30 20:24:47 +02:00
James Cole
9c5292962f More stuff for splits. 2016-04-30 19:50:42 +02:00
James Cole
c05c6e72c0 Display budget and category if relevant. 2016-04-30 16:36:58 +02:00
James Cole
bdcd033952 Fix edit routine 2016-04-30 12:46:21 +02:00
James Cole
4ec6bcc8c7 More code for split and small bug fix in attachment helper. 2016-04-30 09:48:39 +02:00
James Cole
11ea4b6d47 Fix migrations. 2016-04-30 07:15:28 +02:00
James Cole
e4f45b5370 List of categories will check transactions as well. #142 2016-04-29 22:00:24 +02:00
James Cole
9baadd3793 Use other method of collecting query fields. #142 2016-04-29 21:52:15 +02:00
James Cole
94a79876ce View for split transactions. #142 2016-04-29 21:49:18 +02:00
James Cole
42c3d1fa68 Expanding support for split transactions #142 2016-04-29 21:36:59 +02:00
James Cole
0e3ccebd0b First attempt at #142. Needs a lot of work still. 2016-04-29 20:59:28 +02:00
James Cole
4af8272faa Updates to transactions. 2016-04-29 17:29:13 +02:00
James Cole
0ef3d0cf03 Better message for issue #247 2016-04-29 17:26:59 +02:00
James Cole
f266b92ef1 This catches issue #247 2016-04-29 17:26:38 +02:00
James Cole
462c9fb3aa Merge pull request #259 from tonicospinelli/pt_BR
add brazilian currency and translation
2016-04-29 15:11:23 +02:00
Antonio Spinelli
568186828c add brazilian currency and translation
fix #257
2016-04-29 07:30:22 -03:00
James Cole
8bcc319b7d Better demo warning and budget indication. 2016-04-29 11:34:48 +02:00
James Cole
baff9780de Smaller report. [skip ci] 2016-04-29 11:05:52 +02:00
James Cole
d8b8f98738 Translations. [skip ci] 2016-04-29 09:56:50 +02:00
James Cole
b714eaac06 Boxes will try to remember their state and auto-collapse. 2016-04-29 09:47:47 +02:00
James Cole
14b94a5bd2 Simplified some code. 2016-04-29 08:56:56 +02:00
James Cole
ea014a6504 Some code simplifications. 2016-04-28 16:30:21 +02:00
James Cole
e28e66e8f1 Fix ABN AMRO importer 2016-04-28 16:23:21 +02:00
James Cole
b47a140c2f Updates to budgets. 2016-04-28 10:59:36 +02:00
James Cole
19d7e27fa9 Code cleanup. 2016-04-28 05:50:29 +02:00
James Cole
2d368f226e Remove parameters. [skip ci] 2016-04-27 19:23:24 +02:00
James Cole
75d81f8f18 Parameter change [skip ci] 2016-04-27 19:22:15 +02:00
James Cole
e3437ba697 Various code cleanup. 2016-04-27 19:21:47 +02:00
James Cole
84f299c33b Forgot a return statement. 2016-04-27 10:39:27 +02:00
James Cole
3d4489efe6 Code cleanup. 2016-04-27 10:38:51 +02:00
James Cole
6aa50e3c00 @roberthorlings I have no idea if this is a correct fix. 2016-04-27 09:20:51 +02:00
James Cole
b70498c337 Some cleaning up. 2016-04-27 06:46:02 +02:00
James Cole
f34aa77d1d Cleaned up some code. 2016-04-27 06:43:17 +02:00
James Cole
3833a41acb Fix sorting. 2016-04-27 06:19:13 +02:00
James Cole
b5a5a216cd Fine tune chart. [skip ci] 2016-04-26 22:32:55 +02:00
James Cole
d9da2a57b6 Fix query error [skip ci] 2016-04-26 22:31:49 +02:00
James Cole
1591b61b77 Expand new charts. 2016-04-26 22:30:53 +02:00
James Cole
66f2df9677 Some code cleanup and I sneaked in a chart optimisation. 2016-04-26 22:21:34 +02:00
James Cole
5199377113 Fixes tests.. for now. 2016-04-26 21:47:16 +02:00
James Cole
da202317c0 Code cleanup. 2016-04-26 21:40:15 +02:00
James Cole
1d2a4e707e Code cleanup in export routine 2016-04-26 20:49:22 +02:00
James Cole
edf9dbc6e8 Some cleaning up [skip ci] 2016-04-26 14:56:42 +02:00
James Cole
dfbe6e5b6e Code clean up. [skip ci] 2016-04-26 12:39:29 +02:00
James Cole
d551333fa2 Some cleaning up and more charts. 2016-04-26 09:21:57 +02:00
James Cole
01cab599bb And now to make sure it works. 2016-04-26 08:11:26 +02:00
James Cole
1c8834fffb Some code cleaning up and refactoring. 2016-04-26 08:09:10 +02:00
James Cole
22e6ea700f Some extensions to budgets. 2016-04-25 21:37:08 +02:00
James Cole
7f7d6cf893 Expand query [skip ci] 2016-04-25 21:07:17 +02:00
James Cole
a94d476b75 Small additions to budget handling [skip ci] 2016-04-25 20:05:09 +02:00
James Cole
eb5e55a272 Some code cleanup. Fixes the tests. 2016-04-25 18:43:09 +02:00
James Cole
53c80aaef8 Small optimizations to reports. 2016-04-25 14:53:41 +02:00
James Cole
607d0115f0 Code improvements for budgets. 2016-04-25 13:20:42 +02:00
James Cole
b4f18dbe77 Database stuff. 2016-04-25 11:44:41 +02:00
James Cole
51d97cdca5 Reinstated a chart. 2016-04-25 09:57:39 +02:00
James Cole
2cd593157f Comment some stuff. 2016-04-25 09:50:46 +02:00
James Cole
ec70fde557 Start of some changes in budget overview related to #256 and #246 2016-04-25 09:49:34 +02:00
James Cole
950576d38b Better date format [skip ci] 2016-04-25 09:12:52 +02:00
James Cole
ce5304277d Translation for popup [skip ci] 2016-04-25 09:11:09 +02:00
James Cole
53760766a0 Fixed budget charts. 2016-04-24 20:41:12 +02:00
James Cole
ed863986a7 Fine tuning. [skip ci] 2016-04-24 20:28:08 +02:00
James Cole
89ff5a83b5 Expand cache. [skip ci] 2016-04-24 20:25:35 +02:00
James Cole
fe0b62b9b4 Cache charts. [skip ci] 2016-04-24 20:23:42 +02:00
James Cole
32c8ddbe1b First render of new budget charts. 2016-04-24 20:23:17 +02:00
James Cole
2cfbfd8649 Start of better budget charts. 2016-04-24 20:00:20 +02:00
James Cole
3f6c19dec4 Merge branch 'release/3.8.4'
# Conflicts:
#	app/Helpers/Csv/PostProcessing/Bill.php
2016-04-24 18:48:16 +02:00
James Cole
93421b50f9 New translations. 2016-04-24 18:47:03 +02:00
James Cole
54e829173a Prep for next release. 2016-04-24 18:44:29 +02:00
James Cole
4fe38bd31b New release 2016-04-24 18:38:58 +02:00
James Cole
fb0638e824 Say what each thing is. 2016-04-24 18:36:44 +02:00
James Cole
108794a6b6 Improved verify command. 2016-04-24 18:35:45 +02:00
James Cole
9c16fc1380 Some small updates. 2016-04-24 18:25:52 +02:00
James Cole
99c219ed97 Three fixes courtesy of user @Bonno 2016-04-24 12:24:59 +02:00
James Cole
ec12238ea1 Some code cleanup. 2016-04-24 09:14:40 +02:00
James Cole
bdbd22f98b Some language and code updates. 2016-04-24 09:02:21 +02:00
James Cole
b8e1944d20 Mass edit #241 2016-04-24 07:18:39 +02:00
James Cole
8883d185fe Fix tests. 2016-04-23 20:00:48 +02:00
James Cole
19e40e9976 Expand transaction lists for mass delete / edit functionality. 2016-04-23 18:55:57 +02:00
James Cole
fa85b2b5b2 Some layout fixes. [skip ci] 2016-04-23 18:53:16 +02:00
James Cole
5cf0131d75 New translations. 2016-04-23 12:14:24 +02:00
James Cole
3948cb8e6c New mass delete form and options. #241 2016-04-23 09:33:54 +02:00
James Cole
f43938726a Simple mass edit JS complete. Fallback for when the list.js is not included. #241 2016-04-23 06:11:31 +02:00
James Cole
8c8bb7a930 Start of mass delete code. #241 2016-04-21 14:57:58 +02:00
James Cole
3972882a33 Fix #251 2016-04-21 11:03:04 +02:00
James Cole
0ef5eeeb55 Take page size into account. [skip ci] 2016-04-21 10:34:16 +02:00
James Cole
ef48a79d0c Take page size into account. [skip ci] 2016-04-21 10:23:19 +02:00
James Cole
2bb883219c Take page size into account. 2016-04-21 09:10:37 +02:00
James Cole
23c0bb49c4 Take page size into account. [skip ci] 2016-04-21 09:04:19 +02:00
James Cole
13e59105ec Set correct path. [skip ci] 2016-04-21 09:01:34 +02:00
James Cole
98c057c516 Take page size into account. 2016-04-21 09:00:32 +02:00
James Cole
e293d69798 Take page size into account. 2016-04-21 08:59:31 +02:00
James Cole
b097e29104 New preference for page size. 2016-04-21 08:59:15 +02:00
James Cole
29fbd46e33 Fixes for translations. [skip ci] 2016-04-20 17:13:25 +02:00
James Cole
6a15afc723 New translations [skip ci] 2016-04-20 17:10:35 +02:00
James Cole
c56a39a726 Update chart js. [skip ci] 2016-04-20 13:54:13 +02:00
James Cole
4b80e46d26 Fix old bug. 2016-04-18 19:55:48 +02:00
James Cole
a6f3e61520 Fix #248 2016-04-18 19:41:16 +02:00
James Cole
cce4ef19e5 Fix #244 2016-04-18 19:34:15 +02:00
James Cole
1951491c04 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  Fix #243
2016-04-18 19:33:27 +02:00
James Cole
87b72e4bcd Fix #245 2016-04-18 19:33:02 +02:00
James Cole
2c6643d691 Fix #243 2016-04-18 14:15:10 +02:00
James Cole
d02df46517 Fix bug in bill name import routine 2016-04-17 20:40:26 +02:00
James Cole
0c0cc417ee Order chart thing again [skip ci] 2016-04-17 19:59:15 +02:00
James Cole
f0c03e8a3b Update chart order. 2016-04-17 19:58:09 +02:00
James Cole
345766f387 Merge branch 'release/3.8.3' 2016-04-17 12:13:00 +02:00
James Cole
3fa659632c Updated composer.lock [skip ci] 2016-04-17 12:12:35 +02:00
James Cole
95b92b7d1e Should fix test. 2016-04-17 11:43:07 +02:00
James Cole
466e988627 Correct date [skip ci] 2016-04-17 11:32:36 +02:00
James Cole
dc3c967c9f Update stuff in anticipation of new release. 2016-04-17 11:32:18 +02:00
James Cole
1fc31b4d8f Fixed a bug courtesy of Johan. 2016-04-17 11:28:44 +02:00
James Cole
e4a4b0a4eb Config update [skip ci] 2016-04-16 08:41:55 +02:00
James Cole
a9c026884d Fix null pointer. 2016-04-10 21:31:00 +02:00
James Cole
e893000ce9 Fix pie chart. 2016-04-10 20:28:32 +02:00
James Cole
32eeb3424d Code cleanup. 2016-04-10 17:51:51 +02:00
James Cole
ab523b6102 Make chart pretty 2016-04-10 17:03:36 +02:00
James Cole
b062222c45 Update chart options. 2016-04-10 11:28:55 +02:00
James Cole
2dddc843ce Fix chart heights. 2016-04-10 10:20:15 +02:00
James Cole
b74c1c8cf9 Upgrade chart library. 2016-04-10 10:05:50 +02:00
James Cole
d5d4bb2c4b Some javascript upgrades. 2016-04-10 08:23:31 +02:00
James Cole
89ac27ad10 Some code cleanup [skip ci] 2016-04-10 08:18:14 +02:00
James Cole
48b169c026 Fix comma thing [skip ci] 2016-04-09 21:07:43 +02:00
James Cole
0715b7406e Add language in cache as well. 2016-04-09 09:27:04 +02:00
James Cole
6e4991a34b Make help more reliable. 2016-04-09 09:24:17 +02:00
James Cole
8730af59bc Fix help text and debug. 2016-04-09 09:20:16 +02:00
James Cole
bdcc2c6c9f Prep for new report. 2016-04-09 09:16:51 +02:00
James Cole
6f0f6e86a1 Small bug fixes. 2016-04-09 09:10:11 +02:00
James Cole
3962d9da92 Text for error. 2016-04-09 06:02:30 +02:00
James Cole
5ed53d5f04 Some new code for CSV. 2016-04-08 20:36:11 +02:00
James Cole
ddb28b78c3 Some new translations and stuff. 2016-04-08 17:54:25 +02:00
James Cole
7699b6b4ea Update composer lock file. [skip ci] 2016-04-08 15:16:13 +02:00
James Cole
d783d05462 Some query optimisations for the audit report 2016-04-08 15:10:07 +02:00
James Cole
33bf373151 First attempt at audit report (uses lots of queries). 2016-04-08 14:50:18 +02:00
James Cole
8116644526 Some log fine tuning. 2016-04-08 14:44:53 +02:00
James Cole
dc4665e82a Add debug messages. 2016-04-08 11:59:44 +02:00
James Cole
732a85e51d Fix null call 2016-04-06 21:07:03 +02:00
James Cole
32190db8bb Fixed tests. 2016-04-06 21:05:43 +02:00
James Cole
25d3a115e0 Amounts better divided. 2016-04-06 20:59:09 +02:00
James Cole
30e3ed6410 Fix more tests. 2016-04-06 20:52:22 +02:00
James Cole
8b5a775dc5 Nonsense commit to test signing.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-04-06 20:16:28 +02:00
James Cole
2942c3a4be Nonsense commit to test signing.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-04-06 19:45:58 +02:00
James Cole
768d3bb3e8 Fix some tests. Won't fix all. 2016-04-06 19:44:42 +02:00
James Cole
250b2c2f53 PHP7 compatible function definitions. 2016-04-06 16:37:28 +02:00
James Cole
c8440af9a5 PHP7 compatible function definitions. 2016-04-06 09:27:45 +02:00
James Cole
37fe2d22b0 PHP7 compatible function definitions. 2016-04-05 22:00:03 +02:00
James Cole
b0b5d90976 Fixes the travis run. 2016-04-05 21:12:50 +02:00
James Cole
27b0c7f425 Moved a lot of files outside of the root. 2016-04-05 21:08:36 +02:00
James Cole
7c23571806 Missing translation. 2016-04-04 19:54:15 +02:00
James Cole
ea378c8d82 Fix search. [skip-ci] 2016-04-04 19:49:11 +02:00
James Cole
0fb45974ef Fix title. 2016-04-04 19:48:07 +02:00
James Cole
6490f9c128 Fix search. 2016-04-04 19:48:00 +02:00
James Cole
2d7f1af52c Add clear cache, for issue #237 2016-04-04 19:47:55 +02:00
James Cole
ac27659a59 Merge pull request #238 from nhaarman/fix_active-bill-expected-amount
Fixed incorrect average of expectedAmount in active bills.
2016-04-04 18:58:42 +02:00
Niek Haarman
11d59c8bd1 Fixed incorrect average of expectedAmount in active bills. 2016-04-04 18:15:38 +02:00
978 changed files with 55032 additions and 30429 deletions

View File

@@ -1,50 +0,0 @@
---
engines:
csslint:
enabled: true
duplication:
enabled: true
config:
languages:
- ruby
- javascript
- python
- php
eslint:
enabled: true
fixme:
enabled: true
phpmd:
enabled: true
ratings:
paths:
- "**.css"
- "**.inc"
- "**.js"
- "**.jsx"
- "**.module"
- "**.php"
- "**.py"
- "**.rb"
exclude_paths:
- gulpfile.js
- public/packages/maximebf/php-debugbar/debugbar.js
- public/packages/maximebf/php-debugbar/widgets.js
- public/packages/maximebf/php-debugbar/openhandler.js
- public/packages/maximebf/php-debugbar/widgets/sqlqueries/widget.js
- public/js/bootstrap3-typeahead.min.js
- public/js/bootstrap-sortable.js
- public/js/bootstrap-tagsinput.min.js
- public/js/bootstrap-tagsinput.min.js.map
- public/js/daterangepicker.js
- public/js/jquery-2.1.3.min.js
- public/js/jquery-2.1.3.min.js.map
- public/js/jquery-ui.min.js
- public/js/metisMenu.js
- public/js/moment.min.js
- public/js/sb-admin-2.js
- public/bootstrap/*
- resources/lang/*
- tests/*
- database/*
- storage/*

View File

@@ -1 +0,0 @@
src_dir: .

View File

@@ -1,2 +0,0 @@
--exclude-exts=.min.css
--ignore=adjoining-classes,box-model,ids,order-alphabetical,unqualified-attributes

View File

@@ -1,14 +1,19 @@
APP_ENV=production
APP_DEBUG=false
APP_FORCE_SSL=false
APP_FORCE_ROOT=
APP_KEY=SomeRandomStringOf32CharsExactly
APP_LOG_LEVEL=warning
APP_URL=http://localhost
DB_CONNECTION=mysql
DB_HOST=localhost
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
@@ -17,17 +22,14 @@ COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
DEFAULT_CURRENCY=EUR
DEFAULT_LANGUAGE=en_US
REDIS_HOST=localhost
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_FROM=enter_your_email_here
MAIL_FROM=changeme@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
@@ -38,7 +40,8 @@ MUST_CONFIRM_ACCOUNT=false
SHOW_INCOMPLETE_TRANSLATIONS=false
ANALYTICS_ID=
RUNCLEANUP=true
SITE_OWNER=mail@example.com
BLOCKED_DOMAINS=
PUSHER_KEY=
PUSHER_SECRET=
PUSHER_APP_ID=

View File

@@ -1,37 +0,0 @@
APP_ENV=testing
APP_DEBUG=true
APP_KEY=SomeRandomStringOf32CharsExactly
DB_CONNECTION=sqlite
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=array
SESSION_DRIVER=array
QUEUE_DRIVER=array
DEFAULT_CURRENCY=EUR
DEFAULT_LANGUAGE=en_US
REDIS_HOST=localhost
REDIS_PASSWORD=null
REDIS_PORT=6379
MAIL_DRIVER=log
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_FROM=your_address_here@example.com
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SHOW_INCOMPLETE_TRANSLATIONS=false
ANALYTICS_ID=abcde
RUNCLEANUP=false
SITE_OWNER=your_address_here@example.com
BLOCKED_DOMAINS=

View File

@@ -1 +0,0 @@
**/*{.,-}min.js

213
.eslintrc
View File

@@ -1,213 +0,0 @@
ecmaFeatures:
modules: true
jsx: true
env:
amd: true
browser: true
es6: true
jquery: true
node: true
# http://eslint.org/docs/rules/
rules:
# Possible Errors
comma-dangle: [2, never]
no-cond-assign: 2
no-console: 0
no-constant-condition: 2
no-control-regex: 2
no-debugger: 2
no-dupe-args: 2
no-dupe-keys: 2
no-duplicate-case: 2
no-empty: 2
no-empty-character-class: 2
no-ex-assign: 2
no-extra-boolean-cast: 2
no-extra-parens: 0
no-extra-semi: 2
no-func-assign: 2
no-inner-declarations: [2, functions]
no-invalid-regexp: 2
no-irregular-whitespace: 2
no-negated-in-lhs: 2
no-obj-calls: 2
no-regex-spaces: 2
no-sparse-arrays: 2
no-unexpected-multiline: 2
no-unreachable: 2
use-isnan: 2
valid-jsdoc: 0
valid-typeof: 2
# Best Practices
accessor-pairs: 2
block-scoped-var: 0
complexity: [2, 6]
consistent-return: 0
curly: 0
default-case: 0
dot-location: 0
dot-notation: 0
eqeqeq: 2
guard-for-in: 2
no-alert: 2
no-caller: 2
no-case-declarations: 2
no-div-regex: 2
no-else-return: 0
no-empty-label: 2
no-empty-pattern: 2
no-eq-null: 2
no-eval: 2
no-extend-native: 2
no-extra-bind: 2
no-fallthrough: 2
no-floating-decimal: 0
no-implicit-coercion: 0
no-implied-eval: 2
no-invalid-this: 0
no-iterator: 2
no-labels: 0
no-lone-blocks: 2
no-loop-func: 2
no-magic-number: 0
no-multi-spaces: 0
no-multi-str: 0
no-native-reassign: 2
no-new-func: 2
no-new-wrappers: 2
no-new: 2
no-octal-escape: 2
no-octal: 2
no-proto: 2
no-redeclare: 2
no-return-assign: 2
no-script-url: 2
no-self-compare: 2
no-sequences: 0
no-throw-literal: 0
no-unused-expressions: 2
no-useless-call: 2
no-useless-concat: 2
no-void: 2
no-warning-comments: 0
no-with: 2
radix: 2
vars-on-top: 0
wrap-iife: 2
yoda: 0
# Strict
strict: 0
# Variables
init-declarations: 0
no-catch-shadow: 2
no-delete-var: 2
no-label-var: 2
no-shadow-restricted-names: 2
no-shadow: 0
no-undef-init: 2
no-undef: 0
no-undefined: 0
no-unused-vars: 0
no-use-before-define: 0
# Node.js and CommonJS
callback-return: 2
global-require: 2
handle-callback-err: 2
no-mixed-requires: 0
no-new-require: 0
no-path-concat: 2
no-process-exit: 2
no-restricted-modules: 0
no-sync: 0
# Stylistic Issues
array-bracket-spacing: 0
block-spacing: 0
brace-style: 0
camelcase: 0
comma-spacing: 0
comma-style: 0
computed-property-spacing: 0
consistent-this: 0
eol-last: 0
func-names: 0
func-style: 0
id-length: 0
id-match: 0
indent: 0
jsx-quotes: 0
key-spacing: 0
linebreak-style: 0
lines-around-comment: 0
max-depth: 0
max-len: 0
max-nested-callbacks: 0
max-params: 0
max-statements: [2, 30]
new-cap: 0
new-parens: 0
newline-after-var: 0
no-array-constructor: 0
no-bitwise: 0
no-continue: 0
no-inline-comments: 0
no-lonely-if: 0
no-mixed-spaces-and-tabs: 0
no-multiple-empty-lines: 0
no-negated-condition: 0
no-nested-ternary: 0
no-new-object: 0
no-plusplus: 0
no-restricted-syntax: 0
no-spaced-func: 0
no-ternary: 0
no-trailing-spaces: 0
no-underscore-dangle: 0
no-unneeded-ternary: 0
object-curly-spacing: 0
one-var: 0
operator-assignment: 0
operator-linebreak: 0
padded-blocks: 0
quote-props: 0
quotes: 0
require-jsdoc: 0
semi-spacing: 0
semi: 0
sort-vars: 0
space-after-keywords: 0
space-before-blocks: 0
space-before-function-paren: 0
space-before-keywords: 0
space-in-parens: 0
space-infix-ops: 0
space-return-throw-case: 0
space-unary-ops: 0
spaced-comment: 0
wrap-regex: 0
# ECMAScript 6
arrow-body-style: 0
arrow-parens: 0
arrow-spacing: 0
constructor-super: 0
generator-star-spacing: 0
no-arrow-condition: 0
no-class-assign: 0
no-const-assign: 0
no-dupe-class-members: 0
no-this-before-super: 0
no-var: 0
object-shorthand: 0
prefer-arrow-callback: 0
prefer-const: 0
prefer-reflect: 0
prefer-spread: 0
prefer-template: 0
require-yield: 0

2
.gitattributes vendored
View File

@@ -1,3 +1,3 @@
* text=auto
*.css linguist-vendored
*.less linguist-vendored
*.scss linguist-vendored

13
.gitignore vendored Normal file → Executable file
View File

@@ -1,6 +1,13 @@
/vendor
/node_modules
/public/storage
/vendor
/.idea
Homestead.json
Homestead.yaml
.env
storage/
_development
.env.local
result.html
test-import.sh
test-import-report.txt
public/google*.html

View File

@@ -1,22 +0,0 @@
{
"undef": true,
"unused": false,
"strict": true,
"browser": true,
"jquery": true,
"devel": true,
"globals": [
"language",
"token",
"currencyCode",
"$",
"token",
"accountID",
"billID",
"currentMonthName",
"previousMonthName",
"nextMonthName",
"everything",
"moment"
]
}

View File

@@ -4,3 +4,5 @@ tools:
filter:
excluded_paths:
- app/Support/Migration/*
- app/database/migrations/*
- database/migrations/*

View File

@@ -1,22 +0,0 @@
language: php
sudo: false
php:
- 7
install:
- phpenv config-rm xdebug.ini
- composer selfupdate
- rm composer.lock
- composer update --no-scripts
- php artisan clear-compiled
- php artisan optimize
- php artisan env
- mv -v .env.testing .env
- php artisan env
- touch storage/upload/at-1.data
- touch storage/upload/at-2.data
- touch storage/database/testing.db
- php artisan migrate --seed
script:
- phpunit

View File

@@ -2,8 +2,286 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
- No unreleased changes yet.
## [4.1.6] - 2016-11-06
### Added
- New budget table for multi year report.
### Changed
- Greatly expanded help pages and their function.
- Built a new transaction collector, which I think was the idea of @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
## [4.1.5] - 2016-11-01
### Changed
- Report parts are loaded using AJAX, making a lot of code more simple.
- Help content will fall back to English.
- Help content is translated through Crowdin.
### Fixed
- Issue #370
## [4.1.4] - 2016-10-30
### Added
- New Dockerfile thanks to @schoentoon
- Added changing the destination account as rule action.
- Added changing the source account as rule action.
- Can convert transactions into different types.
### Changed
- Changed the export routine to be more future-proof.
- Improved help routine.
- Integrated CrowdIn translations.
- Simplified reports
- 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
## [4.1.3] - 2016-10-22
### Fixed
- Some event handlers called the wrong method.
## [4.1.2] - 2016-10-22
### Fixed
- A bug is fixed in the journal event handler that prevented Firefly III from actually storing journals.
## [4.1.1] - 2016-10-22
### Added
- Option to show deposit accounts on the front page.
- Script to upgrade split transactions
- Can now save notes on piggy banks.
- Extend user admin options.
- Run import jobs from the command line
### Changed
- New preferences screen layout.
### Deprecated
- ``firefly:import`` is now ``firefly:start-import``
### Removed
- Lots of old code
### Fixed
- #357, where non utf-8 files would break Firefly.
- Tab delimiter is not properly loaded from import configuration (@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 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
- #351
- Did some internal remodelling.
### Fixed
- PostgreSQL compatibility thanks to @SanderKleykens
- @RobertHorlings fixed a bug in the ABN Amro import specific.
## [4.0.1] - 2016-10-04
### Added
- New ING import specific by @tomwerf
- New Presidents Choice specific to fix #307
- Added some trimming (#335)
### Changed
- Initial release.
### Deprecated
- Initial release.
### Removed
- Initial release.
### Fixed
- Fixed a bug where incoming transactions would not be properly filtered in several reports.
- #334 by @cyberkov
- #337
- #336
- #338 found by @roberthorlings
### Security
- Initial release.
## [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
### 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
- Various CSS fixes
- Various bugs, thanks to @fuf, @sandermulders and @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
- Simplified code for upgrade instructions.
## [3.10.3] - 2016-08-29
### Added
- More fields for mass-edit, thanks to @Vissert (#282)
- First start of German translation
### Changed
- More optional fields for transactions and the ability to filter them.
### Removed
- Preference for budget maximum.
### Fixed
- A bug in the translation routine broke the import.
- It was possible to destroy your Firefly installation by removing all currencies. Thanks @mondjef
- Translation bugs.
- Import bug.
### Security
- Firefly will not accept registrations beyond the first one, by default.
## [3.10.2] - 2016-08-29
### Added
- New Chinese translations. Set Firefly III to show incomplete translations to follow the progress. Want to translate Firefly III in Chinese, or in any other language? Then check out [the Crowdin project](https://crowdin.com/project/firefly-iii).
- Added more admin pages. They do nothing yet.
### Changed
- Import routine will now also apply user rules.
- Various code cleanup.
- Some small HTML changes.
### Fixed
- Bug in the mass edit routines.
- Firefly III over a proxy will now work (see [issue #290](https://github.com/JC5/firefly-iii/issues/290)), thanks @dfiel for reporting.
- Sneaky bug in the import routine, fixed by @Bonno
## [3.10.1] - 2016-08-25
### Added
- More feedback in the import procedure.
- Extended model for import job.
- Web bases import procedure.
### Changed
- Scrutinizer configuration
- Various code clean up.
### Removed
- Code climate YAML file.
### Fixed
- Fixed a bug where a migration would check an empty table name.
- Fixed various bugs in the import routine.
- Fixed various bugs in the piggy banks pages.
- Fixed a bug in the ``firefly:verify`` routine
## [3.10] - 2015-05-25
### Added
- New charts in year report
- Can add / remove money from piggy bank on mobile device.
- Bill overview shows some useful things.
- Firefly will track registration / activation IP addresses.
### Changed
- Rewrote the import routine.
- The date picker now supports more ranges and periods.
- Rewrote all migrations. #272
### Fixed
- Issue #264
- Issue #265
- Fixed amount calculation problems, #266, thanks @xzaz
- Issue #271
- Issue #278, #273, thanks @StevenReitsma and @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 a bug where an expense would be assigned to a piggy bank if you created a transfer first.
- Bulk update problems, #280, thanks @stickgrinder
- Fixed various problems with amount reporting of split transactions.
[3.9.1]
### Fixed
- Fixed a bug where removing money from a piggy bank would not work. See issue #265 and #269
[3.9.0]
### Added
- @zjean has added code that allows you to force "https://"-URL's.
- @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.
- Likewise for transfers.
### Changed
- Update a lot of libraries.
- Big improvement to test data generation.
- Cleaned up many repositories.
### Removed
- Front page boxes will no longer respond to credit card bills.
### Fixed
- Many bugs
## [3.8.4] - 2016-04-24
### Added
- Lots of new translations.
- Can now set page size.
- Can now mass edit transactions.
- Can now mass delete transactions.
- Firefly will now attempt to verify the integrity of your database when updating.
### Changed
- New version of Charts library.
### Fixed
- Several CSV related bugs.
- Several other bugs.
- Bugs fixed by @Bonno.
## [3.8.3] - 2016-04-17
### Added
- New audit report to see what happened.
### Changed
- New Chart JS release used.
- Help function is more reliable.
### Fixed
- Expected bill amount is now correct.
- Upgrade will now invalidate cache.
- Search was broken.
- Queries run better
## [3.8.2] - 2016-04-03
### Added

42
Dockerfile Normal file
View File

@@ -0,0 +1,42 @@
FROM php:7-apache
RUN apt-get update -y && \
apt-get install -y --no-install-recommends libcurl4-openssl-dev \
zlib1g-dev \
libjpeg62-turbo-dev \
libpng12-dev \
libicu-dev \
libmcrypt-dev \
libedit-dev \
libtidy-dev \
libxml2-dev \
libsqlite3-dev \
libbz2-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install -j$(nproc) curl gd intl json mcrypt readline tidy zip bcmath xml mbstring pdo_sqlite pdo_mysql bz2
# Enable apache mod rewrite..
RUN a2enmod rewrite
# Setup the Composer installer
RUN curl -o /tmp/composer-setup.php https://getcomposer.org/installer && \
curl -o /tmp/composer-setup.sig https://composer.github.io/installer.sig && \
php -r "if (hash('SHA384', file_get_contents('/tmp/composer-setup.php')) !== trim(file_get_contents('/tmp/composer-setup.sig'))) { unlink('/tmp/composer-setup.php'); echo 'Invalid installer' . PHP_EOL; exit(1); }" && \
chmod +x /tmp/composer-setup.php && \
php /tmp/composer-setup.php && \
mv composer.phar /usr/local/bin/composer && \
rm -f /tmp/composer-setup.{php,sig}
ADD . /var/www/firefly-iii
RUN chown -R www-data:www-data /var/www/
ADD docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf
USER www-data
WORKDIR /var/www/firefly-iii
RUN composer install --no-scripts --no-dev
USER root

View File

@@ -1,7 +1,7 @@
Copyright (C) 2016 thegrumpydictator@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
https://creativecommons.org/licenses/by-sa/4.0/
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -1,16 +1,18 @@
# Firefly III
# Firefly III [![Requires PHP7](https://img.shields.io/badge/php-7.0-red.svg)](https://secure.php.net/downloads.php#v7.0.4) [![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable)](https://packagist.org/packages/grumpydictator/firefly-iii) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/JC5/firefly-iii/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/JC5/firefly-iii/?branch=master)
[![Requires PHP7](https://img.shields.io/badge/php-7.0-red.svg)](https://secure.php.net/downloads.php#v7.0.4)
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/JC5/firefly-iii/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/JC5/firefly-iii/?branch=master)
[![Build Status](https://scrutinizer-ci.com/g/JC5/firefly-iii/badges/build.png?b=master)](https://scrutinizer-ci.com/g/JC5/firefly-iii/build-status/master)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
## A personal finances manager
## About
[![Screenshot](https://i.nder.be/hhfv03hp/400)](https://i.nder.be/hhfv03hp) [![Screenshot](https://i.nder.be/hhmwmqw9/400)](https://i.nder.be/hhmwmqw9)
"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! It's pretty fancy. You should use it to save and organise money.
[![Screenshot](https://i.nder.be/g63q05m0/400)](https://i.nder.be/g63q05m0) [![Screenshot](https://i.nder.be/c2g30ngg/400)](https://i.nder.be/c2g30ngg)
"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! It's pretty fancy. You should use it to save and organise money.
## Installation
To install Firefly III, you'll need a web server (preferrably on Linux) and access to the command line. Then, please read the [installation guide](https://jc5.github.io/firefly-iii/installation-guide/).
## More about Firefly III
Personal financial management is pretty difficult, and everybody has their own approach to it. Some people make budgets, other people limit their cashflow by throwing away their credit cards, others try to increase their current cashflow. There are tons of ways to save and earn money.
@@ -24,3 +26,5 @@ Firefly works on the principle that if you know where you're money is going, you
- 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://jc5.github.io/firefly-iii/).
If you want to contact me, please open an issue or [email me](mailto:thegrumpydictator@gmail.com).

View File

@@ -1,27 +0,0 @@
<?xml version="1.0"?>
<ruleset name="JamesStandard">
<rule ref="Zend">
<exclude name="Zend.NamingConventions.ValidVariableName" />
<exclude name="PEAR.WhiteSpace.ScopeClosingBrace" />
<!--<exclude name="PEAR.Whitespace.ScopeIndent"/>-->
<exclude name="PEAR.WhiteSpace.ScopeClosingBrace"/>
<exclude name="Generic.Formatting.MultipleStatementAlignment.Incorrect" />
<exclude name="PEAR.Functions.FunctionCallSignature" />
</rule>
<!--
Here we change two messages from the same sniff. Note how the
codes are slightly different because the sniff developer has
defined both a MaxExceeded message and a TooLong message. In the
case of this sniff, one is used for warnings and one is used
for errors.
-->
<rule ref="Generic.Files.LineLength">
<properties>
<property name="lineLimit" value="160"/>
<property name="absoluteLineLimit" value="160"/>
</properties>
</rule>
</ruleset>

View File

@@ -1,322 +0,0 @@
<code_scheme name="Use This One">
<option name="RIGHT_MARGIN" value="160" />
<CoffeeScriptCodeStyleSettings>
<option name="SPACE_BEFORE_PROPERTY_COLON" value="true" />
</CoffeeScriptCodeStyleSettings>
<JSCodeStyleSettings>
<option name="ALIGN_MULTILINE_VAR_DECLARATION" value="true" />
</JSCodeStyleSettings>
<PHPCodeStyleSettings>
<option name="ALIGN_KEY_VALUE_PAIRS" value="true" />
<option name="ALIGN_PHPDOC_PARAM_NAMES" value="true" />
<option name="ALIGN_PHPDOC_COMMENTS" value="true" />
<option name="ALIGN_ASSIGNMENTS" value="true" />
<option name="COMMA_AFTER_LAST_ARRAY_ELEMENT" value="true" />
<option name="PHPDOC_BLANK_LINE_BEFORE_TAGS" value="true" />
<option name="PHPDOC_BLANK_LINES_AROUND_PARAMETERS" value="true" />
<option name="PHPDOC_WRAP_LONG_LINES" value="true" />
<option name="LOWER_CASE_BOOLEAN_CONST" value="true" />
<option name="LOWER_CASE_NULL_CONST" value="true" />
<option name="BLANK_LINE_BEFORE_RETURN_STATEMENT" value="true" />
<option name="KEEP_RPAREN_AND_LBRACE_ON_ONE_LINE" value="true" />
<option name="ALIGN_CLASS_CONSTANTS" value="true" />
<option name="FORCE_SHORT_DECLARATION_ARRAY_STYLE" value="true" />
</PHPCodeStyleSettings>
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="CoffeeScript">
<option name="KEEP_LINE_BREAKS" value="false" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
</codeStyleSettings>
<codeStyleSettings language="JavaScript">
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
</codeStyleSettings>
<codeStyleSettings language="PHP">
<option name="RIGHT_MARGIN" value="160" />
<option name="KEEP_FIRST_COLUMN_COMMENT" value="false" />
<option name="ALIGN_MULTILINE_CHAINED_METHODS" value="true" />
<option name="ALIGN_MULTILINE_PARAMETERS_IN_CALLS" value="true" />
<option name="ALIGN_MULTILINE_BINARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_TERNARY_OPERATION" value="true" />
<option name="ALIGN_MULTILINE_EXTENDS_LIST" value="true" />
<option name="ALIGN_MULTILINE_ARRAY_INITIALIZER_EXPRESSION" value="true" />
<option name="ALIGN_GROUP_FIELD_DECLARATIONS" value="true" />
<option name="CALL_PARAMETERS_WRAP" value="1" />
<option name="CALL_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="CALL_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_WRAP" value="1" />
<option name="METHOD_PARAMETERS_LPAREN_ON_NEXT_LINE" value="true" />
<option name="METHOD_PARAMETERS_RPAREN_ON_NEXT_LINE" value="true" />
<option name="EXTENDS_LIST_WRAP" value="1" />
<option name="EXTENDS_KEYWORD_WRAP" value="1" />
<option name="METHOD_CALL_CHAIN_WRAP" value="1" />
<option name="BINARY_OPERATION_WRAP" value="1" />
<option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
<option name="TERNARY_OPERATION_WRAP" value="1" />
<option name="TERNARY_OPERATION_SIGNS_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_WRAP" value="1" />
<option name="FOR_STATEMENT_LPAREN_ON_NEXT_LINE" value="true" />
<option name="FOR_STATEMENT_RPAREN_ON_NEXT_LINE" value="true" />
<option name="ARRAY_INITIALIZER_WRAP" value="1" />
<option name="ASSIGNMENT_WRAP" value="1" />
<option name="PLACE_ASSIGNMENT_SIGN_ON_NEXT_LINE" value="true" />
<option name="IF_BRACE_FORCE" value="3" />
<option name="DOWHILE_BRACE_FORCE" value="3" />
<option name="WHILE_BRACE_FORCE" value="3" />
<option name="FOR_BRACE_FORCE" value="3" />
<arrangement>
<tokens>
<token id="modifiers" name="modifiers">
<rules>
<rule>
<match>
<AND>
<PUBLIC>true</PUBLIC>
<STATIC>true</STATIC>
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<PROTECTED>true</PROTECTED>
<STATIC>true</STATIC>
</AND>
</match>
</rule>
<rule>
<match>
<AND>
<PRIVATE>true</PRIVATE>
<STATIC>true</STATIC>
</AND>
</match>
</rule>
<rule>
<match>
<PUBLIC>true</PUBLIC>
</match>
<order>BY_NAME</order>
</rule>
<rule>
<match>
<PROTECTED>true</PROTECTED>
</match>
<order>BY_NAME</order>
</rule>
<rule>
<match>
<PRIVATE>true</PRIVATE>
</match>
<order>BY_NAME</order>
</rule>
</rules>
</token>
<token id="visibility" name="visibility">
<rules>
<rule>
<match>
<PUBLIC>true</PUBLIC>
</match>
</rule>
<rule>
<match>
<PROTECTED>true</PROTECTED>
</match>
</rule>
<rule>
<match>
<PRIVATE>true</PRIVATE>
</match>
</rule>
</rules>
</token>
</tokens>
<groups>
<group>
<type>GETTERS_AND_SETTERS</type>
<order>KEEP</order>
</group>
</groups>
<rules>
<section>
<rule>
<match>
<CONST />
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<FIELD />
<PUBLIC />
<STATIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<FIELD />
<PROTECTED />
<STATIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<FIELD />
<PRIVATE />
<STATIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<FIELD />
<PUBLIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<FIELD />
<PROTECTED />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<FIELD />
<PRIVATE />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<CONSTRUCTOR />
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<METHOD />
<PUBLIC />
<STATIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<METHOD />
<PROTECTED />
<STATIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<METHOD />
<PRIVATE />
<STATIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<METHOD />
<PUBLIC />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<METHOD />
<PROTECTED />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<METHOD />
<PRIVATE />
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<TRAIT />
</match>
</rule>
</section>
<section>
<rule>
<match>
<INTERFACE />
</match>
</rule>
</section>
<section>
<rule>
<match>
<CLASS />
</match>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="pcsg-generated-ruleset"
xmlns="http://pmd.sf.net/ruleset/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd"
xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>Created with the PHP Coding Standard Generator. http://edorian.github.com/php-coding-standard-generator/
</description>
<rule ref="rulesets/codesize.xml/CyclomaticComplexity">
<properties>
<property name="reportLevel" value="5"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/NPathComplexity">
<properties>
<property name="minimum" value="128"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveMethodLength">
<properties>
<property name="minimum" value="40"/>
</properties>
</rule>
<rule ref="rulesets/codesize.xml/ExcessiveParameterList">
<properties>
<property name="minimum" value="5"/>
</properties>
</rule>
<!-- Import rule set and exclude rules -->
<rule ref="rulesets/controversial.xml">
<exclude name="CamelCasePropertyName" />
</rule>
</ruleset>

View File

@@ -1 +0,0 @@
These are some of the files I use for code formatting, PHPMD and PHPCS.

View File

@@ -0,0 +1,63 @@
<?php
/**
* ConfigureLogging.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\Bootstrap;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Foundation\Bootstrap\ConfigureLogging as IlluminateConfigureLogging;
use Illuminate\Log\Writer;
/**
* Class ConfigureLogging
*
* @package FireflyIII\Bootstrap
*/
class ConfigureLogging extends IlluminateConfigureLogging
{
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
*
* @return void
*/
protected function configureDailyHandler(Application $app, Writer $log)
{
$config = $app->make('config');
$maxFiles = $config->get('app.log_max_files');
$log->useDailyFiles(
$app->storagePath() . '/logs/firefly-iii.log', is_null($maxFiles) ? 5 : $maxFiles,
$config->get('app.log_level', 'debug')
);
}
/**
* Configure the Monolog handlers for the application.
*
* @param \Illuminate\Contracts\Foundation\Application $app
* @param \Illuminate\Log\Writer $log
*
* @return void
*/
protected function configureSingleHandler(Application $app, Writer $log)
{
$log->useFiles(
$app->storagePath() . '/logs/firefly-iii.log',
$app->make('config')->get('app.log_level', 'debug')
);
}
}

View File

@@ -0,0 +1,152 @@
<?php
/**
* CreateImport.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\Console\Commands;
use Artisan;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Console\Command;
use Log;
/**
* Class CreateImport
*
* @package FireflyIII\Console\Commands
*/
class CreateImport extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Use this command to create a new import. Your user ID can be found on the /profile page.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:create-import {file} {configuration} {--user=1} {--type=csv} {--start}';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
// find the file
/** @var UserRepositoryInterface $userRepository */
$userRepository = app(UserRepositoryInterface::class);
$file = $this->argument('file');
$configuration = $this->argument('configuration');
$user = $userRepository->find(intval($this->option('user')));
$cwd = getcwd();
$type = strtolower($this->option('type'));
if (!$this->validArguments()) {
return;
}
// try to parse configuration data:
$configurationData = json_decode(file_get_contents($configuration));
if (is_null($configurationData)) {
$this->error(sprintf('Firefly III cannot read the contents of configuration file "%s" (working directory: "%s").', $configuration, $cwd));
return;
}
$this->info(sprintf('Going to create a job to import file: %s', $file));
$this->info(sprintf('Using configuration file: %s', $configuration));
$this->info(sprintf('Import into user: #%d (%s)', $user->id, $user->email));
$this->info(sprintf('Type of import: %s', $type));
/** @var ImportJobRepositoryInterface $jobRepository */
$jobRepository = app(ImportJobRepositoryInterface::class, [$user]);
$job = $jobRepository->create($type);
$this->line(sprintf('Created job "%s"...', $job->key));
// put the file in the proper place:
Artisan::call('firefly:encrypt', ['file' => $file, 'key' => $job->key]);
$this->line('Stored import data...');
// store the configuration in the job:
$job->configuration = $configurationData;
$job->status = 'settings_complete';
$job->save();
$this->line('Stored configuration...');
// if user wants to run it, do!
if ($this->option('start') === true) {
$this->line('The import will start in a moment. This process is not visible...');
Log::debug('Go for import!');
Artisan::call('firefly:start-import', ['key' => $job->key]);
$this->line('Done!');
}
return;
}
/**
* @return bool
*/
private function validArguments(): bool
{
// find the file
/** @var UserRepositoryInterface $userRepository */
$userRepository = app(UserRepositoryInterface::class);
$file = $this->argument('file');
$configuration = $this->argument('configuration');
$user = $userRepository->find(intval($this->option('user')));
$cwd = getcwd();
$validTypes = array_keys(config('firefly.import_formats'));
$type = strtolower($this->option('type'));
if (is_null($user->id)) {
$this->error(sprintf('There is no user with ID %d.', $this->option('user')));
return false;
}
if (!in_array($type, $validTypes)) {
$this->error(sprintf('Cannot import file of type "%s"', $type));
return false;
}
if (!file_exists($file)) {
$this->error(sprintf('Firefly III cannot find file "%s" (working directory: "%s").', $file, $cwd));
return false;
}
if (!file_exists($configuration)) {
$this->error(sprintf('Firefly III cannot find configuration file "%s" (working directory: "%s").', $configuration, $cwd));
return false;
}
return true;
}
}

View File

@@ -0,0 +1,68 @@
<?php
/**
* EncryptFile.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\Console\Commands;
use Crypt;
use Illuminate\Console\Command;
/**
* Class EncryptFile
*
* @package FireflyIII\Console\Commands
*/
class EncryptFile extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Encrypts a file and places it in the storage/upload directory.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:encrypt {file} {key}';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
$file = e(strval($this->argument('file')));
if (!file_exists($file)) {
$this->error(sprintf('File "%s" does not seem to exist.', $file));
return;
}
$content = file_get_contents($file);
$content = Crypt::encrypt($content);
$newName = e(strval($this->argument('key'))) . '.upload';
$path = storage_path('upload') . '/' . $newName;
file_put_contents($path, $content);
$this->line(sprintf('Encrypted "%s" and put it in "%s"', $file, $path));
}
}

View File

@@ -0,0 +1,125 @@
<?php
/**
* Import.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\Console\Commands;
use FireflyIII\Import\ImportProcedure;
use FireflyIII\Import\Logging\CommandHandler;
use FireflyIII\Models\ImportJob;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command;
use Log;
/**
* Class Import
*
* @package FireflyIII\Console\Commands
*/
class Import extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'This will start a new import.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:start-import {key}';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
Log::debug('Start start-import command');
$jobKey = $this->argument('key');
$job = ImportJob::whereKey($jobKey)->first();
if (!$this->isValid($job)) {
Log::error('Job is not valid for some reason. Exit.');
return;
}
$this->line(sprintf('Going to import job with key "%s" of type "%s"', $job->key, $job->file_type));
$monolog = Log::getMonolog();
$handler = new CommandHandler($this);
$monolog->pushHandler($handler);
$result = ImportProcedure::runImport($job);
/**
* @var int $index
* @var TransactionJournal $journal
*/
foreach ($result as $index => $journal) {
if (!is_null($journal->id)) {
$this->line(sprintf('Line #%d has been imported as transaction #%d.', $index, $journal->id));
continue;
}
$this->error(sprintf('Could not store line #%d', $index));
}
$this->line('The import has completed.');
// get any errors from the importer:
$extendedStatus = $job->extended_status;
if (isset($extendedStatus['errors']) && count($extendedStatus['errors']) > 0) {
$this->line(sprintf('The following %d error(s) occured during the import:', count($extendedStatus['errors'])));
foreach ($extendedStatus['errors'] as $error) {
$this->error($error);
}
}
return;
}
/**
* @param ImportJob $job
*
* @return bool
*/
private function isValid(ImportJob $job): bool
{
if (is_null($job)) {
$this->error('This job does not seem to exist.');
return false;
}
if ($job->status != 'settings_complete') {
$this->error('This job is not ready to be imported.');
return false;
}
return true;
}
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* MoveRepository.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\Console\Commands;
use Carbon\Carbon;
use Illuminate\Console\Command;
/**
* Class MoveRepository
*
* @package FireflyIII\Console\Commands
*/
class MoveRepository extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Alerts the user that the Github repository will move, if they are interested to know this.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:github-move';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
$moveDate = new Carbon('2017-01-01');
$final = new Carbon('2017-03-01');
$now = new Carbon;
// display message before 2017-01-01
if ($moveDate > $now) {
$this->line('+------------------------------------------------------------------------------+');
$this->line('');
$this->line('The Github repository for Firefly III will MOVE');
$this->line('This move will be on January 1st 2017');
$this->line('');
$this->error('READ THIS WIKI PAGE FOR MORE INFORMATION');
$this->line('');
$this->info('https://github.com/firefly-iii/help/wiki/New-Github-repository');
$this->line('');
$this->line('+------------------------------------------------------------------------------+');
}
// display message after 2017-01-01 but before 2017-03-01
if ($moveDate <= $now && $now <= $final) {
$this->line('+------------------------------------------------------------------------------+');
$this->line('');
$this->line('The Github repository for Firefly III has MOVED');
$this->line('This move was on January 1st 2017!');
$this->line('');
$this->error('READ THIS WIKI PAGE FOR MORE INFORMATION');
$this->line('');
$this->info('https://github.com/firefly-iii/help/wiki/New-Github-repository');
$this->line('');
$this->line('+------------------------------------------------------------------------------+');
}
}
}

View File

@@ -0,0 +1,101 @@
<?php
/**
* ScanAttachments.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\Console\Commands;
use Crypt;
use FireflyIII\Models\Attachment;
use Illuminate\Console\Command;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Contracts\Filesystem\FileNotFoundException;
use Storage;
/**
* Class ScanAttachments
*
* @package FireflyIII\Console\Commands
*/
class ScanAttachments extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Rescan all attachments and re-set the MD5 hash and mime.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:scan-attachments';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
$attachments = Attachment::get();
$disk = Storage::disk('upload');
/** @var Attachment $attachment */
foreach ($attachments as $attachment) {
$fileName = $attachment->fileName();
// try to grab file content:
try {
$content = $disk->get($fileName);
} catch (FileNotFoundException $e) {
$this->error(sprintf('Could not find data for attachment #%d', $attachment->id));
continue;
}
// try to decrypt content.
try {
$decrypted = Crypt::decrypt($content);
} catch (DecryptException $e) {
$this->error(sprintf('Could not decrypt data of attachment #%d', $attachment->id));
continue;
}
// make temp file:
$tmpfname = tempnam(sys_get_temp_dir(), 'FireflyIII');
// store content in temp file:
file_put_contents($tmpfname, $decrypted);
// get md5 and mime
$md5 = md5_file($tmpfname);
$mime = mime_content_type($tmpfname);
// update attachment:
$attachment->md5 = $md5;
$attachment->mime = $mime;
$attachment->save();
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
// find file:
}
}
}

View File

@@ -0,0 +1,121 @@
<?php
/**
* UpgradeDatabase.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\Console\Commands;
use DB;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
use Log;
/**
* Class UpgradeDatabase
*
* @package FireflyIII\Console\Commands
*/
class UpgradeDatabase extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Will run various commands to update database records.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:upgrade-database';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
$this->setTransactionIdentifier();
}
/**
* This is strangely complex, because the HAVING modifier is a no-no. And subqueries in Laravel are weird.
*/
private function setTransactionIdentifier()
{
$subQuery = TransactionJournal
::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->whereNull('transaction_journals.deleted_at')
->whereNull('transactions.deleted_at')
->groupBy(['transaction_journals.id'])
->select(['transaction_journals.id', DB::raw('COUNT(transactions.id) AS t_count')]);
$result = DB::table(DB::raw('(' . $subQuery->toSql() . ') AS derived'))
->mergeBindings($subQuery->getQuery())
->where('t_count', '>', 2)
->select(['id', 't_count']);
$journalIds = array_unique($result->pluck('id')->toArray());
foreach ($journalIds as $journalId) {
// grab all positive transactiosn from this journal that are not deleted.
// for each one, grab the negative opposing one which has 0 as an identifier and give it the same identifier.
$identifier = 0;
$processed = [];
$transactions = Transaction::where('transaction_journal_id', $journalId)->where('amount', '>', 0)->get();
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
// find opposing:
$amount = bcmul(strval($transaction->amount), '-1');
try {
/** @var Transaction $opposing */
$opposing = Transaction
::where('transaction_journal_id', $journalId)
->where('amount', $amount)->where('identifier', '=', 0)
->whereNotIn('id', $processed)
->first();
} catch (QueryException $e) {
Log::error($e->getMessage());
$this->error('Firefly III could not find the "identifier" field in the "transactions" table.');
$this->error(sprintf('This field is required for Firefly III version %s to run.', config('firefly.version')));
$this->error('Please run "php artisan migrate" to add this field to the table.');
$this->info('Then, run "php artisan firefly:upgrade-database" to try again.');
break 2;
}
if (!is_null($opposing)) {
// give both a new identifier:
$transaction->identifier = $identifier;
$transaction->save();
$opposing->identifier = $identifier;
$opposing->save();
$processed[] = $transaction->id;
$processed[] = $opposing->id;
$this->line(sprintf('Database upgrade for journal #%d, transactions #%d and #%d', $journalId, $transaction->id, $opposing->id));
}
$identifier++;
}
}
}
}

View File

@@ -1,9 +1,18 @@
<?php
/**
* UpgradeFireflyInstructions.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\Console\Commands;
use Config;
use Illuminate\Console\Command;
/**
@@ -18,7 +27,7 @@ class UpgradeFireflyInstructions extends Command
*
* @var string
*/
protected $description = 'Command description';
protected $description = 'Instructions in case of upgrade trouble.';
/**
* The name and signature of the console command.
*
@@ -37,32 +46,37 @@ class UpgradeFireflyInstructions extends Command
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
//
$version = Config::get('firefly.version');
$config = Config::get('upgrade.text');
$text = $config[$version] ?? null;
/** @var string $version */
$version = config('firefly.version');
$config = config('upgrade.text');
$text = null;
foreach (array_keys($config) as $compare) {
// if string starts with:
$len = strlen($compare);
if (substr($version, 0, $len) === $compare) {
$text = $config[$compare];
}
$this->line('+------------------------------------------------------------------------------+');
$this->line('');
if (is_null($text)) {
$this->line('Thank you for installing Firefly III, v' . $version);
$this->line('If you are upgrading from a previous version,');
$this->info('there are no extra upgrade instructions.');
$this->line('Firefly III should be ready for use.');
} else {
$this->line('Thank you for installing Firefly III, v' . $version);
$this->line('If you are upgrading from a previous version,');
$this->line('please follow these upgrade instructions carefully:');
$this->info(wordwrap($text));
}
$this->line('');
$this->line('+------------------------------------------------------------------------------+');
if (is_null($text)) {
$this->line(sprintf('Thank you for installing Firefly III, v%s', $version));
$this->info('There are no extra upgrade instructions.');
$this->line('Firefly III should be ready for use.');
} else {
$this->line('+------------------------------------------------------------------------------+');
$this->line('');
$this->line(sprintf('Thank you for installing Firefly III, v%s', $version));
$this->info(wordwrap($text));
$this->line('');
$this->line('+------------------------------------------------------------------------------+');
}
}
}

View File

@@ -0,0 +1,381 @@
<?php
/**
* VerifyDatabase.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\Console\Commands;
use Crypt;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\User;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Builder;
use stdClass;
/**
* Class VerifyDatabase
*
* @package FireflyIII\Console\Commands
*/
class VerifyDatabase extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Will verify your database.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly:verify';
/**
* Create a new command instance.
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
// accounts with no transactions.
$this->reportAccounts();
// budgets with no limits
$this->reportBudgetLimits();
// budgets with no transactions
$this->reportBudgets();
// categories with no transactions
$this->reportCategories();
// tags with no transactions
$this->reportTags();
// sum of transactions is not zero.
$this->reportSum();
// any deleted transaction journals that have transactions that are NOT deleted:
$this->reportJournals();
// deleted transactions that are connected to a not deleted journal.
$this->reportTransactions();
// deleted accounts that still have not deleted transactions or journals attached to them.
$this->reportDeletedAccounts();
// report on journals with no transactions at all.
$this->reportNoTransactions();
// transfers with budgets.
$this->reportTransfersBudgets();
// report on journals with the wrong types of accounts.
$this->reportIncorrectJournals();
}
/**
* Reports on accounts with no transactions.
*/
private function reportAccounts()
{
$set = Account
::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id')
->leftJoin('users', 'accounts.user_id', '=', 'users.id')
->groupBy(['accounts.id', 'accounts.encrypted', 'accounts.name', 'accounts.user_id', 'users.email'])
->whereNull('transactions.account_id')
->get(
['accounts.id', 'accounts.encrypted', 'accounts.name', 'accounts.user_id', 'users.email']
);
/** @var stdClass $entry */
foreach ($set as $entry) {
$name = $entry->name;
$line = 'User #%d (%s) has account #%d ("%s") which has no transactions.';
$line = sprintf($line, $entry->user_id, $entry->email, $entry->id, $name);
$this->line($line);
}
}
/**
* Reports on budgets with no budget limits (which makes them pointless).
*/
private function reportBudgetLimits()
{
$set = Budget
::leftJoin('budget_limits', 'budget_limits.budget_id', '=', 'budgets.id')
->leftJoin('users', 'budgets.user_id', '=', 'users.id')
->groupBy(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email'])
->whereNull('budget_limits.id')
->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email']);
/** @var stdClass $entry */
foreach ($set as $entry) {
$line = sprintf(
'Notice: User #%d (%s) has budget #%d ("%s") which has no budget limits.',
$entry->user_id, $entry->email, $entry->id, Crypt::decrypt($entry->name)
);
$this->line($line);
}
}
/**
* Reports on budgets without any transactions.
*/
private function reportBudgets()
{
$set = Budget
::leftJoin('budget_transaction_journal', 'budgets.id', '=', 'budget_transaction_journal.budget_id')
->leftJoin('users', 'budgets.user_id', '=', 'users.id')
->distinct()
->whereNull('budget_transaction_journal.budget_id')
->whereNull('budgets.deleted_at')
->get(['budgets.id', 'budgets.name', 'budgets.user_id', 'users.email']);
/** @var stdClass $entry */
foreach ($set as $entry) {
$line = 'Notice: User #' . $entry->user_id . ' (' . $entry->email . ') has budget #' . $entry->id . ' ("' . Crypt::decrypt($entry->name)
. '") which has no transactions.';
$this->line($line);
}
}
/**
* Reports on categories without any transactions.
*/
private function reportCategories()
{
$set = Category
::leftJoin('category_transaction_journal', 'categories.id', '=', 'category_transaction_journal.category_id')
->leftJoin('users', 'categories.user_id', '=', 'users.id')
->distinct()
->whereNull('category_transaction_journal.category_id')
->whereNull('categories.deleted_at')
->get(['categories.id', 'categories.name', 'categories.user_id', 'users.email']);
/** @var stdClass $entry */
foreach ($set as $entry) {
$line = 'Notice: User #' . $entry->user_id . ' (' . $entry->email . ') has category #' . $entry->id . ' ("' . Crypt::decrypt($entry->name)
. '") which has no transactions.';
$this->line($line);
}
}
/**
* Reports on deleted accounts that still have not deleted transactions or journals attached to them.
*/
private function reportDeletedAccounts()
{
$set = Account
::leftJoin('transactions', 'transactions.account_id', '=', 'accounts.id')
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->whereNotNull('accounts.deleted_at')
->whereNotNull('transactions.id')
->where(
function (Builder $q) {
$q->whereNull('transactions.deleted_at');
$q->orWhereNull('transaction_journals.deleted_at');
}
)
->get(
['accounts.id as account_id', 'accounts.deleted_at as account_deleted_at', 'transactions.id as transaction_id',
'transactions.deleted_at as transaction_deleted_at', 'transaction_journals.id as journal_id',
'transaction_journals.deleted_at as journal_deleted_at']
);
/** @var stdClass $entry */
foreach ($set as $entry) {
$date = is_null($entry->transaction_deleted_at) ? $entry->journal_deleted_at : $entry->transaction_deleted_at;
$this->error(
'Error: Account #' . $entry->account_id . ' should have been deleted, but has not.' .
' Find it in the table called "accounts" and change the "deleted_at" field to: "' . $date . '"'
);
}
}
private function reportIncorrectJournals()
{
$configuration = [
// a withdrawal can not have revenue account:
TransactionType::WITHDRAWAL => [AccountType::REVENUE],
// deposit cannot have an expense account:
TransactionType::DEPOSIT => [AccountType::EXPENSE],
// transfer cannot have either:
TransactionType::TRANSFER => [AccountType::EXPENSE, AccountType::REVENUE],
];
foreach ($configuration as $transactionType => $accountTypes) {
$set = TransactionJournal
::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'account_types.id', 'accounts.account_type_id')
->leftJoin('users', 'users.id', '=', 'transaction_journals.user_id')
->where('transaction_types.type', $transactionType)
->whereIn('account_types.type', $accountTypes)
->whereNull('transaction_journals.deleted_at')
->get(['transaction_journals.id', 'transaction_journals.user_id', 'users.email', 'account_types.type as a_type', 'transaction_types.type']);
foreach ($set as $entry) {
$this->error(
sprintf(
'Transaction journal #%d (user #%d, %s) is of type "%s" but ' .
'is linked to a "%s". The transaction journal should be recreated.',
$entry->id,
$entry->user_id,
$entry->email,
$entry->type,
$entry->a_type
)
);
}
}
}
/**
* Any deleted transaction journals that have transactions that are NOT deleted:
*/
private function reportJournals()
{
$set = TransactionJournal
::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->whereNotNull('transaction_journals.deleted_at')// USE THIS
->whereNull('transactions.deleted_at')
->whereNotNull('transactions.id')
->get(
[
'transaction_journals.id as journal_id',
'transaction_journals.description',
'transaction_journals.deleted_at as journal_deleted',
'transactions.id as transaction_id',
'transactions.deleted_at as transaction_deleted_at']
);
/** @var stdClass $entry */
foreach ($set as $entry) {
$this->error(
'Error: Transaction #' . $entry->transaction_id . ' should have been deleted, but has not.' .
' Find it in the table called "transactions" and change the "deleted_at" field to: "' . $entry->journal_deleted . '"'
);
}
}
/**
*
*/
private function reportNoTransactions()
{
$set = TransactionJournal
::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->groupBy('transaction_journals.id')
->whereNull('transactions.transaction_journal_id')
->get(['transaction_journals.id']);
foreach ($set as $entry) {
$this->error(
'Error: Journal #' . $entry->id . ' has zero transactions. Open table "transaction_journals" and delete the entry with id #' . $entry->id
);
}
}
/**
* Reports for each user when the sum of their transactions is not zero.
*/
private function reportSum()
{
/** @var UserRepositoryInterface $userRepository */
$userRepository = app(UserRepositoryInterface::class);
/** @var User $user */
foreach ($userRepository->all() as $user) {
$sum = strval($user->transactions()->sum('amount'));
if (bccomp($sum, '0') !== 0) {
$this->error('Error: Transactions for user #' . $user->id . ' (' . $user->email . ') are off by ' . $sum . '!');
}
}
}
/**
* Reports on tags without any transactions.
*/
private function reportTags()
{
$set = Tag
::leftJoin('tag_transaction_journal', 'tags.id', '=', 'tag_transaction_journal.tag_id')
->leftJoin('users', 'tags.user_id', '=', 'users.id')
->distinct()
->whereNull('tag_transaction_journal.tag_id')
->whereNull('tags.deleted_at')
->get(['tags.id', 'tags.tag', 'tags.user_id', 'users.email']);
/** @var stdClass $entry */
foreach ($set as $entry) {
$line = 'Notice: User #' . $entry->user_id . ' (' . $entry->email . ') has tag #' . $entry->id . ' ("' . $entry->tag
. '") which has no transactions.';
$this->line($line);
}
}
/**
* Reports on deleted transactions that are connected to a not deleted journal.
*/
private function reportTransactions()
{
$set = Transaction
::leftJoin('transaction_journals', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->whereNotNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->get(
['transactions.id as transaction_id', 'transactions.deleted_at as transaction_deleted', 'transaction_journals.id as journal_id',
'transaction_journals.deleted_at']
);
/** @var stdClass $entry */
foreach ($set as $entry) {
$this->error(
'Error: Transaction journal #' . $entry->journal_id . ' should have been deleted, but has not.' .
' Find it in the table called "transaction_journals" and change the "deleted_at" field to: "' . $entry->transaction_deleted . '"'
);
}
}
/**
*
*/
private function reportTransfersBudgets()
{
$set = TransactionJournal
::distinct()
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->leftJoin('budget_transaction_journal', 'transaction_journals.id', '=', 'budget_transaction_journal.transaction_journal_id')
->where('transaction_types.type', TransactionType::TRANSFER)
->whereNotNull('budget_transaction_journal.budget_id')->get(['transaction_journals.id']);
/** @var TransactionJournal $entry */
foreach ($set as $entry) {
$this->error(
sprintf(
'Error: Transaction journal #%d is a transfer, but has a budget. Edit it without changing anything, so the budget will be removed.',
$entry->id
)
);
}
}
}

55
app/Console/Kernel.php Normal file → Executable file
View File

@@ -1,17 +1,26 @@
<?php
declare(strict_types = 1);
/**
* Kernel.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Console;
use FireflyIII\Console\Commands\CreateImport;
use FireflyIII\Console\Commands\EncryptFile;
use FireflyIII\Console\Commands\Import;
use FireflyIII\Console\Commands\MoveRepository;
use FireflyIII\Console\Commands\ScanAttachments;
use FireflyIII\Console\Commands\UpgradeDatabase;
use FireflyIII\Console\Commands\UpgradeFireflyInstructions;
use FireflyIII\Console\Commands\VerifyDatabase;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
@@ -22,6 +31,25 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
*/
class Kernel extends ConsoleKernel
{
/**
* The bootstrap classes for the application.
*
* Next upgrade verify these are the same.
*
* @var array
*/
protected $bootstrappers
= [
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
'FireflyIII\Bootstrap\ConfigureLogging',
'Illuminate\Foundation\Bootstrap\HandleExceptions',
'Illuminate\Foundation\Bootstrap\RegisterFacades',
'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
'Illuminate\Foundation\Bootstrap\RegisterProviders',
'Illuminate\Foundation\Bootstrap\BootProviders',
];
/**
* The Artisan commands provided by your application.
*
@@ -30,16 +58,31 @@ class Kernel extends ConsoleKernel
protected $commands
= [
UpgradeFireflyInstructions::class,
VerifyDatabase::class,
Import::class,
CreateImport::class,
EncryptFile::class,
ScanAttachments::class,
UpgradeDatabase::class,
MoveRepository::class,
];
/**
* Register the Closure based commands for the application.
*
* @return void
*/
protected function commands()
{
require base_path('routes/console.php');
}
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameters)
*/
protected function schedule(Schedule $schedule)
{

View File

@@ -1,24 +1,27 @@
<?php
declare(strict_types = 1);
/**
* UserRegistration.php
* ConfirmedUser.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class UserRegistration
* Class ConfirmedUser
*
* @package FireflyIII\Events
*/
class UserRegistration extends Event
class ConfirmedUser extends Event
{
use SerializesModels;
@@ -26,7 +29,7 @@ class UserRegistration extends Event
public $user;
/**
* Create a new event instance.
* Create a new event instance. This event is triggered when a user confirms their new account.
*
* @param User $user
* @param string $ipAddress

View File

@@ -1,4 +1,14 @@
<?php
/**
* Event.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\Events;

View File

@@ -1,24 +1,27 @@
<?php
declare(strict_types = 1);
/**
* ResendConfirmation.php
* RegisteredUser.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class ResendConfirmation
* Class RegisteredUser
*
* @package FireflyIII\Events
*/
class ResendConfirmation extends Event
class RegisteredUser extends Event
{
use SerializesModels;
@@ -26,7 +29,7 @@ class ResendConfirmation extends Event
public $user;
/**
* Create a new event instance.
* Create a new event instance. This event is triggered when a new user registers.
*
* @param User $user
* @param string $ipAddress

View File

@@ -0,0 +1,42 @@
<?php
/**
* ResentConfirmation.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\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class ResentConfirmation
*
* @package FireflyIII\Events
*/
class ResentConfirmation extends Event
{
use SerializesModels;
public $ipAddress;
public $user;
/**
* Create a new event instance. This event is triggered when a users wants a new confirmation.
*
* @param User $user
* @param string $ipAddress
*/
public function __construct(User $user, string $ipAddress)
{
$this->user = $user;
$this->ipAddress = $ipAddress;
}
}

View File

@@ -0,0 +1,50 @@
<?php
/**
* StoredBudgetLimit.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\Events;
use Carbon\Carbon;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Queue\SerializesModels;
/**
* Class StoredBudgetLimit
*
* @package FireflyIII\Events
*/
class StoredBudgetLimit extends Event
{
use SerializesModels;
/** @var BudgetLimit */
public $budgetLimit;
/** @var Carbon */
public $end; // the only variable we can't get from the budget limit (if necessary).
/**
* BudgetLimitEvents constructor.
*
* @param BudgetLimit $budgetLimit
* @param Carbon $end
*/
public function __construct(BudgetLimit $budgetLimit, Carbon $end)
{
//
$this->budgetLimit = $budgetLimit;
$this->end = $end;
}
}

View File

@@ -1,25 +1,27 @@
<?php
declare(strict_types = 1);
/**
* TransactionJournalStored.php
* StoredTransactionJournal.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Events;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;
/**
* Class TransactionJournalStored
* Class StoredTransactionJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Events
*/
class TransactionJournalStored extends Event
class StoredTransactionJournal extends Event
{
use SerializesModels;

View File

@@ -0,0 +1,50 @@
<?php
/**
* UpdatedBudgetLimit.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\Events;
use Carbon\Carbon;
use FireflyIII\Models\BudgetLimit;
use Illuminate\Queue\SerializesModels;
/**
* Class UpdatedBudgetLimit
*
* @package FireflyIII\Events
*/
class UpdatedBudgetLimit extends Event
{
use SerializesModels;
/** @var BudgetLimit */
public $budgetLimit;
/** @var Carbon */
public $end; // the only variable we can't get from the budget limit (if necessary).
/**
* BudgetLimitEvents constructor.
*
* @param BudgetLimit $budgetLimit
* @param Carbon $end
*/
public function __construct(BudgetLimit $budgetLimit, Carbon $end)
{
//
$this->budgetLimit = $budgetLimit;
$this->end = $end;
}
}

View File

@@ -1,4 +1,14 @@
<?php
/**
* UpdatedTransactionJournal.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\Events;
@@ -7,12 +17,11 @@ use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;
/**
* Class TransactionJournalUpdated
* Class UpdatedTransactionJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Events
*/
class TransactionJournalUpdated extends Event
class UpdatedTransactionJournal extends Event
{
use SerializesModels;

View File

@@ -1,4 +1,14 @@
<?php
/**
* FireflyException.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\Exceptions;
@@ -6,7 +16,6 @@ namespace FireflyIII\Exceptions;
/**
* Class FireflyException
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class FireflyException extends \Exception

50
app/Exceptions/Handler.php Normal file → Executable file
View File

@@ -1,16 +1,26 @@
<?php
/**
* Handler.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\Exceptions;
use Auth;
use ErrorException;
use Exception;
use FireflyIII\Jobs\MailError;
use FireflyIII\User;
use Illuminate\Auth\Access\AuthorizationException;
use Illuminate\Auth\AuthenticationException;
use Illuminate\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
use Illuminate\Session\TokenMismatchException;
use Illuminate\Validation\ValidationException as ValException;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
@@ -27,9 +37,12 @@ class Handler extends ExceptionHandler
*/
protected $dontReport
= [
AuthenticationException::class,
AuthorizationException::class,
HttpException::class,
ModelNotFoundException::class,
TokenMismatchException::class,
ValException::class,
];
/**
@@ -64,11 +77,15 @@ class Handler extends ExceptionHandler
*/
public function report(Exception $exception)
{
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
$user = Auth::check() ? Auth::user() : new User;
$userData = [
'id' => 0,
'email' => 'unknown@example.com',
];
if (auth()->check()) {
$userData['id'] = auth()->user()->id;
$userData['email'] = auth()->user()->email;
}
$data = [
'class' => get_class($exception),
'errorMessage' => $exception->getMessage(),
@@ -80,10 +97,27 @@ class Handler extends ExceptionHandler
];
// create job that will mail.
$job = new MailError($user, env('SITE_OWNER'), Request::ip(), $data);
$ip = $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
$job = new MailError($userData, env('SITE_OWNER', ''), $ip, $data);
dispatch($job);
}
parent::report($exception);
}
/**
* Convert an authentication exception into an unauthenticated response.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
protected function unauthenticated($request)
{
if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401);
}
return redirect()->guest('login');
}
}

View File

@@ -1,4 +1,14 @@
<?php
/**
* NotImplementedException.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\Exceptions;
@@ -6,7 +16,6 @@ namespace FireflyIII\Exceptions;
/**
* Class NotImplementedException
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class NotImplementedException extends \Exception

View File

@@ -1,11 +1,20 @@
<?php
/**
* ValidationException.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\Exceptions;
/**
* Class ValidationExceptions
*
* @codeCoverageIgnore
* @package FireflyIII\Exception
*/
class ValidationException extends \Exception

View File

@@ -1,20 +1,22 @@
<?php
declare(strict_types = 1);
/**
* AttachmentCollector.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Collector;
use Amount;
use Carbon\Carbon;
use Crypt;
use FireflyIII\Models\Attachment;
use FireflyIII\Models\ExportJob;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Contracts\Encryption\DecryptException;
use Illuminate\Support\Collection;
@@ -28,12 +30,14 @@ use Storage;
*/
class AttachmentCollector extends BasicCollector implements CollectorInterface
{
/** @var string */
private $explanationString = '';
/** @var Carbon */
private $end;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $exportDisk;
/** @var AttachmentRepositoryInterface */
private $repository;
/** @var Carbon */
private $start;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $uploadDisk;
@@ -44,7 +48,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
*/
public function __construct(ExportJob $job)
{
$this->repository = app('FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface');
/** @var AttachmentRepositoryInterface repository */
$this->repository = app(AttachmentRepositoryInterface::class);
// make storage:
$this->uploadDisk = Storage::disk('upload');
$this->exportDisk = Storage::disk('export');
@@ -53,9 +58,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
}
/**
*
* @return bool
*/
public function run()
public function run(): bool
{
// grab all the users attachments:
$attachments = $this->getAttachments();
@@ -65,32 +70,17 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
$this->exportAttachment($attachment);
}
// put the explanation string in a file and attach it as well.
$file = $this->job->key . '-Source of all your attachments explained.txt';
$this->exportDisk->put($file, $this->explanationString);
Log::debug('Also put explanation file "' . $file . '" in the zip.');
$this->getFiles()->push($file);
return true;
}
/**
* @param Attachment $attachment
* @param Carbon $start
* @param Carbon $end
*/
private function explain(Attachment $attachment)
public function setDates(Carbon $start, Carbon $end)
{
/** @var TransactionJournal $journal */
$journal = $attachment->attachable;
$args = [
'attachment_name' => $attachment->filename,
'attachment_id' => $attachment->id,
'type' => strtolower($journal->transactionType->type),
'description' => $journal->description,
'journal_id' => $journal->id,
'date' => $journal->date->formatLocalized(strval(trans('config.month_and_day'))),
'amount' => Amount::formatJournal($journal, false),
];
$string = trans('firefly.attachment_explanation', $args) . "\n";
$this->explanationString .= $string;
$this->start = $start;
$this->end = $end;
}
/**
@@ -101,17 +91,13 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
private function exportAttachment(Attachment $attachment): bool
{
$file = $attachment->fileName();
Log::debug('Original file is at "' . $file . '".');
if ($this->uploadDisk->exists($file)) {
try {
$decrypted = Crypt::decrypt($this->uploadDisk->get($file));
$exportFile = $this->exportFileName($attachment);
$this->exportDisk->put($exportFile, $decrypted);
$this->getFiles()->push($exportFile);
Log::debug('Stored file content in new file "' . $exportFile . '", which will be in the final zip file.');
$this->getEntries()->push($exportFile);
// explain:
$this->explain($attachment);
} catch (DecryptException $e) {
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
}
@@ -139,9 +125,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
*/
private function getAttachments(): Collection
{
$attachments = $this->repository->get();
Log::debug('Found ' . $attachments->count() . ' attachments.');
$attachments = $this->repository->getBetween($this->start, $this->end);
return $attachments;
}

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* BasicCollector.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Collector;
@@ -24,7 +27,7 @@ class BasicCollector
/** @var ExportJob */
protected $job;
/** @var Collection */
private $files;
private $entries;
/**
* BasicCollector constructor.
@@ -33,24 +36,24 @@ class BasicCollector
*/
public function __construct(ExportJob $job)
{
$this->files = new Collection;
$this->job = $job;
$this->entries = new Collection;
$this->job = $job;
}
/**
* @return Collection
*/
public function getFiles()
public function getEntries(): Collection
{
return $this->files;
return $this->entries;
}
/**
* @param Collection $files
* @param Collection $entries
*/
public function setFiles(Collection $files)
public function setEntries(Collection $entries)
{
$this->files = $files;
$this->entries = $entries;
}

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* CollectorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Collector;
use Illuminate\Support\Collection;
@@ -22,17 +25,17 @@ interface CollectorInterface
/**
* @return Collection
*/
public function getFiles();
public function getEntries(): Collection;
/**
* @return bool
*/
public function run();
public function run(): bool;
/**
* @param Collection $files
* @param Collection $entries
*
*/
public function setFiles(Collection $files);
public function setEntries(Collection $entries);
}

View File

@@ -0,0 +1,348 @@
<?php
/**
* JournalExportCollector.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\Export\Collector;
use Carbon\Carbon;
use Crypt;
use DB;
use FireflyIII\Models\Transaction;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
/**
* Class JournalExportCollector
*
* @package FireflyIII\Export\Collector
*/
class JournalExportCollector extends BasicCollector implements CollectorInterface
{
/** @var Collection */
private $accounts;
/** @var Carbon */
private $end;
/** @var Carbon */
private $start;
/** @var Collection */
private $workSet;
/**
* @return bool
*/
public function run(): bool
{
/*
* Instead of collecting journals we collect transactions for the given accounts.
* We left join the OPPOSING transaction AND some journal data.
* After that we complement this info with budgets, categories, etc.
*
* This is way more efficient and will also work on split journals.
*/
$this->getWorkSet();
/*
* Extract:
* possible budget ids for journals
* possible category ids journals
* possible budget ids for transactions
* possible category ids for transactions
*
* possible IBAN and account numbers?
*
*/
$journals = $this->extractJournalIds();
$transactions = $this->extractTransactionIds();
// extend work set with category data from journals:
$this->categoryDataForJournals($journals);
// extend work set with category cate from transactions (overrules journals):
$this->categoryDataForTransactions($transactions);
// same for budgets:
$this->budgetDataForJournals($journals);
$this->budgetDataForTransactions($transactions);
$this->setEntries($this->workSet);
return true;
}
/**
* @param Collection $accounts
*/
public function setAccounts(Collection $accounts)
{
$this->accounts = $accounts;
}
/**
* @param Carbon $start
* @param Carbon $end
*/
public function setDates(Carbon $start, Carbon $end)
{
$this->start = $start;
$this->end = $end;
}
/**
* @param array $journals
*
* @return bool
*/
private function budgetDataForJournals(array $journals): bool
{
$set = DB::table('budget_transaction_journal')
->leftJoin('budgets', 'budgets.id', '=', 'budget_transaction_journal.budget_id')
->whereIn('budget_transaction_journal.transaction_journal_id', $journals)
->get(
[
'budget_transaction_journal.budget_id',
'budget_transaction_journal.transaction_journal_id',
'budgets.name',
'budgets.encrypted',
]
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
}
);
$array = [];
foreach ($set as $obj) {
$array[$obj->transaction_journal_id] = ['id' => $obj->budget_id, 'name' => $obj->name];
}
$this->workSet->each(
function ($obj) use ($array) {
if (isset($array[$obj->transaction_journal_id])) {
$obj->budget_id = $array[$obj->transaction_journal_id]['id'];
$obj->budget_name = $array[$obj->transaction_journal_id]['name'];
}
}
);
return true;
}
/**
* @param array $transactions
*
* @return bool
*/
private function budgetDataForTransactions(array $transactions): bool
{
$set = DB::table('budget_transaction')
->leftJoin('budgets', 'budgets.id', '=', 'budget_transaction.budget_id')
->whereIn('budget_transaction.transaction_id', $transactions)
->get(
[
'budget_transaction.budget_id',
'budget_transaction.transaction_id',
'budgets.name',
'budgets.encrypted',
]
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
}
);
$array = [];
foreach ($set as $obj) {
$array[$obj->transaction_id] = ['id' => $obj->budget_id, 'name' => $obj->name];
}
$this->workSet->each(
function ($obj) use ($array) {
// first transaction
if (isset($array[$obj->id])) {
$obj->budget_id = $array[$obj->id]['id'];
$obj->budget_name = $array[$obj->id]['name'];
}
}
);
return true;
}
/**
* @param array $journals
*
* @return bool
*/
private function categoryDataForJournals(array $journals): bool
{
$set = DB::table('category_transaction_journal')
->leftJoin('categories', 'categories.id', '=', 'category_transaction_journal.category_id')
->whereIn('category_transaction_journal.transaction_journal_id', $journals)
->get(
[
'category_transaction_journal.category_id',
'category_transaction_journal.transaction_journal_id',
'categories.name',
'categories.encrypted',
]
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
}
);
$array = [];
foreach ($set as $obj) {
$array[$obj->transaction_journal_id] = ['id' => $obj->category_id, 'name' => $obj->name];
}
$this->workSet->each(
function ($obj) use ($array) {
if (isset($array[$obj->transaction_journal_id])) {
$obj->category_id = $array[$obj->transaction_journal_id]['id'];
$obj->category_name = $array[$obj->transaction_journal_id]['name'];
}
}
);
return true;
}
/**
* @param array $transactions
*
* @return bool
*/
private function categoryDataForTransactions(array $transactions): bool
{
$set = DB::table('category_transaction')
->leftJoin('categories', 'categories.id', '=', 'category_transaction.category_id')
->whereIn('category_transaction.transaction_id', $transactions)
->get(
[
'category_transaction.category_id',
'category_transaction.transaction_id',
'categories.name',
'categories.encrypted',
]
);
$set->each(
function ($obj) {
$obj->name = $obj->encrypted === 1 ? Crypt::decrypt($obj->name) : $obj->name;
}
);
$array = [];
foreach ($set as $obj) {
$array[$obj->transaction_id] = ['id' => $obj->category_id, 'name' => $obj->name];
}
$this->workSet->each(
function ($obj) use ($array) {
// first transaction
if (isset($array[$obj->id])) {
$obj->category_id = $array[$obj->id]['id'];
$obj->category_name = $array[$obj->id]['name'];
}
}
);
return true;
}
/**
* @return array
*/
private function extractJournalIds(): array
{
return $this->workSet->pluck('transaction_journal_id')->toArray();
}
/**
* @return array
*/
private function extractTransactionIds()
{
$set = $this->workSet->pluck('id')->toArray();
$opposing = $this->workSet->pluck('opposing_id')->toArray();
$complete = $set + $opposing;
return array_unique($complete);
}
/**
*
*/
private function getWorkSet()
{
$accountIds = $this->accounts->pluck('id')->toArray();
$this->workSet = Transaction
::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin(
'transactions AS opposing', function (JoinClause $join) {
$join->on('opposing.transaction_journal_id', '=', 'transactions.transaction_journal_id')
->where('opposing.amount', '=', DB::raw('transactions.amount * -1'))
->where('transactions.identifier', '=', 'opposing.identifier');
}
)
->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
->leftJoin('accounts AS opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id')
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', 'transaction_types.id')
->leftJoin('transaction_currencies', 'transaction_journals.transaction_currency_id', '=', 'transaction_currencies.id')
->whereIn('transactions.account_id', $accountIds)
->where('transaction_journals.user_id', $this->job->user_id)
->where('transaction_journals.date', '>=', $this->start->format('Y-m-d'))
->where('transaction_journals.date', '<=', $this->end->format('Y-m-d'))
->where('transaction_journals.completed', 1)
->whereNull('transaction_journals.deleted_at')
->whereNull('transactions.deleted_at')
->whereNull('opposing.deleted_at')
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transactions.identifier', 'ASC')
->get(
[
'transactions.id',
'transactions.amount',
'transactions.description',
'transactions.account_id',
'accounts.name as account_name',
'accounts.encrypted as account_name_encrypted',
'transactions.identifier',
'opposing.id as opposing_id',
'opposing.amount AS opposing_amount',
'opposing.description as opposing_description',
'opposing.account_id as opposing_account_id',
'opposing_accounts.name as opposing_account_name',
'opposing_accounts.encrypted as opposing_account_encrypted',
'opposing.identifier as opposing_identifier',
'transaction_journals.id as transaction_journal_id',
'transaction_journals.date',
'transaction_journals.description as journal_description',
'transaction_journals.encrypted as journal_encrypted',
'transaction_journals.transaction_type_id',
'transaction_types.type as transaction_type',
'transaction_journals.transaction_currency_id',
'transaction_currencies.code AS transaction_currency_code',
]
);
}
}

View File

@@ -1,16 +1,18 @@
<?php
declare(strict_types = 1);
/**
* UploadCollector.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Collector;
use Auth;
use Crypt;
use FireflyIII\Models\ExportJob;
use Illuminate\Contracts\Encryption\DecryptException;
@@ -24,12 +26,12 @@ use Storage;
*/
class UploadCollector extends BasicCollector implements CollectorInterface
{
/** @var string */
private $expected;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $exportDisk;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $uploadDisk;
/** @var string */
private $vintageFormat;
/**
* AttachmentCollector constructor.
@@ -40,35 +42,81 @@ class UploadCollector extends BasicCollector implements CollectorInterface
{
parent::__construct($job);
Log::debug('Going to collect attachments', ['key' => $job->key]);
// make storage:
$this->uploadDisk = Storage::disk('upload');
$this->exportDisk = Storage::disk('export');
$this->expected = 'csv-upload-' . Auth::user()->id . '-';
// file names associated with the old import routine.
$this->vintageFormat = sprintf('csv-upload-%d-', auth()->user()->id);
}
/**
* Is called from the outside to actually start the export.
*
* @return bool
*/
public function run()
public function run(): bool
{
// collect old upload files (names beginning with "csv-upload".
$this->collectVintageUploads();
// then collect current upload files:
$this->collectModernUploads();
return true;
}
/**
* This method collects all the uploads that are uploaded using the new importer. So after the summer of 2016.
*
* @return bool
*/
private function collectModernUploads(): bool
{
$set = $this->job->user->importJobs()->where('status', 'import_complete')->get(['import_jobs.*']);
$keys = [];
if ($set->count() > 0) {
$keys = $set->pluck('key')->toArray();
}
foreach ($keys as $key) {
$this->processModernUpload($key);
}
return true;
}
/**
* This method collects all the uploads that are uploaded using the "old" importer. So from before the summer of 2016.
*
* @return bool
*/
private function collectVintageUploads():bool
{
// grab upload directory.
$files = $this->uploadDisk->files();
Log::debug('Found ' . count($files) . ' files in the upload directory.');
foreach ($files as $entry) {
$this->processOldUpload($entry);
$this->processVintageUpload($entry);
}
return true;
}
/**
* This method tells you when the vintage upload file was actually uploaded.
*
* @param string $entry
*
* @return string
*/
private function getOriginalUploadDate(string $entry): string
private function getVintageUploadDate(string $entry): string
{
// this is an original upload.
$parts = explode('-', str_replace(['.csv.encrypted', $this->expected], '', $entry));
$parts = explode('-', str_replace(['.csv.encrypted', $this->vintageFormat], '', $entry));
$originalUpload = intval($parts[1]);
$date = date('Y-m-d \a\t H-i-s', $originalUpload);
@@ -76,44 +124,97 @@ class UploadCollector extends BasicCollector implements CollectorInterface
}
/**
* Tells you if a file name is a vintage upload.
*
* @param string $entry
*
* @return bool
*/
private function isValidFile(string $entry): bool
private function isVintageImport(string $entry): bool
{
$len = strlen($this->expected);
if (substr($entry, 0, $len) === $this->expected) {
Log::debug($entry . ' is part of this users original uploads.');
$len = strlen($this->vintageFormat);
// file is part of the old import routine:
if (substr($entry, 0, $len) === $this->vintageFormat) {
return true;
}
Log::debug($entry . ' is not part of this users original uploads.');
return false;
}
/**
* @param $entry
* @param string $key
*
* @return bool
*/
private function processOldUpload(string $entry)
private function processModernUpload(string $key): bool
{
// find job associated with import file:
$job = $this->job->user->importJobs()->where('key', $key)->first();
if (is_null($job)) {
return false;
}
// find the file for this import:
$content = '';
try {
$content = Crypt::decrypt($this->uploadDisk->get(sprintf('%s.upload', $key)));
} catch (DecryptException $e) {
Log::error(sprintf('Could not decrypt old import file "%s". Skipped because: %s', $key, $e->getMessage()));
}
if (strlen($content) > 0) {
// add to export disk.
$date = $job->created_at->format('Y-m-d');
$file = sprintf('%s-Old %s import dated %s.%s', $this->job->key, strtoupper($job->file_type), $date, $job->file_type);
$this->exportDisk->put($file, $content);
$this->getEntries()->push($file);
}
return true;
}
/**
* If the file is a vintage upload, process it.
*
* @param string $entry
*
* @return bool
*/
private function processVintageUpload(string $entry): bool
{
if ($this->isVintageImport($entry)) {
$this->saveVintageImportFile($entry);
return true;
}
return false;
}
/**
* This will store the content of the old vintage upload somewhere.
*
* @param string $entry
*/
private function saveVintageImportFile(string $entry)
{
$content = '';
if ($this->isValidFile($entry)) {
try {
$content = Crypt::decrypt($this->uploadDisk->get($entry));
} catch (DecryptException $e) {
Log::error('Could not decrypt old CSV import file ' . $entry . '. Skipped because ' . $e->getMessage());
}
try {
$content = Crypt::decrypt($this->uploadDisk->get($entry));
} catch (DecryptException $e) {
Log::error('Could not decrypt old CSV import file ' . $entry . '. Skipped because ' . $e->getMessage());
}
if (strlen($content) > 0) {
// continue with file:
$date = $this->getOriginalUploadDate($entry);
$file = $this->job->key . '-Old CSV import dated ' . $date . '.csv';
Log::debug('Will put "' . $file . '" in the zip file.');
// add to export disk.
$date = $this->getVintageUploadDate($entry);
$file = $this->job->key . '-Old import dated ' . $date . '.csv';
$this->exportDisk->put($file, $content);
$this->getFiles()->push($file);
$this->getEntries()->push($file);
}
}
}

View File

@@ -1,67 +0,0 @@
<?php
declare(strict_types = 1);
/**
* ConfigurationFile.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Export;
use FireflyIII\Models\ExportJob;
use Log;
use Storage;
/**
* Class ConfigurationFile
*
* @package FireflyIII\Export
*/
class ConfigurationFile
{
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $exportDisk;
/** @var ExportJob */
private $job;
/**
* ConfigurationFile constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
{
$this->job = $job;
$this->exportDisk = Storage::disk('export');
}
/**
* @return bool
*/
public function make()
{
$fields = array_keys(get_class_vars(Entry::class));
$types = Entry::getTypes();
$configuration = [
'date-format' => 'Y-m-d', // unfortunately, this is hard-coded.
'has-headers' => true,
'map' => [], // we could build a map if necessary for easy re-import.
'roles' => [],
'mapped' => [],
'specifix' => [],
];
foreach ($fields as $field) {
$configuration['roles'][] = $types[$field];
}
$file = $this->job->key . '-configuration.json';
Log::debug('Created JSON config file.');
Log::debug('Will put "' . $file . '" in the ZIP file.');
$this->exportDisk->put($file, json_encode($configuration, JSON_PRETTY_PRINT));
return $file;
}
}

View File

@@ -1,460 +0,0 @@
<?php
declare(strict_types = 1);
/**
* Entry.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Export;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\TransactionJournal;
/**
* To extend the exported object, in case of new features in Firefly III for example,
* do the following:
*
* - Add the field(s) to this class
* - Make sure the "fromJournal"-routine fills these fields.
* - Add them to the static function that returns its type (key=value. Remember that the only
* valid types can be found in config/csv.php (under "roles").
*
* These new entries should be should be strings and numbers as much as possible.
*
*
*
* Class Entry
*
* @package FireflyIII\Export
*/
class Entry
{
/** @var string */
public $amount;
/** @var int */
public $billId;
/** @var string */
public $billName;
/** @var int */
public $budgetId;
/** @var string */
public $budgetName;
/** @var int */
public $categoryId;
/** @var string */
public $categoryName;
/** @var string */
public $date;
/** @var string */
public $description;
/** @var string */
public $fromAccountIban;
/** @var int */
public $fromAccountId;
/** @var string */
public $fromAccountName;
public $fromAccountNumber;
/** @var string */
public $fromAccountType;
/** @var string */
public $toAccountIban;
/** @var int */
public $toAccountId;
/** @var string */
public $toAccountName;
public $toAccountNumber;
/** @var string */
public $toAccountType;
/**
* @param TransactionJournal $journal
*
* @return Entry
*/
public static function fromJournal(TransactionJournal $journal)
{
$entry = new self;
$entry->setDescription($journal->description);
$entry->setDate($journal->date->format('Y-m-d'));
$entry->setAmount(TransactionJournal::amount($journal));
/** @var Budget $budget */
$budget = $journal->budgets->first();
if (!is_null($budget)) {
$entry->setBudgetId($budget->id);
$entry->setBudgetName($budget->name);
}
/** @var Category $category */
$category = $journal->categories->first();
if (!is_null($category)) {
$entry->setCategoryId($category->id);
$entry->setCategoryName($category->name);
}
if (!is_null($journal->bill_id)) {
$entry->setBillId($journal->bill_id);
$entry->setBillName($journal->bill->name);
}
/** @var Account $sourceAccount */
$sourceAccount = TransactionJournal::sourceAccount($journal);
$entry->setFromAccountId($sourceAccount->id);
$entry->setFromAccountName($sourceAccount->name);
$entry->setFromAccountIban($sourceAccount->iban);
$entry->setFromAccountType($sourceAccount->accountType->type);
$entry->setFromAccountNumber($sourceAccount->getMeta('accountNumber'));
/** @var Account $destination */
$destination = TransactionJournal::destinationAccount($journal);
$entry->setToAccountId($destination->id);
$entry->setToAccountName($destination->name);
$entry->setToAccountIban($destination->iban);
$entry->setToAccountType($destination->accountType->type);
$entry->setToAccountNumber($destination->getMeta('accountNumber'));
return $entry;
}
/**
* @return array
*/
public static function getTypes(): array
{
// key = field name (see top of class)
// value = field type (see csv.php under 'roles')
return [
'amount' => 'amount',
'date' => 'date-transaction',
'description' => 'description',
'billId' => 'bill-id',
'billName' => 'bill-name',
'budgetId' => 'budget-id',
'budgetName' => 'budget-name',
'categoryId' => 'category-id',
'categoryName' => 'category-name',
'fromAccountId' => 'account-id',
'fromAccountName' => 'account-name',
'fromAccountIban' => 'account-iban',
'fromAccountType' => '_ignore', // no, Firefly cannot import what it exports. I know :D
'toAccountId' => 'opposing-id',
'toAccountName' => 'opposing-name',
'toAccountIban' => 'opposing-iban',
'toAccountType' => '_ignore',
];
}
/**
* @return string
*/
public function getAmount(): string
{
return $this->amount;
}
/**
* @param string $amount
*/
public function setAmount(string $amount)
{
$this->amount = $amount;
}
/**
* @return int
*/
public function getBillId()
{
return $this->billId;
}
/**
* @param int $billId
*/
public function setBillId($billId)
{
$this->billId = $billId;
}
/**
* @return string
*/
public function getBillName()
{
return $this->billName;
}
/**
* @param string $billName
*/
public function setBillName($billName)
{
$this->billName = $billName;
}
/**
* @return int
*/
public function getBudgetId()
{
return $this->budgetId;
}
/**
* @param int $budgetId
*/
public function setBudgetId($budgetId)
{
$this->budgetId = $budgetId;
}
/**
* @return string
*/
public function getBudgetName()
{
return $this->budgetName;
}
/**
* @param string $budgetName
*/
public function setBudgetName($budgetName)
{
$this->budgetName = $budgetName;
}
/**
* @return int
*/
public function getCategoryId()
{
return $this->categoryId;
}
/**
* @param int $categoryId
*/
public function setCategoryId($categoryId)
{
$this->categoryId = $categoryId;
}
/**
* @return string
*/
public function getCategoryName()
{
return $this->categoryName;
}
/**
* @param string $categoryName
*/
public function setCategoryName($categoryName)
{
$this->categoryName = $categoryName;
}
/**
* @return string
*/
public function getDate()
{
return $this->date;
}
/**
* @param string $date
*/
public function setDate(string $date)
{
$this->date = $date;
}
/**
* @return string
*/
public function getDescription()
{
return $this->description;
}
/**
* @param string $description
*/
public function setDescription(string $description)
{
$this->description = $description;
}
/**
* @return string
*/
public function getFromAccountIban()
{
return $this->fromAccountIban;
}
/**
* @param string $fromAccountIban
*/
public function setFromAccountIban($fromAccountIban)
{
$this->fromAccountIban = $fromAccountIban;
}
/**
* @return int
*/
public function getFromAccountId()
{
return $this->fromAccountId;
}
/**
* @param int $fromAccountId
*/
public function setFromAccountId($fromAccountId)
{
$this->fromAccountId = $fromAccountId;
}
/**
* @return string
*/
public function getFromAccountName()
{
return $this->fromAccountName;
}
/**
* @param string $fromAccountName
*/
public function setFromAccountName($fromAccountName)
{
$this->fromAccountName = $fromAccountName;
}
/**
* @return mixed
*/
public function getFromAccountNumber()
{
return $this->fromAccountNumber;
}
/**
* @param mixed $fromAccountNumber
*/
public function setFromAccountNumber($fromAccountNumber)
{
$this->fromAccountNumber = $fromAccountNumber;
}
/**
* @return string
*/
public function getFromAccountType()
{
return $this->fromAccountType;
}
/**
* @param string $fromAccountType
*/
public function setFromAccountType($fromAccountType)
{
$this->fromAccountType = $fromAccountType;
}
/**
* @return string
*/
public function getToAccountIban()
{
return $this->toAccountIban;
}
/**
* @param string $toAccountIban
*/
public function setToAccountIban($toAccountIban)
{
$this->toAccountIban = $toAccountIban;
}
/**
* @return int
*/
public function getToAccountId()
{
return $this->toAccountId;
}
/**
* @param int $toAccountId
*/
public function setToAccountId($toAccountId)
{
$this->toAccountId = $toAccountId;
}
/**
* @return string
*/
public function getToAccountName()
{
return $this->toAccountName;
}
/**
* @param string $toAccountName
*/
public function setToAccountName($toAccountName)
{
$this->toAccountName = $toAccountName;
}
/**
* @return mixed
*/
public function getToAccountNumber()
{
return $this->toAccountNumber;
}
/**
* @param mixed $toAccountNumber
*/
public function setToAccountNumber($toAccountNumber)
{
$this->toAccountNumber = $toAccountNumber;
}
/**
* @return string
*/
public function getToAccountType()
{
return $this->toAccountType;
}
/**
* @param string $toAccountType
*/
public function setToAccountType($toAccountType)
{
$this->toAccountType = $toAccountType;
}
}

110
app/Export/Entry/Entry.php Normal file
View File

@@ -0,0 +1,110 @@
<?php
/**
* Entry.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\Export\Entry;
use Crypt;
/**
* To extend the exported object, in case of new features in Firefly III for example,
* do the following:
*
* - Add the field(s) to this class. If you add more than one related field, add a new object.
* - Make sure the "fromJournal"-routine fills these fields.
* - Add them to the static function that returns its type (key=value. Remember that the only
* valid types can be found in config/csv.php (under "roles").
*
* These new entries should be should be strings and numbers as much as possible.
*
*
*
* Class Entry
*
* @package FireflyIII\Export\Entry
*/
final class Entry
{
// @formatter:off
public $journal_id;
public $date;
public $description;
public $currency_code;
public $amount;
public $transaction_type;
public $source_account_id;
public $source_account_name;
public $destination_account_id;
public $destination_account_name;
public $budget_id;
public $budget_name;
public $category_id;
public $category_name;
// @formatter:on
/**
* Entry constructor.
*/
private function __construct()
{
}
/**
* @param $object
*
* @return Entry
*/
public static function fromObject($object): Entry
{
$entry = new self;
// journal information:
$entry->journal_id = $object->transaction_journal_id;
$entry->description = $object->journal_encrypted === 1 ? Crypt::decrypt($object->journal_description) : $object->journal_description;
$entry->amount = round($object->amount, 2); // always positive
$entry->date = $object->date;
$entry->transaction_type = $object->transaction_type;
$entry->currency_code = $object->transaction_currency_code;
// source information:
$entry->source_account_id = $object->account_id;
$entry->source_account_name = $object->account_name_encrypted === 1 ? Crypt::decrypt($object->account_name) : $object->account_name;
// destination information
$entry->destination_account_id = $object->opposing_account_id;
$entry->destination_account_name = $object->opposing_account_encrypted === 1 ? Crypt::decrypt($object->opposing_account_name)
: $object->opposing_account_name;
// category and budget
$entry->category_id = $object->category_id ?? '';
$entry->category_name = $object->category_name ?? '';
$entry->budget_id = $object->budget_id ?? '';
$entry->budget_name = $object->budget_name ?? '';
// update description when transaction description is different:
if (!is_null($object->description) && $object->description != $entry->description) {
$entry->description = $entry->description . ' (' . $object->description . ')';
}
return $entry;
}
}

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* BasicExporter.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Exporter;
@@ -39,7 +42,7 @@ class BasicExporter
/**
* @return Collection
*/
public function getEntries()
public function getEntries(): Collection
{
return $this->entries;
}

View File

@@ -1,16 +1,19 @@
<?php
declare(strict_types = 1);
/**
* CsvExporter.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Exporter;
use FireflyIII\Export\Entry;
use FireflyIII\Export\Entry\Entry;
use FireflyIII\Models\ExportJob;
use League\Csv\Writer;
use SplFileObject;
@@ -39,41 +42,43 @@ class CsvExporter extends BasicExporter implements ExporterInterface
/**
* @return string
*/
public function getFileName()
public function getFileName(): string
{
return $this->fileName;
}
/**
*
* @return bool
*/
public function run()
public function run(): bool
{
// create temporary file:
$this->tempFile();
// necessary for CSV writer:
$fullPath = storage_path('export') . DIRECTORY_SEPARATOR . $this->fileName;
$writer = Writer::createFromPath(new SplFileObject($fullPath, 'a+'), 'w');
$rows = [];
// create CSV writer:
$writer = Writer::createFromPath(new SplFileObject($fullPath, 'a+'), 'w');
// get field names for header row:
$first = $this->getEntries()->first();
$headers = array_keys(get_object_vars($first));
$rows[] = $headers;
// all rows:
$rows = [];
// add header:
$first = $this->getEntries()->first();
$rows[] = array_keys(get_object_vars($first));
// then the rest:
/** @var Entry $entry */
foreach ($this->getEntries() as $entry) {
$rows[] = array_values(get_object_vars($entry));
$line = [];
foreach ($headers as $header) {
$line[] = $entry->$header;
}
$rows[] = $line;
}
$writer->insertAll($rows);
return true;
}
private function tempFile()
{
$this->fileName = $this->job->key . '-records.csv';

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* ExporterInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export\Exporter;
use Illuminate\Support\Collection;
@@ -22,17 +25,17 @@ interface ExporterInterface
/**
* @return Collection
*/
public function getEntries();
public function getEntries(): Collection;
/**
* @return string
*/
public function getFileName();
public function getFileName(): string;
/**
*
* @return bool
*/
public function run();
public function run(): bool;
/**
* @param Collection $entries

View File

@@ -1,20 +1,25 @@
<?php
declare(strict_types = 1);
/**
* Processor.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Export;
use Auth;
use Config;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Export\Collector\AttachmentCollector;
use FireflyIII\Export\Collector\JournalExportCollector;
use FireflyIII\Export\Collector\UploadCollector;
use FireflyIII\Export\Entry\Entry;
use FireflyIII\Models\ExportJob;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Collection;
use Log;
use Storage;
@@ -35,15 +40,11 @@ class Processor
/** @var bool */
public $includeAttachments;
/** @var bool */
public $includeConfig;
/** @var bool */
public $includeOldUploads;
/** @var ExportJob */
public $job;
/** @var array */
public $settings;
/** @var \FireflyIII\Export\ConfigurationFile */
private $configurationMaker;
/** @var Collection */
private $exportEntries;
/** @var Collection */
@@ -63,7 +64,6 @@ class Processor
$this->accounts = $settings['accounts'];
$this->exportFormat = $settings['exportFormat'];
$this->includeAttachments = $settings['includeAttachments'];
$this->includeConfig = $settings['includeConfig'];
$this->includeOldUploads = $settings['includeOldUploads'];
$this->job = $settings['job'];
$this->journals = new Collection;
@@ -73,66 +73,73 @@ class Processor
}
/**
*
* @return bool
*/
public function collectAttachments()
public function collectAttachments(): bool
{
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
/** @var AttachmentCollector $attachmentCollector */
$attachmentCollector = app(AttachmentCollector::class, [$this->job]);
$attachmentCollector->setDates($this->settings['startDate'], $this->settings['endDate']);
$attachmentCollector->run();
$this->files = $this->files->merge($attachmentCollector->getFiles());
$this->files = $this->files->merge($attachmentCollector->getEntries());
return true;
}
/**
*
* @return bool
*/
public function collectJournals()
public function collectJournals(): bool
{
$args = [$this->accounts, Auth::user(), $this->settings['startDate'], $this->settings['endDate']];
$journalCollector = app('FireflyIII\Repositories\Journal\JournalCollector', $args);
$this->journals = $journalCollector->collect();
Log::debug(
'Collected ' .
$this->journals->count() . ' journals (between ' .
$this->settings['startDate']->format('Y-m-d') . ' and ' .
$this->settings['endDate']->format('Y-m-d')
. ').'
);
/** @var JournalExportCollector $collector */
$collector = app(JournalExportCollector::class, [$this->job]);
$collector->setDates($this->settings['startDate'], $this->settings['endDate']);
$collector->setAccounts($this->settings['accounts']);
$collector->run();
$this->journals = $collector->getEntries();
Log::debug(sprintf('Count %d journals in collectJournals() ', $this->journals->count()));
return true;
}
public function collectOldUploads()
/**
* @return bool
*/
public function collectOldUploads(): bool
{
$uploadCollector = app('FireflyIII\Export\Collector\UploadCollector', [$this->job]);
/** @var UploadCollector $uploadCollector */
$uploadCollector = app(UploadCollector::class, [$this->job]);
$uploadCollector->run();
$this->files = $this->files->merge($uploadCollector->getFiles());
$this->files = $this->files->merge($uploadCollector->getEntries());
return true;
}
/**
*
* @return bool
*/
public function convertJournals()
public function convertJournals(): bool
{
$count = 0;
/** @var TransactionJournal $journal */
foreach ($this->journals as $journal) {
$this->exportEntries->push(Entry::fromJournal($journal));
foreach ($this->journals as $object) {
$this->exportEntries->push(Entry::fromObject($object));
$count++;
}
Log::debug('Converted ' . $count . ' journals to "Entry" objects.');
Log::debug(sprintf('Count %d entries in exportEntries (convertJournals)', $this->exportEntries->count()));
return true;
}
public function createConfigFile()
{
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
$this->files->push($this->configurationMaker->make());
}
public function createZipFile()
/**
* @return bool
* @throws FireflyException
*/
public function createZipFile(): bool
{
$zip = new ZipArchive;
$file = $this->job->key . '.zip';
$fullPath = storage_path('export') . '/' . $file;
Log::debug('Will create zip file at ' . $fullPath);
if ($zip->open($fullPath, ZipArchive::CREATE) !== true) {
throw new FireflyException('Cannot store zip file.');
@@ -142,41 +149,46 @@ class Processor
foreach ($this->getFiles() as $entry) {
// is part of this job?
$zipFileName = str_replace($this->job->key . '-', '', $entry);
$result = $zip->addFromString($zipFileName, $disk->get($entry));
if (!$result) {
Log::error('Could not add "' . $entry . '" into zip file as "' . $zipFileName . '".');
}
$zip->addFromString($zipFileName, $disk->get($entry));
}
$zip->close();
// delete the files:
foreach ($this->getFiles() as $file) {
Log::debug('Will now delete file "' . $file . '".');
$disk->delete($file);
}
Log::debug('Done!');
$this->deleteFiles($disk);
return true;
}
/**
*
* @return bool
*/
public function exportJournals()
public function exportJournals(): bool
{
$exporterClass = Config::get('firefly.export_formats.' . $this->exportFormat);
$exporterClass = config('firefly.export_formats.' . $this->exportFormat);
$exporter = app($exporterClass, [$this->job]);
Log::debug('Going to export ' . $this->exportEntries->count() . ' export entries into ' . $this->exportFormat . ' format.');
$exporter->setEntries($this->exportEntries);
$exporter->run();
$this->files->push($exporter->getFileName());
Log::debug('Added "' . $exporter->getFileName() . '" to the list of files to include in the zip.');
return true;
}
/**
* @return Collection
*/
public function getFiles()
public function getFiles(): Collection
{
return $this->files;
}
/**
* @param FilesystemAdapter $disk
*/
private function deleteFiles(FilesystemAdapter $disk)
{
foreach ($this->getFiles() as $file) {
$disk->delete($file);
}
}
}

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* AccountChartGeneratorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\Account;
use Carbon\Carbon;
@@ -21,7 +24,6 @@ use Illuminate\Support\Collection;
*/
interface AccountChartGeneratorInterface
{
/**
* @param Collection $accounts
* @param Carbon $start
@@ -41,11 +43,20 @@ interface AccountChartGeneratorInterface
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Account $account
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function single(Account $account, Carbon $start, Carbon $end): array;
public function revenueAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Account $account
* @param array $labels
* @param array $dataSet
*
* @return array
*/
public function single(Account $account, array $labels, array $dataSet): array;
}

View File

@@ -1,11 +1,20 @@
<?php
/**
* ChartJsAccountChartGenerator.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\Generator\Chart\Account;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use Illuminate\Support\Collection;
use Steam;
/**
* Class ChartJsAccountChartGenerator
@@ -29,28 +38,6 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
'labels' => [], 'datasets' => [[
'label' => trans('firefly.spent'),
'data' => []]]];
$start->subDay();
$ids = $this->getIdsFromCollection($accounts);
$startBalances = Steam::balancesById($ids, $start);
$endBalances = Steam::balancesById($ids, $end);
$accounts->each(
function (Account $account) use ($startBalances, $endBalances) {
$id = $account->id;
$startBalance = $this->isInArray($startBalances, $id);
$endBalance = $this->isInArray($endBalances, $id);
$diff = bcsub($endBalance, $startBalance);
$account->difference = round($diff, 2);
}
);
$accounts = $accounts->sortByDesc(
function (Account $account) {
return $account->difference;
}
);
foreach ($accounts as $account) {
if ($account->difference > 0) {
$data['labels'][] = $account->name;
@@ -80,7 +67,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
}
foreach ($accounts as $account) {
$set = [
$data['datasets'][] = [
'label' => $account->name,
'fillColor' => 'rgba(220,220,220,0.2)',
'strokeColor' => 'rgba(220,220,220,1)',
@@ -88,20 +75,8 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
'pointStrokeColor' => '#fff',
'pointHighlightFill' => '#fff',
'pointHighlightStroke' => 'rgba(220,220,220,1)',
'data' => [],
'data' => $account->balances,
];
$current = clone $start;
$range = Steam::balanceInRange($account, $start, clone $end);
$previous = round(array_values($range)[0], 2);
while ($current <= $end) {
$format = $current->format('Y-m-d');
$balance = isset($range[$format]) ? round($range[$format], 2) : $previous;
$set['data'][] = $balance;
$previous = $balance;
$current->addDay();
}
$data['datasets'][] = $set;
}
$data['count'] = count($data['datasets']);
@@ -109,72 +84,49 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
}
/**
* @param Account $account
* @param Carbon $start
* @param Carbon $end
* @param Collection $accounts
* @param Carbon $start
* @param Carbon $end
*
* @return array
*/
public function single(Account $account, Carbon $start, Carbon $end): array
public function revenueAccounts(Collection $accounts, Carbon $start, Carbon $end): array
{
// language:
$format = (string)trans('config.month_and_day');
$data = [
'count' => 1,
'labels' => [],
'datasets' => [
[
'label' => $account->name,
'data' => [],
],
],
];
$range = Steam::balanceInRange($account, $start, $end);
$current = clone $start;
$previous = array_values($range)[0];
while ($end >= $current) {
$theDate = $current->format('Y-m-d');
$balance = $range[$theDate] ?? $previous;
$data['labels'][] = $current->formatLocalized($format);
$data['datasets'][0]['data'][] = $balance;
$previous = $balance;
$current->addDay();
$data = [
'count' => 1,
'labels' => [], 'datasets' => [[
'label' => trans('firefly.earned'),
'data' => []]]];
foreach ($accounts as $account) {
if ($account->difference > 0) {
$data['labels'][] = $account->name;
$data['datasets'][0]['data'][] = $account->difference;
}
}
return $data;
}
/**
* @param Collection $collection
* @param Account $account
* @param array $labels
* @param array $dataSet
*
* @return array
*/
protected function getIdsFromCollection(Collection $collection): array
public function single(Account $account, array $labels, array $dataSet): array
{
$ids = [];
foreach ($collection as $entry) {
$ids[] = $entry->id;
}
$data = [
'count' => 1,
'labels' => $labels,
'datasets' => [
[
'label' => $account->name,
'data' => $dataSet,
],
],
];
return array_unique($ids);
}
/**
* @param $array
* @param $entryId
*
* @return string
*/
protected function isInArray($array, $entryId): string
{
if (isset($array[$entryId])) {
return $array[$entryId];
}
return '0';
return $data;
}
}

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* BillChartGeneratorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\Bill;

View File

@@ -1,17 +1,20 @@
<?php
declare(strict_types = 1);
/**
* ChartJsBillChartGenerator.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\Bill;
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
/**
@@ -31,18 +34,15 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
public function frontpage(string $paid, string $unpaid): array
{
$data = [
[
'value' => round($unpaid, 2),
'color' => 'rgba(53, 124, 165,0.7)',
'highlight' => 'rgba(53, 124, 165,0.9)',
'label' => trans('firefly.unpaid'),
],
[
'value' => round(bcmul($paid, '-1'), 2), // paid is negative, must be positive.
'color' => 'rgba(0, 141, 76, 0.7)',
'highlight' => 'rgba(0, 141, 76, 0.9)',
'label' => trans('firefly.paid'),
'datasets' => [
[
'data' => [round($unpaid, 2), round(bcmul($paid, '-1'), 2)],
'backgroundColor' => ['rgba(53, 124, 165,0.7)', 'rgba(0, 141, 76, 0.7)',],
],
],
'labels' => [strval(trans('firefly.unpaid')), strval(trans('firefly.paid'))],
];
return $data;
@@ -57,34 +57,31 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
public function single(Bill $bill, Collection $entries): array
{
$format = (string)trans('config.month');
$data = [
'count' => 3,
'labels' => [],
'datasets' => [],
];
$data = ['count' => 3, 'labels' => [], 'datasets' => [],];
$minAmount = [];
$maxAmount = [];
$actualAmount = [];
/** @var TransactionJournal $entry */
/** @var Transaction $entry */
foreach ($entries as $entry) {
$data['labels'][] = $entry->date->formatLocalized($format);
$minAmount[] = round($bill->amount_min, 2);
$maxAmount[] = round($bill->amount_max, 2);
/*
* journalAmount has been collected in BillRepository::getJournals
*/
$actualAmount[] = round(TransactionJournal::amountPositive($entry), 2);
// journalAmount has been collected in BillRepository::getJournals
$actualAmount[] = bcmul($entry->transaction_amount, '-1');
}
$data['datasets'][] = [
'type' => 'bar',
'label' => trans('firefly.minAmount'),
'data' => $minAmount,
];
$data['datasets'][] = [
'type' => 'line',
'label' => trans('firefly.billEntry'),
'data' => $actualAmount,
];
$data['datasets'][] = [
'type' => 'bar',
'label' => trans('firefly.maxAmount'),
'data' => $maxAmount,
];

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* BudgetChartGeneratorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\Budget;
use Illuminate\Support\Collection;
@@ -19,19 +22,14 @@ use Illuminate\Support\Collection;
*/
interface BudgetChartGeneratorInterface
{
/**
* @param Collection $entries
*
* @return array
*/
public function budget(Collection $entries): array;
/**
* @param Collection $entries
* @param string $dateFormat
*
* @return array
*/
public function budgetLimit(Collection $entries): array;
public function budgetLimit(Collection $entries, string $dateFormat): array;
/**
* @param Collection $entries
@@ -42,10 +40,11 @@ interface BudgetChartGeneratorInterface
/**
* @param Collection $entries
* @param string $viewRange
*
* @return array
*/
public function multiYear(Collection $entries): array;
public function period(Collection $entries, string $viewRange) : array;
/**
* @param Collection $budgets

View File

@@ -1,11 +1,20 @@
<?php
/**
* ChartJsBudgetChartGenerator.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\Generator\Chart\Budget;
use Config;
use Illuminate\Support\Collection;
use Preferences;
use Navigation;
/**
* Class ChartJsBudgetChartGenerator
@@ -14,20 +23,17 @@ use Preferences;
*/
class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
{
/**
*
* @param Collection $entries
* @param string $dateFormat
*
* @return array
*/
public function budget(Collection $entries, $dateFormat = 'month'): array
public function budgetLimit(Collection $entries, string $dateFormat = 'month_and_day'): array
{
// language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
$format = Config::get('firefly.' . $dateFormat . '.' . $language);
$data = [
$format = strval(trans('config.' . $dateFormat));
$data = [
'labels' => [],
'datasets' => [
[
@@ -49,18 +55,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
return $data;
}
/**
* @codeCoverageIgnore
*
* @param Collection $entries
*
* @return array
*/
public function budgetLimit(Collection $entries): array
{
return $this->budget($entries, 'monthAndDay');
}
/**
* @param Collection $entries
*
@@ -88,6 +82,10 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
$overspent[] = round(bcmul($entry[3], '-1'), 2); // same
}
$data['datasets'][] = [
'label' => trans('firefly.overspent'),
'data' => $overspent,
];
$data['datasets'][] = [
'label' => trans('firefly.left'),
'data' => $left,
@@ -96,45 +94,43 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
'label' => trans('firefly.spent'),
'data' => $spent,
];
$data['datasets'][] = [
'label' => trans('firefly.overspent'),
'data' => $overspent,
];
$data['count'] = count($data['datasets']);
$data['count'] = 3;
return $data;
}
/**
* @param Collection $entries
* @param string $viewRange
*
* @return array
*/
public function multiYear(Collection $entries): array
public function period(Collection $entries, string $viewRange) : array
{
// dataset:
$data = [
'count' => 0,
'labels' => [],
'datasets' => [],
'datasets' => [
0 => [
'label' => trans('firefly.budgeted'),
'data' => [],
],
1 => [
'label' => trans('firefly.spent'),
'data' => [],
],
],
'count' => 2,
];
// get labels from one of the budgets (assuming there's at least one):
$first = $entries->first();
$keys = array_keys($first['budgeted']);
foreach ($keys as $year) {
$data['labels'][] = strval($year);
}
// then, loop all entries and create datasets:
foreach ($entries as $entry) {
$name = $entry['name'];
$spent = $entry['spent'];
$budgeted = $entry['budgeted'];
$data['datasets'][] = ['label' => 'Spent on ' . $name, 'data' => array_values($spent)];
$data['datasets'][] = ['label' => 'Budgeted for ' . $name, 'data' => array_values($budgeted)];
$label = Navigation::periodShow($entry['date'], $viewRange);
$data['labels'][] = $label;
// data set 0 is budgeted
// data set 1 is spent:
$data['datasets'][0]['data'][] = $entry['budgeted'];
$data['datasets'][1]['data'][] = round(($entry['spent'] * -1), 2);
}
$data['count'] = count($data['datasets']);
return $data;

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* CategoryChartGeneratorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\Category;
use Illuminate\Support\Collection;
@@ -25,7 +28,7 @@ interface CategoryChartGeneratorInterface
*
* @return array
*/
public function all(Collection $entries);
public function all(Collection $entries): array;
/**
* @param Collection $categories
@@ -42,13 +45,6 @@ interface CategoryChartGeneratorInterface
*/
public function frontpage(Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function multiYear(Collection $entries): array;
/**
* @param Collection $entries
*

View File

@@ -1,4 +1,14 @@
<?php
/**
* ChartJsCategoryChartGenerator.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\Generator\Chart\Category;
@@ -20,8 +30,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*/
public function all(Collection $entries): array
{
$data = [
'count' => 2,
'labels' => [],
@@ -42,8 +50,8 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
$spent = $entry[2];
$earned = $entry[3];
$data['datasets'][0]['data'][] = bccomp($spent, '0') === 0 ? null : bcmul($spent, '-1');
$data['datasets'][1]['data'][] = bccomp($earned, '0') === 0 ? null : $earned;
$data['datasets'][0]['data'][] = bccomp($spent, '0') === 0 ? null : round(bcmul($spent, '-1'), 4);
$data['datasets'][1]['data'][] = bccomp($earned, '0') === 0 ? null : round($earned, 4);
}
return $data;
@@ -110,45 +118,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
}
/**
* @param Collection $entries
*
* @return array
*/
public function multiYear(Collection $entries): array
{
// dataset:
$data = [
'count' => 0,
'labels' => [],
'datasets' => [],
];
// get labels from one of the categories (assuming there's at least one):
$first = $entries->first();
$keys = array_keys($first['spent']);
foreach ($keys as $year) {
$data['labels'][] = strval($year);
}
// then, loop all entries and create datasets:
foreach ($entries as $entry) {
$name = $entry['name'];
$spent = $entry['spent'];
$earned = $entry['earned'];
if (array_sum(array_values($spent)) != 0) {
$data['datasets'][] = ['label' => 'Spent in category ' . $name, 'data' => array_values($spent)];
}
if (array_sum(array_values($earned)) != 0) {
$data['datasets'][] = ['label' => 'Earned in category ' . $name, 'data' => array_values($earned)];
}
}
$data['count'] = count($data['datasets']);
return $data;
}
/**
* @codeCoverageIgnore
*
* @param Collection $entries
*

View File

@@ -1,4 +1,14 @@
<?php
/**
* ChartJsPiggyBankChartGenerator.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\Generator\Chart\PiggyBank;
@@ -36,9 +46,9 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGeneratorInterface
],
];
$sum = '0';
foreach ($set as $entry) {
$date = new Carbon($entry->date);
$sum = bcadd($sum, $entry->sum);
foreach ($set as $key => $value) {
$date = new Carbon($key);
$sum = bcadd($sum, $value);
$data['labels'][] = $date->formatLocalized($format);
$data['datasets'][0]['data'][] = round($sum, 2);
}

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* PiggyBankChartGenerator.php
* PiggyBankChartGeneratorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\PiggyBank;
use Illuminate\Support\Collection;

View File

@@ -1,4 +1,14 @@
<?php
/**
* ChartJsReportChartGenerator.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\Generator\Chart\Report;
@@ -89,7 +99,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
'labels' => [],
'datasets' => [
[
'label' => trans('firefly.net-worth'),
'label' => trans('firefly.net_worth'),
'data' => [],
],
],

View File

@@ -1,13 +1,16 @@
<?php
declare(strict_types = 1);
/**
* ReportChartGenerator.php
* ReportChartGeneratorInterface.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Generator\Chart\Report;
use Illuminate\Support\Collection;

View File

@@ -1,52 +0,0 @@
<?php
declare(strict_types = 1);
/**
* AttachUserRole.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\UserRegistration;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Log;
/**
* Class AttachUserRole
*
* @package FireflyIII\Handlers\Events
*/
class AttachUserRole
{
/**
* Create the event listener.
*
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param UserRegistration $event
*/
public function handle(UserRegistration $event)
{
Log::debug('Trigger attachuserrole');
/** @var UserRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\User\UserRepositoryInterface');
// first user ever?
if ($repository->count() == 1) {
Log::debug('Will attach role.');
$repository->attachRole($event->user, 'owner');
}
}
}

View File

@@ -0,0 +1,110 @@
<?php
/**
* BudgetEventHandler.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\Handlers\Events;
use FireflyIII\Events\StoredBudgetLimit;
use FireflyIII\Events\UpdatedBudgetLimit;
use FireflyIII\Models\LimitRepetition;
use Illuminate\Database\QueryException;
use Log;
/**
* Handles budget related events.
*
* Class BudgetEventHandler
*
* @package FireflyIII\Handlers\Events
*/
class BudgetEventHandler
{
/**
* This method creates a new budget limit repetition when a new budget limit has been created.
*
* @param StoredBudgetLimit $event
*
* @return bool
*/
public function storeRepetition(StoredBudgetLimit $event):bool
{
$budgetLimit = $event->budgetLimit;
$end = $event->end;
$set = $budgetLimit->limitrepetitions()
->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))
->where('enddate', $end->format('Y-m-d 00:00:00'))
->get();
if ($set->count() == 0) {
$repetition = new LimitRepetition;
$repetition->startdate = $budgetLimit->startdate;
$repetition->enddate = $end;
$repetition->amount = $budgetLimit->amount;
$repetition->budgetLimit()->associate($budgetLimit);
try {
$repetition->save();
} catch (QueryException $e) {
Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage());
}
}
if ($set->count() == 1) {
$repetition = $set->first();
$repetition->amount = $budgetLimit->amount;
$repetition->save();
}
return true;
}
/**
* Updates, if present the budget limit repetition part of a budget limit.
*
* @param UpdatedBudgetLimit $event
*
* @return bool
*/
public function updateRepetition(UpdatedBudgetLimit $event): bool
{
$budgetLimit = $event->budgetLimit;
$end = $event->end;
$set = $budgetLimit->limitrepetitions()
->where('startdate', $budgetLimit->startdate->format('Y-m-d 00:00:00'))
->where('enddate', $end->format('Y-m-d 00:00:00'))
->get();
if ($set->count() == 0) {
$repetition = new LimitRepetition;
$repetition->startdate = $budgetLimit->startdate;
$repetition->enddate = $end;
$repetition->amount = $budgetLimit->amount;
$repetition->budgetLimit()->associate($budgetLimit);
try {
$repetition->save();
} catch (QueryException $e) {
Log::error('Trying to save new LimitRepetition failed: ' . $e->getMessage());
}
}
if ($set->count() == 1) {
$repetition = $set->first();
$repetition->amount = $budgetLimit->amount;
$repetition->save();
}
return true;
}
}

View File

@@ -1,62 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Handlers\Events;
use Auth;
use FireflyIII\Events\TransactionJournalStored;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\TransactionJournal;
/**
* Class ConnectJournalToPiggyBank
*
* @package FireflyIII\Handlers\Events
*/
class ConnectJournalToPiggyBank
{
/**
* Connect a new transaction journal to any related piggy banks.
*
* @param TransactionJournalStored $event
*
* @return bool
*/
public function handle(TransactionJournalStored $event): bool
{
/** @var TransactionJournal $journal */
$journal = $event->journal;
$piggyBankId = $event->piggyBankId;
/** @var PiggyBank $piggyBank */
$piggyBank = Auth::user()->piggybanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
if (is_null($piggyBank)) {
return true;
}
// update piggy bank rep for date of transaction journal.
$repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($journal->date)->first();
if (is_null($repetition)) {
return true;
}
$amount = TransactionJournal::amountPositive($journal);
// if piggy account matches source account, the amount is positive
if ($piggyBank->account_id == TransactionJournal::sourceAccount($journal)->id) {
$amount = bcmul($amount, '-1');
}
$repetition->currentamount = bcadd($repetition->currentamount, $amount);
$repetition->save();
PiggyBankEvent::create(['piggy_bank_id' => $piggyBank->id, 'transaction_journal_id' => $journal->id, 'date' => $journal->date, 'amount' => $amount]);
return true;
}
}

View File

@@ -1,69 +0,0 @@
<?php
declare(strict_types = 1);
/**
* FireRulesForStore.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\TransactionJournalStored;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Rules\Processor;
use FireflyIII\User;
use Illuminate\Support\Facades\Auth;
use Log;
/**
* Class FireRulesForStore
*
* @package FireflyIII\Handlers\Events
*/
class FireRulesForStore
{
/**
* Connect a new transaction journal to any related piggy banks.
*
* @param TransactionJournalStored $event
*
* @return bool
*/
public function handle(TransactionJournalStored $event): bool
{
// get all the user's rule groups, with the rules, order by 'order'.
/** @var User $user */
$user = Auth::user();
$groups = $user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get();
//
/** @var RuleGroup $group */
foreach ($groups as $group) {
Log::debug('Now processing group "' . $group->title . '".');
$rules = $group->rules()
->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
->where('rule_triggers.trigger_type', 'user_action')
->where('rule_triggers.trigger_value', 'store-journal')
->where('rules.active', 1)
->get(['rules.*']);
/** @var Rule $rule */
foreach ($rules as $rule) {
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
$processor = Processor::make($rule);
$processor->handleTransactionJournal($event->journal);
if ($rule->stop_processing) {
return true;
}
}
}
return true;
}
}

View File

@@ -1,40 +0,0 @@
<?php
declare(strict_types = 1);
/**
* RescanJournalAfterStore.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\TransactionJournalStored;
use FireflyIII\Support\Events\BillScanner;
/**
* Class RescanJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class ScanForBillsAfterStore
{
/**
* Scan a transaction journal for possible links to bills, right after storing.
*
* @param TransactionJournalStored $event
*
* @return bool
*/
public function handle(TransactionJournalStored $event): bool
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}
}

View File

@@ -1,39 +0,0 @@
<?php
declare(strict_types = 1);
/**
* ScanForBillsAfterUpdate.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\TransactionJournalUpdated;
use FireflyIII\Support\Events\BillScanner;
/**
* Class RescanJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class ScanForBillsAfterUpdate
{
/**
* Scan a transaction journal for possibly related bills after it has been updated.
*
* @param TransactionJournalUpdated $event
*
* @return bool
*/
public function handle(TransactionJournalUpdated $event): bool
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}
}

View File

@@ -1,64 +0,0 @@
<?php
declare(strict_types = 1);
/**
* SendRegistrationMail.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\UserRegistration;
use Illuminate\Mail\Message;
use Log;
use Mail;
use Swift_TransportException;
/**
* Class SendRegistrationMail
*
* @package FireflyIII\Handlers\Events
*/
class SendRegistrationMail
{
/**
* Create the event listener.
*
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param UserRegistration $event
*
* @return void
*/
public function handle(UserRegistration $event)
{
$sendMail = env('SEND_REGISTRATION_MAIL', true);
if (!$sendMail) {
return;
}
// get the email address
$email = $event->user->email;
$address = route('index');
$ipAddress = $event->ipAddress;
// send email.
try {
Mail::send(
['emails.registered-html', 'emails.registered'], ['address' => $address, 'ip' => $ipAddress], function (Message $message) use ($email) {
$message->to($email, $email)->subject('Welcome to Firefly III! ');
}
);
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
}
}

View File

@@ -0,0 +1,164 @@
<?php
/**
* StoredJournalEventHandler.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\Handlers\Events;
use FireflyIII\Events\StoredTransactionJournal;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Rules\Processor;
use FireflyIII\Support\Events\BillScanner;
use Log;
/**
* Class StoredJournalEventHandler
*
* @package FireflyIII\Handlers\Events
*/
class StoredJournalEventHandler
{
/**
* This method connects a new transfer to a piggy bank.
*
* @param StoredTransactionJournal $event
*
* @return bool
*/
public function connectToPiggyBank(StoredTransactionJournal $event): bool
{
/** @var TransactionJournal $journal */
$journal = $event->journal;
$piggyBankId = $event->piggyBankId;
Log::debug(sprintf('Trying to connect journal %d to piggy bank %d.', $journal->id, $piggyBankId));
/** @var PiggyBank $piggyBank */
$piggyBank = $journal->user->piggyBanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
if (is_null($piggyBank)) {
Log::error('No such piggy bank!');
return true;
}
Log::debug(sprintf('Found piggy bank #%d: "%s"', $piggyBank->id, $piggyBank->name));
// update piggy bank rep for date of transaction journal.
$repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($journal->date)->first();
if (is_null($repetition)) {
Log::error(sprintf('No piggy bank repetition on %s!', $journal->date->format('Y-m-d')));
return true;
}
$amount = TransactionJournal::amountPositive($journal);
Log::debug(sprintf('Will add/remove %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
// if piggy account matches source account, the amount is positive
$sources = TransactionJournal::sourceAccountList($journal)->pluck('id')->toArray();
if (in_array($piggyBank->account_id, $sources)) {
$amount = bcmul($amount, '-1');
Log::debug(sprintf('Account #%d is the source, so will remove amount from piggy bank.', $piggyBank->account_id));
}
// if the amount is positive:
// make sure it fits in piggy bank:
if (bccomp($amount, '0') === 1) {
// amount is positive
$room = bcsub(strval($piggyBank->targetamount), strval($repetition->currentamount));
Log::debug(sprintf('Room in piggy bank for extra money is %f', $room));
if (bccomp($room, $amount) === -1) {
// $room is smaller than $amount
Log::debug(sprintf('There is NO room to add %f to piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
Log::debug(sprintf('New amount is %f', $room));
$amount = $room;
}
}
if (bccomp($amount, '0') === -1) {
// amount is negative
Log::debug(sprintf('Max amount to remove is %f', $repetition->currentamount));
$compare = bcmul($repetition->currentamount, '-1');
if (bccomp($compare, $amount) === 1) {
// $currentamount is smaller than $amount
Log::debug(sprintf('Cannot remove %f from piggy bank #%d ("%s")', $amount, $piggyBank->id, $piggyBank->name));
Log::debug(sprintf('New amount is %f', $compare));
$amount = $compare;
}
}
$repetition->currentamount = bcadd($repetition->currentamount, $amount);
$repetition->save();
/** @var PiggyBankEvent $event */
$event = PiggyBankEvent::create(
['piggy_bank_id' => $piggyBank->id, 'transaction_journal_id' => $journal->id, 'date' => $journal->date, 'amount' => $amount]
);
Log::debug(sprintf('Created piggy bank event #%d', $event->id));
return true;
}
/**
* This method grabs all the users rules and processes them.
*
* @param StoredTransactionJournal $event
*
* @return bool
*/
public function processRules(StoredTransactionJournal $event): bool
{
// get all the user's rule groups, with the rules, order by 'order'.
$journal = $event->journal;
$groups = $journal->user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get();
//
/** @var RuleGroup $group */
foreach ($groups as $group) {
$rules = $group->rules()
->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
->where('rule_triggers.trigger_type', 'user_action')
->where('rule_triggers.trigger_value', 'store-journal')
->where('rules.active', 1)
->get(['rules.*']);
/** @var Rule $rule */
foreach ($rules as $rule) {
$processor = Processor::make($rule);
$processor->handleTransactionJournal($journal);
if ($rule->stop_processing) {
return true;
}
}
}
return true;
}
/**
* This method calls a special bill scanner that will check if the stored journal is part of a bill.
*
* @param StoredTransactionJournal $event
*
* @return bool
*/
public function scanBills(StoredTransactionJournal $event): bool
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}
}

View File

@@ -1,60 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\TransactionJournalUpdated;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\PiggyBankRepetition;
use FireflyIII\Models\TransactionJournal;
/**
* Class UpdateJournalConnection
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class UpdateJournalConnection
{
/**
* Handle the event.
*
* @param TransactionJournalUpdated $event
*
* @return bool
*/
public function handle(TransactionJournalUpdated $event):bool
{
$journal = $event->journal;
// get the event connected to this journal:
/** @var PiggyBankEvent $event */
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
if (is_null($event)) {
return false;
}
$piggyBank = $event->piggyBank()->first();
$repetition = null;
if ($piggyBank) {
/** @var PiggyBankRepetition $repetition */
$repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($journal->date)->first();
}
if (is_null($repetition)) {
return false;
}
$amount = TransactionJournal::amount($journal);
$diff = bcsub($amount, $event->amount); // update current repetition
$repetition->currentamount = bcadd($repetition->currentamount, $diff);
$repetition->save();
$event->amount = $amount;
$event->save();
return true;
}
}

View File

@@ -1,47 +1,48 @@
<?php
declare(strict_types = 1);
/**
* FireRulesForUpdate.php
* UpdatedJournalEventHandler.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
* 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\Handlers\Events;
use Auth;
use FireflyIII\Events\TransactionJournalUpdated;
use FireflyIII\Events\UpdatedTransactionJournal;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Rules\Processor;
use FireflyIII\User;
use Log;
use FireflyIII\Support\Events\BillScanner;
/**
* Class FireRulesForUpdate
* Class UpdatedJournalEventHandler
*
* @package FireflyIII\Handlers\Events
*/
class FireRulesForUpdate
class UpdatedJournalEventHandler
{
/**
* Handle the event.
* This method will check all the rules when a journal is updated.
*
* @param TransactionJournalUpdated $event
* @param UpdatedTransactionJournal $event
*
* @return bool
*/
public function handle(TransactionJournalUpdated $event): bool
public function processRules(UpdatedTransactionJournal $event):bool
{
// get all the user's rule groups, with the rules, order by 'order'.
/** @var User $user */
$user = Auth::user();
$groups = $user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get();
$journal = $event->journal;
$groups = $journal->user->ruleGroups()->where('rule_groups.active', 1)->orderBy('order', 'ASC')->get();
//
/** @var RuleGroup $group */
foreach ($groups as $group) {
Log::debug('Now processing group "' . $group->title . '".');
$rules = $group->rules()
->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
->where('rule_triggers.trigger_type', 'user_action')
@@ -50,11 +51,8 @@ class FireRulesForUpdate
->get(['rules.*']);
/** @var Rule $rule */
foreach ($rules as $rule) {
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
$processor = Processor::make($rule);
$processor->handleTransactionJournal($event->journal);
$processor->handleTransactionJournal($journal);
if ($rule->stop_processing) {
break;
@@ -65,4 +63,19 @@ class FireRulesForUpdate
return true;
}
/**
* This method calls a special bill scanner that will check if the updated journal is part of a bill.
*
* @param UpdatedTransactionJournal $event
*
* @return bool
*/
public function scanBills(UpdatedTransactionJournal $event): bool
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}
}

View File

@@ -1,115 +0,0 @@
<?php
declare(strict_types = 1);
/**
* UserConfirmation.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use Exception;
use FireflyIII\Events\ResendConfirmation;
use FireflyIII\Events\UserRegistration;
use FireflyIII\User;
use Illuminate\Mail\Message;
use Log;
use Mail;
use Preferences;
use Swift_TransportException;
/**
* Class UserConfirmation
*
* @package FireflyIII\Handlers\Events
*/
class UserConfirmation
{
/**
* Create the event listener.
*
*/
public function __construct()
{
//
}
/**
* @param ResendConfirmation $event
*/
public function resendConfirmation(ResendConfirmation $event)
{
$user = $event->user;
$ipAddress = $event->ipAddress;
$this->doConfirm($user, $ipAddress);
}
/**
* Handle the event.
*
* @param UserRegistration $event
*/
public function sendConfirmation(UserRegistration $event)
{
$user = $event->user;
$ipAddress = $event->ipAddress;
$this->doConfirm($user, $ipAddress);
}
/**
* @param User $user
* @param string $ipAddress
*/
private function doConfirm(User $user, string $ipAddress)
{
Log::debug('Trigger UserConfirmation::doConfirm');
// if user must confirm account, send email
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
// otherwise, auto-confirm:
if ($confirmAccount === false) {
Log::debug('Confirm account is false, so user will be auto-confirmed.');
Preferences::setForUser($user, 'user_confirmed', true);
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
Preferences::mark();
return;
}
// send email message:
$email = $user->email;
$code = str_random(16);
$route = route('do_confirm_account', [$code]);
// set preferences:
Preferences::setForUser($user, 'user_confirmed', false);
Preferences::setForUser($user, 'user_confirmed_last_mail', time());
Preferences::setForUser($user, 'user_confirmed_code', $code);
Log::debug('Set preferences for user.');
// send email.
try {
Log::debug('Now in try block for user email message thing to ' . $email . '.');
Mail::send(
['emails.confirm-account-html', 'emails.confirm-account'], ['route' => $route, 'ip' => $ipAddress],
function (Message $message) use ($email) {
$message->to($email, $email)->subject('Please confirm your Firefly III account');
}
);
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
} catch (Exception $e) {
Log::debug('Caught general exception.');
Log::error($e->getMessage());
}
Log::debug('Finished mail handling for activation.');
return;
}
}

View File

@@ -0,0 +1,225 @@
<?php
/**
* UserEventHandler.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\Handlers\Events;
use Exception;
use FireflyIII\Events\ConfirmedUser;
use FireflyIII\Events\RegisteredUser;
use FireflyIII\Events\ResentConfirmation;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Mail\Message;
use Log;
use Mail;
use Preferences;
use Session;
use Swift_TransportException;
/**
* Class UserEventHandler
*
* This class responds to any events that have anything to do with the User object.
*
* The method name reflects what is being done. This is in the present tense.
*
*
* @package FireflyIII\Handlers\Events
*/
class UserEventHandler
{
/**
* This method will bestow upon a user the "owner" role if he is the first user in the system.
*
* @param RegisteredUser $event
*
* @return bool
*/
public function attachUserRole(RegisteredUser $event): bool
{
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
// first user ever?
if ($repository->count() === 1) {
$repository->attachRole($event->user, 'owner');
}
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;
}
/**
* This method will send a newly registered user a confirmation message, urging him or her to activate their account.
*
* @param RegisteredUser $event
*
* @return bool
*/
public function sendConfirmationMessage(RegisteredUser $event): bool
{
$user = $event->user;
$ipAddress = $event->ipAddress;
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
if ($confirmAccount === false) {
Preferences::setForUser($user, 'user_confirmed', true);
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
Preferences::mark();
return true;
}
$email = $user->email;
$code = str_random(16);
$route = route('do_confirm_account', [$code]);
Preferences::setForUser($user, 'user_confirmed', false);
Preferences::setForUser($user, 'user_confirmed_last_mail', time());
Preferences::setForUser($user, 'user_confirmed_code', $code);
try {
Mail::send(
['emails.confirm-account-html', 'emails.confirm-account'], ['route' => $route, 'ip' => $ipAddress],
function (Message $message) use ($email) {
$message->to($email, $email)->subject('Please confirm your Firefly III account');
}
);
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
} catch (Exception $e) {
Log::error($e->getMessage());
}
return true;
}
/**
* If the user has somehow lost his or her confirmation message, this event will send it to the user again.
*
* At the moment, this method is exactly the same as the ::sendConfirmationMessage method, but that will change.
*
* @param ResentConfirmation $event
*
* @return bool
*/
function sendConfirmationMessageAgain(ResentConfirmation $event): bool
{
$user = $event->user;
$ipAddress = $event->ipAddress;
$confirmAccount = env('MUST_CONFIRM_ACCOUNT', false);
if ($confirmAccount === false) {
Preferences::setForUser($user, 'user_confirmed', true);
Preferences::setForUser($user, 'user_confirmed_last_mail', 0);
Preferences::mark();
return true;
}
$email = $user->email;
$code = str_random(16);
$route = route('do_confirm_account', [$code]);
Preferences::setForUser($user, 'user_confirmed', false);
Preferences::setForUser($user, 'user_confirmed_last_mail', time());
Preferences::setForUser($user, 'user_confirmed_code', $code);
try {
Mail::send(
['emails.confirm-account-html', 'emails.confirm-account'], ['route' => $route, 'ip' => $ipAddress],
function (Message $message) use ($email) {
$message->to($email, $email)->subject('Please confirm your Firefly III account');
}
);
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
} catch (Exception $e) {
Log::error($e->getMessage());
}
return true;
}
/**
* This method will send the user a registration mail, welcoming him or her to Firefly III.
* This message is only sent when the configuration of Firefly III says so.
*
* @param RegisteredUser $event
*
* @return bool
*/
public function sendRegistrationMail(RegisteredUser $event)
{
$sendMail = env('SEND_REGISTRATION_MAIL', true);
if (!$sendMail) {
return true;
}
// get the email address
$email = $event->user->email;
$address = route('index');
$ipAddress = $event->ipAddress;
// send email.
try {
Mail::send(
['emails.registered-html', 'emails.registered'], ['address' => $address, 'ip' => $ipAddress], function (Message $message) use ($email) {
$message->to($email, $email)->subject('Welcome to Firefly III! ');
}
);
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
return true;
}
/**
* When the user is confirmed, this method stores the IP address of the user
* as a preference. Since this preference cannot be edited, it is effectively hidden
* from the user yet stored conveniently.
*
* @param ConfirmedUser $event
*
* @return bool
*/
public function storeConfirmationIpAddress(ConfirmedUser $event): bool
{
Preferences::setForUser($event->user, 'confirmation_ip_address', $event->ipAddress);
return true;
}
/**
* This message stores the users IP address on registration, in much the same
* fashion as the previous method.
*
* @param RegisteredUser $event
*
* @return bool
*/
public function storeRegistrationIpAddress(RegisteredUser $event): bool
{
Preferences::setForUser($event->user, 'registration_ip_address', $event->ipAddress);
return true;
}
}

View File

@@ -1,33 +0,0 @@
<?php
declare(strict_types = 1);
/**
* UserEventListener.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace FireflyIII\Handlers\Events;
use Session;
/**
* Class UserEventListener
*
* @package FireflyIII\Handlers\Events
*/
class UserEventListener
{
/**
* Handle user logout events.
*/
public function onUserLogout()
{
// dump stuff from the session:
Session::forget('twofactor-authenticated');
Session::forget('twofactor-authenticated-date');
return true;
}
}

View File

@@ -1,18 +1,24 @@
<?php
/**
* AttachmentHelper.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\Attachments;
use Auth;
use Config;
use Crypt;
use FireflyIII\Models\Attachment;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\MessageBag;
use Input;
use Log;
use Storage;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use TypeError;
/**
* Class AttachmentHelper
@@ -39,8 +45,8 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
public function __construct()
{
$this->maxUploadSize = Config::get('firefly.maxUploadSize');
$this->allowedMimes = Config::get('firefly.allowedMimes');
$this->maxUploadSize = config('firefly.maxUploadSize');
$this->allowedMimes = config('firefly.allowedMimes');
$this->errors = new MessageBag;
$this->messages = new MessageBag;
$this->uploadDisk = Storage::disk('upload');
@@ -53,7 +59,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
public function getAttachmentLocation(Attachment $attachment): string
{
$path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';
$path = sprintf('%s%sat-%d.data', storage_path('upload'), DIRECTORY_SEPARATOR, intval($attachment->id));
return $path;
}
@@ -81,26 +87,14 @@ class AttachmentHelper implements AttachmentHelperInterface
*/
public function saveAttachmentsForModel(Model $model): bool
{
$files = null;
try {
if (Input::hasFile('attachments')) {
$files = Input::file('attachments');
}
} catch (TypeError $e) {
// Log it, do nothing else.
Log::error($e->getMessage());
$files = $this->getFiles();
if (!is_null($files) && !is_array($files)) {
$this->processFile($files, $model);
}
if (is_array($files)) {
foreach ($files as $entry) {
if (!is_null($entry)) {
$this->processFile($entry, $model);
}
}
} else {
if (!is_null($files)) {
$this->processFile($files, $model);
}
$this->processFiles($files, $model);
}
return true;
@@ -117,7 +111,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$md5 = md5_file($file->getRealPath());
$name = $file->getClientOriginalName();
$class = get_class($model);
$count = Auth::user()->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count();
$count = auth()->user()->attachments()->where('md5', $md5)->where('attachable_id', $model->id)->where('attachable_type', $class)->count();
if ($count > 0) {
$msg = (string)trans('validation.file_already_attached', ['name' => $name]);
@@ -144,7 +138,7 @@ class AttachmentHelper implements AttachmentHelperInterface
}
$attachment = new Attachment; // create Attachment object.
$attachment->user()->associate(Auth::user());
$attachment->user()->associate(auth()->user());
$attachment->attachable()->associate($model);
$attachment->md5 = md5_file($file->getRealPath());
$attachment->filename = $file->getClientOriginalName();
@@ -234,5 +228,36 @@ class AttachmentHelper implements AttachmentHelperInterface
return true;
}
/**
* @return array|null|UploadedFile
*/
private function getFiles()
{
$files = null;
if (Input::hasFile('attachments')) {
$files = Input::file('attachments');
}
return $files;
}
/**
* @param array $files
*
* @param Model $model
*
* @return bool
*/
private function processFiles(array $files, Model $model): bool
{
foreach ($files as $entry) {
if (!is_null($entry)) {
$this->processFile($entry, $model);
}
}
return true;
}
}

View File

@@ -1,4 +1,14 @@
<?php
/**
* AttachmentHelperInterface.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\Attachments;

View File

@@ -1,11 +1,20 @@
<?php
/**
* Account.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;
/**
* @codeCoverageIgnore
* Class Account
*
* @package FireflyIII\Helpers\Collection

View File

@@ -1,11 +1,20 @@
<?php
/**
* Balance.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;
/**
* @codeCoverageIgnore
*
* Class Balance
*
@@ -60,5 +69,13 @@ class Balance
return $this->balanceLines;
}
/**
* @param Collection $balanceLines
*/
public function setBalanceLines(Collection $balanceLines)
{
$this->balanceLines = $balanceLines;
}
}

View File

@@ -1,11 +1,20 @@
<?php
/**
* BalanceEntry.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\Account as AccountModel;
/**
* @codeCoverageIgnore
*
* Class BalanceEntry
*

View File

@@ -1,4 +1,14 @@
<?php
/**
* BalanceHeader.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;
@@ -6,7 +16,6 @@ use FireflyIII\Models\Account as AccountModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class BalanceHeader
*

View File

@@ -1,12 +1,22 @@
<?php
/**
* BalanceLine.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 Carbon\Carbon;
use FireflyIII\Models\Budget as BudgetModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class BalanceLine
*
@@ -24,9 +34,12 @@ class BalanceLine
/** @var BudgetModel */
protected $budget;
/** @var Carbon */
protected $endDate;
/** @var int */
protected $role = self::ROLE_DEFAULTROLE;
/** @var Carbon */
protected $startDate;
/**
*
@@ -77,6 +90,22 @@ class BalanceLine
$this->budget = $budget;
}
/**
* @return Carbon
*/
public function getEndDate()
{
return $this->endDate;
}
/**
* @param Carbon $endDate
*/
public function setEndDate($endDate)
{
$this->endDate = $endDate;
}
/**
* @return int
*/
@@ -93,6 +122,22 @@ class BalanceLine
$this->role = $role;
}
/**
* @return Carbon
*/
public function getStartDate()
{
return $this->startDate;
}
/**
* @param Carbon $startDate
*/
public function setStartDate($startDate)
{
$this->startDate = $startDate;
}
/**
* @return string
*/

View File

@@ -1,4 +1,14 @@
<?php
/**
* Bill.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;
@@ -6,7 +16,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
* Class Bill
*
* @package FireflyIII\Helpers\Collection

View File

@@ -1,11 +1,20 @@
<?php
/**
* BillLine.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\Bill as BillModel;
/**
* @codeCoverageIgnore
*
* Class BillLine
*
@@ -111,7 +120,7 @@ class BillLine
}
/**
* @return boolean
* @return bool
*/
public function isActive(): bool
{
@@ -127,7 +136,7 @@ class BillLine
}
/**
* @return boolean
* @return bool
*/
public function isHit(): bool
{
@@ -142,5 +151,4 @@ class BillLine
$this->hit = $hit;
}
}

View File

@@ -1,11 +1,20 @@
<?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;
/**
* @codeCoverageIgnore
*
* Class Budget
*
@@ -34,46 +43,66 @@ class Budget
/**
* @param BudgetLine $budgetLine
*
* @return Budget
*/
public function addBudgetLine(BudgetLine $budgetLine)
public function addBudgetLine(BudgetLine $budgetLine): Budget
{
$this->budgetLines->push($budgetLine);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addBudgeted(string $add)
public function addBudgeted(string $add): Budget
{
$add = strval(round($add, 2));
$this->budgeted = bcadd($this->budgeted, $add);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addLeft(string $add)
public function addLeft(string $add): Budget
{
$add = strval(round($add, 2));
$this->left = bcadd($this->left, $add);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addOverspent(string $add)
public function addOverspent(string $add): Budget
{
$add = strval(round($add, 2));
$this->overspent = bcadd($this->overspent, $add);
return $this;
}
/**
* @param string $add
*
* @return Budget
*/
public function addSpent(string $add)
public function addSpent(string $add): Budget
{
$add = strval(round($add, 2));
$this->spent = bcadd($this->spent, $add);
return $this;
}
/**
@@ -94,10 +123,14 @@ class Budget
/**
* @param string $budgeted
*
* @return Budget
*/
public function setBudgeted(string $budgeted)
public function setBudgeted(string $budgeted): Budget
{
$this->budgeted = $budgeted;
return $this;
}
/**
@@ -110,10 +143,14 @@ class Budget
/**
* @param string $left
*
* @return Budget
*/
public function setLeft(string $left)
public function setLeft(string $left): Budget
{
$this->left = $left;
return $this;
}
/**
@@ -126,10 +163,14 @@ class Budget
/**
* @param string $overspent
*
* @return Budget
*/
public function setOverspent(string $overspent)
public function setOverspent(string $overspent): Budget
{
$this->overspent = strval(round($overspent, 2));
return $this;
}
/**
@@ -142,10 +183,14 @@ class Budget
/**
* @param string $spent
*
* @return Budget
*/
public function setSpent(string $spent)
public function setSpent(string $spent): Budget
{
$this->spent = strval(round($spent, 2));
return $this;
}

View File

@@ -1,4 +1,14 @@
<?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;
@@ -6,7 +16,6 @@ use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
/**
* @codeCoverageIgnore
*
* Class BudgetLine
*
@@ -38,10 +47,14 @@ class BudgetLine
/**
* @param BudgetModel $budget
*
* @return BudgetLine
*/
public function setBudget(BudgetModel $budget)
public function setBudget(BudgetModel $budget): BudgetLine
{
$this->budget = $budget;
return $this;
}
/**
@@ -54,10 +67,14 @@ class BudgetLine
/**
* @param string $budgeted
*
* @return BudgetLine
*/
public function setBudgeted(string $budgeted)
public function setBudgeted(string $budgeted): BudgetLine
{
$this->budgeted = $budgeted;
return $this;
}
/**
@@ -70,10 +87,14 @@ class BudgetLine
/**
* @param string $left
*
* @return BudgetLine
*/
public function setLeft(string $left)
public function setLeft(string $left): BudgetLine
{
$this->left = $left;
return $this;
}
/**
@@ -86,10 +107,14 @@ class BudgetLine
/**
* @param string $overspent
*
* @return BudgetLine
*/
public function setOverspent(string $overspent)
public function setOverspent(string $overspent): BudgetLine
{
$this->overspent = $overspent;
return $this;
}
/**
@@ -102,10 +127,14 @@ class BudgetLine
/**
* @param LimitRepetition $repetition
*
* @return BudgetLine
*/
public function setRepetition(LimitRepetition $repetition)
public function setRepetition(LimitRepetition $repetition): BudgetLine
{
$this->repetition = $repetition;
return $this;
}
/**
@@ -118,10 +147,14 @@ class BudgetLine
/**
* @param string $spent
*
* @return BudgetLine
*/
public function setSpent(string $spent)
public function setSpent(string $spent): BudgetLine
{
$this->spent = $spent;
return $this;
}

View File

@@ -1,4 +1,14 @@
<?php
/**
* Category.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;
@@ -7,7 +17,6 @@ use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Category
*

View File

@@ -1,14 +1,21 @@
<?php
/**
* Expense.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 Crypt;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use stdClass;
/**
* @codeCoverageIgnore
*
* Class Expense
*
@@ -30,30 +37,11 @@ class Expense
}
/**
* @param TransactionJournal $entry
* @param stdClass $entry
*/
public function addOrCreateExpense(TransactionJournal $entry)
public function addOrCreateExpense(stdClass $entry)
{
$accountId = $entry->account_id;
$amount = strval(round($entry->journalAmount, 2));
if (bccomp('0', $amount) === -1) {
$amount = bcmul($amount, '-1');
}
if (!$this->expenses->has($accountId)) {
$newObject = new stdClass;
$newObject->amount = $amount;
$newObject->name = Crypt::decrypt($entry->account_name);
$newObject->count = 1;
$newObject->id = $accountId;
$this->expenses->put($accountId, $newObject);
} else {
$existing = $this->expenses->get($accountId);
$existing->amount = bcadd($existing->amount, $amount);
$existing->count++;
$this->expenses->put($accountId, $existing);
}
$this->expenses->put($entry->id, $entry);
}
/**
@@ -61,8 +49,6 @@ class Expense
*/
public function addToTotal(string $add)
{
$add = strval(round($add, 2));
if (bccomp('0', $add) === -1) {
$add = bcmul($add, '-1');

View File

@@ -1,14 +1,21 @@
<?php
/**
* Income.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 Crypt;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use stdClass;
/**
* @codeCoverageIgnore
*
* Class Income
*
@@ -31,25 +38,12 @@ class Income
}
/**
* @param TransactionJournal $entry
* @param stdClass $entry
*/
public function addOrCreateIncome(TransactionJournal $entry)
public function addOrCreateIncome(stdClass $entry)
{
$this->incomes->put($entry->id, $entry);
$accountId = $entry->account_id;
if (!$this->incomes->has($accountId)) {
$newObject = new stdClass;
$newObject->amount = strval(round($entry->journalAmount, 2));
$newObject->name = Crypt::decrypt($entry->account_name);
$newObject->count = 1;
$newObject->id = $accountId;
$this->incomes->put($accountId, $newObject);
} else {
$existing = $this->incomes->get($accountId);
$existing->amount = bcadd($existing->amount, $entry->journalAmount);
$existing->count++;
$this->incomes->put($accountId, $existing);
}
}
/**

View File

@@ -0,0 +1,485 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collector;
use Carbon\Carbon;
use Crypt;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\Tag;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\User;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Pagination\LengthAwarePaginator;
use Illuminate\Support\Collection;
use Log;
/**
* Maybe this is a good idea after all...
*
* Class JournalCollector
*
* @package FireflyIII\Helpers\Collector
*/
class JournalCollector
{
/** @var int */
private $count = 0;
/** @var array */
private $fields
= [
'transaction_journals.id as journal_id',
'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',
'transactions.id as id',
'transactions.amount as transaction_amount',
'transactions.description as transaction_description',
'transactions.account_id',
'transactions.identifier',
'transactions.transaction_journal_id',
'accounts.name as account_name',
'accounts.encrypted as account_encrypted',
'account_types.type as account_type',
];
/** @var bool */
private $filterTransfers = false;
/** @var bool */
private $joinedBudget = false;
/** @var bool */
private $joinedCategory = false;
/** @var bool */
private $joinedTag = false;
/** @var int */
private $limit;
/** @var int */
private $offset;
/** @var int */
private $page = 1;
/** @var EloquentBuilder */
private $query;
/** @var bool */
private $run = false;
/** @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
*/
public function count(): int
{
if ($this->run === true) {
throw new FireflyException('Cannot count after run in JournalCollector.');
}
$countQuery = clone $this->query;
// dont need some fields:
$countQuery->getQuery()->limit = null;
$countQuery->getQuery()->offset = null;
$countQuery->getQuery()->unionLimit = null;
$countQuery->getQuery()->groups = null;
$countQuery->getQuery()->orders = null;
$countQuery->groupBy('accounts.user_id');
$this->count = $countQuery->count();
return $this->count;
}
/**
* @return Collection
*/
public function getJournals(): Collection
{
$this->run = true;
$set = $this->query->get(array_values($this->fields));
$set = $this->filterTransfers($set);
// loop for decryption.
$set->each(
function (Transaction $transaction) {
$transaction->date = new Carbon($transaction->date);
$transaction->description = intval($transaction->encrypted) === 1 ? Crypt::decrypt($transaction->description) : $transaction->description;
$transaction->bill_name = !is_null($transaction->bill_name) ? Crypt::decrypt($transaction->bill_name) : '';
}
);
return $set;
}
/**
* @return LengthAwarePaginator
* @throws FireflyException
*/
public function getPaginatedJournals():LengthAwarePaginator
{
if ($this->run === true) {
throw new FireflyException('Cannot getPaginatedJournals after run in JournalCollector.');
}
$this->count();
$set = $this->getJournals();
$journals = new LengthAwarePaginator($set, $this->count, $this->limit, $this->page);
return $journals;
}
/**
* @param Collection $accounts
*
* @return JournalCollector
*/
public function setAccounts(Collection $accounts): JournalCollector
{
if ($accounts->count() > 0) {
$accountIds = $accounts->pluck('id')->toArray();
$this->query->whereIn('transactions.account_id', $accountIds);
}
if ($accounts->count() > 1) {
$this->filterTransfers = true;
}
return $this;
}
/**
* @return JournalCollector
*/
public function setAllAssetAccounts(): JournalCollector
{
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class, [$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);
}
if ($accounts->count() > 1) {
$this->filterTransfers = true;
}
return $this;
}
/**
* @param Collection $bills
*
* @return JournalCollector
*/
public function setBills(Collection $bills): JournalCollector
{
if ($bills->count() > 0) {
$billIds = $bills->pluck('id')->toArray();
$this->query->whereIn('transaction_journals.bill_id', $billIds);
}
return $this;
}
/**
* @param Budget $budget
*
* @return JournalCollector
*/
public function setBudget(Budget $budget): JournalCollector
{
$this->joinBudgetTables();
$this->query->where(
function (EloquentBuilder $q) use ($budget) {
$q->where('budget_transaction.budget_id', $budget->id);
$q->orWhere('budget_transaction_journal.budget_id', $budget->id);
}
);
return $this;
}
/**
* @param Category $category
*
* @return JournalCollector
*/
public function setCategory(Category $category): JournalCollector
{
$this->joinCategoryTables();
$this->query->where(
function (EloquentBuilder $q) use ($category) {
$q->where('category_transaction.category_id', $category->id);
$q->orWhere('category_transaction_journal.category_id', $category->id);
}
);
return $this;
}
/**
* @param int $limit
*
* @return JournalCollector
*/
public function setLimit(int $limit): JournalCollector
{
$this->limit = $limit;
$this->query->limit($limit);
Log::debug(sprintf('Set limit to %d', $limit));
return $this;
}
/**
* @param int $offset
*
* @return JournalCollector
*/
public function setOffset(int $offset): JournalCollector
{
$this->offset = $offset;
return $this;
}
/**
* @param int $page
*
* @return JournalCollector
*/
public function setPage(int $page): JournalCollector
{
$this->page = $page;
if ($page > 0) {
$page--;
}
Log::debug(sprintf('Page is %d', $page));
if (!is_null($this->limit)) {
$offset = ($this->limit * $page);
$this->offset = $offset;
$this->query->skip($offset);
Log::debug(sprintf('Changed offset to %d', $offset));
}
if (is_null($this->limit)) {
Log::debug('The limit is zero, cannot set the page.');
}
return $this;
}
/**
* @param Carbon $start
* @param Carbon $end
*
* @return JournalCollector
*/
public function setRange(Carbon $start, Carbon $end): JournalCollector
{
if ($start <= $end) {
$this->query->where('transaction_journals.date', '>=', $start->format('Y-m-d'));
$this->query->where('transaction_journals.date', '<=', $end->format('Y-m-d'));
}
return $this;
}
/**
* @param Tag $tag
*
* @return JournalCollector
*/
public function setTag(Tag $tag): JournalCollector
{
$this->joinTagTables();
$this->query->where('tag_transaction_journal.tag_id', $tag->id);
return $this;
}
/**
* @param array $types
*
* @return JournalCollector
*/
public function setTypes(array $types): JournalCollector
{
if (count($types) > 0) {
$this->query->whereIn('transaction_types.type', $types);
}
return $this;
}
/**
* @return JournalCollector
*/
public function withoutBudget(): JournalCollector
{
$this->joinBudgetTables();
$this->query->where(
function (EloquentBuilder $q) {
$q->whereNull('budget_transaction.budget_id');
$q->whereNull('budget_transaction_journal.budget_id');
}
);
return $this;
}
/**
* @return JournalCollector
*/
public function withoutCategory(): JournalCollector
{
$this->joinCategoryTables();
$this->query->where(
function (EloquentBuilder $q) {
$q->whereNull('category_transaction.category_id');
$q->whereNull('category_transaction_journal.category_id');
}
);
return $this;
}
/**
* If the set of accounts used by the collector includes more than one asset
* 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.
*
* @param Collection $set
*
* @return Collection
*/
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;
}
);
}
return $set;
}
/**
*
*/
private function joinBudgetTables()
{
if (!$this->joinedBudget) {
// join some extra tables:
$this->joinedBudget = true;
$this->query->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
$this->query->leftJoin('budget_transaction', 'budget_transaction.transaction_id', '=', 'transactions.id');
}
}
/**
*
*/
private function joinCategoryTables()
{
if (!$this->joinedCategory) {
// join some extra tables:
$this->joinedCategory = true;
$this->query->leftJoin('category_transaction_journal', 'category_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
$this->query->leftJoin('category_transaction', 'category_transaction.transaction_id', '=', 'transactions.id');
}
}
/**
*
*/
private function joinTagTables()
{
if (!$this->joinedTag) {
// join some extra tables:
$this->joinedTag = true;
$this->query->leftJoin('tag_transaction_journal', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
}
}
/**
* @return EloquentBuilder
*/
private function startQuery(): EloquentBuilder
{
$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

@@ -1,35 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AccountId
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class AccountId extends BasicConverter implements ConverterInterface
{
/**
* @return Account
*/
public function convert(): Account
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
/** @var Account $account */
$account = $repository->find($this->mapped[$this->index][$this->value]);
} else {
/** @var Account $account */
$account = $repository->find($this->value);
}
return $account;
}
}

View File

@@ -1,24 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**
* Class Amount
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class Amount extends BasicConverter implements ConverterInterface
{
/**
* @return string
*/
public function convert(): string
{
if (is_numeric($this->value)) {
return strval($this->value);
}
return '0';
}
}

View File

@@ -1,28 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**
* Class AmountComma
*
* Parses the input as the amount with a comma as decimal separator
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class AmountComma extends BasicConverter implements ConverterInterface
{
/**
* @return float|int
*/
public function convert()
{
$value = str_replace(',', '.', strval($this->value));
if (is_numeric($value)) {
return strval($value);
}
return '0';
}
}

View File

@@ -1,67 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountIban
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class AssetAccountIban extends BasicConverter implements ConverterInterface
{
/**
* @return Account
*/
public function convert(): Account
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
}
if (strlen($this->value) > 0) {
// find or create new account:
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->iban == $this->value) {
return $entry;
}
}
// create it if doesn't exist.
$accountData = [
'name' => $this->value,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => null,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
return $account;
}
return new Account;
}
}

View File

@@ -1,64 +0,0 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountName
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class AssetAccountName extends BasicConverter implements ConverterInterface
{
/**
* @return Account|null
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
}
// find or create new account:
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->name == $this->value) {
return $entry;
}
}
// create it if doesnt exist.
$accountData = [
'name' => $this->value,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => null,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
return $account;
}
}

View File

@@ -1,79 +0,0 @@
<?php
declare(strict_types = 1);
/**
* AssetAccountNumber.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountNumber
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class AssetAccountNumber extends BasicConverter implements ConverterInterface
{
/**
* @return Account|null
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
}
// if not, search for it (or create it):
$value = $this->value ?? '';
if (strlen($value) > 0) {
// find or create new account:
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
$accountNumber = $entry->getMeta('accountNumber');
if ($accountNumber == $this->value) {
return $entry;
}
}
$accountData = [
'name' => $this->value,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => null,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
return $account;
}
return null; // is this accepted?
}
}

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