Compare commits

...

585 Commits
3.7.2 ... 3.8.2

Author SHA1 Message Date
James Cole
a6936cbd02 Merge branch 'release/3.8.2' 2016-04-03 16:47:54 +02:00
James Cole
3be84d76ef Updated composer.lock and other files. [skip ci] 2016-04-03 16:47:27 +02:00
James Cole
9aed1f344f Code cleanup. 2016-04-03 15:47:00 +02:00
James Cole
4fff264630 New translations. 2016-04-03 15:45:41 +02:00
James Cole
2e444da2a3 Better titles. 2016-04-03 14:55:56 +02:00
James Cole
7a216f95ca Add sum. 2016-04-03 14:38:12 +02:00
James Cole
f22a9799a1 Hide some fields. 2016-04-03 14:01:27 +02:00
James Cole
90bdc40393 Fixed balance list. 2016-04-03 13:56:06 +02:00
James Cole
622a97c8d8 Category information. #159 2016-04-03 11:20:55 +02:00
James Cole
03691c81c2 More code for #159 [skip ci] 2016-04-03 11:14:36 +02:00
James Cole
885b56c465 More code for #159 2016-04-03 11:07:51 +02:00
James Cole
23cc7be231 More things [skip ci] 2016-04-03 10:51:37 +02:00
James Cole
bb82b0eb79 Better view for admin [skip ci] 2016-04-03 10:42:46 +02:00
James Cole
2e05f640b8 Title in guest view [skip ci] 2016-04-03 10:35:54 +02:00
James Cole
697a02ffee Page titles. 2016-04-03 10:34:42 +02:00
James Cole
ad402021ed Basic user admin. 2016-04-03 07:07:17 +02:00
James Cole
67caf6ef1f Code cleanup [skip ci] 2016-04-01 16:46:11 +02:00
James Cole
3277858c5a Code cleanup. [skip ci] 2016-04-01 16:44:46 +02:00
James Cole
3fbedf323f Fix list for no budget #159 2016-04-01 16:23:12 +02:00
James Cole
144a6130f2 First code for #159 popups 2016-04-01 16:06:55 +02:00
James Cole
fa38c975b6 New converters for #180 (Tag and accounts) 2016-04-01 14:17:12 +02:00
James Cole
c14fa1021c New converters for #180 (Currency) 2016-04-01 14:10:08 +02:00
James Cole
5e78cc02bd New converters for #180 (Category and some other stuff) 2016-04-01 13:23:12 +02:00
James Cole
429ef80fb9 New converters for #180 (Budget) 2016-04-01 13:17:07 +02:00
James Cole
e4d93cad27 New converters for #180 (Bill) 2016-04-01 13:07:19 +02:00
James Cole
d9a4840e37 New converters for #180 2016-04-01 13:03:38 +02:00
James Cole
a93070b98d Fixes #234. 2016-04-01 09:13:50 +02:00
James Cole
c05a942862 This fixes a null pointer exception. [skip ci] 2016-04-01 05:36:29 +02:00
James Cole
f9a7879c1e Damn git. 2016-03-30 17:51:40 +02:00
James Cole
bdfbc6d6a7 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  New activation message
2016-03-30 17:48:59 +02:00
James Cole
21181d8d8e Fixes for #233 2016-03-30 17:47:13 +02:00
James Cole
1c7a27b816 New activation message 2016-03-30 12:46:51 +02:00
James Cole
e953f58c74 Merge branch 'release/3.8.1' into develop 2016-03-29 17:42:45 +02:00
James Cole
9250cee9e7 Merge branch 'release/3.8.1' 2016-03-29 17:42:44 +02:00
James Cole
bb075d15ff Add warning about PHP 7.0 2016-03-29 17:42:32 +02:00
James Cole
a31f16bba7 Change log for 3.8.1 [skip ci] 2016-03-29 17:41:43 +02:00
James Cole
88a41c37f3 Bug fix, thank you scrutiniser. 2016-03-29 17:18:42 +02:00
James Cole
d21885ca98 New translations. 2016-03-29 16:38:42 +02:00
James Cole
d774f8e870 Code cleanup. 2016-03-29 16:17:06 +02:00
James Cole
08b5e66628 Some code cleanup. 2016-03-29 16:16:14 +02:00
James Cole
6fdfec3967 Clean up some code. 2016-03-29 16:13:36 +02:00
James Cole
ab4616a3ad Make some vars longer. 2016-03-29 16:10:51 +02:00
James Cole
cb34ff4c83 Clean up some code. 2016-03-29 16:02:54 +02:00
James Cole
bdbead256c Make field a number. 2016-03-29 16:02:09 +02:00
James Cole
f200086d01 Code for #207 2016-03-29 15:55:14 +02:00
James Cole
ef97c3b42d Some new help text for bills. #207 2016-03-29 15:33:09 +02:00
James Cole
ed8b41e8ec Add source account to scan, see issue #226 2016-03-29 15:24:40 +02:00
James Cole
aada3371b7 Better translations for dates and so on. 2016-03-29 15:09:37 +02:00
James Cole
38a9782bdf Debug. 2016-03-29 13:55:57 +02:00
James Cole
c6ac81dcf6 Some more confirmation things. 2016-03-29 13:52:51 +02:00
James Cole
2d3f3f0fde Updated the routes. 2016-03-29 13:45:18 +02:00
James Cole
993a2c7823 New middleware. 2016-03-29 12:23:10 +02:00
James Cole
87b36cf7e3 Update 2FA and account activation 2016-03-29 12:14:01 +02:00
James Cole
742f2c8d9f New middle ware for user activation. 2016-03-29 11:55:49 +02:00
James Cole
0d7ac5f1d8 Move some routes around. 2016-03-29 11:55:38 +02:00
James Cole
3adccff611 New events and their handlers for user activation and other things. 2016-03-29 11:55:25 +02:00
James Cole
08b8bd27f9 Expand Preferences to handle not logged in users. 2016-03-29 11:55:02 +02:00
James Cole
1059c7e2be Updated config for user activation. 2016-03-29 11:54:50 +02:00
James Cole
3ebcd5f738 New translations for user activation. 2016-03-29 11:54:36 +02:00
James Cole
4627ea1dec Updated views for user activation. 2016-03-29 11:54:26 +02:00
James Cole
7ed24e78d5 New emails for the activation. 2016-03-29 11:48:29 +02:00
James Cole
ae02e3fd8d New example configuration that includes user account activation (disabled by default). 2016-03-29 11:46:21 +02:00
James Cole
cc88d5962e Move code to event handlers instead of registration routine. 2016-03-28 19:50:24 +02:00
James Cole
70c8a524cd Should fix the tests 2016-03-22 17:22:48 +01:00
James Cole
9a8efc8a58 Info in tags for #159 2016-03-22 16:59:29 +01:00
James Cole
f0f67b87c4 Code for #159 2016-03-22 16:57:26 +01:00
James Cole
1a3ec98896 Give all icons some context, no value yet. 2016-03-22 16:55:04 +01:00
James Cole
efff44cba9 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  Fix link to non-existing budget
2016-03-22 16:54:31 +01:00
James Cole
7227418c4c More fine-grained cookie control. 2016-03-22 15:04:51 +01:00
James Cole
29f93a9b73 Fix link to non-existing budget 2016-03-22 09:04:32 +01:00
James Cole
532aa2acd0 Fix amount [skip ci] 2016-03-21 19:29:24 +01:00
James Cole
6aca410f37 Fix amount [skip ci] 2016-03-21 19:28:22 +01:00
James Cole
f20656b516 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  Fix for #227
2016-03-21 19:27:13 +01:00
James Cole
bcd7866e10 For debug, add float. [skip ci] 2016-03-21 19:24:15 +01:00
James Cole
c1b8d44209 Small various fixes. 2016-03-21 19:22:37 +01:00
James Cole
50e947fbbe Fix for #227 2016-03-21 08:48:36 +01:00
James Cole
189d969ee6 Include "no budget" thing for issue #152 2016-03-20 20:06:05 +01:00
James Cole
201790ff8d Cleanup transaction journal edit. #215 2016-03-20 17:12:34 +01:00
James Cole
cc26ce4143 Some scrutiniser related code cleanup. 2016-03-20 16:49:49 +01:00
James Cole
745e0aa525 Move to object held user object. 2016-03-20 16:47:53 +01:00
James Cole
6602b1587a Some scrutiniser related code cleanup. 2016-03-20 16:46:26 +01:00
James Cole
6698b57f52 Fixed a bug that would leave all amounts at zero. #224 2016-03-20 16:41:48 +01:00
James Cole
628268d47c Code to fix #223 2016-03-20 11:47:10 +01:00
James Cole
56a635212a Code for #155 2016-03-20 11:46:27 +01:00
James Cole
7e67eb17e0 All new translations for #218 2016-03-20 11:38:01 +01:00
James Cole
935d72d672 New English text for issue #218 2016-03-20 11:36:50 +01:00
James Cole
fccb510186 Merge pull request #222 from eddyh/patch-1
Fixed small typo.
2016-03-20 11:34:58 +01:00
Edwin
e7ea0dc842 Fixed small typo. 2016-03-19 18:45:12 +01:00
James Cole
a40d6b0649 Merge branch 'master' into develop
* master:
  Code cleanup [skip ci]
  Quick bug fix.
2016-03-19 17:40:24 +01:00
James Cole
b7429a358f Code cleanup [skip ci] 2016-03-19 17:34:37 +01:00
James Cole
cf8b4e2f76 Quick bug fix. 2016-03-19 17:34:02 +01:00
James Cole
48c865e57a Merge branch 'hotfix/account-repos' into develop 2016-03-19 17:28:16 +01:00
James Cole
059764cd23 Merge branch 'hotfix/account-repos' 2016-03-19 17:28:15 +01:00
James Cole
c205eee6fd Something went wrong. 2016-03-19 17:28:04 +01:00
James Cole
7b22099608 Merge branch 'release/3.8.0'
Conflicts:
	app/Repositories/Account/AccountRepository.php
2016-03-19 17:17:06 +01:00
James Cole
b56b42d6fb Final change log. 2016-03-19 17:15:19 +01:00
James Cole
ef6ef57e67 Various code cleanup things. 2016-03-19 16:51:52 +01:00
James Cole
47d3cf1d45 Updated composer. 2016-03-19 16:50:01 +01:00
James Cole
9cfac9a884 New translations. #219 2016-03-19 16:47:29 +01:00
James Cole
dc172476e1 Make sure the two factor auth pages are not accessible when already authenticated using two factor. 2016-03-19 16:29:01 +01:00
James Cole
6fc7763380 New routes for #219 2016-03-19 16:25:24 +01:00
James Cole
ce45f21dba Translated stuff. #219 2016-03-19 16:25:16 +01:00
James Cole
2de713c946 New language stuff. #219 2016-03-19 16:25:05 +01:00
James Cole
3d1dfe20b3 Listen to the logout event. #219 2016-03-19 16:24:47 +01:00
James Cole
0404735ccb This is the cleaned up version of the controller #219 2016-03-19 16:24:35 +01:00
James Cole
83f200f5a2 This is the two factor middleware. #219 2016-03-19 16:23:09 +01:00
James Cole
a29eb9b993 This is the controller for two factor authentication. #219 2016-03-19 16:22:57 +01:00
James Cole
c939be97fb These are some new middleware groups required to call the two factor auth routines at the right moments. 2016-03-19 16:22:20 +01:00
James Cole
f31e62a532 This is a routine that will remove all two-factor related information from the session, when the user logs out. See issue #219 2016-03-19 16:21:50 +01:00
James Cole
34c195159e Clean mail message for blocked users. 2016-03-19 11:32:23 +01:00
James Cole
322fef2db1 Removed most logging. 2016-03-19 11:25:11 +01:00
James Cole
7aa2565e89 Fixed a bug where profiled account names would not get strtolower() and thus match nothing. Thanks to Tweakers.net user "doeners" 2016-03-19 11:23:23 +01:00
James Cole
8f3572f2d3 Correctly save 2fa secret. 2016-03-19 07:59:55 +01:00
James Cole
fb165ef28b Do not give the user the secret. 2016-03-19 07:56:57 +01:00
James Cole
a26acf4a25 Clean up mail thing. 2016-03-18 20:30:07 +01:00
James Cole
645400e17f Clean up mail thing. 2016-03-18 20:29:51 +01:00
James Cole
ccad52b80f Fix opening balance bug #214 2016-03-18 16:29:08 +01:00
James Cole
f6303deaa4 Error when blocked user logs in 2016-03-18 11:22:58 +01:00
James Cole
d3a3083b85 Error when blocked user logs in 2016-03-18 11:20:54 +01:00
James Cole
99452056ec Error when blocked user logs in 2016-03-18 11:19:22 +01:00
James Cole
fca21bab4d Error when blocked user logs in 2016-03-18 11:16:05 +01:00
James Cole
9c58b77f01 Error when blocked user logs in 2016-03-18 11:10:51 +01:00
James Cole
b5c5f67fcc Catch possible NULL 2016-03-18 10:53:59 +01:00
James Cole
0f17423465 Fix chart money format 2016-03-18 09:57:18 +01:00
James Cole
f093e29bd1 Removed the last floatvals. 2016-03-16 17:48:07 +01:00
James Cole
fe9b8e834d Change the precision. Should not influence anything. 2016-03-16 17:47:07 +01:00
James Cole
64f273120e Make sure that charts work when Firefly III is in a subdirectory. Thx to @xnyhps. 2016-03-16 17:28:04 +01:00
James Cole
31c1dd466b Merge pull request #217 from JC5/revert-216-fix-absolute-urls-report
Revert "Fix use of absolute URLs for linecharts for the report pages."
2016-03-16 17:26:06 +01:00
James Cole
99b369bf45 Revert "Fix use of absolute URLs for linecharts for the report pages." 2016-03-16 17:25:57 +01:00
James Cole
e2a1535c44 Merge pull request #216 from xnyhps/fix-absolute-urls-report
Fix use of absolute URLs for linecharts for the report pages.
2016-03-16 17:25:53 +01:00
Thijs Alkemade
3dfa88020e Fix use of absolute URLs for linecharts for the report pages. 2016-03-16 11:46:12 +01:00
James Cole
a220094941 Remove param doc. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-14 21:03:35 +01:00
James Cole
ababdacf89 Some code cleanup
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-14 20:53:56 +01:00
James Cole
114dd5fc2a Rename method.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-14 20:52:08 +01:00
James Cole
c058629172 Small bug fixes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-14 20:51:34 +01:00
James Cole
79d7f577e4 Small bug fixes.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-14 20:50:19 +01:00
James Cole
631bafc6ab Small bug fixes. 2016-03-14 20:47:13 +01:00
James Cole
be58da539e Fix various small issues. 2016-03-14 20:38:23 +01:00
James Cole
a508ac9dda Update composer.lock 2016-03-14 20:20:12 +01:00
James Cole
538fd2cef0 Add upgrade warning. 2016-03-14 20:15:29 +01:00
James Cole
42557446a1 New change log file 2016-03-14 20:13:27 +01:00
James Cole
b9586481fc Translate some help text. 2016-03-14 19:46:42 +01:00
James Cole
a0434e3271 Disable audit reports for now. [skip ci] 2016-03-14 19:42:05 +01:00
James Cole
15a5bcc21a Clean up some views 2016-03-14 17:18:28 +01:00
James Cole
edb838045b Update composer [skip ci] 2016-03-13 19:36:49 +01:00
James Cole
41a2e657b1 Cleaned up translation files. 2016-03-13 17:19:09 +01:00
James Cole
18b80a69c2 PHP 7 badge [skip ci] 2016-03-12 14:30:21 +01:00
James Cole
ce80fb39e8 Fix for #185 2016-03-12 14:20:45 +01:00
James Cole
2f19ff314b Fix for #185 2016-03-12 14:18:28 +01:00
James Cole
a0fd4b505a Fix for #185 2016-03-12 11:07:54 +01:00
James Cole
919aa70251 Account controller #185 2016-03-12 11:05:26 +01:00
James Cole
1aea4045a3 Fixes #151 2016-03-12 07:44:20 +01:00
James Cole
4cded0bf57 New translations for #122 2016-03-12 07:39:11 +01:00
James Cole
cd0585c7c4 Views will show new dates #122 2016-03-12 07:37:36 +01:00
James Cole
8281279452 Repository will store edits/ new journals #122 2016-03-12 07:37:26 +01:00
James Cole
8f1bf846fe Journal allows date edits and sets fields as dates #122 2016-03-12 07:37:13 +01:00
James Cole
c26bf557d0 Controller can let you edit new dates #122 2016-03-12 07:37:00 +01:00
James Cole
499b92cdd1 Journal request can handle new dates #122 2016-03-12 07:36:49 +01:00
James Cole
3dce5e162f New field for #122 2016-03-12 07:36:35 +01:00
James Cole
f9de65c035 Expand phpdoc. 2016-03-12 07:36:23 +01:00
James Cole
6f95e9a3cb Fix some decrypt bugs. 2016-03-12 07:17:00 +01:00
James Cole
ce09da084c Add account number to export #107 2016-03-12 07:16:42 +01:00
James Cole
5d50f92dd3 Issue #208 2016-03-12 07:04:47 +01:00
James Cole
d054e085d6 This will make triggers check existing fields first. 2016-03-12 07:02:39 +01:00
James Cole
59cdfa6fe6 Fix #211 2016-03-12 06:58:39 +01:00
James Cole
ee0e9011b2 Fixes bug #213 2016-03-11 19:20:31 +01:00
James Cole
654ebe0c48 Whoops, forgot the brackets. 2016-03-07 21:39:50 +01:00
James Cole
a40859c0bb Make opening balance not click-able. 2016-03-07 21:39:08 +01:00
James Cole
74e3f6dee5 Updated composer.lock
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-07 21:06:18 +01:00
James Cole
e553bfb204 Add new lines.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-07 20:46:05 +01:00
James Cole
96caace068 Update language fields.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-07 20:45:59 +01:00
James Cole
5310ccebbe New ability to disable 2fa.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-07 20:28:26 +01:00
James Cole
ccd55257cd Add php doc.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-03-07 20:19:05 +01:00
James Cole
583687f3a7 Better FF name for multiple accounts. 2016-03-07 20:17:43 +01:00
James Cole
e06dc86bf7 Fix some logic in the preferences controller. 2016-03-07 20:14:24 +01:00
James Cole
8828aa0621 Merge pull request #204 from zjean/2fa
Validate the 2fa secret
2016-03-07 20:01:19 +01:00
James Cole
e472e105f2 ING specific amount modifier. See issue #210 2016-03-07 20:00:16 +01:00
James Cole
6ad10f1772 Fix bug that occurs when the transaction journal does not have the field "transaction_currency_code" 2016-03-07 19:52:59 +01:00
zjean
fcf7d98834 Update translations. 2016-03-04 19:36:42 +01:00
zjean
90ad06c65c Fixed composer.json 2016-03-04 19:35:11 +01:00
zjean
888e9beb4c Add breadcrumbs 2016-03-03 22:02:08 +01:00
zjean
69b338ca85 Added translations for 2fa. 2016-03-03 22:00:56 +01:00
zjean
0c009445d4 Added 2fa code validation 2016-03-03 21:14:53 +01:00
James Cole
c5fb734e42 Fix query. [skip ci] 2016-03-03 13:24:02 +01:00
James Cole
d2c8475504 #202 [skip ci] 2016-03-03 13:20:06 +01:00
James Cole
f38d99653f #202 make positive. 2016-03-03 13:19:47 +01:00
James Cole
cdce43d226 Closed #202 2016-03-03 13:19:06 +01:00
James Cole
89ab0a7e97 Clean up files. 2016-03-03 12:15:18 +01:00
James Cole
c7250bfcba Fix null error [skip ci] 2016-03-03 10:46:23 +01:00
James Cole
4a9b693da8 Fix sum [skip ci] 2016-03-03 10:39:11 +01:00
James Cole
fff35aa820 Reinstated sum of tag. 2016-03-03 10:37:06 +01:00
James Cole
a9a542d68f Update language stuff. 2016-03-03 10:27:53 +01:00
James Cole
35ff3f0cbf Some code cleanup. 2016-03-03 10:24:59 +01:00
James Cole
abf92b6df3 Add some new lines. 2016-03-03 09:38:16 +01:00
James Cole
8517fc9f24 Exclude test data. 2016-03-03 09:37:40 +01:00
James Cole
21b473108f Updated test script [skip ci] 2016-03-03 09:35:45 +01:00
James Cole
d4367f73a2 Updated composer.lock file. 2016-03-03 09:15:11 +01:00
James Cole
7ff46c3cd6 New providers in config. 2016-03-03 09:09:14 +01:00
James Cole
4a88e241b5 Code cleanup. 2016-03-03 09:05:09 +01:00
James Cole
8da0317b19 Fixed tag repository and provider. 2016-03-03 09:03:55 +01:00
James Cole
297c2e244d Created / updated rule repository and provider. 2016-03-03 09:02:04 +01:00
James Cole
a51d752a35 Update rule group repository and provider. 2016-03-03 09:00:15 +01:00
James Cole
7800b0a7f5 Update piggy bank repository / provider. 2016-03-03 08:58:15 +01:00
James Cole
5ce4104644 Update transaction journal repository / provider 2016-03-03 08:55:43 +01:00
James Cole
b4f1bbf793 Updated export job repository 2016-03-03 08:53:05 +01:00
James Cole
ca33bea6b7 Update category repository. 2016-03-03 08:50:17 +01:00
James Cole
42d20ff693 Updated budget provider and budget repository. 2016-03-03 08:44:20 +01:00
James Cole
22a14416ad Forgot to include classes for bill service provider. 2016-03-03 08:41:29 +01:00
James Cole
98bd9bdaa0 New bill repository provider. 2016-03-03 08:40:25 +01:00
James Cole
13bac92a24 Adapted attachment repository. 2016-03-03 08:38:24 +01:00
James Cole
d9eb14d6e5 New attachment service provider. 2016-03-03 08:36:36 +01:00
James Cole
6ec0471e8b Code cleanup. 2016-03-03 08:31:31 +01:00
James Cole
8008311d9c Added a new argument to the constructor of the account repository which should correctly inject the user. 2016-03-03 08:31:18 +01:00
James Cole
fcf16051a2 Some general code cleanup. 2016-03-03 08:29:56 +01:00
James Cole
3a236456cd Fix tag report thing. [skip ci] 2016-03-02 20:44:55 +01:00
James Cole
2606d77c62 Fix show tag [skip ci] 2016-03-02 20:40:43 +01:00
James Cole
3d2f33c120 Clean up some views. 2016-03-02 20:38:17 +01:00
James Cole
4f14969464 Add cache to journal support. 2016-03-02 20:19:39 +01:00
James Cole
7234f011ec Clean up method relying on old transaction journal code. 2016-03-02 20:11:28 +01:00
James Cole
5b949d6e00 Move some stuff around. 2016-03-02 19:41:22 +01:00
James Cole
2fd476ada8 Fixed search as well. 2016-03-02 13:56:56 +01:00
James Cole
2e7703bc97 Fixed two crashes. 2016-03-02 13:55:48 +01:00
James Cole
9b69a6addd Lots of todo's [skip ci] 2016-03-02 13:51:56 +01:00
James Cole
500243b0b3 This fixes most of the tests. 2016-03-02 13:37:28 +01:00
James Cole
3ef84dc1fc Cleanup and fix tests. 2016-03-02 13:13:33 +01:00
James Cole
b04d68d087 Stop on failure for easy log debug thing. 2016-03-02 12:57:35 +01:00
James Cole
715c381eb2 No longer need this left join. 2016-03-02 12:53:20 +01:00
James Cole
ca32ae4561 Fix is / is not already joined. 2016-03-02 12:52:36 +01:00
James Cole
6b277c5e67 Fix bill overview. 2016-03-02 12:47:15 +01:00
James Cole
1ac64fd0b3 Last updates, fixes the main list. 2016-03-02 12:33:07 +01:00
James Cole
f2c1dd41d0 Expanded Amount and expanded TransactionJournal to include source and destination information. 2016-03-02 12:25:00 +01:00
James Cole
869360f26c Some unrelated phpdoc. 2016-03-02 12:24:38 +01:00
James Cole
dbdc334931 Clean up frontpage query call (first of many...) 2016-03-02 12:09:45 +01:00
James Cole
b317d1a171 First attempt at scopeExpanded(), included some new fields in QUERYFIELDS. 2016-03-02 12:09:34 +01:00
James Cole
b00c7b0ce3 New constant that defines which fields a journal query is expected to load. 2016-03-02 12:03:53 +01:00
James Cole
a61eafeac2 Will now look for new field "transaction_type_type" 2016-03-02 12:03:04 +01:00
James Cole
5978b1c421 Removed cache from typeIcon 2016-03-02 12:02:01 +01:00
James Cole
9f16799453 Re-added phpdoc. 2016-03-02 11:59:39 +01:00
James Cole
74fe0ee4e4 Add some todo things, removed "withrelevantdata". This breaks FF 2016-03-02 11:58:31 +01:00
James Cole
e8880232b3 Removed "transaction_type" 2016-03-02 11:57:02 +01:00
James Cole
556e9f1df7 Removed "source_account" attribute. 2016-03-02 11:56:47 +01:00
James Cole
beb301e781 Removed "destination_account" 2016-03-02 11:54:03 +01:00
James Cole
056c809754 Removed amount_positive. This breaks the other half. 2016-03-02 11:53:23 +01:00
James Cole
fa47eac9ff Removed "amount" attribute. This breaks half of Firefly III. 2016-03-02 11:52:52 +01:00
James Cole
bf4a7846dd Removed boolean for left join that was never called more than twice anyway. 2016-03-02 11:52:17 +01:00
James Cole
b0cc6dd714 - Removed php doc.
- Added book_date and rent_date as fillable fields.
2016-03-02 11:50:37 +01:00
James Cole
d6e2d8e4a2 Add some extra filters [skip ci] 2016-03-02 11:48:53 +01:00
James Cole
bbfc962727 Include tags in multi year report [skip ci] 2016-03-02 07:08:08 +01:00
James Cole
8ddb357e5a Refer to correct var [skip ci] 2016-03-02 07:06:19 +01:00
James Cole
560c10898f Extra spaces for clarity [skip ci] 2016-03-02 07:05:43 +01:00
James Cole
04f5214bb7 Fix multiplier for single tag. 2016-03-02 07:04:48 +01:00
James Cole
4c35d52234 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
# By Robert Horlings
# Via James Cole (2) and Robert Horlings (1)
* 'develop' of https://github.com/JC5/firefly-iii:
  Small bugfix
  Small bugfix in AbnAmroImport specific
2016-03-01 21:31:42 +01:00
James Cole
01be5e3e23 Tag report. 2016-03-01 21:31:25 +01:00
James Cole
46dc4102e0 Merge pull request #200 from roberthorlings/develop
Small improvement in AbnAmroImport specific
2016-02-25 16:24:57 +01:00
James Cole
cf31049c51 Merge pull request #199 from roberthorlings/bugfix/import-amount-comma
Small bugfix
2016-02-25 16:20:28 +01:00
Robert Horlings
c624c4342f Small bugfix 2016-02-25 16:19:27 +01:00
James Cole
701d7baca8 #193 2016-02-25 15:17:24 +01:00
James Cole
8e45959483 #193 forgot to change file size thing. 2016-02-25 15:06:01 +01:00
James Cole
6858d67897 #193 2016-02-25 15:04:17 +01:00
James Cole
9b23cbd2c2 #193 2016-02-25 15:02:05 +01:00
Robert Horlings
ec1bb300e2 Small bugfix in AbnAmroImport specific 2016-02-25 14:54:06 +01:00
James Cole
69a8cad47b Attachment download (issue #193) 2016-02-25 14:53:26 +01:00
James Cole
bcaca0eca3 Queue name, default queue name. 2016-02-24 20:51:50 +01:00
James Cole
a1f79e58db Include time in job. 2016-02-24 20:44:39 +01:00
James Cole
2cc5fdcf62 Include time and date for errors. 2016-02-24 20:42:05 +01:00
James Cole
dd1b4e21f5 New table for #196 2016-02-24 20:14:09 +01:00
James Cole
91eb052c22 Use a job to send the error email instead of inline. #196 2016-02-24 20:13:55 +01:00
James Cole
ecefcfabc0 This is a partial fix for issue #151. It does not filter on account selection. 2016-02-24 17:37:08 +01:00
James Cole
8e42e71528 End of month... 2016-02-24 16:01:08 +01:00
James Cole
a2275ae111 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
# By Robert Horlings
# Via James Cole (2) and Robert Horlings (1)
* 'develop' of https://github.com/JC5/firefly-iii:
  Bugfix for a bug when adding a tag in a rule
  Bugfix in redirect after creating a new rule
2016-02-24 14:49:42 +01:00
James Cole
3976803d8f Same method of determining the applicable range as the "no category" view. Thanks to @roberthorlings in issue #151 2016-02-24 14:49:36 +01:00
James Cole
7921fc74fd Merge pull request #198 from roberthorlings/bugfix/rule-action-addtag
Bugfix for a bug when adding a tag in a rule
2016-02-24 14:09:00 +01:00
Robert Horlings
1732acfee2 Bugfix for a bug when adding a tag in a rule 2016-02-24 14:06:11 +01:00
James Cole
3a4fc65712 Merge pull request #197 from roberthorlings/bugfix/redirect-after-creating-rule
Bugfix in redirect after creating a new rule
2016-02-24 13:16:21 +01:00
Robert Horlings
9ce9caba02 Bugfix in redirect after creating a new rule 2016-02-24 10:21:04 +01:00
James Cole
07f4995c8f First start of new report. 2016-02-23 20:23:10 +01:00
James Cole
8200c7248a Helper for help text. 2016-02-23 20:22:53 +01:00
James Cole
bd9f1d5398 Rename export date range in other forms. Makes the rule group runner by @roberthorlings more consistent. 2016-02-23 19:59:41 +01:00
James Cole
ce0ca23d79 Rename field export start and end date. 2016-02-23 19:57:35 +01:00
James Cole
35863c8d3a This should fix the tests. 2016-02-23 17:55:56 +01:00
James Cole
dad73ce9df Added a translation. 2016-02-23 16:16:03 +01:00
James Cole
f716692591 New route and method. Work in progress. 2016-02-23 16:15:53 +01:00
James Cole
6387114a18 New method to access files. 2016-02-23 16:15:37 +01:00
James Cole
55ab39ca55 Old cover script. 2016-02-23 16:15:26 +01:00
James Cole
28a4f724d5 Use Requests library to get help from Github. 2016-02-23 16:12:59 +01:00
James Cole
f2d06bcea1 Fix bread crumb 2016-02-23 16:03:05 +01:00
James Cole
4d1771614a Code reformat 2016-02-23 16:02:44 +01:00
James Cole
61efabb3b5 Added sub title 2016-02-23 16:02:37 +01:00
James Cole
b00458c2b9 Small code format thing. 2016-02-23 15:55:09 +01:00
James Cole
594f9822c7 Fix parameters, re-order. 2016-02-23 15:54:13 +01:00
James Cole
9b3131b95e Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
# By Robert Horlings
# Via Robert Horlings (2) and James Cole (1)
* 'develop' of https://github.com/JC5/firefly-iii:
  Added button to specify parameters and execute the job
  Added missing imports for job
  Implemented job to execute rulegroup on existing transactions
  Moved JournalCollector to other package to encourage reuse
2016-02-23 15:47:39 +01:00
James Cole
d7ad32a8cc Merge pull request #194 from roberthorlings/feature/rules-on-existing-transactions
Implemented support to execute rulegroup on existing set of transactions
2016-02-23 15:10:39 +01:00
Robert Horlings
59127e4029 Added button to specify parameters and execute the job 2016-02-23 14:18:09 +01:00
Robert Horlings
7edf70a77b Added missing imports for job 2016-02-23 14:17:41 +01:00
Robert Horlings
3fd90a37fb Merge branch 'develop' into feature/rules-on-existing-transactions 2016-02-23 13:17:07 +01:00
James Cole
356ec276bc Updated composer stuff. 2016-02-23 12:04:00 +01:00
James Cole
ad8d945c1d Make sure all the users accounts are included so internal transfers are ignored. [skip ci] 2016-02-23 09:22:18 +01:00
James Cole
a3bf30a77b Remove file_get / file_put combi for #193 2016-02-23 09:12:21 +01:00
James Cole
3f829a3114 Restore original functionality. 2016-02-23 07:31:01 +01:00
James Cole
537b4ae003 Fix translation. 2016-02-23 07:27:52 +01:00
James Cole
08b4c9ea5c Use export disk for zip file. 2016-02-23 07:27:29 +01:00
James Cole
6b00f5a97d Updated config file maker. 2016-02-23 07:07:14 +01:00
James Cole
d259df9a47 Fixed a small documentation bug. 2016-02-23 07:05:18 +01:00
James Cole
aeaebd082f Cleaned up upload collector. 2016-02-23 07:05:08 +01:00
James Cole
0c9c0f2032 Simplified the attachment collector. 2016-02-23 06:54:51 +01:00
James Cole
155801ab2b Some extra logging. 2016-02-23 06:54:16 +01:00
James Cole
deeeb06488 Added debug info to the export routine. 2016-02-23 06:39:01 +01:00
James Cole
28fd719ce3 New file systems. 2016-02-23 06:17:04 +01:00
James Cole
317075aa6d Oops. 2016-02-20 18:48:06 +01:00
James Cole
eaf2efc510 Updated favicons. 2016-02-20 18:47:06 +01:00
James Cole
88555bbea2 Some translations. 2016-02-20 14:18:55 +01:00
Robert Horlings
a4d7bf4ebe Implemented job to execute rulegroup on existing transactions 2016-02-18 20:15:50 +01:00
Robert Horlings
50e5c21735 Moved JournalCollector to other package to encourage reuse 2016-02-18 20:01:53 +01:00
James Cole
2ddacf48d4 Removed unused parameter and added caching. [skip ci] 2016-02-18 10:12:07 +01:00
James Cole
cd66d2c7b0 Return 0 amount. [skip ci] 2016-02-18 10:06:34 +01:00
James Cole
2e7c26c539 New chart called "net worth". 2016-02-18 10:04:53 +01:00
James Cole
f0f47530bf PHP7 type declarations. 2016-02-18 10:04:26 +01:00
James Cole
e7be4e3e49 PHP7 compatible type hinting [skip ci] 2016-02-18 07:21:48 +01:00
James Cole
7a7ce7fcea Some new translations [skip ci] 2016-02-18 06:57:25 +01:00
James Cole
bd104a7ea8 Massively reduced number of checked transactions. Even if the user six transactions a day, every day, the test will go back a month to find matches. 2016-02-18 06:56:24 +01:00
James Cole
31d6789ff0 Type hinting. 2016-02-18 06:54:50 +01:00
James Cole
bdcb7372a5 More phpdoc. 2016-02-18 06:45:10 +01:00
James Cole
b8df2226ae New phpdoc. 2016-02-18 06:38:37 +01:00
James Cole
106bae5c97 Move factories to separate folder. 2016-02-18 06:34:16 +01:00
James Cole
651297fa0b Method can be private. 2016-02-18 06:29:04 +01:00
James Cole
1b2873fc5f Some phpdoc. 2016-02-18 06:28:46 +01:00
James Cole
f82a2b3bc5 Some phpdoc. 2016-02-18 06:24:47 +01:00
James Cole
4cb616ebeb Some PHP7 compatible type definitions 2016-02-18 06:24:39 +01:00
James Cole
1bcc975d7b Some new phpDoc and refactoring. 2016-02-18 06:15:01 +01:00
James Cole
98fd5b8858 Invert stuff so chart works again. 2016-02-17 22:35:57 +01:00
James Cole
6f08482aaf Some simplification. 2016-02-17 22:02:32 +01:00
James Cole
f7d06b9759 Some more code cleanup. 2016-02-17 21:59:47 +01:00
James Cole
a178fed0c6 Code cleanup courtesy of Scrutiniser CI. 2016-02-17 21:55:00 +01:00
James Cole
ff342f6789 New translations. 2016-02-17 21:22:49 +01:00
James Cole
b1c2f8faa1 Various code cleaning things. 2016-02-17 21:14:32 +01:00
James Cole
6f59e79b28 Massively reduce number of searched transactions. 2016-02-17 21:05:32 +01:00
James Cole
6c22bad77a Revamped a part of the rule test code.
- clean way of constructing triggers
- processor can be constructed in a number of ways.
- cleaner transaction matcher using collections instead of arrays
2016-02-17 21:03:59 +01:00
James Cole
1cf0125d1b New method for transaction matcher. 2016-02-17 20:31:18 +01:00
James Cole
49211482b0 New getters and setters. 2016-02-17 20:25:54 +01:00
James Cole
b3aecec11d Remove parameter and make fields private. 2016-02-17 20:25:20 +01:00
James Cole
7cb86d0254 Add field. Also limit range. 2016-02-17 20:24:59 +01:00
James Cole
0ba9389ca2 Rename field. 2016-02-17 20:24:27 +01:00
James Cole
1902787104 Removed constructor. 2016-02-17 20:23:53 +01:00
James Cole
b3e32db073 Rename variables. 2016-02-17 20:23:14 +01:00
James Cole
01d53bdb85 Use request instead of complex method. 2016-02-17 20:22:25 +01:00
James Cole
51acc34a80 Fix factory and triggers. 2016-02-17 20:19:44 +01:00
James Cole
694447e66c Removed all constructors from all triggers. 2016-02-17 20:09:03 +01:00
James Cole
05b7a610ef Prep for private constructor. 2016-02-17 19:58:49 +01:00
James Cole
1e799402ee Rule actions no longer need to know the journal at construction time. This is easier. 2016-02-17 19:56:05 +01:00
James Cole
5f9c61c4b4 Update Processor with new situation. 2016-02-17 19:08:27 +01:00
James Cole
12b6791e8b Changed trigger constructor. No longer needs model AND journal, now only model. Wait for it... 2016-02-17 19:07:20 +01:00
James Cole
8024ad123e Cleaned up the Processor. This completely breaks everything @ roberthorlings has built but stay with me. 2016-02-17 18:47:05 +01:00
James Cole
2bd2f5a5aa Renamed config thing. [skip ci] 2016-02-17 18:36:08 +01:00
James Cole
37d79b2a1c Remove unused import. 2016-02-17 18:35:29 +01:00
James Cole
cd057045e6 Code clean up. 2016-02-17 18:23:20 +01:00
James Cole
ddfbd69e8b Minimum of one trigger. 2016-02-17 18:23:12 +01:00
James Cole
28fa1264b7 Remove matchesAnything 2016-02-17 18:06:49 +01:00
James Cole
a6c3189833 Add willMatchEveryThing as a static replacement for matchesAnything 2016-02-17 18:00:13 +01:00
James Cole
0d2fe08dc9 New request object for when the user wants to test triggers. 2016-02-17 17:47:29 +01:00
James Cole
8cfe25bfac Small code clean up [skip ci] 2016-02-17 17:32:02 +01:00
James Cole
f9e2a677d9 Offload stuff to repositories for rules and rule groups, see issue #185 2016-02-17 17:27:41 +01:00
James Cole
2ef1c54417 Code cleanup. [skip ci] 2016-02-17 17:19:57 +01:00
James Cole
f9c3c0c8ae Merge pull request #191 from roberthorlings/feature/test-triggers
New feature for testing triggers
2016-02-17 17:19:21 +01:00
James Cole
44a15551ba Merge pull request #192 from roberthorlings/bugfix/abnamro-description-specifix
Bugfix in parsing specific descriptions
2016-02-17 17:15:53 +01:00
Robert Horlings
732e181312 Bugfix in parsing specific descriptions 2016-02-17 16:59:56 +01:00
Robert Horlings
919187f7fd Made performance settings for testing triggers configurable 2016-02-17 16:39:26 +01:00
Robert Horlings
7840a5ea49 Added missing import 2016-02-17 16:30:54 +01:00
Robert Horlings
3a33ac1455 Removed code left over from merge 2016-02-17 16:29:32 +01:00
Robert Horlings
2eb7d8ba91 Merge branch 'feature/test-triggers' of github.com:roberthorlings/firefly-iii into feature/test-triggers 2016-02-17 16:26:29 +01:00
Robert Horlings
7ec5cce2c8 Implemented filter not to return all transactions when testing filters 2016-02-17 16:23:43 +01:00
Robert Horlings
8fdc6c11e1 Merge branch 'develop' into feature/test-triggers 2016-02-17 16:14:07 +01:00
James Cole
1a110de597 Throw errors instead of abort() 2016-02-17 15:52:46 +01:00
James Cole
317aa591c3 Need to "use" the TriggerFactory! 2016-02-17 15:46:58 +01:00
James Cole
0d44f82c86 Code cleanup. [skip ci] 2016-02-17 15:38:21 +01:00
James Cole
9cac61dc33 Better description for matchesAnything 2016-02-17 15:37:05 +01:00
James Cole
52481a6e8b Code formatting. 2016-02-17 15:29:26 +01:00
James Cole
b3e18f4e56 Merge pull request #189 from roberthorlings/feature/trigger-matches-anything
Check for triggers that match anything
2016-02-17 15:28:39 +01:00
James Cole
aa25ac774e Merge pull request #190 from roberthorlings/feature/trigger-action-factories
Introduction of factories to create rule actions and rule triggers
2016-02-17 15:27:38 +01:00
Robert Horlings
af7da586aa Cleanup of processor after introduction of factories 2016-02-17 13:26:38 +01:00
Robert Horlings
b671da900a Implemented action factory analogue to trigger factory 2016-02-17 13:24:56 +01:00
Robert Horlings
d8bb83e8c4 Moved creation of Trigger objects to factory for reuse 2016-02-17 13:20:51 +01:00
Robert Horlings
bc3d64a2ff Moved creation of Trigger objects to factory for reuse 2016-02-17 13:16:46 +01:00
Robert Horlings
70e72c246d Added method to RuleTrigger object as well 2016-02-17 13:03:02 +01:00
Robert Horlings
7c8c82edd7 Added method for triggers to check whether they match all transactions 2016-02-17 13:02:27 +01:00
Robert Horlings
5dc556f0af Updated frontend to access the 'test-rules' functionality 2016-02-17 12:11:00 +01:00
Robert Horlings
c8c69f1a66 Implemented controller method and helper object to find matching transactions 2016-02-17 12:10:38 +01:00
James Cole
985019e117 Merge pull request #188 from roberthorlings/bugfix/fixed-missing-tags
Added closing li tags
2016-02-17 10:31:51 +01:00
Robert Horlings
b9620b3a21 Refactored method to check whether a transaction is triggered by a list of triggers 2016-02-17 10:24:40 +01:00
Robert Horlings
e7bb4a8ec6 Implemented option to specify pagesize when retrieving journals 2016-02-17 10:17:16 +01:00
Robert Horlings
bb5f935d7a Added closing li tags 2016-02-17 10:13:21 +01:00
James Cole
17dad27610 Catch type error. 2016-02-16 18:39:03 +01:00
James Cole
ee960d76c7 Possible fix for attachment helper 2016-02-16 13:30:50 +01:00
James Cole
dfb595193a Possible fix for attachment helper 2016-02-16 13:28:55 +01:00
James Cole
0a91a40c1b Merge branch 'develop' of github.com:JC5/firefly-iii into develop 2016-02-16 13:25:48 +01:00
James Cole
12f4305691 Possible fix for attachment helper 2016-02-16 13:25:03 +01:00
James Cole
dd865b0dfb Remove IDE specific files from .gitignore. [skip ci] 2016-02-15 19:49:33 +01:00
James Cole
7cbfa9fcd4 Merge pull request #182 from roberthorlings/develop
Small fix for importing amounts with comma as decimal separator
2016-02-15 19:48:27 +01:00
Robert Horlings
28d880a7c4 Ignoring eclipse specific files 2016-02-15 14:50:10 +01:00
James Cole
e83d45fce5 Expand manifest.json [skip ci] 2016-02-14 16:17:01 +01:00
James Cole
693ff3cc66 Various fixes. 2016-02-13 13:13:22 +01:00
James Cole
706b095f95 Forgot to actually return the created array. 2016-02-12 17:50:12 +01:00
James Cole
8e2e96d513 Config for code climate. 2016-02-12 17:45:33 +01:00
James Cole
28bce44f69 More code cleanup. 2016-02-12 17:41:12 +01:00
James Cole
53d88dfd50 Clean up code. 2016-02-12 17:37:11 +01:00
James Cole
42daf7ed32 Clean up some code. 2016-02-12 17:34:42 +01:00
James Cole
e5402ea7c1 Fixed a sum. 2016-02-12 15:01:32 +01:00
James Cole
05e8d6b578 Removed superfluous sentence in registration mail. 2016-02-12 14:16:51 +01:00
James Cole
505f340917 Some clean up in the error handler. 2016-02-12 14:15:49 +01:00
James Cole
46856c9394 Remove entrust package. 2016-02-12 05:49:53 +01:00
James Cole
c63a2ad39d Updated test data. 2016-02-12 05:32:16 +01:00
James Cole
68a7078614 Clean up TestData 2016-02-12 05:29:41 +01:00
James Cole
2e15f1e2a3 Removed todo comments. 2016-02-12 04:59:14 +01:00
James Cole
a790838222 Remove total downloads. [skip ci] 2016-02-12 04:51:40 +01:00
James Cole
cd14360d62 Merge pull request #178 from zjean/develop
Respect the base href in ajax calls.
2016-02-11 21:24:53 +01:00
zjean
74c94a60a6 Respect the base href in ajax calls. 2016-02-11 19:57:26 +01:00
James Cole
56cbc7683e Try changes to the handler 2016-02-11 14:20:18 +01:00
James Cole
bf778d2fca Try changes to the handler 2016-02-11 14:17:58 +01:00
James Cole
6e5bca8306 Try changes to the handler 2016-02-11 14:17:11 +01:00
James Cole
7e8fea6ed3 Forgot a bracket 2016-02-11 14:14:47 +01:00
James Cole
43ff3e11ed Some changes to the error handler 2016-02-11 14:13:23 +01:00
James Cole
f1750e3c35 Will inform about the logged in user 2016-02-11 12:54:16 +01:00
James Cole
8b1fe26c84 A route that displays an error. Seems quite useless, I know 2016-02-11 12:49:04 +01:00
James Cole
6ab09a3603 Undo PHP7 thing in master. 2016-02-11 11:22:27 +01:00
James Cole
df45298c1f Fixed bug in sumOfEverything() function 2016-02-11 11:21:50 +01:00
James Cole
4a64dce737 Fixed bug in sumOfEverything() function 2016-02-11 11:21:05 +01:00
James Cole
27ad428b5e Weird letter. 2016-02-11 08:13:57 +01:00
James Cole
2da33bae43 Some code used for #164 2016-02-11 08:13:04 +01:00
James Cole
3dab683a45 New asset account number handler. For issue #107 2016-02-11 08:12:10 +01:00
James Cole
d08fa37ccf Expanded error handling. 2016-02-11 08:11:26 +01:00
James Cole
4cd7976f63 Changes to the CSV importer because I ran into small bugs. 2016-02-11 08:11:12 +01:00
James Cole
569e8b6180 Better sort for CSV import column roles. 2016-02-11 07:03:12 +01:00
James Cole
9a443bd08e New translations. 2016-02-11 07:02:57 +01:00
James Cole
efb37ae709 Field 'name' is not used. Also added some other new stuff. 2016-02-11 07:02:48 +01:00
James Cole
4658ef9918 Fix PHP7 related strict type check. 2016-02-11 07:02:27 +01:00
James Cole
2b6a1c9cb1 Fixes a bug in the CSV importer. 2016-02-11 06:49:39 +01:00
James Cole
c4606b1854 New error message translations (also for #107) 2016-02-11 06:41:31 +01:00
James Cole
d47b946d00 New validator for account number #107 2016-02-11 06:40:16 +01:00
James Cole
a886e8087d New rule for account number. #107 2016-02-11 06:40:06 +01:00
James Cole
d473455680 Valid misspelled #107 2016-02-11 06:30:37 +01:00
James Cole
40245ef43b Some cosmetic changes for #107. 2016-02-11 06:30:09 +01:00
James Cole
aa057d6a57 Merge pull request #177 from zjean/develop
Tried to start with #107
2016-02-11 06:27:01 +01:00
zjean
5c03e64f46 Tried to start with #107
- Always show the IBAN in the create account view, because it is always editable the edit view.
- Added 'accountNumber' account_meta field, and showing it in create/edit account view.
2016-02-10 22:09:24 +01:00
James Cole
1d4d156749 Merge pull request #176 from zjean/2fa
Some small fixes to respect the base url
2016-02-10 20:12:28 +01:00
zjean
4fc6da1fa1 Add favicons to default.twig 2016-02-10 19:47:40 +01:00
zjean
9fac48fcea Fix base url in empty.twig 2016-02-10 19:45:23 +01:00
zjean
ff4fdd3740 Respect the base url in the guest area. 2016-02-10 19:42:04 +01:00
zjean
da1cce035a Focus the first visible form field in the guest area. 2016-02-10 19:39:10 +01:00
James Cole
49292bbb2d New model for future implementation of #164 2016-02-10 16:26:42 +01:00
James Cole
3e502db772 Various code fixes. 2016-02-10 16:23:37 +01:00
James Cole
426351bb54 Added new lines. 2016-02-10 16:01:18 +01:00
James Cole
4d6e244100 Better error handling for issue #168 2016-02-10 15:18:13 +01:00
James Cole
71253b23d5 Allow tests to run very long. 2016-02-10 15:04:18 +01:00
James Cole
076ff7c7ba Fixes #173 2016-02-10 15:04:06 +01:00
James Cole
94b6c7975a Fixes #174. 2016-02-10 14:36:21 +01:00
James Cole
0b08010221 Slightly updated travis file. 2016-02-10 12:04:24 +01:00
James Cole
bc67113d77 This fixes the broken tests. 2016-02-10 12:01:45 +01:00
James Cole
5974bdcc2a This fixes what turns out to be an incredibly inaccurate chart. 2016-02-10 07:34:04 +01:00
James Cole
f9696287a4 Removed opening balance as possible expense for the balance thing. [skip ci] 2016-02-10 06:58:41 +01:00
James Cole
807dede90a Because nextExpectedMatch() must return a date (and cannot return null) the list of bills will show "unknown" when the bill is next expected in 1900. 2016-02-10 06:55:08 +01:00
James Cole
1f2b37b70e Updated translations via CrowdIn: new lines added to Dutch (still untranslated in other languages). Changed @zjean's 2-step verification lines a bit. 2016-02-10 06:39:09 +01:00
James Cole
7288ba0fd7 Bit of code cleanup + the true/false in SHOW_INCOMPLETE_TRANSLATIONS is not a text but a boolean. Changed as such. 2016-02-10 06:25:21 +01:00
James Cole
f48c17cf88 Update packages. [skip ci] 2016-02-10 06:24:10 +01:00
James Cole
fba9cc3739 Merge pull request #175 from zjean/2fa
Started over with 2fa
2016-02-10 06:13:44 +01:00
zjean
e04388a230 Added two factor auth setting to Preferences page. 2016-02-08 22:28:24 +01:00
James Cole
fbe3be169d Add some fancy Schema markers. [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-02-08 21:25:12 +01:00
James Cole
4e4ae0fca0 New URL for "full description" [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-02-08 21:13:44 +01:00
James Cole
2f278c8618 Just a test commit [skip ci]
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-02-08 21:10:33 +01:00
James Cole
905ae3437b float > string. 2016-02-08 21:09:00 +01:00
James Cole
7679721007 float > string. 2016-02-08 21:07:11 +01:00
James Cole
9f29a2e04f Fixed something in the reports. 2016-02-08 20:59:09 +01:00
James Cole
ff5bf0c6e5 Opening balance does not count as an income or as an expense. It's just there. 2016-02-08 20:42:31 +01:00
James Cole
0eb8c2b7ba Make sure account has a start and end balance. 2016-02-08 20:40:47 +01:00
James Cole
deb140e3bc Fixes to export [skip ci] 2016-02-07 09:19:51 +01:00
James Cole
9a1710eb27 Some enhancements to export. 2016-02-07 09:11:46 +01:00
James Cole
e478238d77 New translations [skip ci] 2016-02-07 08:49:02 +01:00
James Cole
c9c9410908 Use translations instead of hard config. [skip ci] 2016-02-07 08:40:59 +01:00
James Cole
42372cabd5 Wasn't used. [skip ci] 2016-02-07 08:35:37 +01:00
James Cole
ab9c991530 Better flashes (also translated) [skip ci] 2016-02-07 08:31:21 +01:00
James Cole
9429d84cf8 Some code cleanup [skip ci] 2016-02-07 07:56:58 +01:00
James Cole
b22774a599 Logout blocked accounts. 2016-02-07 07:36:31 +01:00
James Cole
ca3b0a2ab1 It's called a route [skip ci] 2016-02-06 22:16:59 +01:00
James Cole
62f76d08ad It's called a route [skip ci] 2016-02-06 22:16:30 +01:00
James Cole
92bff24d43 It's called a route [skip ci] 2016-02-06 22:15:16 +01:00
James Cole
eddd3e508f Force blocked users to logout. 2016-02-06 22:14:51 +01:00
James Cole
649eb65bb1 Fixed scrutiniser issue. [skip ci] [skip Scrutinizer] 2016-02-06 20:19:28 +01:00
James Cole
8fb3348a7c Added some (yet without function) information icons. [skip ci] [skip Scrutinizer] 2016-02-06 20:17:55 +01:00
James Cole
6c2df1a783 Give maintenance page a title as well [skip ci] 2016-02-06 19:10:24 +01:00
James Cole
55afc98108 Better maintenance page. 2016-02-06 19:06:10 +01:00
James Cole
b875eb31d2 Small cosmetic changes. 2016-02-06 19:00:01 +01:00
James Cole
060b031272 Added PHP7 return type statements. 2016-02-06 18:59:48 +01:00
James Cole
95c4c4a238 Fixed a small bug after changing the return type statements. 2016-02-06 16:23:54 +01:00
James Cole
4424e48926 Added PHP7 return type statements. 2016-02-06 16:22:12 +01:00
James Cole
b8c7876454 Simplified export controller. 2016-02-06 15:01:26 +01:00
James Cole
8256f60340 Fixed form elements. 2016-02-06 15:00:57 +01:00
James Cole
1d0cb45e4c List in translation. 2016-02-06 15:00:48 +01:00
James Cole
d1a184e3f2 Added PHP7 return type statements. 2016-02-06 10:17:41 +01:00
James Cole
aa38b31015 Added PHP7 return type statements. 2016-02-06 10:15:07 +01:00
James Cole
466067bd95 Added PHP7 return type statements. 2016-02-06 10:11:06 +01:00
James Cole
c9b56efaaa Mock stuff in tests. 2016-02-06 09:52:31 +01:00
James Cole
e56920edee Speed up some tests. [skip ci] 2016-02-06 05:15:17 +01:00
James Cole
0e0c475c83 Forgot a thing. 2016-02-06 05:04:41 +01:00
James Cole
241190c4da More consistent error handling. 2016-02-06 05:01:34 +01:00
James Cole
69d0c31ae5 Translation. 2016-02-06 04:55:41 +01:00
James Cole
c3993fd943 Merge branch 'hotfix/3.7.2.3' into develop 2016-02-06 04:37:33 +01:00
James Cole
8a3b7d7c1a Merge branch 'hotfix/3.7.2.3' 2016-02-06 04:37:29 +01:00
James Cole
87f14617cc Code fix for #172. 2016-02-06 04:37:18 +01:00
James Cole
9f24f765ea Fix in Javascript for #172. 2016-02-06 04:35:51 +01:00
James Cole
48c802e5cc New version. 2016-02-06 04:34:06 +01:00
James Cole
388d141d82 Fix for #172 2016-02-06 04:32:30 +01:00
James Cole
7fa93e97db Fix language [skip-ci] 2016-02-05 21:30:56 +01:00
James Cole
030d241130 Should fix a bug in Travis. 2016-02-05 21:29:03 +01:00
James Cole
bac392d331 Some new translations 2016-02-05 21:23:10 +01:00
James Cole
1542d5e386 Include IBAN 2016-02-05 21:12:19 +01:00
James Cole
f1b6b3386a Expanded entry for export. 2016-02-05 21:10:55 +01:00
James Cole
7d05999ced Fixed view. [skip-ci] 2016-02-05 19:59:38 +01:00
James Cole
d477feb930 Some fix [skip-ci] 2016-02-05 19:59:07 +01:00
James Cole
9465a6d2b5 This PHP7 thing is strict! 2016-02-05 19:57:17 +01:00
James Cole
c3f78b698d This PHP7 thing is strict! 2016-02-05 19:56:25 +01:00
James Cole
a4e699f781 Fix another php7 bug. 2016-02-05 19:54:25 +01:00
James Cole
cd871e5aad Let's see what happens. 2016-02-05 19:27:52 +01:00
James Cole
c9b215684c Also fixed tests. 2016-02-05 19:25:17 +01:00
James Cole
82a4c706b0 Update something in travis. 2016-02-05 19:16:42 +01:00
James Cole
082e6f5e99 Removed the composer.lock, see what happens. 2016-02-05 19:14:06 +01:00
James Cole
b90c7c09b6 Smaller travis file. Try to fix the search. 2016-02-05 19:12:54 +01:00
James Cole
1ee72a6ce5 Travis file update. 2016-02-05 18:53:31 +01:00
James Cole
f72a8c5c06 Fixed some errors. Debug tests. 2016-02-05 17:38:58 +01:00
James Cole
ba5db2c15f Fixed test data. 2016-02-05 17:29:51 +01:00
James Cole
f5b89ca783 Some code cleanup. 2016-02-05 15:41:40 +01:00
James Cole
4ef840e210 More test data tweaks. 2016-02-05 15:20:44 +01:00
James Cole
e2d0ee125f Cleaning up test data. 2016-02-05 15:01:33 +01:00
James Cole
8e1dbc03d9 Merge branch 'hotfix/3.7.2.2' into develop
Conflicts:
	app/Http/Controllers/RuleGroupController.php
2016-02-05 13:23:00 +01:00
James Cole
9c0893fa8c Merge branch 'hotfix/3.7.2.2' 2016-02-05 13:22:02 +01:00
James Cole
0dfb97c5f7 Fix #171 2016-02-05 13:21:56 +01:00
James Cole
cb52af28e7 Also fixes #171 2016-02-05 13:20:10 +01:00
James Cole
4b4384b1a8 Merge branch 'hotfix/3.7.2.1' 2016-02-05 13:16:21 +01:00
James Cole
62483e748b Merge branch 'hotfix/3.7.2.1' into develop 2016-02-05 13:16:21 +01:00
James Cole
9b10984d81 Fix for bug #171 2016-02-05 13:16:12 +01:00
James Cole
c5e283a13e This is a fix for #171 2016-02-05 13:13:47 +01:00
James Cole
df918e8529 Fixed all problems related to strict types. 2016-02-05 13:09:18 +01:00
James Cole
aa1193a9eb Fixed all problems related to strict types. 2016-02-05 12:28:05 +01:00
James Cole
8f7f263a48 Declare strict type. 2016-02-05 12:08:25 +01:00
James Cole
0bad227548 No more PHP 5.6 tests. 2016-02-05 09:30:06 +01:00
James Cole
78bcd3e1bb Changed a lot of parameters. 2016-02-05 09:25:15 +01:00
James Cole
554640c345 These are the first commits that make FF require php 7. 2016-02-05 08:03:26 +01:00
James Cole
baecc256f6 Secretly updated some migrations. 2016-02-05 07:55:36 +01:00
James Cole
c5dc073d49 Merge branch 'hotfix/3.7.2' into develop 2016-02-05 07:40:38 +01:00
James Cole
af17381e04 Merge branch 'release/3.7.1' into develop 2016-02-05 07:34:34 +01:00
James Cole
c6cddad13c Let's see if this works as well. 2016-02-05 07:31:22 +01:00
James Cole
54bd54b521 First install with no-dev, then update? 2016-02-05 07:27:07 +01:00
James Cole
8cbbb970e1 Attempt to fix the tests. 2016-02-05 07:26:20 +01:00
James Cole
fbbf7f75c3 Fix for test. 2016-02-05 07:24:33 +01:00
James Cole
5a23b95352 Final fix for #170. Now to make a new release! 2016-02-05 07:21:51 +01:00
James Cole
6f9675b6d6 Catch the latest exceptions for #170. 2016-02-05 07:16:55 +01:00
James Cole
bb8ce30552 Added missing ranges to Navigation, see issue #170 2016-02-05 06:56:10 +01:00
James Cole
581e2ad431 Updated all tests to include the range. 2016-02-05 06:45:54 +01:00
James Cole
45deb493ba Added the provider annotation to all tests. 2016-02-05 06:41:28 +01:00
James Cole
4531d0ee32 Expand test to set a "custom" range. 2016-02-05 06:37:08 +01:00
James Cole
a26e8a5f83 Added the $range argument to every test that might need it. See #170 2016-02-05 06:36:56 +01:00
James Cole
be74fbd677 The tests now reflect that not all category-related views support all date ranges, see issue #170 2016-02-05 06:31:27 +01:00
James Cole
ee8c83bbd8 Some small fixes. 2016-02-04 17:57:36 +01:00
James Cole
dbd32abdd1 Also delete old files. 2016-02-04 17:50:35 +01:00
James Cole
f300287814 Better cleanup routine. 2016-02-04 17:22:09 +01:00
James Cole
dd361bb9ad Delete files used. 2016-02-04 17:22:01 +01:00
James Cole
744205cb6e New composer. 2016-02-04 17:21:46 +01:00
James Cole
86c22c9fdd New export functionality. 2016-02-04 17:16:16 +01:00
James Cole
d7a66f6782 New model for export. 2016-02-04 17:14:59 +01:00
James Cole
902f310eb0 New export directory. 2016-02-04 17:14:32 +01:00
James Cole
3bb107e192 New migrations (also for export). 2016-02-04 17:13:58 +01:00
James Cole
78f8b1454d New export controller. 2016-02-04 17:13:42 +01:00
James Cole
70ba9a4db5 Some phpunit updates. 2016-02-04 17:13:34 +01:00
James Cole
93d9c44585 This should fix the tests. 2016-02-04 11:07:34 +01:00
James Cole
f0bb462f1c New test data. 2016-02-04 11:00:26 +01:00
James Cole
151e8e8f17 Experimenting with a negation for #159 2016-02-04 08:56:33 +01:00
James Cole
23f474b003 Don't add inactive unhit bills, see #159 2016-02-04 08:55:06 +01:00
James Cole
15104de84c This should clean up the monthly report a bit. See issue #159 2016-02-04 08:53:56 +01:00
James Cole
55e4875662 New method to collect a users accounts by the given ids. 2016-02-04 08:53:15 +01:00
James Cole
5c3165efa2 Site is gone. 2016-02-04 08:52:54 +01:00
James Cole
3690a53dc9 expand tests 2016-02-04 07:30:48 +01:00
James Cole
fb119cc208 Replaced success() with done () 2016-02-04 07:30:12 +01:00
James Cole
7343304284 Code cleanup. 2016-02-04 07:28:39 +01:00
James Cole
c1ecc62ac1 Replaced Session::get() with session() 2016-02-04 07:27:03 +01:00
James Cole
bd40615f8e Code cleanup. 2016-02-04 07:23:14 +01:00
James Cole
0df8d096f0 Removed unused use statements. 2016-02-04 07:23:02 +01:00
James Cole
749dd1e8e3 Text alignment. 2016-02-04 07:22:38 +01:00
James Cole
ade6558769 Mea culpa. Removed ide specific files from git ignore. 2016-02-04 07:22:26 +01:00
560 changed files with 19491 additions and 11358 deletions

View File

@@ -1,26 +1,50 @@
# Save as .codeclimate.yml (note leading .) in project root directory
languages:
JavaScript: true
PHP: true
---
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/*"
- 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/*

2
.csslintrc Normal file
View File

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

View File

@@ -13,6 +13,10 @@ CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync
COOKIE_PATH="/"
COOKIE_DOMAIN=
COOKIE_SECURE=false
DEFAULT_CURRENCY=EUR
DEFAULT_LANGUAGE=en_US
@@ -28,6 +32,9 @@ MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
SEND_REGISTRATION_MAIL=true
MUST_CONFIRM_ACCOUNT=false
SHOW_INCOMPLETE_TRANSLATIONS=false
ANALYTICS_ID=

1
.eslintignore Normal file
View File

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

213
.eslintrc Normal file
View File

@@ -0,0 +1,213 @@
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

11
.gitignore vendored
View File

@@ -1,17 +1,6 @@
/vendor
/node_modules
Homestead.yaml
Homestead.json
.env
_ide_helper.php
_ide_helper_models.php
.phpstorm.meta.php
storage/
# Eclipse project files
.buildpath
.project
.settings/
.env.local

View File

@@ -1,3 +1,6 @@
# .scrutinizer.yml
tools:
external_code_coverage: false
filter:
excluded_paths:
- app/Support/Migration/*

View File

@@ -1,15 +1,15 @@
language: php
sudo: false
php:
- 5.6
- 7
install:
- phpenv config-rm xdebug.ini
- composer selfupdate
- composer install --no-dev
- composer update
- 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

74
CHANGELOG.md Normal file
View File

@@ -0,0 +1,74 @@
# Change Log
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.
## [3.8.2] - 2016-04-03
### Added
- Small user administration at /admin.
- Informational popups are working in reports.
### Changed
- User activation emails are better
### Fixed
- Some bugs related to accounts and rules.
## [3.8.1] - 2016-03-29
### Added
- More translations
- Extended cookie control.
- User accounts can now be activated (disabled by default).
- Bills can now take the source and destination account name into account.
### Changed
- The pages related to rules have new URL's.
### Fixed
- Spelling errors.
- Problems related to the "account repository".
- Some views showed empty (0.0) amounts.
## [3.8.0] - 2016-03-20
### Added
- Two factor authentication, thanks to the excellent work of [zjean](https://github.com/zjean).
- A new chart showing your net worth in year and multi-year reports.
- You can now see if your current or future rules actually match any transactions, thanks to the excellent work of @roberthorlings.
- New date fields for transactions. They are not used yet in reports or anything, but they can be filled in.
- New routine to export your data.
- Firefly III will mail the site owner when blocked users try to login, or when blocked domains are used in registrations.
### Changed
- Firefly III now requires PHP 7.0 minimum.
### Fixed
- HTML fixes, thanks to [roberthorlings](https://github.com/roberthorlings) and [zjean](https://github.com/zjean)..
- A bug fix in the ABN Amro importer, thanks to [roberthorlings](https://github.com/roberthorlings)
- It was not possible to change the opening balance, once it had been set. Thanks to [xnyhps](https://github.com/xnyhps) and [marcoveeneman](https://github.com/marcoveeneman) for spotting this.
- Various other bug fixes.
## [3.4.2] - 2015-05-25
### Added
- Initial release.
### Changed
- Initial release.
### Deprecated
- Initial release.
### Removed
- Initial release.
### Fixed
- Initial release.
### Security
- Initial release.

View File

@@ -1,4 +1,4 @@
Copyright (C) 2016 Sander Dorigo
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:

View File

@@ -1,12 +1,11 @@
# 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)
[![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads)](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)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
## About

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Console\Commands;
@@ -44,7 +45,7 @@ class UpgradeFireflyInstructions extends Command
//
$version = Config::get('firefly.version');
$config = Config::get('upgrade.text');
$text = isset($config[$version]) ? $config[$version] : null;
$text = $config[$version] ?? null;
$this->line('+------------------------------------------------------------------------------+');
$this->line('');

View File

@@ -1,7 +1,9 @@
<?php
declare(strict_types = 1);
/**
* Kernel.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Events;
/**

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types = 1);
/**
* ResendConfirmation.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\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class ResendConfirmation
*
* @package FireflyIII\Events
*/
class ResendConfirmation extends Event
{
use SerializesModels;
public $ipAddress;
public $user;
/**
* Create a new event instance.
*
* @param User $user
* @param string $ipAddress
*/
public function __construct(User $user, string $ipAddress)
{
$this->user = $user;
$this->ipAddress = $ipAddress;
}
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* TransactionJournalStored.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -30,9 +31,9 @@ class TransactionJournalStored extends Event
* Create a new event instance.
*
* @param TransactionJournal $journal
* @param $piggyBankId
* @param int $piggyBankId
*/
public function __construct(TransactionJournal $journal, $piggyBankId)
public function __construct(TransactionJournal $journal, int $piggyBankId)
{
//
$this->journal = $journal;

View File

@@ -1,4 +1,7 @@
<?php namespace FireflyIII\Events;
<?php
declare(strict_types = 1);
namespace FireflyIII\Events;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;

View File

@@ -0,0 +1,39 @@
<?php
declare(strict_types = 1);
/**
* UserRegistration.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\Events;
use FireflyIII\User;
use Illuminate\Queue\SerializesModels;
/**
* Class UserRegistration
*
* @package FireflyIII\Events
*/
class UserRegistration extends Event
{
use SerializesModels;
public $ipAddress;
public $user;
/**
* Create a new event instance.
*
* @param User $user
* @param string $ipAddress
*/
public function __construct(User $user, string $ipAddress)
{
$this->user = $user;
$this->ipAddress = $ipAddress;
}
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Exceptions;

View File

@@ -1,11 +1,16 @@
<?php
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\Database\Eloquent\ModelNotFoundException;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
/**
@@ -37,9 +42,17 @@ class Handler extends ExceptionHandler
*/
public function render($request, Exception $exception)
{
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
$isDebug = env('APP_DEBUG', false);
return response()->view('errors.FireflyException', ['exception' => $exception, 'debug' => $isDebug], 500);
}
return parent::render($request, $exception);
}
/**
* Report or log an exception.
*
@@ -51,6 +64,26 @@ class Handler extends ExceptionHandler
*/
public function report(Exception $exception)
{
if ($exception instanceof FireflyException || $exception instanceof ErrorException) {
$user = Auth::check() ? Auth::user() : new User;
$data = [
'class' => get_class($exception),
'errorMessage' => $exception->getMessage(),
'time' => date('r'),
'stackTrace' => $exception->getTraceAsString(),
'file' => $exception->getFile(),
'line' => $exception->getLine(),
'code' => $exception->getCode(),
];
// create job that will mail.
$job = new MailError($user, env('SITE_OWNER'), Request::ip(), $data);
dispatch($job);
}
parent::report($exception);
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Exceptions;

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Exceptions;
/**

View File

@@ -0,0 +1,148 @@
<?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.
*/
namespace FireflyIII\Export\Collector;
use Amount;
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;
use Log;
use Storage;
/**
* Class AttachmentCollector
*
* @package FireflyIII\Export\Collector
*/
class AttachmentCollector extends BasicCollector implements CollectorInterface
{
/** @var string */
private $explanationString = '';
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $exportDisk;
/** @var AttachmentRepositoryInterface */
private $repository;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $uploadDisk;
/**
* AttachmentCollector constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
{
$this->repository = app('FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface');
// make storage:
$this->uploadDisk = Storage::disk('upload');
$this->exportDisk = Storage::disk('export');
parent::__construct($job);
}
/**
*
*/
public function run()
{
// grab all the users attachments:
$attachments = $this->getAttachments();
/** @var Attachment $attachment */
foreach ($attachments as $attachment) {
$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);
}
/**
* @param Attachment $attachment
*/
private function explain(Attachment $attachment)
{
/** @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;
}
/**
* @param Attachment $attachment
*
* @return bool
*/
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.');
// explain:
$this->explain($attachment);
} catch (DecryptException $e) {
Log::error('Catchable error: could not decrypt attachment #' . $attachment->id . ' because: ' . $e->getMessage());
}
}
return true;
}
/**
* Returns the new file name for the export file.
*
* @param $attachment
*
* @return string
*/
private function exportFileName($attachment): string
{
return sprintf('%s-Attachment nr. %s - %s', $this->job->key, strval($attachment->id), $attachment->filename);
}
/**
* @return Collection
*/
private function getAttachments(): Collection
{
$attachments = $this->repository->get();
Log::debug('Found ' . $attachments->count() . ' attachments.');
return $attachments;
}
}

View File

@@ -0,0 +1,57 @@
<?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.
*/
namespace FireflyIII\Export\Collector;
use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
* Class BasicCollector
*
* @package FireflyIII\Export\Collector
*/
class BasicCollector
{
/** @var ExportJob */
protected $job;
/** @var Collection */
private $files;
/**
* BasicCollector constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
{
$this->files = new Collection;
$this->job = $job;
}
/**
* @return Collection
*/
public function getFiles()
{
return $this->files;
}
/**
* @param Collection $files
*/
public function setFiles(Collection $files)
{
$this->files = $files;
}
}

View File

@@ -0,0 +1,38 @@
<?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.
*/
namespace FireflyIII\Export\Collector;
use Illuminate\Support\Collection;
/**
* Interface CollectorInterface
*
* @package FireflyIII\Export\Collector
*/
interface CollectorInterface
{
/**
* @return Collection
*/
public function getFiles();
/**
* @return bool
*/
public function run();
/**
* @param Collection $files
*
*/
public function setFiles(Collection $files);
}

View File

@@ -0,0 +1,119 @@
<?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.
*/
namespace FireflyIII\Export\Collector;
use Auth;
use Crypt;
use FireflyIII\Models\ExportJob;
use Illuminate\Contracts\Encryption\DecryptException;
use Log;
use Storage;
/**
* Class UploadCollector
*
* @package FireflyIII\Export\Collector
*/
class UploadCollector extends BasicCollector implements CollectorInterface
{
/** @var string */
private $expected;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $exportDisk;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
private $uploadDisk;
/**
* AttachmentCollector constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
{
parent::__construct($job);
// make storage:
$this->uploadDisk = Storage::disk('upload');
$this->exportDisk = Storage::disk('export');
$this->expected = 'csv-upload-' . Auth::user()->id . '-';
}
/**
*
*/
public function run()
{
// grab upload directory.
$files = $this->uploadDisk->files();
Log::debug('Found ' . count($files) . ' files in the upload directory.');
foreach ($files as $entry) {
$this->processOldUpload($entry);
}
}
/**
* @param string $entry
*
* @return string
*/
private function getOriginalUploadDate(string $entry): string
{
// this is an original upload.
$parts = explode('-', str_replace(['.csv.encrypted', $this->expected], '', $entry));
$originalUpload = intval($parts[1]);
$date = date('Y-m-d \a\t H-i-s', $originalUpload);
return $date;
}
/**
* @param string $entry
*
* @return bool
*/
private function isValidFile(string $entry): bool
{
$len = strlen($this->expected);
if (substr($entry, 0, $len) === $this->expected) {
Log::debug($entry . ' is part of this users original uploads.');
return true;
}
Log::debug($entry . ' is not part of this users original uploads.');
return false;
}
/**
* @param $entry
*/
private function processOldUpload(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());
}
}
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.');
$this->exportDisk->put($file, $content);
$this->getFiles()->push($file);
}
}
}

View File

@@ -0,0 +1,67 @@
<?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;
}
}

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

@@ -0,0 +1,460 @@
<?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;
}
}

View File

@@ -0,0 +1,56 @@
<?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.
*/
namespace FireflyIII\Export\Exporter;
use FireflyIII\Models\ExportJob;
use Illuminate\Support\Collection;
/**
* Class BasicExporter
*
* @package FireflyIII\Export\Exporter
*/
class BasicExporter
{
/** @var ExportJob */
protected $job;
private $entries;
/**
* BasicExporter constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
{
$this->entries = new Collection;
$this->job = $job;
}
/**
* @return Collection
*/
public function getEntries()
{
return $this->entries;
}
/**
* @param Collection $entries
*/
public function setEntries(Collection $entries)
{
$this->entries = $entries;
}
}

View File

@@ -0,0 +1,81 @@
<?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.
*/
namespace FireflyIII\Export\Exporter;
use FireflyIII\Export\Entry;
use FireflyIII\Models\ExportJob;
use League\Csv\Writer;
use SplFileObject;
/**
* Class CsvExporter
*
* @package FireflyIII\Export\Exporter
*/
class CsvExporter extends BasicExporter implements ExporterInterface
{
/** @var string */
private $fileName;
/**
* CsvExporter constructor.
*
* @param ExportJob $job
*/
public function __construct(ExportJob $job)
{
parent::__construct($job);
}
/**
* @return string
*/
public function getFileName()
{
return $this->fileName;
}
/**
*
*/
public function run()
{
// create temporary file:
$this->tempFile();
// necessary for CSV writer:
$fullPath = storage_path('export') . DIRECTORY_SEPARATOR . $this->fileName;
// create CSV writer:
$writer = Writer::createFromPath(new SplFileObject($fullPath, 'a+'), 'w');
// 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));
}
$writer->insertAll($rows);
}
private function tempFile()
{
$this->fileName = $this->job->key . '-records.csv';
}
}

View File

@@ -0,0 +1,43 @@
<?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.
*/
namespace FireflyIII\Export\Exporter;
use Illuminate\Support\Collection;
/**
* Interface ExporterInterface
*
* @package FireflyIII\Export\Exporter
*/
interface ExporterInterface
{
/**
* @return Collection
*/
public function getEntries();
/**
* @return string
*/
public function getFileName();
/**
*
*/
public function run();
/**
* @param Collection $entries
*
*/
public function setEntries(Collection $entries);
}

182
app/Export/Processor.php Normal file
View File

@@ -0,0 +1,182 @@
<?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.
*/
namespace FireflyIII\Export;
use Auth;
use Config;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\ExportJob;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use Log;
use Storage;
use ZipArchive;
/**
* Class Processor
*
* @package FireflyIII\Export
*/
class Processor
{
/** @var Collection */
public $accounts;
/** @var string */
public $exportFormat;
/** @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 */
private $files;
/** @var Collection */
private $journals;
/**
* Processor constructor.
*
* @param array $settings
*/
public function __construct(array $settings)
{
// save settings
$this->settings = $settings;
$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;
$this->exportEntries = new Collection;
$this->files = new Collection;
}
/**
*
*/
public function collectAttachments()
{
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
$attachmentCollector->run();
$this->files = $this->files->merge($attachmentCollector->getFiles());
}
/**
*
*/
public function collectJournals()
{
$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')
. ').'
);
}
public function collectOldUploads()
{
$uploadCollector = app('FireflyIII\Export\Collector\UploadCollector', [$this->job]);
$uploadCollector->run();
$this->files = $this->files->merge($uploadCollector->getFiles());
}
/**
*
*/
public function convertJournals()
{
$count = 0;
/** @var TransactionJournal $journal */
foreach ($this->journals as $journal) {
$this->exportEntries->push(Entry::fromJournal($journal));
$count++;
}
Log::debug('Converted ' . $count . ' journals to "Entry" objects.');
}
public function createConfigFile()
{
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
$this->files->push($this->configurationMaker->make());
}
public function createZipFile()
{
$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.');
}
// for each file in the collection, add it to the zip file.
$disk = Storage::disk('export');
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->close();
// delete the files:
foreach ($this->getFiles() as $file) {
Log::debug('Will now delete file "' . $file . '".');
$disk->delete($file);
}
Log::debug('Done!');
}
/**
*
*/
public function exportJournals()
{
$exporterClass = Config::get('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 Collection
*/
public function getFiles()
{
return $this->files;
}
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* AccountChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -28,7 +29,7 @@ interface AccountChartGeneratorInterface
*
* @return array
*/
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end);
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Collection $accounts
@@ -37,7 +38,7 @@ interface AccountChartGeneratorInterface
*
* @return array
*/
public function frontpage(Collection $accounts, Carbon $start, Carbon $end);
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array;
/**
* @param Account $account
@@ -46,5 +47,5 @@ interface AccountChartGeneratorInterface
*
* @return array
*/
public function single(Account $account, Carbon $start, Carbon $end);
public function single(Account $account, Carbon $start, Carbon $end): array;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\Account;
use Carbon\Carbon;
@@ -22,7 +22,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
*
* @return array
*/
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end)
public function expenseAccounts(Collection $accounts, Carbon $start, Carbon $end): array
{
$data = [
'count' => 1,
@@ -30,7 +30,6 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
'label' => trans('firefly.spent'),
'data' => []]]];
bcscale(2);
$start->subDay();
$ids = $this->getIdsFromCollection($accounts);
$startBalances = Steam::balancesById($ids, $start);
@@ -69,7 +68,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
*
* @return array
*/
public function frontpage(Collection $accounts, Carbon $start, Carbon $end)
public function frontpage(Collection $accounts, Carbon $start, Carbon $end): array
{
// language:
$format = (string)trans('config.month_and_day');
@@ -116,7 +115,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
*
* @return array
*/
public function single(Account $account, Carbon $start, Carbon $end)
public function single(Account $account, Carbon $start, Carbon $end): array
{
// language:
$format = (string)trans('config.month_and_day');
@@ -137,7 +136,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
while ($end >= $current) {
$theDate = $current->format('Y-m-d');
$balance = isset($range[$theDate]) ? $range[$theDate] : $previous;
$balance = $range[$theDate] ?? $previous;
$data['labels'][] = $current->formatLocalized($format);
$data['datasets'][0]['data'][] = $balance;
@@ -153,7 +152,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
*
* @return array
*/
protected function getIdsFromCollection(Collection $collection)
protected function getIdsFromCollection(Collection $collection): array
{
$ids = [];
foreach ($collection as $entry) {
@@ -170,7 +169,7 @@ class ChartJsAccountChartGenerator implements AccountChartGeneratorInterface
*
* @return string
*/
protected function isInArray($array, $entryId)
protected function isInArray($array, $entryId): string
{
if (isset($array[$entryId])) {
return $array[$entryId];

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* BillChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -27,7 +28,7 @@ interface BillChartGeneratorInterface
*
* @return array
*/
public function frontpage($paid, $unpaid);
public function frontpage(string $paid, string $unpaid): array;
/**
* @param Bill $bill
@@ -35,6 +36,6 @@ interface BillChartGeneratorInterface
*
* @return array
*/
public function single(Bill $bill, Collection $entries);
public function single(Bill $bill, Collection $entries): array;
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* ChartJsBillChartGenerator.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -27,9 +28,8 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
*
* @return array
*/
public function frontpage($paid, $unpaid)
public function frontpage(string $paid, string $unpaid): array
{
bcscale(2);
$data = [
[
'value' => round($unpaid, 2),
@@ -38,7 +38,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
'label' => trans('firefly.unpaid'),
],
[
'value' => round($paid * -1, 2), // paid is negative, must be positive.
'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'),
@@ -54,7 +54,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
*
* @return array
*/
public function single(Bill $bill, Collection $entries)
public function single(Bill $bill, Collection $entries): array
{
$format = (string)trans('config.month');
$data = [
@@ -73,7 +73,7 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
/*
* journalAmount has been collected in BillRepository::getJournals
*/
$actualAmount[] = round(($entry->journalAmount * -1), 2);
$actualAmount[] = round(TransactionJournal::amountPositive($entry), 2);
}
$data['datasets'][] = [

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* BudgetChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -23,28 +24,28 @@ interface BudgetChartGeneratorInterface
*
* @return array
*/
public function budget(Collection $entries);
public function budget(Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function budgetLimit(Collection $entries);
public function budgetLimit(Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function frontpage(Collection $entries);
public function frontpage(Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function multiYear(Collection $entries);
public function multiYear(Collection $entries): array;
/**
* @param Collection $budgets
@@ -52,6 +53,6 @@ interface BudgetChartGeneratorInterface
*
* @return array
*/
public function year(Collection $budgets, Collection $entries);
public function year(Collection $budgets, Collection $entries): array;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\Budget;
@@ -21,7 +21,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
*
* @return array
*/
public function budget(Collection $entries, $dateFormat = 'month')
public function budget(Collection $entries, $dateFormat = 'month'): array
{
// language:
$language = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
@@ -56,7 +56,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
*
* @return array
*/
public function budgetLimit(Collection $entries)
public function budgetLimit(Collection $entries): array
{
return $this->budget($entries, 'monthAndDay');
}
@@ -66,7 +66,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
*
* @return array
*/
public function frontpage(Collection $entries)
public function frontpage(Collection $entries): array
{
$data = [
'count' => 0,
@@ -84,8 +84,8 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
foreach ($filtered as $entry) {
$data['labels'][] = $entry[0];
$left[] = round($entry[1], 2);
$spent[] = round($entry[2] * -1, 2); // spent is coming in negative, must be positive
$overspent[] = round($entry[3] * -1, 2); // same
$spent[] = round(bcmul($entry[2], '-1'), 2); // spent is coming in negative, must be positive
$overspent[] = round(bcmul($entry[3], '-1'), 2); // same
}
$data['datasets'][] = [
@@ -111,7 +111,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
*
* @return array
*/
public function multiYear(Collection $entries)
public function multiYear(Collection $entries): array
{
// dataset:
$data = [
@@ -146,7 +146,7 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
*
* @return array
*/
public function year(Collection $budgets, Collection $entries)
public function year(Collection $budgets, Collection $entries): array
{
// language:
$format = (string)trans('config.month');
@@ -159,6 +159,9 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
foreach ($budgets as $budget) {
$data['labels'][] = $budget->name;
}
// also add "no budget"
$data['labels'][] = strval(trans('firefly.no_budget'));
/** @var array $entry */
foreach ($entries as $entry) {
$array = [

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* CategoryChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -32,28 +33,28 @@ interface CategoryChartGeneratorInterface
*
* @return array
*/
public function earnedInPeriod(Collection $categories, Collection $entries);
public function earnedInPeriod(Collection $categories, Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function frontpage(Collection $entries);
public function frontpage(Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function multiYear(Collection $entries);
public function multiYear(Collection $entries): array;
/**
* @param Collection $entries
*
* @return array
*/
public function period(Collection $entries);
public function period(Collection $entries): array;
/**
* @param Collection $categories
@@ -61,5 +62,5 @@ interface CategoryChartGeneratorInterface
*
* @return array
*/
public function spentInPeriod(Collection $categories, Collection $entries);
public function spentInPeriod(Collection $categories, Collection $entries): array;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\Category;
use Illuminate\Support\Collection;
@@ -18,7 +18,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*
* @return array
*/
public function all(Collection $entries)
public function all(Collection $entries): array
{
@@ -39,11 +39,11 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
foreach ($entries as $entry) {
$data['labels'][] = $entry[1];
$spent = round($entry[2], 2);
$earned = round($entry[3], 2);
$spent = $entry[2];
$earned = $entry[3];
$data['datasets'][0]['data'][] = $spent == 0 ? null : $spent * -1;
$data['datasets'][1]['data'][] = $earned == 0 ? null : $earned;
$data['datasets'][0]['data'][] = bccomp($spent, '0') === 0 ? null : bcmul($spent, '-1');
$data['datasets'][1]['data'][] = bccomp($earned, '0') === 0 ? null : $earned;
}
return $data;
@@ -55,7 +55,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*
* @return array
*/
public function earnedInPeriod(Collection $categories, Collection $entries)
public function earnedInPeriod(Collection $categories, Collection $entries): array
{
// language:
@@ -87,7 +87,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*
* @return array
*/
public function frontpage(Collection $entries)
public function frontpage(Collection $entries): array
{
$data = [
'count' => 1,
@@ -102,7 +102,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
foreach ($entries as $entry) {
if ($entry->spent != 0) {
$data['labels'][] = $entry->name;
$data['datasets'][0]['data'][] = round(($entry->spent * -1), 2);
$data['datasets'][0]['data'][] = round(bcmul($entry->spent, '-1'), 2);
}
}
@@ -114,7 +114,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*
* @return array
*/
public function multiYear(Collection $entries)
public function multiYear(Collection $entries): array
{
// dataset:
$data = [
@@ -154,7 +154,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*
* @return array
*/
public function period(Collection $entries)
public function period(Collection $entries): array
{
return $this->all($entries);
@@ -166,7 +166,7 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
*
* @return array
*/
public function spentInPeriod(Collection $categories, Collection $entries)
public function spentInPeriod(Collection $categories, Collection $entries): array
{
// language:

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\PiggyBank;
use Carbon\Carbon;
@@ -19,7 +19,7 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGeneratorInterface
*
* @return array
*/
public function history(Collection $set)
public function history(Collection $set): array
{
// language:
@@ -36,7 +36,6 @@ class ChartJsPiggyBankChartGenerator implements PiggyBankChartGeneratorInterface
],
];
$sum = '0';
bcscale(2);
foreach ($set as $entry) {
$date = new Carbon($entry->date);
$sum = bcadd($sum, $entry->sum);

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* PiggyBankChartGenerator.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -23,5 +24,5 @@ interface PiggyBankChartGeneratorInterface
*
* @return array
*/
public function history(Collection $set);
public function history(Collection $set): array;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Generator\Chart\Report;
use Illuminate\Support\Collection;
@@ -19,7 +19,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
*
* @return array
*/
public function multiYearInOut(Collection $entries)
public function multiYearInOut(Collection $entries): array
{
$data = [
'count' => 2,
@@ -52,7 +52,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
*
* @return array
*/
public function multiYearInOutSummarized($income, $expense, $count)
public function multiYearInOutSummarized(string $income, string $expense, int $count): array
{
$data = [
'count' => 2,
@@ -81,7 +81,33 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
*
* @return array
*/
public function yearInOut(Collection $entries)
public function netWorth(Collection $entries) : array
{
$format = (string)trans('config.month_and_day');
$data = [
'count' => 1,
'labels' => [],
'datasets' => [
[
'label' => trans('firefly.net-worth'),
'data' => [],
],
],
];
foreach ($entries as $entry) {
$data['labels'][] = trim($entry['date']->formatLocalized($format));
$data['datasets'][0]['data'][] = round($entry['net-worth'], 2);
}
return $data;
}
/**
* @param Collection $entries
*
* @return array
*/
public function yearInOut(Collection $entries): array
{
// language:
$format = (string)trans('config.month');
@@ -117,7 +143,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
*
* @return array
*/
public function yearInOutSummarized($income, $expense, $count)
public function yearInOutSummarized(string $income, string $expense, int $count): array
{
$data = [

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* ReportChartGenerator.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -24,7 +25,7 @@ interface ReportChartGeneratorInterface
*
* @return array
*/
public function multiYearInOut(Collection $entries);
public function multiYearInOut(Collection $entries): array;
/**
* @param string $income
@@ -33,14 +34,21 @@ interface ReportChartGeneratorInterface
*
* @return array
*/
public function multiYearInOutSummarized($income, $expense, $count);
public function multiYearInOutSummarized(string $income, string $expense, int $count): array;
/**
* @param Collection $entries
*
* @return array
*/
public function yearInOut(Collection $entries);
public function netWorth(Collection $entries) : array;
/**
* @param Collection $entries
*
* @return array
*/
public function yearInOut(Collection $entries): array;
/**
* @param string $income
@@ -49,6 +57,6 @@ interface ReportChartGeneratorInterface
*
* @return array
*/
public function yearInOutSummarized($income, $expense, $count);
public function yearInOutSummarized(string $income, string $expense, int $count): array;
}

View File

@@ -0,0 +1,52 @@
<?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

@@ -1,4 +1,7 @@
<?php namespace FireflyIII\Handlers\Events;
<?php
declare(strict_types = 1);
namespace FireflyIII\Handlers\Events;
use Auth;
use FireflyIII\Events\TransactionJournalStored;
@@ -14,25 +17,14 @@ use FireflyIII\Models\TransactionJournal;
class ConnectJournalToPiggyBank
{
/**
* Create the event handler.
*
* @codeCoverageIgnore
*
*/
public function __construct()
{
//
}
/**
* Connect a new transaction journal to any related piggy banks.
*
* @param TransactionJournalStored $event
*
* @return boolean
* @return bool
*/
public function handle(TransactionJournalStored $event)
public function handle(TransactionJournalStored $event): bool
{
/** @var TransactionJournal $journal */
$journal = $event->journal;
@@ -49,12 +41,11 @@ class ConnectJournalToPiggyBank
if (is_null($repetition)) {
return true;
}
bcscale(2);
$amount = $journal->amount_positive;
$amount = TransactionJournal::amountPositive($journal);
// if piggy account matches source account, the amount is positive
if ($piggyBank->account_id == $journal->source_account->id) {
$amount = $amount * -1;
if ($piggyBank->account_id == TransactionJournal::sourceAccount($journal)->id) {
$amount = bcmul($amount, '-1');
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* FireRulesForStore.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -25,25 +26,15 @@ use Log;
*/
class FireRulesForStore
{
/**
* Create the event handler.
*
* @codeCoverageIgnore
*
*/
public function __construct()
{
//
}
/**
* Connect a new transaction journal to any related piggy banks.
*
* @param TransactionJournalStored $event
*
* @return boolean
* @return bool
*/
public function handle(TransactionJournalStored $event)
public function handle(TransactionJournalStored $event): bool
{
// get all the user's rule groups, with the rules, order by 'order'.
/** @var User $user */
@@ -61,17 +52,18 @@ class FireRulesForStore
->get(['rules.*']);
/** @var Rule $rule */
foreach ($rules as $rule) {
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
$processor = new Processor($rule, $event->journal);
// get some return out of this?
$processor->handle();
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
$processor = Processor::make($rule);
$processor->handleTransactionJournal($event->journal);
if ($rule->stop_processing) {
break;
return true;
}
}
}
return true;
}
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* FireRulesForUpdate.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -24,23 +25,14 @@ use Log;
*/
class FireRulesForUpdate
{
/**
* Create the event handler.
*
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param TransactionJournalUpdated $event
*
* @return void
* @return bool
*/
public function handle(TransactionJournalUpdated $event)
public function handle(TransactionJournalUpdated $event): bool
{
// get all the user's rule groups, with the rules, order by 'order'.
/** @var User $user */
@@ -59,10 +51,10 @@ class FireRulesForUpdate
/** @var Rule $rule */
foreach ($rules as $rule) {
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
$processor = new Processor($rule, $event->journal);
// get some return out of this?
$processor->handle();
Log::debug('Now handling rule #' . $rule->id . ' (' . $rule->title . ')');
$processor = Processor::make($rule);
$processor->handleTransactionJournal($event->journal);
if ($rule->stop_processing) {
break;
@@ -70,5 +62,7 @@ class FireRulesForUpdate
}
}
return true;
}
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* RescanJournalAfterStore.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -11,7 +12,6 @@ namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\TransactionJournalStored;
use FireflyIII\Support\Events\BillScanner;
use Log;
/**
* Class RescanJournal
@@ -22,26 +22,19 @@ use Log;
class ScanForBillsAfterStore
{
/**
* Create the event handler.
*
*/
public function __construct()
{
//
}
/**
* Scan a transaction journal for possible links to bills, right after storing.
*
* @param TransactionJournalStored $event
*
* @return void
* @return bool
*/
public function handle(TransactionJournalStored $event)
public function handle(TransactionJournalStored $event): bool
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* ScanForBillsAfterUpdate.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -11,7 +12,6 @@ namespace FireflyIII\Handlers\Events;
use FireflyIII\Events\TransactionJournalUpdated;
use FireflyIII\Support\Events\BillScanner;
use Log;
/**
* Class RescanJournal
@@ -21,27 +21,19 @@ use Log;
*/
class ScanForBillsAfterUpdate
{
/**
* Create the event handler.
*
*/
public function __construct()
{
//
}
/**
* Scan a transaction journal for possibly related bills after it has been updated.
*
* @param TransactionJournalUpdated $event
*
* @return void
* @return bool
*/
public function handle(TransactionJournalUpdated $event)
public function handle(TransactionJournalUpdated $event): bool
{
$journal = $event->journal;
BillScanner::scan($journal);
return true;
}
}

View File

@@ -0,0 +1,64 @@
<?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

@@ -1,8 +1,11 @@
<?php namespace FireflyIII\Handlers\Events;
<?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
@@ -13,23 +16,14 @@ use FireflyIII\Models\PiggyBankRepetition;
class UpdateJournalConnection
{
/**
* Create the event handler.
*
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param TransactionJournalUpdated $event
*
* @return void
* @return bool
*/
public function handle(TransactionJournalUpdated $event)
public function handle(TransactionJournalUpdated $event):bool
{
$journal = $event->journal;
@@ -37,7 +31,7 @@ class UpdateJournalConnection
/** @var PiggyBankEvent $event */
$event = PiggyBankEvent::where('transaction_journal_id', $journal->id)->first();
if (is_null($event)) {
return;
return false;
}
$piggyBank = $event->piggyBank()->first();
$repetition = null;
@@ -47,11 +41,10 @@ class UpdateJournalConnection
}
if (is_null($repetition)) {
return;
return false;
}
bcscale(2);
$amount = $journal->amount;
$amount = TransactionJournal::amount($journal);
$diff = bcsub($amount, $event->amount); // update current repetition
$repetition->currentamount = bcadd($repetition->currentamount, $diff);
@@ -60,6 +53,8 @@ class UpdateJournalConnection
$event->amount = $amount;
$event->save();
return true;
}
}

View File

@@ -0,0 +1,115 @@
<?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,33 @@
<?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,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Attachments;
use Auth;
@@ -9,7 +9,10 @@ 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
@@ -28,6 +31,9 @@ class AttachmentHelper implements AttachmentHelperInterface
/** @var int */
protected $maxUploadSize;
/** @var \Illuminate\Contracts\Filesystem\Filesystem */
protected $uploadDisk;
/**
*
*/
@@ -37,6 +43,7 @@ class AttachmentHelper implements AttachmentHelperInterface
$this->allowedMimes = Config::get('firefly.allowedMimes');
$this->errors = new MessageBag;
$this->messages = new MessageBag;
$this->uploadDisk = Storage::disk('upload');
}
/**
@@ -44,7 +51,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return string
*/
public function getAttachmentLocation(Attachment $attachment)
public function getAttachmentLocation(Attachment $attachment): string
{
$path = storage_path('upload') . DIRECTORY_SEPARATOR . 'at-' . $attachment->id . '.data';
@@ -54,7 +61,7 @@ class AttachmentHelper implements AttachmentHelperInterface
/**
* @return MessageBag
*/
public function getErrors()
public function getErrors(): MessageBag
{
return $this->errors;
}
@@ -62,7 +69,7 @@ class AttachmentHelper implements AttachmentHelperInterface
/**
* @return MessageBag
*/
public function getMessages()
public function getMessages(): MessageBag
{
return $this->messages;
}
@@ -72,9 +79,17 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
public function saveAttachmentsForModel(Model $model)
public function saveAttachmentsForModel(Model $model): bool
{
$files = Input::file('attachments');
$files = null;
try {
if (Input::hasFile('attachments')) {
$files = Input::file('attachments');
}
} catch (TypeError $e) {
// Log it, do nothing else.
Log::error($e->getMessage());
}
if (is_array($files)) {
foreach ($files as $entry) {
@@ -97,7 +112,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
protected function hasFile(UploadedFile $file, Model $model)
protected function hasFile(UploadedFile $file, Model $model): bool
{
$md5 = md5_file($file->getRealPath());
$name = $file->getClientOriginalName();
@@ -115,16 +130,17 @@ class AttachmentHelper implements AttachmentHelperInterface
}
/**
*
* @param UploadedFile $file
* @param Model $model
*
* @return bool|Attachment
* @return Attachment
*/
protected function processFile(UploadedFile $file, Model $model)
protected function processFile(UploadedFile $file, Model $model): Attachment
{
$validation = $this->validateUpload($file, $model);
if ($validation === false) {
return false;
return new Attachment;
}
$attachment = new Attachment; // create Attachment object.
@@ -137,15 +153,13 @@ class AttachmentHelper implements AttachmentHelperInterface
$attachment->uploaded = 0;
$attachment->save();
$path = $file->getRealPath(); // encrypt and move file to storage.
$content = file_get_contents($path);
$fileObject = $file->openFile('r');
$fileObject->rewind();
$content = $fileObject->fread($file->getSize());
$encrypted = Crypt::encrypt($content);
// store it:
$upload = $this->getAttachmentLocation($attachment);
if (is_writable(dirname($upload))) {
file_put_contents($upload, $encrypted);
}
$this->uploadDisk->put($attachment->fileName(), $encrypted);
$attachment->uploaded = 1; // update attachment
$attachment->save();
@@ -165,7 +179,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
protected function validMime(UploadedFile $file)
protected function validMime(UploadedFile $file): bool
{
$mime = e($file->getMimeType());
$name = e($file->getClientOriginalName());
@@ -185,7 +199,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
protected function validSize(UploadedFile $file)
protected function validSize(UploadedFile $file): bool
{
$size = $file->getSize();
$name = e($file->getClientOriginalName());
@@ -205,7 +219,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
protected function validateUpload(UploadedFile $file, Model $model)
protected function validateUpload(UploadedFile $file, Model $model): bool
{
if (!$this->validMime($file)) {
return false;

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Attachments;
use FireflyIII\Models\Attachment;
@@ -17,25 +17,25 @@ interface AttachmentHelperInterface
/**
* @param Attachment $attachment
*
* @return mixed
* @return string
*/
public function getAttachmentLocation(Attachment $attachment);
public function getAttachmentLocation(Attachment $attachment): string;
/**
* @return MessageBag
*/
public function getErrors();
public function getErrors(): MessageBag;
/**
* @return MessageBag
*/
public function getMessages();
public function getMessages(): MessageBag;
/**
* @param Model $model
*
* @return bool
*/
public function saveAttachmentsForModel(Model $model);
public function saveAttachmentsForModel(Model $model): bool;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
@@ -15,73 +15,81 @@ class Account
/** @var Collection */
protected $accounts;
/** @var float */
protected $difference;
/** @var float */
protected $end;
/** @var float */
protected $start;
/** @var string */
protected $difference = '';
/** @var string */
protected $end = '';
/** @var string */
protected $start = '';
/**
* @return \Illuminate\Support\Collection
* Account constructor.
*/
public function getAccounts()
public function __construct()
{
$this->accounts = new Collection;
}
/**
* @return Collection
*/
public function getAccounts(): Collection
{
return $this->accounts;
}
/**
* @param \Illuminate\Support\Collection $accounts
* @param Collection $accounts
*/
public function setAccounts($accounts)
public function setAccounts(Collection $accounts)
{
$this->accounts = $accounts;
}
/**
* @return float
* @return string
*/
public function getDifference()
public function getDifference(): string
{
return $this->difference;
}
/**
* @param float $difference
* @param string $difference
*/
public function setDifference($difference)
public function setDifference(string $difference)
{
$this->difference = $difference;
}
/**
* @return float
* @return string
*/
public function getEnd()
public function getEnd(): string
{
return $this->end;
}
/**
* @param float $end
* @param string $end
*/
public function setEnd($end)
public function setEnd(string $end)
{
$this->end = $end;
}
/**
* @return float
* @return string
*/
public function getStart()
public function getStart(): string
{
return $this->start;
}
/**
* @param float $start
* @param string $start
*/
public function setStart($start)
public function setStart(string $start)
{
$this->start = $start;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
@@ -39,23 +39,23 @@ class Balance
/**
* @return BalanceHeader
*/
public function getBalanceHeader()
public function getBalanceHeader(): BalanceHeader
{
return $this->balanceHeader;
return $this->balanceHeader ?? new BalanceHeader;
}
/**
* @param BalanceHeader $balanceHeader
*/
public function setBalanceHeader($balanceHeader)
public function setBalanceHeader(BalanceHeader $balanceHeader)
{
$this->balanceHeader = $balanceHeader;
}
/**
* @return \Illuminate\Support\Collection
* @return Collection
*/
public function getBalanceLines()
public function getBalanceLines(): Collection
{
return $this->balanceLines;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
@@ -17,15 +17,15 @@ class BalanceEntry
/** @var AccountModel */
protected $account;
/** @var float */
protected $left = 0.0;
/** @var float */
protected $spent = 0.0;
/** @var string */
protected $left = '0';
/** @var string */
protected $spent = '0';
/**
* @return AccountModel
*/
public function getAccount()
public function getAccount(): AccountModel
{
return $this->account;
}
@@ -33,39 +33,39 @@ class BalanceEntry
/**
* @param AccountModel $account
*/
public function setAccount($account)
public function setAccount(AccountModel $account)
{
$this->account = $account;
}
/**
* @return float
* @return string
*/
public function getLeft()
public function getLeft(): string
{
return $this->left;
}
/**
* @param float $left
* @param string $left
*/
public function setLeft($left)
public function setLeft(string $left)
{
$this->left = $left;
}
/**
* @return float
* @return string
*/
public function getSpent()
public function getSpent(): string
{
return $this->spent;
}
/**
* @param float $spent
* @param string $spent
*/
public function setSpent($spent)
public function setSpent(string $spent)
{
$this->spent = $spent;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
@@ -37,7 +37,7 @@ class BalanceHeader
/**
* @return Collection
*/
public function getAccounts()
public function getAccounts(): Collection
{
return $this->accounts;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Budget as BudgetModel;
@@ -25,6 +25,7 @@ class BalanceLine
/** @var BudgetModel */
protected $budget;
/** @var int */
protected $role = self::ROLE_DEFAULTROLE;
/**
@@ -33,6 +34,7 @@ class BalanceLine
public function __construct()
{
$this->balanceEntries = new Collection;
}
/**
@@ -46,7 +48,7 @@ class BalanceLine
/**
* @return Collection
*/
public function getBalanceEntries()
public function getBalanceEntries(): Collection
{
return $this->balanceEntries;
}
@@ -54,7 +56,7 @@ class BalanceLine
/**
* @param Collection $balanceEntries
*/
public function setBalanceEntries($balanceEntries)
public function setBalanceEntries(Collection $balanceEntries)
{
$this->balanceEntries = $balanceEntries;
}
@@ -62,15 +64,15 @@ class BalanceLine
/**
* @return BudgetModel
*/
public function getBudget()
public function getBudget(): BudgetModel
{
return $this->budget;
return $this->budget ?? new BudgetModel;
}
/**
* @param BudgetModel $budget
*/
public function setBudget($budget)
public function setBudget(BudgetModel $budget)
{
$this->budget = $budget;
}
@@ -78,7 +80,7 @@ class BalanceLine
/**
* @return int
*/
public function getRole()
public function getRole(): int
{
return $this->role;
}
@@ -86,7 +88,7 @@ class BalanceLine
/**
* @param int $role
*/
public function setRole($role)
public function setRole(int $role)
{
$this->role = $role;
}
@@ -94,13 +96,13 @@ class BalanceLine
/**
* @return string
*/
public function getTitle()
public function getTitle(): string
{
if ($this->getBudget() instanceof BudgetModel) {
if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
return $this->getBudget()->name;
}
if ($this->getRole() == self::ROLE_DEFAULTROLE) {
return trans('firefly.noBudget');
return trans('firefly.no_budget');
}
if ($this->getRole() == self::ROLE_TAGROLE) {
return trans('firefly.coveredWithTags');
@@ -118,14 +120,14 @@ class BalanceLine
* on the given budget/repetition. If you subtract all those amounts from the budget/repetition's
* total amount, this is returned:
*
* @return float
* @return string
*/
public function leftOfRepetition()
public function leftOfRepetition(): string
{
$start = isset($this->budget->amount) ? $this->budget->amount : 0;
$start = $this->budget->amount ?? '0';
/** @var BalanceEntry $balanceEntry */
foreach ($this->getBalanceEntries() as $balanceEntry) {
$start += $balanceEntry->getSpent();
$start = bcadd($balanceEntry->getSpent(), $start);
}
return $start;

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
@@ -38,7 +38,7 @@ class Bill
/**
* @return Collection
*/
public function getBills()
public function getBills(): Collection
{
$set = $this->bills->sortBy(
function (BillLine $bill) {

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Bill as BillModel;
@@ -27,18 +27,21 @@ class BillLine
/** @var string */
protected $min;
/** @var int */
private $transactionJournalId;
/**
* @return string
*/
public function getAmount()
public function getAmount(): string
{
return $this->amount;
return $this->amount ?? '0';
}
/**
* @param string $amount
*/
public function setAmount($amount)
public function setAmount(string $amount)
{
$this->amount = $amount;
}
@@ -46,7 +49,7 @@ class BillLine
/**
* @return BillModel
*/
public function getBill()
public function getBill(): BillModel
{
return $this->bill;
}
@@ -54,7 +57,7 @@ class BillLine
/**
* @param BillModel $bill
*/
public function setBill($bill)
public function setBill(BillModel $bill)
{
$this->bill = $bill;
}
@@ -62,7 +65,7 @@ class BillLine
/**
* @return string
*/
public function getMax()
public function getMax(): string
{
return $this->max;
}
@@ -70,7 +73,7 @@ class BillLine
/**
* @param string $max
*/
public function setMax($max)
public function setMax(string $max)
{
$this->max = $max;
}
@@ -78,7 +81,7 @@ class BillLine
/**
* @return string
*/
public function getMin()
public function getMin(): string
{
return $this->min;
}
@@ -86,23 +89,39 @@ class BillLine
/**
* @param string $min
*/
public function setMin($min)
public function setMin(string $min)
{
$this->min = $min;
}
/**
* @return int
*/
public function getTransactionJournalId(): int
{
return $this->transactionJournalId ?? 0;
}
/**
* @param int $transactionJournalId
*/
public function setTransactionJournalId(int $transactionJournalId)
{
$this->transactionJournalId = $transactionJournalId;
}
/**
* @return boolean
*/
public function isActive()
public function isActive(): bool
{
return $this->active;
}
/**
* @param boolean $active
* @param bool $active
*/
public function setActive($active)
public function setActive(bool $active)
{
$this->active = $active;
}
@@ -110,15 +129,15 @@ class BillLine
/**
* @return boolean
*/
public function isHit()
public function isHit(): bool
{
return $this->hit;
}
/**
* @param boolean $hit
* @param bool $hit
*/
public function setHit($hit)
public function setHit(bool $hit)
{
$this->hit = $hit;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
@@ -41,49 +41,45 @@ class Budget
}
/**
* @param float $add
* @param string $add
*/
public function addBudgeted($add)
public function addBudgeted(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
$add = strval(round($add, 2));
$this->budgeted = bcadd($this->budgeted, $add);
}
/**
* @param float $add
* @param string $add
*/
public function addLeft($add)
public function addLeft(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
$add = strval(round($add, 2));
$this->left = bcadd($this->left, $add);
}
/**
* @param float $add
* @param string $add
*/
public function addOverspent($add)
public function addOverspent(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
$add = strval(round($add, 2));
$this->overspent = bcadd($this->overspent, $add);
}
/**
* @param float $add
* @param string $add
*/
public function addSpent($add)
public function addSpent(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
$add = strval(round($add, 2));
$this->spent = bcadd($this->spent, $add);
}
/**
* @return \Illuminate\Support\Collection
*/
public function getBudgetLines()
public function getBudgetLines(): Collection
{
return $this->budgetLines;
}
@@ -91,7 +87,7 @@ class Budget
/**
* @return string
*/
public function getBudgeted()
public function getBudgeted(): string
{
return $this->budgeted;
}
@@ -99,7 +95,7 @@ class Budget
/**
* @param string $budgeted
*/
public function setBudgeted($budgeted)
public function setBudgeted(string $budgeted)
{
$this->budgeted = $budgeted;
}
@@ -107,7 +103,7 @@ class Budget
/**
* @return string
*/
public function getLeft()
public function getLeft(): string
{
return $this->left;
}
@@ -115,7 +111,7 @@ class Budget
/**
* @param string $left
*/
public function setLeft($left)
public function setLeft(string $left)
{
$this->left = $left;
}
@@ -123,7 +119,7 @@ class Budget
/**
* @return string
*/
public function getOverspent()
public function getOverspent(): string
{
return $this->overspent;
}
@@ -131,7 +127,7 @@ class Budget
/**
* @param string $overspent
*/
public function setOverspent($overspent)
public function setOverspent(string $overspent)
{
$this->overspent = strval(round($overspent, 2));
}
@@ -139,7 +135,7 @@ class Budget
/**
* @return string
*/
public function getSpent()
public function getSpent(): string
{
return $this->spent;
}
@@ -147,7 +143,7 @@ class Budget
/**
* @param string $spent
*/
public function setSpent($spent)
public function setSpent(string $spent)
{
$this->spent = strval(round($spent, 2));
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Budget as BudgetModel;
@@ -17,77 +17,77 @@ class BudgetLine
/** @var BudgetModel */
protected $budget;
/** @var float */
protected $budgeted = 0;
/** @var float */
protected $left = 0;
/** @var float */
protected $overspent = 0;
/** @var string */
protected $budgeted = '0';
/** @var string */
protected $left = '0';
/** @var string */
protected $overspent = '0';
/** @var LimitRepetition */
protected $repetition;
/** @var float */
protected $spent = 0;
/** @var string */
protected $spent = '0';
/**
* @return BudgetModel
*/
public function getBudget()
public function getBudget(): BudgetModel
{
return $this->budget;
return $this->budget ?? new BudgetModel;
}
/**
* @param BudgetModel $budget
*/
public function setBudget($budget)
public function setBudget(BudgetModel $budget)
{
$this->budget = $budget;
}
/**
* @return float
* @return string
*/
public function getBudgeted()
public function getBudgeted(): string
{
return $this->budgeted;
}
/**
* @param float $budgeted
* @param string $budgeted
*/
public function setBudgeted($budgeted)
public function setBudgeted(string $budgeted)
{
$this->budgeted = $budgeted;
}
/**
* @return float
* @return string
*/
public function getLeft()
public function getLeft(): string
{
return $this->left;
}
/**
* @param float $left
* @param string $left
*/
public function setLeft($left)
public function setLeft(string $left)
{
$this->left = $left;
}
/**
* @return float
* @return string
*/
public function getOverspent()
public function getOverspent(): string
{
return $this->overspent;
}
/**
* @param float $overspent
* @param string $overspent
*/
public function setOverspent($overspent)
public function setOverspent(string $overspent)
{
$this->overspent = $overspent;
}
@@ -95,31 +95,31 @@ class BudgetLine
/**
* @return LimitRepetition
*/
public function getRepetition()
public function getRepetition(): LimitRepetition
{
return $this->repetition;
return $this->repetition ?? new LimitRepetition;
}
/**
* @param LimitRepetition $repetition
*/
public function setRepetition($repetition)
public function setRepetition(LimitRepetition $repetition)
{
$this->repetition = $repetition;
}
/**
* @return float
* @return string
*/
public function getSpent()
public function getSpent(): string
{
return $this->spent;
}
/**
* @param float $spent
* @param string $spent
*/
public function setSpent($spent)
public function setSpent(string $spent)
{
$this->spent = $spent;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Category as CategoryModel;
@@ -42,19 +42,18 @@ class Category
}
/**
* @param float $add
* @param string $add
*/
public function addTotal($add)
public function addTotal(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
$add = strval(round($add, 2));
$this->total = bcadd($this->total, $add);
}
/**
* @return Collection
*/
public function getCategories()
public function getCategories(): Collection
{
$set = $this->categories->sortBy(
function (CategoryModel $category) {
@@ -69,7 +68,7 @@ class Category
/**
* @return string
*/
public function getTotal()
public function getTotal(): string
{
return strval(round($this->total, 2));
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use Crypt;
@@ -34,7 +34,6 @@ class Expense
*/
public function addOrCreateExpense(TransactionJournal $entry)
{
bcscale(2);
$accountId = $entry->account_id;
$amount = strval(round($entry->journalAmount, 2));
@@ -58,11 +57,10 @@ class Expense
}
/**
* @param $add
* @param string $add
*/
public function addToTotal($add)
public function addToTotal(string $add)
{
bcscale(2);
$add = strval(round($add, 2));
@@ -80,7 +78,7 @@ class Expense
/**
* @return Collection
*/
public function getExpenses()
public function getExpenses(): Collection
{
$set = $this->expenses->sortBy(
function (stdClass $object) {
@@ -94,7 +92,7 @@ class Expense
/**
* @return string
*/
public function getTotal()
public function getTotal(): string
{
return strval(round($this->total, 2));
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Collection;
use Crypt;
@@ -20,7 +20,7 @@ class Income
/** @var Collection */
protected $incomes;
/** @var string */
protected $total;
protected $total = '0';
/**
*
@@ -45,7 +45,6 @@ class Income
$newObject->id = $accountId;
$this->incomes->put($accountId, $newObject);
} else {
bcscale(2);
$existing = $this->incomes->get($accountId);
$existing->amount = bcadd($existing->amount, $entry->journalAmount);
$existing->count++;
@@ -54,19 +53,18 @@ class Income
}
/**
* @param $add
* @param string $add
*/
public function addToTotal($add)
public function addToTotal(string $add)
{
$add = strval(round($add, 2));
bcscale(2);
$add = strval(round($add, 2));
$this->total = bcadd($this->total, $add);
}
/**
* @return Collection
*/
public function getIncomes()
public function getIncomes(): Collection
{
$set = $this->incomes->sortByDesc(
function (stdClass $object) {
@@ -80,7 +78,7 @@ class Income
/**
* @return string
*/
public function getTotal()
public function getTotal(): string
{
return strval(round($this->total, 2));
}

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use Log;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AccountId
@@ -16,21 +16,18 @@ class AccountId extends BasicConverter implements ConverterInterface
/**
* @return Account
*/
public function convert()
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 = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
} else {
/** @var Account $account */
$account = Auth::user()->accounts()->find($this->value);
if (!is_null($account)) {
Log::debug('Found ' . $account->accountType->type . ' named "******" with ID: ' . $this->value . ' (not mapped) ');
}
$account = $repository->find($this->value);
}
return $account;

View File

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

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**
@@ -17,12 +17,12 @@ class AmountComma extends BasicConverter implements ConverterInterface
*/
public function convert()
{
$value = str_replace(',', '.', $this->value);
$value = str_replace(',', '.', strval($this->value));
if (is_numeric($value)) {
return floatval($value);
return strval($value);
}
return 0;
return '0';
}
}

View File

@@ -1,10 +1,11 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountIban
@@ -15,54 +16,52 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
{
/**
* @return Account|null
* @return Account
*/
public function convert()
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 = Auth::user()->accounts()->find($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:
$account = $this->findAccount();
$accountType = AccountType::where('type', 'Asset account')->first();
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->iban == $this->value) {
if (is_null($account)) {
// create it if doesn't exist.
$account = Account::firstOrCreateEncrypted(
[
'name' => $this->value,
'iban' => $this->value,
'user_id' => Auth::user()->id,
'account_type_id' => $accountType->id,
'active' => 1,
]
);
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 null;
}
/**
* @return Account|null
*/
protected function findAccount()
{
$set = Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->get(['accounts.*']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->iban == $this->value) {
return $entry;
}
}
return null;
return new Account;
}
}

View File

@@ -1,10 +1,11 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountName
@@ -19,15 +20,19 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
*/
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 = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
}
// find or create new account:
$accountType = AccountType::where('type', 'Asset account')->first();
$set = Auth::user()->accounts()->accountTypeIn(['Asset account', 'Default account'])->get();
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->name == $this->value) {
@@ -36,15 +41,23 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
}
// create it if doesnt exist.
$account = Account::firstOrCreateEncrypted(
[
'name' => $this->value,
'iban' => '',
'user_id' => Auth::user()->id,
'account_type_id' => $accountType->id,
'active' => 1,
]
);
$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

@@ -0,0 +1,79 @@
<?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?
}
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
/**
* Class BillId
@@ -18,11 +18,14 @@ class BillId extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var BillRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$bill = Auth::user()->bills()->find($this->mapped[$this->index][$this->value]);
$bill = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$bill = Auth::user()->bills()->find($this->value);
$bill = $repository->find($this->value);
}
return $bill;

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
/**
* Class BillName
@@ -18,13 +18,15 @@ class BillName extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var BillRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$bill = null;
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$bill = Auth::user()->bills()->find($this->mapped[$this->index][$this->value]);
$bill = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$bills = Auth::user()->bills()->get();
$bills = $repository->getBills();
/** @var Bill $bill */
foreach ($bills as $bill) {
if ($bill->name == $this->value) {

View File

@@ -1,8 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
/**
* Class BudgetId
@@ -17,11 +18,15 @@ class BudgetId extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var BudgetRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
$budget = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$budget = Auth::user()->budgets()->find($this->value);
$budget = $repository->find($this->value);
}
return $budget;

View File

@@ -1,8 +1,10 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
/**
* Class BudgetName
@@ -17,17 +19,14 @@ class BudgetName extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var BudgetRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
$budget = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$budget = Budget::firstOrCreateEncrypted(
[
'name' => $this->value,
'user_id' => Auth::user()->id,
'active' => true,
]
);
$budget = $repository->store(['name' => $this->value, 'user' => Auth::user()->id]);
}
return $budget;

View File

@@ -1,8 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
/**
* Class CategoryId
@@ -17,11 +18,14 @@ class CategoryId extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var SingleCategoryRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$category = Auth::user()->categories()->find($this->mapped[$this->index][$this->value]);
$category = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$category = Auth::user()->categories()->find($this->value);
$category = $repository->find($this->value);
}
return $category;

View File

@@ -1,8 +1,10 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
/**
* Class CategoryName
@@ -17,16 +19,20 @@ class CategoryName extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var SingleCategoryRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$category = Auth::user()->categories()->find($this->mapped[$this->index][$this->value]);
$category = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$category = Category::firstOrCreateEncrypted(
[
'name' => $this->value,
'user_id' => Auth::user()->id,
]
);
$data = [
'name' => $this->value,
'user' => Auth::user()->id,
];
$category = $repository->store($data);
}
return $category;

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**

View File

@@ -1,8 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencyCode
@@ -17,10 +18,14 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::whereCode($this->value)->first();
$currency = $repository->findByCode($this->value);
}
return $currency;

View File

@@ -1,8 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencyId
@@ -17,10 +18,13 @@ class CurrencyId extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::find($this->value);
$currency = $repository->find($this->value);
}
return $currency;

View File

@@ -1,8 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencyName
@@ -17,10 +18,14 @@ class CurrencyName extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::whereName($this->value)->first();
$currency = $repository->findByName($this->value);
}
return $currency;

View File

@@ -1,8 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencySymbol
@@ -17,10 +18,13 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::whereSymbol($this->value)->first();
$currency = $repository->findBySymbol($this->value);
}
return $currency;

View File

@@ -1,12 +1,11 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use InvalidArgumentException;
use Log;
use Session;
/**
* Class Date
@@ -22,7 +21,7 @@ class Date extends BasicConverter implements ConverterInterface
*/
public function convert()
{
$format = Session::get('csv-date-format');
$format = session('csv-date-format');
try {
$date = Carbon::createFromFormat($format, $this->value);
} catch (InvalidArgumentException $e) {

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**
@@ -16,6 +16,8 @@ class Description extends BasicConverter implements ConverterInterface
*/
public function convert()
{
return trim($this->data['description'] . ' ' . $this->value);
$description = $this->data['description'] ?? '';
return trim($description . ' ' . $this->value);
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types = 1);
/**
* INGDebetCredit.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;
/**
* Class INGDebetCredit
*
* @package FireflyIII\Helpers\Csv\Converter
*/
class INGDebetCredit extends BasicConverter implements ConverterInterface
{
/**
* @return int
*/
public function convert()
{
if ($this->value === 'Af') {
return -1;
}
return 1;
}
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
/**

View File

@@ -1,10 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use Log;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class OpposingAccountIban
@@ -21,15 +20,23 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
} else {
if (strlen($this->value) > 0) {
$account = $this->findAccount();
if (!is_null($account)) {
return $account;
$set = $repository->getAccounts([]);
/** @var Account $account */
foreach ($set as $account) {
if ($account->iban == $this->value) {
return $account;
}
}
}
@@ -37,21 +44,4 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
}
}
/**
* @return Account|null
*/
protected function findAccount()
{
$set = Auth::user()->accounts()->get();
/** @var Account $account */
foreach ($set as $account) {
if ($account->iban == $this->value) {
Log::debug('OpposingAccountIban::convert found an Account (#' . $account->id . ': ******) with IBAN ******');
return $account;
}
}
return null;
}
}

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class OpposingAccountId
@@ -19,11 +19,14 @@ class OpposingAccountId extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$account = Auth::user()->accounts()->find($this->value);
$account = $repository->find($this->value);
}
return $account;

View File

@@ -1,9 +1,9 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class OpposingAccountName
@@ -20,8 +20,11 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
} else {

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Support\Collection;
/**
@@ -19,17 +18,22 @@ class TagsComma extends BasicConverter implements ConverterInterface
*/
public function convert()
{
$tags = new Collection;
/** @var TagRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$tags = new Collection;
$strings = explode(',', $this->value);
foreach ($strings as $string) {
$tag = Tag::firstOrCreateEncrypted(
[
'tag' => $string,
'tagMode' => 'nothing',
'user_id' => Auth::user()->id,
]
);
$data = [
'tag' => $string,
'date' => null,
'description' => null,
'latitude' => null,
'longitude' => null,
'zoomLevel' => null,
'tagMode' => 'nothing',
];
$tag = $repository->store($data); // should validate first?
$tags->push($tag);
}
$tags = $tags->merge($this->data['tags']);

View File

@@ -1,9 +1,8 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Support\Collection;
/**
@@ -19,17 +18,23 @@ class TagsSpace extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var TagRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$tags = new Collection;
$strings = explode(' ', $this->value);
foreach ($strings as $string) {
$tag = Tag::firstOrCreateEncrypted(
[
'tag' => $string,
'tagMode' => 'nothing',
'user_id' => Auth::user()->id,
]
);
$data = [
'tag' => $string,
'date' => null,
'description' => null,
'latitude' => null,
'longitude' => null,
'zoomLevel' => null,
'tagMode' => 'nothing',
];
$tag = $repository->store($data); // should validate first?
$tags->push($tag);
}
$tags = $tags->merge($this->data['tags']);

View File

@@ -1,9 +1,11 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv;
use Crypt;
use League\Csv\Reader;
use Session;
use Storage;
/**
* Class Data
@@ -14,13 +16,13 @@ class Data
{
/** @var string */
protected $csvFileContent;
protected $csvFileContent = '';
/** @var string */
protected $csvFileLocation;
protected $csvFileLocation = '';
/** @var string */
protected $dateFormat;
protected $dateFormat = '';
/** @var string */
protected $delimiter;
protected $delimiter = '';
/** @var bool */
protected $hasHeaders;
/** @var int */
@@ -57,14 +59,14 @@ class Data
*/
public function getCsvFileContent()
{
return $this->csvFileContent;
return $this->csvFileContent ?? '';
}
/**
*
* @param string $csvFileContent
*/
public function setCsvFileContent($csvFileContent)
public function setCsvFileContent(string $csvFileContent)
{
$this->csvFileContent = $csvFileContent;
}
@@ -82,7 +84,7 @@ class Data
*
* @param string $csvFileLocation
*/
public function setCsvFileLocation($csvFileLocation)
public function setCsvFileLocation(string $csvFileLocation)
{
Session::put('csv-file', $csvFileLocation);
$this->csvFileLocation = $csvFileLocation;
@@ -99,9 +101,9 @@ class Data
/**
*
* @param mixed $dateFormat
* @param string $dateFormat
*/
public function setDateFormat($dateFormat)
public function setDateFormat(string $dateFormat)
{
Session::put('csv-date-format', $dateFormat);
$this->dateFormat = $dateFormat;
@@ -120,7 +122,7 @@ class Data
*
* @param string $delimiter
*/
public function setDelimiter($delimiter)
public function setDelimiter(string $delimiter)
{
Session::put('csv-delimiter', $delimiter);
$this->delimiter = $delimiter;
@@ -170,7 +172,7 @@ class Data
*/
public function getReader()
{
if (strlen($this->csvFileContent) === 0) {
if (!is_null($this->csvFileContent) && strlen($this->csvFileContent) === 0) {
$this->loadCsvFile();
}
@@ -233,7 +235,7 @@ class Data
*
* @param bool $hasHeaders
*/
public function setHasHeaders($hasHeaders)
public function setHasHeaders(bool $hasHeaders)
{
Session::put('csv-has-headers', $hasHeaders);
$this->hasHeaders = $hasHeaders;
@@ -243,7 +245,7 @@ class Data
*
* @param int $importAccount
*/
public function setImportAccount($importAccount)
public function setImportAccount(int $importAccount)
{
Session::put('csv-import-account', $importAccount);
$this->importAccount = $importAccount;
@@ -252,7 +254,8 @@ class Data
protected function loadCsvFile()
{
$file = $this->getCsvFileLocation();
$content = file_get_contents($file);
$disk = Storage::disk('upload');
$content = $disk->get($file);
$contentDecrypted = Crypt::decrypt($content);
$this->setCsvFileContent($contentDecrypted);
}
@@ -260,63 +263,63 @@ class Data
protected function sessionCsvFileLocation()
{
if (Session::has('csv-file')) {
$this->csvFileLocation = (string)Session::get('csv-file');
$this->csvFileLocation = (string)session('csv-file');
}
}
protected function sessionDateFormat()
{
if (Session::has('csv-date-format')) {
$this->dateFormat = (string)Session::get('csv-date-format');
$this->dateFormat = (string)session('csv-date-format');
}
}
protected function sessionDelimiter()
{
if (Session::has('csv-delimiter')) {
$this->delimiter = Session::get('csv-delimiter');
$this->delimiter = session('csv-delimiter');
}
}
protected function sessionHasHeaders()
{
if (Session::has('csv-has-headers')) {
$this->hasHeaders = (bool)Session::get('csv-has-headers');
$this->hasHeaders = (bool)session('csv-has-headers');
}
}
protected function sessionImportAccount()
{
if (Session::has('csv-import-account')) {
$this->importAccount = intval(Session::get('csv-import-account'));
$this->importAccount = intval(session('csv-import-account'));
}
}
protected function sessionMap()
{
if (Session::has('csv-map')) {
$this->map = (array)Session::get('csv-map');
$this->map = (array)session('csv-map');
}
}
protected function sessionMapped()
{
if (Session::has('csv-mapped')) {
$this->mapped = (array)Session::get('csv-mapped');
$this->mapped = (array)session('csv-mapped');
}
}
protected function sessionRoles()
{
if (Session::has('csv-roles')) {
$this->roles = (array)Session::get('csv-roles');
$this->roles = (array)session('csv-roles');
}
}
protected function sessionSpecifix()
{
if (Session::has('csv-specifix')) {
$this->specifix = (array)Session::get('csv-specifix');
$this->specifix = (array)session('csv-specifix');
}
}
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv;
use Auth;
@@ -120,6 +120,8 @@ class Importer
Log::error('Caught error at row #' . $index . ': ' . $result);
$this->errors[$index] = $result;
} else {
$this->imported++;
$this->journals->push($result);
}
@@ -136,7 +138,7 @@ class Importer
/**
* @param Data $data
*/
public function setData($data)
public function setData(Data $data)
{
$this->data = $data;
}
@@ -147,7 +149,6 @@ class Importer
*/
protected function createTransactionJournal()
{
bcscale(2);
$date = $this->importData['date'];
if (is_null($this->importData['date'])) {
$date = $this->importData['date-rent'];
@@ -169,7 +170,7 @@ class Importer
// second transaction
$accountId = $this->importData['opposing-account-object']->id; // create second transaction:
$amount = bcmul($this->importData['amount'], -1);
$amount = bcmul($this->importData['amount'], '-1');
$transaction = Transaction::create(['transaction_journal_id' => $journal->id, 'account_id' => $accountId, 'amount' => $amount]);
$errors = $transaction->getErrors()->merge($errors);
}
@@ -187,7 +188,7 @@ class Importer
// some debug info:
$journalId = $journal->id;
$type = $journal->getTransactionType();
$type = $journal->transaction_type_type ?? $journal->transactionType->type;
/** @var Account $asset */
$asset = $this->importData['asset-account-object'];
/** @var Account $opposing */
@@ -195,7 +196,7 @@ class Importer
Log::info('Created journal #' . $journalId . ' of type ' . $type . '!');
Log::info('Asset account #' . $asset->id . ' lost/gained: ' . $this->importData['amount']);
Log::info($opposing->accountType->type . ' #' . $opposing->id . ' lost/gained: ' . bcmul($this->importData['amount'], -1));
Log::info($opposing->accountType->type . ' #' . $opposing->id . ' lost/gained: ' . bcmul($this->importData['amount'], '-1'));
return $journal;
}
@@ -218,17 +219,17 @@ class Importer
}
/**
* @param $row
* @param array $row
*
* @throws FireflyException
* @return string|bool
*/
protected function importRow($row)
protected function importRow(array $row)
{
$data = $this->getFiller(); // These fields are necessary to create a new transaction journal. Some are optional
foreach ($row as $index => $value) {
$role = isset($this->roles[$index]) ? $this->roles[$index] : '_ignore';
$role = $this->roles[$index] ?? '_ignore';
$class = Config::get('csv.roles.' . $role . '.converter');
$field = Config::get('csv.roles.' . $role . '.field');
@@ -266,7 +267,7 @@ class Importer
*
* @return bool
*/
protected function parseRow($index)
protected function parseRow(int $index)
{
return (($this->data->hasHeaders() && $index >= 1) || !$this->data->hasHeaders());
}
@@ -296,7 +297,8 @@ class Importer
foreach ($set as $className) {
/** @var PostProcessorInterface $postProcessor */
$postProcessor = app('FireflyIII\Helpers\Csv\PostProcessing\\' . $className);
$postProcessor->setData($this->importData);
$array = $this->importData ?? [];
$postProcessor->setData($array);
Log::debug('Now post-process processor named ' . $className . ':');
$this->importData = $postProcessor->process();
}
@@ -343,7 +345,9 @@ class Importer
*/
protected function validateData()
{
if (is_null($this->importData['date']) && is_null($this->importData['date-rent'])) {
$date = $this->importData['date'] ?? null;
$rentDate = $this->importData['date-rent'] ?? null;
if (is_null($date) && is_null($rentDate)) {
return 'No date value for this row.';
}
if (is_null($this->importData['opposing-account-object'])) {
@@ -368,8 +372,8 @@ class Importer
/** @var Rule $rule */
foreach ($group->rules as $rule) {
$processor = new Processor($rule, $journal);
$processor->handle();
$processor = Processor::make($rule);
$processor->handleTransactionJournal($journal);
if ($rule->stop_processing) {
break;
}

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Mapper;
use Auth;

View File

@@ -1,5 +1,5 @@
<?php
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Mapper;
use Auth;
@@ -30,7 +30,8 @@ class AssetAccount implements MapperInterface
/** @var Account $account */
foreach ($result as $account) {
$name = $account->name;
if (strlen($account->iban) > 0) {
$iban = $account->iban ?? '';
if (strlen($iban) > 0) {
$name .= ' (' . $account->iban . ')';
}
$list[$account->id] = $name;

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