Compare commits

...

746 Commits
4.4.3 ... 4.6.4

Author SHA1 Message Date
James Cole
2915fae942 Merge branch 'release/4.6.4' 2017-08-13 09:04:40 +02:00
James Cole
f9b5468481 Last minute fixes for import routine. 2017-08-13 08:49:45 +02:00
James Cole
287f37eba5 Remove unused parameters. 2017-08-13 08:24:58 +02:00
James Cole
26740668da Import transfer error 2017-08-12 21:23:19 +02:00
James Cole
bdd72f0d30 Fix path for tag controller. 2017-08-12 21:22:59 +02:00
James Cole
7e79f25949 Merge languages. 2017-08-12 19:47:46 +02:00
James Cole
2d917e166c Merge pull request #755 from firefly-iii/l10n_develop
New Crowdin translations
2017-08-12 19:47:26 +02:00
James Cole
ad4a811d0a Small bug fixes [skip ci] 2017-08-12 19:11:24 +02:00
James Cole
ab1aa97af4 Read me says 7.1 too. [skip ci] 2017-08-12 19:11:11 +02:00
James Cole
018941c5b3 Actually use journal [skip ci] 2017-08-12 19:05:29 +02:00
James Cole
cc1439fb7b Revamped import routine. 2017-08-12 19:03:42 +02:00
James Cole
f684a2900b Include default currency. 2017-08-12 16:42:29 +02:00
James Cole
83b721a322 Small bug fix in map / roles. 2017-08-12 16:41:05 +02:00
James Cole
a879528ed8 Back to basics. 2017-08-12 16:40:51 +02:00
James Cole
accbff3ccb Small cleanup in CSV processor 2017-08-12 16:12:30 +02:00
James Cole
0375f77b73 Prevent asset account from being found by opposing account. #719 2017-08-12 13:49:40 +02:00
James Cole
9d01162f42 New translations auth.php (Chinese Traditional) 2017-08-12 10:42:10 +02:00
James Cole
3436dc1564 New translations firefly.php (Slovenian) 2017-08-12 10:42:09 +02:00
James Cole
089293079f New translations firefly.php (Spanish) 2017-08-12 10:42:06 +02:00
James Cole
00e2cd7c04 New translations form.php (Chinese Traditional) 2017-08-12 10:42:04 +02:00
James Cole
f5abb933b0 New translations form.php (French) 2017-08-12 10:42:03 +02:00
James Cole
848386bbaf New translations form.php (Dutch) 2017-08-12 10:42:01 +02:00
James Cole
5562a3c2ae New translations firefly.php (Portuguese, Brazilian) 2017-08-12 10:42:00 +02:00
James Cole
9e8738660b New translations firefly.php (Polish) 2017-08-12 10:41:57 +02:00
James Cole
178772d50d New translations firefly.php (Chinese Traditional) 2017-08-12 10:41:55 +02:00
James Cole
8d7f29c7c9 New translations firefly.php (Dutch) 2017-08-12 10:41:52 +02:00
James Cole
255f87f1c3 New translations firefly.php (German) 2017-08-12 10:41:50 +02:00
James Cole
975354d081 New translations firefly.php (French) 2017-08-12 10:41:48 +02:00
James Cole
ec6890ced1 New translations form.php (German) 2017-08-12 10:41:46 +02:00
James Cole
290efb4b62 New translations form.php (Polish) 2017-08-12 10:41:44 +02:00
James Cole
ab3ea76244 New translations help.php (Portuguese, Brazilian) 2017-08-12 10:41:43 +02:00
James Cole
21d07aef15 New translations help.php (Slovenian) 2017-08-12 10:41:42 +02:00
James Cole
6031cd02b9 New translations help.php (Spanish) 2017-08-12 10:41:41 +02:00
James Cole
2cdb4cab12 New translations list.php (Dutch) 2017-08-12 10:41:41 +02:00
James Cole
679217f2ef New translations list.php (Chinese Traditional) 2017-08-12 10:41:40 +02:00
James Cole
3aacc0a258 New translations help.php (Polish) 2017-08-12 10:41:39 +02:00
James Cole
254cf6cc5b New translations help.php (German) 2017-08-12 10:41:38 +02:00
James Cole
c06095259a New translations form.php (Slovenian) 2017-08-12 10:41:37 +02:00
James Cole
30fd98c8d7 New translations form.php (Portuguese, Brazilian) 2017-08-12 10:41:36 +02:00
James Cole
3a410f04fe New translations form.php (Spanish) 2017-08-12 10:41:35 +02:00
James Cole
4a0a58cdc1 New translations help.php (Chinese Traditional) 2017-08-12 10:41:34 +02:00
James Cole
c834f93539 New translations help.php (French) 2017-08-12 10:41:33 +02:00
James Cole
35bdb84e57 New translations help.php (Dutch) 2017-08-12 10:41:32 +02:00
James Cole
36a3a09fcc New translations breadcrumbs.php (Dutch) 2017-08-12 10:41:30 +02:00
James Cole
2c07b490e8 New translations breadcrumbs.php (French) 2017-08-12 10:41:29 +02:00
James Cole
5790311cbd New translations breadcrumbs.php (German) 2017-08-12 10:41:29 +02:00
James Cole
fde3322117 New translations breadcrumbs.php (Portuguese, Brazilian) 2017-08-12 10:41:28 +02:00
James Cole
5664e133d1 New translations breadcrumbs.php (Polish) 2017-08-12 10:41:27 +02:00
James Cole
a1dc38a83f New translations breadcrumbs.php (Chinese Traditional) 2017-08-12 10:41:26 +02:00
James Cole
df974f93ee New translations auth.php (Spanish) 2017-08-12 10:41:25 +02:00
James Cole
3dde64cdac New translations auth.php (French) 2017-08-12 10:41:24 +02:00
James Cole
6b4887df0f New translations auth.php (Dutch) 2017-08-12 10:41:23 +02:00
James Cole
ca8ef3961e New translations auth.php (German) 2017-08-12 10:41:22 +02:00
James Cole
114e0e5b1e New translations auth.php (Polish) 2017-08-12 10:41:22 +02:00
James Cole
c7a247cbba New translations auth.php (Slovenian) 2017-08-12 10:41:21 +02:00
James Cole
3a641a7020 New translations auth.php (Portuguese, Brazilian) 2017-08-12 10:41:20 +02:00
James Cole
0977859bf5 New translations breadcrumbs.php (Slovenian) 2017-08-12 10:41:19 +02:00
James Cole
a644253ee9 New translations breadcrumbs.php (Spanish) 2017-08-12 10:41:18 +02:00
James Cole
3403356be8 New translations config.php (Spanish) 2017-08-12 10:41:16 +02:00
James Cole
4a9ec0d0d4 New translations config.php (Slovenian) 2017-08-12 10:41:15 +02:00
James Cole
250c5c0745 New translations config.php (Dutch) 2017-08-12 10:41:14 +02:00
James Cole
120b5880b1 New translations config.php (Chinese Traditional) 2017-08-12 10:41:13 +02:00
James Cole
18eff73795 New translations config.php (French) 2017-08-12 10:41:12 +02:00
James Cole
89b9dbb1b4 New translations config.php (German) 2017-08-12 10:41:12 +02:00
James Cole
dde4b3ab93 New translations config.php (Portuguese, Brazilian) 2017-08-12 10:41:11 +02:00
James Cole
b1cc655ba5 New translations config.php (Polish) 2017-08-12 10:41:10 +02:00
James Cole
5645a12d5b New translations list.php (French) 2017-08-12 10:41:09 +02:00
James Cole
ce1a935c06 New translations list.php (German) 2017-08-12 10:41:08 +02:00
James Cole
58b90ad6c9 New translations breadcrumbs.php (Russian) 2017-08-12 10:41:07 +02:00
James Cole
4740e63e76 New translations config.php (Russian) 2017-08-12 10:41:06 +02:00
James Cole
319932c734 New translations form.php (Russian) 2017-08-12 10:41:05 +02:00
James Cole
7cf415288a New translations firefly.php (Russian) 2017-08-12 10:41:03 +02:00
James Cole
fe67c1db8f New translations auth.php (Russian) 2017-08-12 10:41:01 +02:00
James Cole
09afbd89b8 New translations demo.php (Spanish) 2017-08-12 10:41:00 +02:00
James Cole
824f7d827c New translations demo.php (French) 2017-08-12 10:40:59 +02:00
James Cole
3a8ca56f95 New translations demo.php (German) 2017-08-12 10:40:58 +02:00
James Cole
137e3fd083 New translations demo.php (Polish) 2017-08-12 10:40:57 +02:00
James Cole
1285944b1f New translations demo.php (Slovenian) 2017-08-12 10:40:56 +02:00
James Cole
cd8e9deab7 New translations demo.php (Portuguese, Brazilian) 2017-08-12 10:40:56 +02:00
James Cole
de424eac64 New translations help.php (Russian) 2017-08-12 10:40:55 +02:00
James Cole
d106a09766 New translations list.php (Russian) 2017-08-12 10:40:54 +02:00
James Cole
963e8ccd2c New translations intro.php (Polish) 2017-08-12 10:40:53 +02:00
James Cole
3474b8f2d0 New translations intro.php (Portuguese, Brazilian) 2017-08-12 10:40:52 +02:00
James Cole
e27b449ae9 New translations intro.php (Russian) 2017-08-12 10:40:51 +02:00
James Cole
7656818456 New translations intro.php (Spanish) 2017-08-12 10:40:50 +02:00
James Cole
d214be1215 New translations intro.php (Slovenian) 2017-08-12 10:40:49 +02:00
James Cole
c8678c3ee5 New translations intro.php (German) 2017-08-12 10:40:48 +02:00
James Cole
108ee40c3f New translations intro.php (French) 2017-08-12 10:40:47 +02:00
James Cole
de51d205dc New translations passwords.php (Russian) 2017-08-12 10:40:46 +02:00
James Cole
1f76246edc New translations pagination.php (Russian) 2017-08-12 10:40:45 +02:00
James Cole
f91974b766 New translations validation.php (Russian) 2017-08-12 10:40:44 +02:00
James Cole
df85936145 New translations demo.php (Russian) 2017-08-12 10:40:43 +02:00
James Cole
f39aa0f52a New translations intro.php (Dutch) 2017-08-12 10:40:42 +02:00
James Cole
180812394b New translations intro.php (Chinese Traditional) 2017-08-12 10:40:41 +02:00
James Cole
291fa9597f New translations demo.php (Dutch) 2017-08-12 10:40:40 +02:00
James Cole
6c4d8c25fc New translations demo.php (Chinese Traditional) 2017-08-12 10:40:39 +02:00
James Cole
bf4b32a8e9 New translations pagination.php (Polish) 2017-08-12 10:40:39 +02:00
James Cole
2e9dac7678 New translations pagination.php (Portuguese, Brazilian) 2017-08-12 10:40:38 +02:00
James Cole
369314c1cb New translations pagination.php (Slovenian) 2017-08-12 10:40:37 +02:00
James Cole
6ab86898af New translations passwords.php (Chinese Traditional) 2017-08-12 10:40:36 +02:00
James Cole
f3aa65d219 New translations pagination.php (Spanish) 2017-08-12 10:40:35 +02:00
James Cole
edf4f19de9 New translations pagination.php (German) 2017-08-12 10:40:34 +02:00
James Cole
91eaaae6d7 New translations pagination.php (French) 2017-08-12 10:40:34 +02:00
James Cole
ca0ae5a165 New translations list.php (Portuguese, Brazilian) 2017-08-12 10:40:33 +02:00
James Cole
86d788d294 New translations list.php (Polish) 2017-08-12 10:40:32 +02:00
James Cole
e345cea9be New translations list.php (Slovenian) 2017-08-12 10:40:31 +02:00
James Cole
779f7841c2 New translations list.php (Spanish) 2017-08-12 10:40:30 +02:00
James Cole
15fdca46b8 New translations pagination.php (Dutch) 2017-08-12 10:40:29 +02:00
James Cole
97e099c70f New translations pagination.php (Chinese Traditional) 2017-08-12 10:40:28 +02:00
James Cole
d5a58bb763 New translations passwords.php (Dutch) 2017-08-12 10:40:26 +02:00
James Cole
2774df0d30 New translations passwords.php (French) 2017-08-12 10:40:25 +02:00
James Cole
93a1799a4b New translations validation.php (German) 2017-08-12 10:40:24 +02:00
James Cole
f65f051c7c New translations validation.php (Polish) 2017-08-12 10:40:23 +02:00
James Cole
c46952dd4e New translations validation.php (Portuguese, Brazilian) 2017-08-12 10:40:22 +02:00
James Cole
1dad6b6118 New translations validation.php (Spanish) 2017-08-12 10:40:22 +02:00
James Cole
e964621f2c New translations validation.php (Slovenian) 2017-08-12 10:40:21 +02:00
James Cole
46ae62f693 New translations validation.php (French) 2017-08-12 10:40:20 +02:00
James Cole
7d578f5852 New translations validation.php (Dutch) 2017-08-12 10:40:19 +02:00
James Cole
467f257ad3 New translations passwords.php (Polish) 2017-08-12 10:40:18 +02:00
James Cole
55186c0a49 New translations passwords.php (German) 2017-08-12 10:40:17 +02:00
James Cole
1a0a4f7112 New translations passwords.php (Portuguese, Brazilian) 2017-08-12 10:40:16 +02:00
James Cole
658290ae80 New translations passwords.php (Slovenian) 2017-08-12 10:40:15 +02:00
James Cole
cb9f29c6fc New translations validation.php (Chinese Traditional) 2017-08-12 10:40:15 +02:00
James Cole
d8f4955292 New translations passwords.php (Spanish) 2017-08-12 10:40:13 +02:00
James Cole
9803932324 Various code clean up. 2017-08-12 10:27:45 +02:00
James Cole
a3a416b5e2 New composer file 2017-08-12 09:15:09 +02:00
James Cole
1453a318fe Merge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop
* 'develop' of https://github.com/firefly-iii/firefly-iii: (23 commits)
  New translations firefly.php (Dutch)
  New translations firefly.php (Chinese Traditional)
  New translations firefly.php (Dutch)
  New translations firefly.php (Polish)
  New translations firefly.php (Portuguese, Brazilian)
  New translations firefly.php (Slovenian)
  New translations firefly.php (Spanish)
  New translations firefly.php (German)
  New translations firefly.php (French)
  New translations firefly.php (Russian)
  New translations firefly.php (Dutch)
  New translations validation.php (Dutch)
  New translations form.php (Dutch)
  New translations csv.php (Dutch)
  New translations firefly.php (Slovenian)
  New translations firefly.php (Spanish)
  New translations firefly.php (Portuguese, Brazilian)
  New translations firefly.php (Polish)
  New translations firefly.php (Chinese Traditional)
  New translations firefly.php (Dutch)
  ...
2017-08-12 09:14:54 +02:00
James Cole
9ffa01d318 Merge pull request #754 from firefly-iii/l10n_develop
New Crowdin translations
2017-08-12 09:14:18 +02:00
James Cole
29b779c873 Remove intro popup. 2017-08-12 09:06:13 +02:00
James Cole
598307f676 Update change log 2017-08-12 09:06:02 +02:00
James Cole
aa9d546bf5 New translations firefly.php (Dutch) 2017-08-12 08:20:30 +02:00
James Cole
f2ef245eca New translations firefly.php (Chinese Traditional) 2017-08-12 08:10:24 +02:00
James Cole
458606381e New translations firefly.php (Dutch) 2017-08-12 08:10:21 +02:00
James Cole
244f174dc9 New translations firefly.php (Polish) 2017-08-12 08:10:19 +02:00
James Cole
8a577f3197 New translations firefly.php (Portuguese, Brazilian) 2017-08-12 08:10:17 +02:00
James Cole
2f1b24cc14 New translations firefly.php (Slovenian) 2017-08-12 08:10:13 +02:00
James Cole
d5f836db7a New translations firefly.php (Spanish) 2017-08-12 08:10:10 +02:00
James Cole
ffd7c36cb2 New translations firefly.php (German) 2017-08-12 08:05:26 +02:00
James Cole
dba543d539 New translations firefly.php (French) 2017-08-12 08:05:24 +02:00
James Cole
9753c0f8eb New translations firefly.php (Russian) 2017-08-12 08:05:09 +02:00
James Cole
c50b4d3d47 New translations firefly.php (Dutch) 2017-08-12 08:05:02 +02:00
James Cole
907f886cf0 New translations validation.php (Dutch) 2017-08-12 08:04:53 +02:00
James Cole
218a2d2004 Expand password modal. 2017-08-12 08:01:40 +02:00
James Cole
0e0f2c6833 New translations form.php (Dutch) 2017-08-12 08:00:06 +02:00
James Cole
e59090d3b6 Text and modal for password security. 2017-08-12 07:56:02 +02:00
James Cole
0404be8bef New translations csv.php (Dutch) 2017-08-12 07:50:05 +02:00
James Cole
337895cbaa Add newlines to files. 2017-08-12 07:48:39 +02:00
James Cole
743547096e Various code cleanup 2017-08-12 07:47:42 +02:00
James Cole
81fb3df45e Fix #747 2017-08-12 07:39:58 +02:00
James Cole
12624cab5b Improve foreign currency routine for #746 2017-08-12 07:38:22 +02:00
James Cole
7d62ea88d2 New translations firefly.php (Slovenian) 2017-08-12 07:10:58 +02:00
James Cole
abcc277430 New translations firefly.php (Spanish) 2017-08-12 07:10:55 +02:00
James Cole
4c4c9426ee New translations firefly.php (Portuguese, Brazilian) 2017-08-12 07:10:52 +02:00
James Cole
88fdeb2bf2 New translations firefly.php (Polish) 2017-08-12 07:10:50 +02:00
James Cole
f9ab868022 New translations firefly.php (Chinese Traditional) 2017-08-12 07:10:47 +02:00
James Cole
148d2cec8f New translations firefly.php (Dutch) 2017-08-12 07:10:45 +02:00
James Cole
5869f157f6 New translations firefly.php (German) 2017-08-12 07:10:43 +02:00
James Cole
69a2902161 New translations firefly.php (French) 2017-08-12 07:10:40 +02:00
James Cole
c19b048249 New translations firefly.php (Russian) 2017-08-12 07:10:26 +02:00
James Cole
cd2c8acdb2 Merge pull request #729 from firefly-iii/l10n_develop
New Crowdin translations
2017-08-12 07:01:33 +02:00
James Cole
7d0d1c764f Make sure we’re still at 4.6.4 and bunq import is unavailable. [skip ci] 2017-08-12 07:01:21 +02:00
James Cole
b5acf1d529 Merge early release branch
Code for #749
  Add link to split withdrawal
  Clarifies #751
  Text for #748
  Improve error reporting #752
  Small code cleanup.
  Add copyright markers.
2017-08-12 06:59:59 +02:00
James Cole
72b08384ad Code for #749 2017-08-12 06:55:46 +02:00
James Cole
f51e48f282 Add link to split withdrawal 2017-08-12 06:55:35 +02:00
James Cole
2e6d1f3642 Clarifies #751 2017-08-12 06:44:00 +02:00
James Cole
716af4ed93 Text for #748 2017-08-12 06:41:14 +02:00
James Cole
31de86c9eb Improve error reporting #752 2017-08-12 06:40:17 +02:00
James Cole
04a2cd1f1f Small code cleanup. 2017-08-11 05:42:15 +02:00
James Cole
bc0ef11a8c Add copyright markers. 2017-08-11 05:36:05 +02:00
James Cole
90c8420a4c Initial code for preparing bunq import #714 2017-08-11 05:21:00 +02:00
James Cole
657d5e0d74 Upgrade version in develop 2017-08-11 05:02:49 +02:00
James Cole
03fa4d957c Added upgrade instruction [skip ci] 2017-08-10 20:52:10 +02:00
James Cole
8d4530f1f2 Fixes #743 2017-08-10 20:48:29 +02:00
James Cole
6d15c503c3 Fix #515 2017-08-10 20:41:33 +02:00
James Cole
75ddb34398 Remove references to date range thing. 2017-08-10 19:57:18 +02:00
James Cole
6fbfe6fb72 Remove references to date range thing. 2017-08-10 19:55:52 +02:00
James Cole
db500e911c update date range picker 2017-08-10 19:55:23 +02:00
James Cole
c0c5ced6ad Fix multi currency edit display 2017-08-10 19:55:13 +02:00
James Cole
726270f8bc New translations form.php (Chinese Traditional) 2017-08-08 16:41:01 +02:00
James Cole
c3908450a0 New translations form.php (French) 2017-08-08 16:40:59 +02:00
James Cole
f7ba05f465 New translations form.php (Dutch) 2017-08-08 16:40:58 +02:00
James Cole
dea7f7d5d6 New translations form.php (German) 2017-08-08 16:40:46 +02:00
James Cole
ed7a0a2b9d New translations form.php (Polish) 2017-08-08 16:40:45 +02:00
James Cole
ac6b4db0f8 New translations form.php (Slovenian) 2017-08-08 16:40:41 +02:00
James Cole
b5d659c13c New translations form.php (Portuguese, Brazilian) 2017-08-08 16:40:40 +02:00
James Cole
919cb5d1f2 New translations form.php (Spanish) 2017-08-08 16:40:39 +02:00
James Cole
e504d3cc35 New translations form.php (Russian) 2017-08-08 16:40:28 +02:00
James Cole
1d67939e76 No password service in env file. [skip ci] 2017-08-08 16:30:43 +02:00
James Cole
5d1e90d29c Expand verify password routine. 2017-08-08 16:30:21 +02:00
James Cole
1678eba9cc New translations intro.php (Polish) 2017-08-08 16:10:35 +02:00
James Cole
cc142b2ba1 New translations intro.php (Portuguese, Brazilian) 2017-08-08 16:10:33 +02:00
James Cole
48cbffba14 New translations intro.php (Russian) 2017-08-08 16:10:32 +02:00
James Cole
d909bb1b25 New translations intro.php (Spanish) 2017-08-08 16:10:31 +02:00
James Cole
3313e66fc2 New translations intro.php (Slovenian) 2017-08-08 16:10:30 +02:00
James Cole
085892a4c8 New translations intro.php (German) 2017-08-08 16:10:28 +02:00
James Cole
817e059230 New translations intro.php (French) 2017-08-08 16:10:27 +02:00
James Cole
7ce8891246 New translations intro.php (Dutch) 2017-08-08 16:10:25 +02:00
James Cole
439b2589f9 New translations intro.php (Chinese Traditional) 2017-08-08 16:10:24 +02:00
James Cole
e7b5cf66d2 Fix #739 2017-08-08 16:06:58 +02:00
James Cole
b29fabf76c Include virtual balance in transaction overview #735 2017-08-07 20:36:23 +02:00
James Cole
5d837c3ee4 Bump version. [skip ci] 2017-08-07 20:27:58 +02:00
James Cole
4c0396ad1c Fixes #733 2017-08-07 17:59:26 +02:00
James Cole
97b62fce79 New translations firefly.php (Russian) 2017-08-05 02:00:07 +02:00
James Cole
e904a38735 New translations firefly.php (Russian) 2017-08-05 01:10:08 +02:00
James Cole
ae72187aed New translations form.php (Russian) 2017-08-05 01:10:05 +02:00
James Cole
e4ebeefa61 New translations firefly.php (Russian) 2017-08-05 01:00:09 +02:00
James Cole
417373ba70 New translations form.php (Russian) 2017-08-05 01:00:06 +02:00
James Cole
36f9ded08e New translations breadcrumbs.php (Russian) 2017-08-05 01:00:05 +02:00
James Cole
858925b8c8 New translations firefly.php (Slovenian) 2017-08-04 17:11:13 +02:00
James Cole
d36c96fba9 New translations firefly.php (Spanish) 2017-08-04 17:11:10 +02:00
James Cole
2be6fb329e New translations firefly.php (Portuguese, Brazilian) 2017-08-04 17:11:05 +02:00
James Cole
da56363ef9 New translations firefly.php (Polish) 2017-08-04 17:11:02 +02:00
James Cole
90d73228f3 New translations firefly.php (Chinese Traditional) 2017-08-04 17:10:59 +02:00
James Cole
1c76fcd26b New translations firefly.php (Dutch) 2017-08-04 17:10:55 +02:00
James Cole
c26c4ddf15 New translations firefly.php (German) 2017-08-04 17:10:53 +02:00
James Cole
537bdb62da New translations firefly.php (French) 2017-08-04 17:10:49 +02:00
James Cole
b2ac2bd97a New translations firefly.php (Russian) 2017-08-04 17:10:32 +02:00
James Cole
aee6ea56b5 New translations validation.php (Russian) 2017-08-04 17:10:24 +02:00
James Cole
ff5506c842 New translations validation.php (German) 2017-08-04 17:10:16 +02:00
James Cole
94c5340fbf New translations validation.php (Polish) 2017-08-04 17:10:15 +02:00
James Cole
0e11026b60 New translations validation.php (Portuguese, Brazilian) 2017-08-04 17:10:14 +02:00
James Cole
1d8e953ebc New translations validation.php (Spanish) 2017-08-04 17:10:13 +02:00
James Cole
8708fba4bc New translations validation.php (Slovenian) 2017-08-04 17:10:12 +02:00
James Cole
bc1294ae61 New translations validation.php (French) 2017-08-04 17:10:10 +02:00
James Cole
308f05101e New translations validation.php (Dutch) 2017-08-04 17:10:09 +02:00
James Cole
f368739303 New translations validation.php (Chinese Traditional) 2017-08-04 17:10:07 +02:00
James Cole
1bca1b921b Fix import tests. 2017-08-04 16:24:44 +02:00
James Cole
3e513e92b1 Import routine is prepped for multi-source import (such as banks). 2017-08-04 15:56:14 +02:00
James Cole
194fe178c0 Refactor for #732 2017-08-04 15:48:26 +02:00
James Cole
5d10a19bfa First version of routine #732 2017-08-04 15:46:52 +02:00
James Cole
8f52a68526 New translations firefly.php (French) 2017-08-04 13:10:13 +02:00
James Cole
c67d0d59bb New translations firefly.php (French) 2017-08-04 13:00:08 +02:00
James Cole
4477064f17 New translations firefly.php (French) 2017-08-04 12:50:08 +02:00
James Cole
9dbe24b37c New translations csv.php (Portuguese, Brazilian) 2017-08-04 08:20:13 +02:00
James Cole
46a85295e8 New translations firefly.php (Portuguese, Brazilian) 2017-08-04 08:20:11 +02:00
James Cole
63170324a8 New translations form.php (Portuguese, Brazilian) 2017-08-04 08:20:08 +02:00
James Cole
4fd157b5f4 New translations firefly.php (Polish) 2017-08-03 21:00:23 +02:00
James Cole
e5406a0ea3 New translations firefly.php (Chinese Traditional) 2017-08-03 21:00:20 +02:00
James Cole
9b64ba21fd New translations firefly.php (Portuguese, Brazilian) 2017-08-03 21:00:17 +02:00
James Cole
18fcf07971 New translations firefly.php (Slovenian) 2017-08-03 21:00:14 +02:00
James Cole
d3404c6570 New translations firefly.php (Spanish) 2017-08-03 21:00:10 +02:00
James Cole
1878b5287b Cheap solution for #730 [skip ci] 2017-08-03 20:50:16 +02:00
James Cole
7f74545586 New translations firefly.php (German) 2017-07-30 14:10:38 +02:00
James Cole
a920894a8f New translations firefly.php (French) 2017-07-30 14:10:35 +02:00
James Cole
2c912456ce New translations firefly.php (Russian) 2017-07-30 14:10:23 +02:00
James Cole
ebda475972 New translations firefly.php (Dutch) 2017-07-30 14:10:17 +02:00
James Cole
05aace84e1 Fix tests for show() routines. 2017-07-30 13:57:46 +02:00
James Cole
1cfa1faccc Remove all time jumps because they’re unclear and complex. 2017-07-30 13:53:04 +02:00
James Cole
1caa393974 Simple cache routine. 2017-07-30 13:44:36 +02:00
James Cole
ef357ab6e5 Fix tests 2017-07-30 13:42:38 +02:00
James Cole
c39c5492ea Simplify controllers 2017-07-30 13:42:30 +02:00
James Cole
1a5d54f74f New translations firefly.php (Slovenian) 2017-07-30 10:40:53 +02:00
James Cole
13dc6c7dfb New translations firefly.php (Spanish) 2017-07-30 10:40:50 +02:00
James Cole
4c7dee69c2 New translations firefly.php (Portuguese, Brazilian) 2017-07-30 10:40:47 +02:00
James Cole
dc9cf7689d New translations firefly.php (Polish) 2017-07-30 10:40:44 +02:00
James Cole
778a408c6c New translations firefly.php (Chinese Traditional) 2017-07-30 10:40:42 +02:00
James Cole
2b7f3061d0 New translations firefly.php (Dutch) 2017-07-30 10:40:40 +02:00
James Cole
92903e1ec3 New translations firefly.php (German) 2017-07-30 10:40:37 +02:00
James Cole
c5a621010e New translations firefly.php (French) 2017-07-30 10:40:35 +02:00
James Cole
0b5b636578 New translations firefly.php (Russian) 2017-07-30 10:40:20 +02:00
James Cole
8fcdb91ba3 Will no longer support extended tag modes. 2017-07-30 10:22:14 +02:00
James Cole
f67d5f1197 Fix bug in filter. 2017-07-30 10:21:45 +02:00
James Cole
6e0e6203cc Some help text for attachment decrypter 2017-07-30 10:21:35 +02:00
James Cole
2694ce4148 Decryption routine for #671 2017-07-30 08:22:39 +02:00
James Cole
7c02b032f6 New translations firefly.php (Slovenian) 2017-07-29 14:40:52 +02:00
James Cole
deb7754cb9 New translations firefly.php (Spanish) 2017-07-29 14:40:50 +02:00
James Cole
624f3c60bd New translations firefly.php (Portuguese, Brazilian) 2017-07-29 14:40:46 +02:00
James Cole
8a8e792faa New translations firefly.php (Polish) 2017-07-29 14:40:44 +02:00
James Cole
bc836011bc New translations firefly.php (Chinese Traditional) 2017-07-29 14:40:41 +02:00
James Cole
107eedfb49 New translations firefly.php (Dutch) 2017-07-29 14:40:38 +02:00
James Cole
61a7dcda23 New translations firefly.php (German) 2017-07-29 14:40:36 +02:00
James Cole
873ca4f438 New translations firefly.php (French) 2017-07-29 14:40:33 +02:00
James Cole
29221c2901 New translations firefly.php (Russian) 2017-07-29 14:40:19 +02:00
James Cole
eac9613df7 Fix for #648 2017-07-29 14:25:54 +02:00
James Cole
184d5d25a6 New translations csv.php (Spanish) 2017-07-29 08:40:46 +02:00
James Cole
ae33411566 New translations csv.php (Slovenian) 2017-07-29 08:40:34 +02:00
James Cole
479ebcc3fa New translations csv.php (Portuguese, Brazilian) 2017-07-29 08:40:33 +02:00
James Cole
1ae572cf30 New translations csv.php (Chinese Traditional) 2017-07-29 08:40:29 +02:00
James Cole
ac6e16688d New translations csv.php (Dutch) 2017-07-29 08:40:28 +02:00
James Cole
69159e0271 New translations csv.php (French) 2017-07-29 08:40:28 +02:00
James Cole
cae35d6a5a New translations csv.php (Polish) 2017-07-29 08:40:27 +02:00
James Cole
df9b65e296 New translations csv.php (German) 2017-07-29 08:40:26 +02:00
James Cole
fb0b34a6a0 New translations csv.php (Russian) 2017-07-29 08:40:22 +02:00
James Cole
db3b822aef Include warning for #722 2017-07-29 08:27:39 +02:00
James Cole
f4994ef151 Also store links when importing data. 2017-07-28 14:52:01 +02:00
James Cole
8e27291417 Tags no longer mappable. 2017-07-28 14:40:53 +02:00
James Cole
aae9ad78e5 This should fix the tests for now. 2017-07-26 18:40:48 +02:00
James Cole
fb3efbfc66 Fix parameter count. 2017-07-26 16:40:25 +02:00
James Cole
0f8a66609a Fix controller for #718 2017-07-26 16:40:14 +02:00
James Cole
b3bb8c386f Fix routes for #718 2017-07-26 16:40:00 +02:00
James Cole
b3b5e0e155 This will disable the PHP 7.0 tests. 2017-07-25 21:01:37 +02:00
James Cole
99a0bf1286 This fixes #717 2017-07-25 21:01:25 +02:00
James Cole
650f0ee752 Merge branch 'hotfix/4.6.3.1' into develop 2017-07-23 20:02:46 +02:00
James Cole
2ddcf1120f Merge branch 'hotfix/4.6.3.1' 2017-07-23 20:02:45 +02:00
James Cole
d45c74915c This fixes #715 2017-07-23 20:02:32 +02:00
James Cole
cd373791ac Updated composer file. 2017-07-23 20:00:26 +02:00
James Cole
7b03b0c5fc Some PHP 7.1 compatible code. 2017-07-23 19:06:24 +02:00
James Cole
57d6677131 Merge branch 'release/4.6.3' 2017-07-23 10:01:48 +02:00
James Cole
05e73344eb Various files for upgrade. 2017-07-23 09:54:07 +02:00
James Cole
fff8f96490 Merge pull request #706 from firefly-iii/l10n_develop
New Crowdin translations
2017-07-23 09:53:40 +02:00
James Cole
1ccfb34246 New translations firefly.php (Slovenian) 2017-07-23 09:50:53 +02:00
James Cole
b30bd00993 New translations firefly.php (Spanish) 2017-07-23 09:50:51 +02:00
James Cole
6b2d9fe816 New translations firefly.php (Portuguese, Brazilian) 2017-07-23 09:50:47 +02:00
James Cole
531114279d New translations firefly.php (Polish) 2017-07-23 09:50:45 +02:00
James Cole
944aaff0fa New translations firefly.php (Chinese Traditional) 2017-07-23 09:50:42 +02:00
James Cole
6bafa6819d New translations firefly.php (Dutch) 2017-07-23 09:50:40 +02:00
James Cole
8d7091285a New translations firefly.php (German) 2017-07-23 09:50:38 +02:00
James Cole
579e95219a New translations firefly.php (French) 2017-07-23 09:50:35 +02:00
James Cole
4a746881e3 New translations firefly.php (Russian) 2017-07-23 09:50:20 +02:00
James Cole
9122f1b642 New translations firefly.php (Dutch) 2017-07-23 09:40:08 +02:00
James Cole
8b033ed4a8 Update contributing and support guidelines [skip ci] 2017-07-23 09:37:51 +02:00
James Cole
8e53a63243 Broken translation. [skip ci] 2017-07-23 09:36:50 +02:00
James Cole
4de01e7387 New translations firefly.php (Dutch) 2017-07-23 09:30:10 +02:00
James Cole
f85ab74e2b Code cleanup and tests. 2017-07-23 08:32:51 +02:00
James Cole
8bb7d5de3f Various code clean up. 2017-07-23 08:16:11 +02:00
James Cole
68424e485c New translations firefly.php (Slovenian) 2017-07-23 07:41:00 +02:00
James Cole
ac34285eed New translations firefly.php (Spanish) 2017-07-23 07:40:58 +02:00
James Cole
e605a82573 New translations firefly.php (Portuguese, Brazilian) 2017-07-23 07:40:55 +02:00
James Cole
1061764426 New translations firefly.php (Polish) 2017-07-23 07:40:52 +02:00
James Cole
8d93e410f7 New translations firefly.php (Chinese Traditional) 2017-07-23 07:40:49 +02:00
James Cole
9336cdcc5d New translations firefly.php (Dutch) 2017-07-23 07:40:47 +02:00
James Cole
7639c03646 New translations firefly.php (German) 2017-07-23 07:40:45 +02:00
James Cole
2da55bff9c New translations firefly.php (French) 2017-07-23 07:40:43 +02:00
James Cole
6ea5d45dec New translations firefly.php (Russian) 2017-07-23 07:40:29 +02:00
James Cole
e9504a3899 New translations intro.php (Polish) 2017-07-23 07:40:25 +02:00
James Cole
7bff2fd1e5 New translations intro.php (Portuguese, Brazilian) 2017-07-23 07:40:23 +02:00
James Cole
694712e933 New translations intro.php (Russian) 2017-07-23 07:40:22 +02:00
James Cole
aa675559e6 New translations intro.php (Spanish) 2017-07-23 07:40:22 +02:00
James Cole
2af19d675a New translations intro.php (Slovenian) 2017-07-23 07:40:21 +02:00
James Cole
4588d16fc2 New translations intro.php (German) 2017-07-23 07:40:20 +02:00
James Cole
5dbd3031be New translations intro.php (French) 2017-07-23 07:40:19 +02:00
James Cole
59c16eba77 New translations intro.php (Dutch) 2017-07-23 07:40:17 +02:00
James Cole
8c21ec96d1 New translations intro.php (Chinese Traditional) 2017-07-23 07:40:16 +02:00
James Cole
2c00a8353d Fix small issue reenabling intro [skip ci] 2017-07-23 07:35:30 +02:00
James Cole
19e7a76f85 Forgot small statement [skip ci] 2017-07-23 07:32:06 +02:00
James Cole
f16a186faf Option to re-enable intro boxes. 2017-07-23 07:30:05 +02:00
James Cole
456dd39ec4 New intro texts. 2017-07-22 22:56:21 +02:00
James Cole
5b69a697e4 Improve pages to show intro texts. 2017-07-22 10:50:30 +02:00
James Cole
20d279fee4 New translations firefly.php (Slovenian) 2017-07-21 06:20:54 +02:00
James Cole
cd55d819af New translations firefly.php (Spanish) 2017-07-21 06:20:52 +02:00
James Cole
dce51da92f New translations firefly.php (Portuguese, Brazilian) 2017-07-21 06:20:48 +02:00
James Cole
6118cf6041 New translations firefly.php (Polish) 2017-07-21 06:20:45 +02:00
James Cole
4ae8bffd4d New translations firefly.php (Chinese Traditional) 2017-07-21 06:20:42 +02:00
James Cole
5ebe86d5b6 New translations firefly.php (Dutch) 2017-07-21 06:20:40 +02:00
James Cole
317d97a310 New translations firefly.php (German) 2017-07-21 06:20:38 +02:00
James Cole
082aa1d8e3 New translations firefly.php (French) 2017-07-21 06:20:36 +02:00
James Cole
2f2963676f New translations firefly.php (Russian) 2017-07-21 06:20:19 +02:00
James Cole
f2d388f742 Improve code for intro texts. 2017-07-21 06:00:10 +02:00
James Cole
d79008495a Remove some html comments. 2017-07-21 04:36:23 +02:00
James Cole
43f1867fb8 Language strings for #708 2017-07-21 04:36:09 +02:00
James Cole
043c28628c Fixes #708 2017-07-21 04:35:57 +02:00
James Cole
9540854c8a Language is not complete yet. [skip ci] 2017-07-21 04:26:13 +02:00
James Cole
b951a6ca66 Merge pull request #712 from simonsmiley/update-charts
Make charts easier to read
2017-07-19 16:11:58 +02:00
Simon Hanna
26561a395d Make charts easier to read
* Do not fill the area below the lines
* Provide border color
* Decrease transparency of border
2017-07-19 15:53:22 +02:00
James Cole
0a884c8718 New translations intro.php (Polish) 2017-07-16 18:40:23 +02:00
James Cole
b393e3c662 New translations intro.php (Portuguese, Brazilian) 2017-07-16 18:40:22 +02:00
James Cole
c36062210f New translations intro.php (Russian) 2017-07-16 18:40:21 +02:00
James Cole
861381fbb6 New translations intro.php (Spanish) 2017-07-16 18:40:20 +02:00
James Cole
b9019f9590 New translations intro.php (Slovenian) 2017-07-16 18:40:19 +02:00
James Cole
fcfa877e89 New translations intro.php (German) 2017-07-16 18:40:18 +02:00
James Cole
d61849eefe New translations intro.php (French) 2017-07-16 18:40:17 +02:00
James Cole
bc83bd6ec8 New translations intro.php (Dutch) 2017-07-16 18:40:15 +02:00
James Cole
c18c94e565 New translations intro.php (Chinese Traditional) 2017-07-16 18:40:15 +02:00
James Cole
77d077ec08 Fix help button. 2017-07-16 18:28:46 +02:00
James Cole
021d0e6359 More stuff for intro texts. 2017-07-16 18:14:29 +02:00
James Cole
7f4fd2c52f Fix tests. 2017-07-16 17:05:52 +02:00
James Cole
8ffe098e3b New translations firefly.php (Slovenian) 2017-07-16 13:20:56 +02:00
James Cole
a2ca86ca74 New translations firefly.php (Spanish) 2017-07-16 13:20:54 +02:00
James Cole
deef018806 New translations firefly.php (Portuguese, Brazilian) 2017-07-16 13:20:50 +02:00
James Cole
c3f8b2ea56 New translations firefly.php (Polish) 2017-07-16 13:20:47 +02:00
James Cole
e3696b6055 New translations firefly.php (Chinese Traditional) 2017-07-16 13:20:45 +02:00
James Cole
b82b340668 New translations firefly.php (Dutch) 2017-07-16 13:20:42 +02:00
James Cole
a8b01c439b New translations firefly.php (German) 2017-07-16 13:20:39 +02:00
James Cole
6ec686ca7e New translations firefly.php (French) 2017-07-16 13:20:37 +02:00
James Cole
fdb664fecb New translations firefly.php (Russian) 2017-07-16 13:20:21 +02:00
James Cole
09f838089b Allow rule to be applied to transactions (not just group). 2017-07-16 13:04:45 +02:00
James Cole
db0fe918b8 New translations firefly.php (Dutch) 2017-07-16 08:00:07 +02:00
James Cole
8ca696d547 New translations firefly.php (Dutch) 2017-07-16 07:50:41 +02:00
James Cole
b7ccb1ce5c New translations breadcrumbs.php (Dutch) 2017-07-16 07:50:33 +02:00
James Cole
5f0033e466 New translations intro.php (Polish) 2017-07-16 07:50:22 +02:00
James Cole
477adba3e1 New translations intro.php (Portuguese, Brazilian) 2017-07-16 07:50:21 +02:00
James Cole
eb15ca8ebd New translations intro.php (Russian) 2017-07-16 07:50:20 +02:00
James Cole
dbf5907c20 New translations intro.php (Spanish) 2017-07-16 07:50:19 +02:00
James Cole
e95deb9443 New translations intro.php (Slovenian) 2017-07-16 07:50:19 +02:00
James Cole
e19c36b5c4 New translations intro.php (German) 2017-07-16 07:50:18 +02:00
James Cole
fdd589db4f New translations intro.php (French) 2017-07-16 07:50:17 +02:00
James Cole
cd4e45d8f5 New translations intro.php (Dutch) 2017-07-16 07:50:16 +02:00
James Cole
e6e31b9cab New translations intro.php (Chinese Traditional) 2017-07-16 07:50:15 +02:00
James Cole
b676b1fef9 Simplify import storage routine. 2017-07-16 07:45:20 +02:00
James Cole
58bfb35fa6 Built a new routine for intro tours. 2017-07-16 07:35:08 +02:00
James Cole
09131e8c36 Add Russian language. 2017-07-15 22:42:14 +02:00
James Cole
1d6ca91c01 This fixes the tests. 2017-07-15 22:41:57 +02:00
James Cole
fa00ba2edd Expand tests and fix various small issues in strict comparison. 2017-07-15 22:17:24 +02:00
James Cole
65114c8483 New translations firefly.php (German) 2017-07-15 22:00:52 +02:00
James Cole
d033985141 New translations firefly.php (Polish) 2017-07-15 22:00:49 +02:00
James Cole
5badfbee93 New translations firefly.php (Portuguese, Brazilian) 2017-07-15 22:00:47 +02:00
James Cole
44a61842f0 New translations firefly.php (Slovenian) 2017-07-15 22:00:45 +02:00
James Cole
70b61af572 New translations firefly.php (French) 2017-07-15 22:00:42 +02:00
James Cole
53a53d393d New translations firefly.php (Chinese Traditional) 2017-07-15 22:00:38 +02:00
James Cole
6c95b5757b New translations firefly.php (Spanish) 2017-07-15 22:00:35 +02:00
James Cole
693b3e5a6f New translations firefly.php (Russian) 2017-07-15 22:00:18 +02:00
James Cole
aac1338bdd Merge pull request #705 from firefly-iii/l10n_develop
New Crowdin translations
2017-07-15 21:58:20 +02:00
James Cole
2979137102 New translations firefly.php (Dutch) 2017-07-15 21:50:12 +02:00
James Cole
0068675f3b Remove alert [skip ci] 2017-07-15 21:48:02 +02:00
James Cole
6c1a22ea7f Merge pull request #702 from firefly-iii/l10n_develop
New Crowdin translations
2017-07-15 21:42:33 +02:00
James Cole
2869b92e6b Merge branch 'develop' into l10n_develop 2017-07-15 21:42:27 +02:00
James Cole
8a38ce1964 Remove references to old tour but include code for new tour. 2017-07-15 21:40:42 +02:00
James Cole
3a7c5566ed New translations firefly.php (German) 2017-07-15 17:30:52 +02:00
James Cole
1bed8c2b08 New translations firefly.php (Polish) 2017-07-15 17:30:49 +02:00
James Cole
e24500b306 New translations firefly.php (Portuguese, Brazilian) 2017-07-15 17:30:47 +02:00
James Cole
6251914419 New translations firefly.php (Slovenian) 2017-07-15 17:30:45 +02:00
James Cole
8d9e943d57 New translations firefly.php (French) 2017-07-15 17:30:43 +02:00
James Cole
f71bc5d323 New translations firefly.php (Dutch) 2017-07-15 17:30:40 +02:00
James Cole
a8082b2b3f New translations firefly.php (Chinese Traditional) 2017-07-15 17:30:37 +02:00
James Cole
510b72303d New translations firefly.php (Spanish) 2017-07-15 17:30:35 +02:00
James Cole
4666d4bbaa New translations breadcrumbs.php (Chinese Traditional) 2017-07-15 17:30:28 +02:00
James Cole
025f1e9502 New translations breadcrumbs.php (Dutch) 2017-07-15 17:30:27 +02:00
James Cole
b4c05098a9 New translations breadcrumbs.php (French) 2017-07-15 17:30:27 +02:00
James Cole
3c8ee6f7f7 New translations breadcrumbs.php (German) 2017-07-15 17:30:26 +02:00
James Cole
8b34135b08 New translations breadcrumbs.php (Polish) 2017-07-15 17:30:24 +02:00
James Cole
d4b7c6689f New translations breadcrumbs.php (Portuguese, Brazilian) 2017-07-15 17:30:23 +02:00
James Cole
d72aadfb00 New translations breadcrumbs.php (Slovenian) 2017-07-15 17:30:21 +02:00
James Cole
00ff8ae166 New translations breadcrumbs.php (Spanish) 2017-07-15 17:30:20 +02:00
James Cole
cffcf49b26 New translations breadcrumbs.php (Russian) 2017-07-15 17:30:14 +02:00
James Cole
ad55aa8b85 New translations firefly.php (Russian) 2017-07-15 17:30:13 +02:00
James Cole
accbdea942 Improve search and display of results. 2017-07-15 17:19:12 +02:00
James Cole
22144b78ea Strict comparisons. 2017-07-15 16:41:07 +02:00
James Cole
c03ab269f0 Memory optimised, connect journal to tag. 2017-07-15 10:43:22 +02:00
James Cole
0c6c4d5959 Fix small issue in chart. 2017-07-15 10:26:27 +02:00
James Cole
e4e1873770 Improve import routine. 2017-07-15 10:26:16 +02:00
James Cole
3b3579025d Improve results when presented with invalid data. #701 2017-07-14 17:57:20 +02:00
James Cole
5cf8f2f4f4 Add sort flag for #698 2017-07-14 17:25:03 +02:00
James Cole
c4ff05b1ba Sort fix #698 [skip ci] 2017-07-14 17:21:30 +02:00
James Cole
2bf54d0b8e Remove extra X [skip ci] 2017-07-14 17:10:56 +02:00
James Cole
2a63888546 Table is sortable, #697 2017-07-14 17:10:06 +02:00
James Cole
cb8294cbd2 Disable button form on submit. 2017-07-14 17:05:32 +02:00
James Cole
c9a99be183 Fix #699 2017-07-14 17:04:18 +02:00
James Cole
5d2e026e5a New translations firefly.php (Polish) 2017-07-14 16:10:12 +02:00
James Cole
568fdad52a New translations form.php (Polish) 2017-07-14 16:10:08 +02:00
James Cole
174fb65fed New translations firefly.php (Polish) 2017-07-14 16:00:25 +02:00
James Cole
2e77c45ae8 New translations csv.php (Polish) 2017-07-14 15:50:27 +02:00
James Cole
1b674a0abf New translations firefly.php (Polish) 2017-07-14 15:50:25 +02:00
James Cole
4beb8b1f6b New translations csv.php (Polish) 2017-07-14 15:40:20 +02:00
James Cole
3c4abb7b60 Fixed some issues in import, should improve results for #701 2017-07-14 06:41:47 +02:00
James Cole
970c73c221 Fix path 2017-07-14 06:41:10 +02:00
James Cole
6797c1255f New translations firefly.php (Russian) 2017-07-13 14:40:45 +02:00
James Cole
0ed159b553 New translations firefly.php (Russian) 2017-07-13 14:30:23 +02:00
James Cole
faa8679804 New translations firefly.php (Russian) 2017-07-13 14:20:12 +02:00
James Cole
e3d2253958 New translations firefly.php (Russian) 2017-07-13 14:10:18 +02:00
James Cole
3f7b7996c0 New translations firefly.php (Russian) 2017-07-13 14:00:16 +02:00
James Cole
9229ff54df New translations csv.php (Russian) 2017-07-13 13:50:15 +02:00
James Cole
204ab8f427 New translations demo.php (Russian) 2017-07-13 13:50:13 +02:00
James Cole
8ee6c0789d New translations csv.php (Russian) 2017-07-13 13:40:21 +02:00
James Cole
be188e7266 New translations form.php (Russian) 2017-07-13 13:40:20 +02:00
James Cole
1a43b62750 New translations help.php (Russian) 2017-07-13 13:30:11 +02:00
James Cole
eaa8321aa8 New translations help.php (Russian) 2017-07-13 13:20:19 +02:00
James Cole
f01f0071dd New translations list.php (Russian) 2017-07-13 13:20:17 +02:00
James Cole
ec69cc3590 New translations list.php (Russian) 2017-07-13 13:10:16 +02:00
James Cole
102dac1eb8 New translations validation.php (Russian) 2017-07-13 13:10:14 +02:00
James Cole
d54c5f1f99 New translations passwords.php (Russian) 2017-07-13 12:10:27 +02:00
James Cole
c2e0e00c47 New translations pagination.php (Russian) 2017-07-13 12:10:26 +02:00
James Cole
f24e387363 New translations breadcrumbs.php (Russian) 2017-07-13 12:00:27 +02:00
James Cole
09715b83e4 New translations auth.php (Russian) 2017-07-13 11:50:19 +02:00
James Cole
e4f197bbc9 New translations breadcrumbs.php (Russian) 2017-07-13 11:50:18 +02:00
James Cole
de64cef48d New translations auth.php (Russian) 2017-07-13 11:01:08 +02:00
James Cole
b85329b371 New translations firefly.php (Russian) 2017-07-13 11:01:07 +02:00
James Cole
215f9a4245 New translations csv.php (Russian) 2017-07-13 11:00:58 +02:00
James Cole
80ce7a64ba New translations config.php (Russian) 2017-07-13 11:00:56 +02:00
James Cole
65f3dc0656 New translations breadcrumbs.php (Russian) 2017-07-13 11:00:55 +02:00
James Cole
f9b6b841b6 New translations form.php (Russian) 2017-07-13 11:00:53 +02:00
James Cole
d4f2d649e8 New translations help.php (Russian) 2017-07-13 11:00:50 +02:00
James Cole
15b057fe68 New translations demo.php (Russian) 2017-07-13 11:00:48 +02:00
James Cole
9cb549f4a1 New translations validation.php (Russian) 2017-07-13 11:00:47 +02:00
James Cole
4d67578458 New translations passwords.php (Russian) 2017-07-13 11:00:44 +02:00
James Cole
71faaf1c19 New translations list.php (Russian) 2017-07-13 11:00:43 +02:00
James Cole
0187f29b4b New translations pagination.php (Russian) 2017-07-13 11:00:40 +02:00
James Cole
9b6ccdd43a Fixes #694 2017-07-10 19:52:31 +02:00
James Cole
e82deddefb Merge branch 'release/4.6.2' 2017-07-08 09:55:44 +02:00
James Cole
780bec35bb Merge pull request #687 from firefly-iii/l10n_develop
New Crowdin translations
2017-07-08 09:47:01 +02:00
James Cole
27d80fd370 Updated libraries. 2017-07-08 06:53:15 +02:00
James Cole
952328d55c Routine to make sure imported entries have the correct opposing account and the correct amount. 2017-07-08 06:53:06 +02:00
James Cole
f747f3bd10 Updated changelog. 2017-07-08 06:30:41 +02:00
James Cole
11c3aca58d New version. 2017-07-08 06:28:52 +02:00
James Cole
5ef2067836 Some code cleanup. 2017-07-08 06:28:44 +02:00
James Cole
de9728895e Fixed #658 2017-07-08 06:09:17 +02:00
James Cole
19774f32c2 First code for #658 2017-07-07 17:51:14 +02:00
James Cole
e62b979708 Fix redirect error [skip ci] 2017-07-07 16:53:44 +02:00
James Cole
69eef30ad3 Various code clean up. 2017-07-07 13:50:15 +02:00
James Cole
71a41bc00d Add newlines [skip ci] 2017-07-07 08:09:42 +02:00
James Cole
dd508dbc49 This should fix #693. 2017-07-07 08:04:21 +02:00
James Cole
13ad40402a New translations firefly.php (German) 2017-07-06 11:30:11 +02:00
James Cole
98712f288c New translations firefly.php (German) 2017-07-04 20:40:08 +02:00
James Cole
a29a78e199 New translations csv.php (German) 2017-07-04 20:40:05 +02:00
James Cole
767267c89e New translations demo.php (German) 2017-07-04 20:20:16 +02:00
James Cole
b3801f65cf New translations demo.php (German) 2017-07-04 20:10:06 +02:00
James Cole
44a1d6b3d4 New translations csv.php (German) 2017-07-04 20:00:06 +02:00
James Cole
7a1528d1e4 New translations csv.php (German) 2017-07-04 19:50:10 +02:00
James Cole
c970a25d58 New translations firefly.php (German) 2017-07-04 19:50:09 +02:00
James Cole
0a78b0b130 New translations demo.php (German) 2017-07-04 19:50:06 +02:00
James Cole
69f6dc09d3 New translations demo.php (German) 2017-07-04 19:40:06 +02:00
James Cole
467e708617 New translations form.php (German) 2017-07-04 19:40:05 +02:00
James Cole
3a84591e61 Simplify edit transaction routine. 2017-07-04 16:31:16 +02:00
James Cole
a527066216 Add links to boxes for #688 2017-07-04 16:17:05 +02:00
James Cole
ef9823035f Add if-statement to catch unset POST data. 2017-07-04 16:03:00 +02:00
James Cole
513ee4c7d9 New translations firefly.php (Polish) 2017-07-03 18:00:20 +02:00
James Cole
fcc9b3a588 Merge branch 'release/4.6.1' 2017-07-02 09:36:20 +02:00
James Cole
71eed45b77 Merge branch 'develop' of https://github.com/firefly-iii/firefly-iii into develop
* 'develop' of https://github.com/firefly-iii/firefly-iii:
  New translations firefly.php (Dutch)
  New translations firefly.php (Chinese Traditional)
  New translations firefly.php (Dutch)
  New translations firefly.php (French)
  New translations firefly.php (German)
  New translations firefly.php (Polish)
  New translations firefly.php (Portuguese, Brazilian)
  New translations firefly.php (Slovenian)
  New translations firefly.php (Spanish)
2017-07-02 09:35:46 +02:00
James Cole
6940f00492 Merge pull request #686 from firefly-iii/l10n_develop
New Crowdin translations
2017-07-02 09:35:13 +02:00
James Cole
1c85c20fa9 New translations firefly.php (Dutch) 2017-07-02 09:35:03 +02:00
James Cole
ae30b02405 New version and changelog. 2017-07-02 09:32:19 +02:00
James Cole
89b7a9d3ac Updated composer file [skip ci] 2017-07-02 09:30:46 +02:00
James Cole
dc25fc99b3 New translations firefly.php (Chinese Traditional) 2017-07-02 09:30:42 +02:00
James Cole
6e6957a9ab New translations firefly.php (Dutch) 2017-07-02 09:30:40 +02:00
James Cole
0609e7db06 New translations firefly.php (French) 2017-07-02 09:30:38 +02:00
James Cole
f57097b79e New translations firefly.php (German) 2017-07-02 09:30:34 +02:00
James Cole
7e988d97d3 New translations firefly.php (Polish) 2017-07-02 09:30:32 +02:00
James Cole
2795042c2c Included some dev data by accident [skip ci] 2017-07-02 09:30:28 +02:00
James Cole
c3c86545fc New translations firefly.php (Portuguese, Brazilian) 2017-07-02 09:30:28 +02:00
James Cole
3fe14a3d56 New translations firefly.php (Slovenian) 2017-07-02 09:30:25 +02:00
James Cole
bad5740728 New translations firefly.php (Spanish) 2017-07-02 09:30:23 +02:00
James Cole
c164553ba1 Small cosmetic change. 2017-07-02 09:27:08 +02:00
James Cole
e6c72b2995 Fixed mobile display 2017-07-02 09:24:46 +02:00
James Cole
cbcefabbff Forgot a translation. 2017-07-02 09:24:30 +02:00
James Cole
97cfa3f3ae Remove old providers. 2017-07-02 09:24:20 +02:00
James Cole
803a008821 Improve bread crumbs 2017-07-02 09:24:11 +02:00
James Cole
658730928b Remove old JS 2017-07-02 09:24:00 +02:00
James Cole
310db374c8 Fix #678 2017-07-02 09:22:56 +02:00
James Cole
dc5bd648cf Fix for #685 2017-07-02 08:43:34 +02:00
James Cole
b6be9e6ade Fix for #682 2017-07-01 10:39:59 +02:00
James Cole
04f71496e3 Code for #678 2017-07-01 10:36:08 +02:00
James Cole
1eed142423 Small display bug related to #648 2017-07-01 10:29:07 +02:00
James Cole
f1e0ad0df0 CoC. [skip ci] 2017-06-30 07:22:12 +02:00
James Cole
f8fa5f1ba5 Improved mobile response, issue #678 2017-06-30 07:17:25 +02:00
James Cole
c187563267 Update report layout [skip ci] 2017-06-28 20:41:02 +02:00
James Cole
fcdbbd5dbc Update report layout [skip ci] 2017-06-28 20:39:12 +02:00
James Cole
6604d04c60 Slightly different report layout [skip ci] 2017-06-28 20:23:24 +02:00
James Cole
63be574a14 Merge branch 'release/4.6.0' 2017-06-28 18:13:00 +02:00
James Cole
2414f998ba Update git ignore file. 2017-06-28 18:09:32 +02:00
James Cole
90e2ecad4f Merge pull request #683 from firefly-iii/l10n_develop
New Crowdin translations
2017-06-28 18:08:27 +02:00
James Cole
87a3f5c715 New translations firefly.php (Dutch) 2017-06-28 18:07:52 +02:00
James Cole
a4ef81ebd8 Improve test coverage. 2017-06-28 18:05:38 +02:00
James Cole
67fc810fc2 Ignore test database. 2017-06-28 18:05:04 +02:00
James Cole
e13a61645d New change log 2017-06-28 18:04:42 +02:00
James Cole
aae4a78fd4 Possible fix for #649 [skip ci] 2017-06-28 15:52:13 +02:00
James Cole
3947da5e27 Possible fix for #682 2017-06-28 15:45:28 +02:00
James Cole
4e4ce2f77c Remove test database from Firefly III thing. [skip ci] 2017-06-28 15:31:11 +02:00
James Cole
d9a2e081bd Update travis script. 2017-06-28 15:27:31 +02:00
James Cole
e60dde7ce5 Merge pull request #681 from firefly-iii/l10n_develop
New Crowdin translations
2017-06-28 15:18:59 +02:00
James Cole
699b138999 Small link fixes [skip ci] 2017-06-28 15:18:11 +02:00
James Cole
8f191b497f Updated read me and contributing guidelines. 2017-06-28 15:17:19 +02:00
James Cole
fd013d617c New translations firefly.php (Chinese Traditional) 2017-06-28 15:11:10 +02:00
James Cole
a8bda38035 New translations firefly.php (Dutch) 2017-06-28 15:11:07 +02:00
James Cole
411de9aa23 New translations firefly.php (French) 2017-06-28 15:11:05 +02:00
James Cole
f0abe497ef New translations firefly.php (German) 2017-06-28 15:11:02 +02:00
James Cole
9c8be83f5d New translations firefly.php (Polish) 2017-06-28 15:10:58 +02:00
James Cole
45335af8cf New translations firefly.php (Portuguese, Brazilian) 2017-06-28 15:10:56 +02:00
James Cole
945e433bb7 New translations firefly.php (Slovenian) 2017-06-28 15:10:51 +02:00
James Cole
70729fdb0c New translations firefly.php (Spanish) 2017-06-28 15:10:48 +02:00
James Cole
4a435e5701 Updated composer file. 2017-06-28 15:01:06 +02:00
James Cole
427747c6b8 Merge pull request #666 from firefly-iii/l10n_develop
New Crowdin translations
2017-06-28 15:00:48 +02:00
James Cole
be9407cb57 New translations csv.php (Dutch) 2017-06-28 15:00:19 +02:00
James Cole
c380d3d2a0 New translations firefly.php (Dutch) 2017-06-28 15:00:13 +02:00
James Cole
489b0eb12d New translations firefly.php (Dutch) 2017-06-28 14:50:13 +02:00
James Cole
7c73629962 Merge pull request #680 from Xeli/l10n_develop
Fix en_US translation: no_accounts_imperative_revenue.
2017-06-28 12:41:26 +02:00
richard@xeli.eu
ff619eca1c Fix en_US translation: no_accounts_imperative_revenue. Change Expense to Revenue 2017-06-28 12:12:31 +02:00
James Cole
134a39fd71 New translations firefly.php (German) 2017-06-27 13:50:38 +02:00
James Cole
506509b1b2 Fix #677 2017-06-26 18:29:45 +02:00
James Cole
02a36316be Forgot to remove a variable. 2017-06-26 18:24:44 +02:00
James Cole
8549c7c81b This should fix #677 2017-06-26 18:24:29 +02:00
James Cole
5a0be7d2ad Push new version number. 2017-06-24 13:05:12 +02:00
James Cole
c6f44c6398 Composer update. 2017-06-24 13:04:50 +02:00
James Cole
04a8a0e6a1 Code clean up 2017-06-24 13:04:41 +02:00
James Cole
8a175d147b Remove JS console log. 2017-06-24 13:03:09 +02:00
James Cole
5fbc319b20 This fixes the tests (must still upload test database). 2017-06-24 12:38:24 +02:00
James Cole
8e3ba7caf2 Fix various import bugs. 2017-06-24 08:37:09 +02:00
James Cole
182aaa7d27 New translations csv.php (Spanish) 2017-06-24 07:30:48 +02:00
James Cole
ec17d466f7 New translations firefly.php (Chinese Traditional) 2017-06-24 07:30:46 +02:00
James Cole
79c2445117 New translations firefly.php (Dutch) 2017-06-24 07:30:44 +02:00
James Cole
aa59db1609 New translations firefly.php (French) 2017-06-24 07:30:42 +02:00
James Cole
814b106be2 New translations csv.php (Slovenian) 2017-06-24 07:30:40 +02:00
James Cole
3901ea0fbe New translations csv.php (Portuguese, Brazilian) 2017-06-24 07:30:39 +02:00
James Cole
65133107be New translations csv.php (Dutch) 2017-06-24 07:30:38 +02:00
James Cole
08d15cfc5e New translations csv.php (French) 2017-06-24 07:30:37 +02:00
James Cole
3c89f9a5f1 New translations csv.php (German) 2017-06-24 07:30:36 +02:00
James Cole
dbc6bc8206 New translations csv.php (Polish) 2017-06-24 07:30:35 +02:00
James Cole
dc38291ef5 New translations firefly.php (German) 2017-06-24 07:30:34 +02:00
James Cole
3bb634ed5b New translations firefly.php (Polish) 2017-06-24 07:30:32 +02:00
James Cole
4bdcfe4d30 New translations firefly.php (Portuguese, Brazilian) 2017-06-24 07:30:28 +02:00
James Cole
3b74784486 New translations firefly.php (Slovenian) 2017-06-24 07:30:25 +02:00
James Cole
5226664a3d New translations firefly.php (Spanish) 2017-06-24 07:30:23 +02:00
James Cole
6d23823b63 New translations csv.php (Chinese Traditional) 2017-06-24 07:30:20 +02:00
James Cole
da3a56c144 Further improve import storage. 2017-06-24 07:30:05 +02:00
James Cole
58aa54d8cf Improving import storage. 2017-06-24 07:21:10 +02:00
James Cole
e525e673a8 Import routine cleanup. 2017-06-24 06:57:24 +02:00
James Cole
445dbf8779 More and improved code for the import routine. 2017-06-24 05:49:33 +02:00
James Cole
6a27bea2a3 New translations firefly.php (Chinese Traditional) 2017-06-22 22:01:08 +02:00
James Cole
13163f9c5c New translations firefly.php (Dutch) 2017-06-22 22:01:05 +02:00
James Cole
fde08f922b New translations firefly.php (French) 2017-06-22 22:01:02 +02:00
James Cole
266ce00872 New translations firefly.php (German) 2017-06-22 22:00:56 +02:00
James Cole
623a70a0d1 New translations firefly.php (Polish) 2017-06-22 22:00:52 +02:00
James Cole
1d7b738040 New translations firefly.php (Portuguese, Brazilian) 2017-06-22 22:00:46 +02:00
James Cole
edc8dd2601 New translations firefly.php (Slovenian) 2017-06-22 22:00:43 +02:00
James Cole
31dc932ca4 New translations firefly.php (Spanish) 2017-06-22 22:00:40 +02:00
James Cole
edb355941c More code for import routine. 2017-06-22 21:50:10 +02:00
James Cole
cddaccb7f7 Further improve import routine 2017-06-21 20:04:35 +02:00
James Cole
a905cce2c9 Expand import routine. 2017-06-20 21:04:25 +02:00
James Cole
b9f110ac2b Refactor and rename some import things. 2017-06-17 22:49:44 +02:00
James Cole
7cc24417b3 Expanded import routine. 2017-06-14 20:13:19 +02:00
James Cole
b304284d70 Fix report bug. 2017-06-14 19:15:30 +02:00
James Cole
c382fb1577 Add debug info for #671 2017-06-12 19:58:32 +02:00
James Cole
77244f4e2c Lots of new code for new importer routine. 2017-06-12 19:12:07 +02:00
James Cole
8beab5f5bc Fix #672 2017-06-12 17:21:31 +02:00
James Cole
902ae3f0cf Fix for #671 2017-06-12 17:07:29 +02:00
James Cole
519ef4e486 New translations csv.php (French) 2017-06-10 15:21:17 +02:00
James Cole
699e04f371 New translations firefly.php (French) 2017-06-10 15:21:16 +02:00
James Cole
d73de0e60d New translations csv.php (German) 2017-06-10 15:21:12 +02:00
James Cole
8e0b7d2a73 New translations firefly.php (German) 2017-06-10 15:21:10 +02:00
James Cole
04283cf2d6 New translations csv.php (Polish) 2017-06-10 15:21:06 +02:00
James Cole
d60b4aa56f New translations csv.php (Chinese Traditional) 2017-06-10 15:20:57 +02:00
James Cole
9cfeda1b0c New translations firefly.php (Chinese Traditional) 2017-06-10 15:20:55 +02:00
James Cole
5e1bd8e1eb New translations csv.php (Dutch) 2017-06-10 15:20:48 +02:00
James Cole
9b495d212b New translations firefly.php (Polish) 2017-06-10 15:20:47 +02:00
James Cole
b6fdd0070b New translations firefly.php (Slovenian) 2017-06-10 15:20:40 +02:00
James Cole
eea387ad0c New translations csv.php (Spanish) 2017-06-10 15:20:33 +02:00
James Cole
9cdb0f173a New translations csv.php (Slovenian) 2017-06-10 15:20:31 +02:00
James Cole
51063230d0 New translations firefly.php (Dutch) 2017-06-10 15:20:30 +02:00
James Cole
1111478b7f New translations firefly.php (Portuguese, Brazilian) 2017-06-10 15:20:25 +02:00
James Cole
c99c9b441f New translations csv.php (Portuguese, Brazilian) 2017-06-10 15:20:17 +02:00
James Cole
b5065a0276 New translations firefly.php (Spanish) 2017-06-10 15:20:11 +02:00
James Cole
c79a577060 Remove unused files in import. 2017-06-10 15:10:46 +02:00
James Cole
091596e80e Lots of new code for new importer routine. 2017-06-10 15:09:41 +02:00
James Cole
0b4efe4ae1 Small typo in chart. [skip ci] 2017-06-09 12:53:31 +02:00
James Cole
1f9b7faa60 Code for #660 2017-06-09 11:52:20 +02:00
James Cole
762d7bcc34 Fix database for postgresql 2017-06-09 11:51:59 +02:00
James Cole
a2145f6b49 Possible fix for #667 2017-06-08 10:54:15 +02:00
James Cole
b48de98865 Fix a bug where the balance routine forgot to account for accounts without a currency preference. 2017-06-08 10:35:02 +02:00
James Cole
a23179dd83 Merge branch 'release/4.5.0' 2017-06-07 12:30:09 +02:00
James Cole
5c18794122 Update lock file, and update database. 2017-06-07 12:22:59 +02:00
James Cole
f04011f6a7 New translations firefly.php (Dutch) 2017-06-07 12:20:13 +02:00
James Cole
893498238e Merge pull request #647 from firefly-iii/l10n_develop
New Crowdin translations
2017-06-07 12:11:28 +02:00
James Cole
474fa9dea0 New translations firefly.php (Dutch) 2017-06-07 12:10:10 +02:00
James Cole
d8a8574dda Prep for new release. 2017-06-07 12:08:32 +02:00
James Cole
935fb015d3 Live update budget amounts. 2017-06-07 11:58:04 +02:00
James Cole
8bbd3063ec Move code around for simplicity and fix tests. 2017-06-07 11:13:04 +02:00
James Cole
92c5cabd70 Try to untangle complex repositories 2017-06-07 08:18:42 +02:00
James Cole
e5db5a7b5c Various code clean up. 2017-06-07 07:38:58 +02:00
James Cole
28cf123da3 New translations firefly.php (French) 2017-06-06 20:41:24 +02:00
James Cole
5069367873 New translations firefly.php (German) 2017-06-06 20:41:16 +02:00
James Cole
234e656ff6 New translations firefly.php (Chinese Traditional) 2017-06-06 20:40:59 +02:00
James Cole
aeadfbdd6a New translations firefly.php (Polish) 2017-06-06 20:40:50 +02:00
James Cole
39288cfb0b New translations firefly.php (Slovenian) 2017-06-06 20:40:41 +02:00
James Cole
5e430968c1 New translations firefly.php (Dutch) 2017-06-06 20:40:34 +02:00
James Cole
154b74ce6f New translations firefly.php (Portuguese, Brazilian) 2017-06-06 20:40:26 +02:00
James Cole
2e26303b66 New translations firefly.php (Spanish) 2017-06-06 20:40:11 +02:00
James Cole
51ddcd9ee1 Plus not minus [skip ci] 2017-06-06 20:37:24 +02:00
James Cole
9d5d1c0a41 Updated budget view. 2017-06-06 20:35:39 +02:00
James Cole
6058ccff0d Merge pull request #664 from kressh/master
Add pgsql dependencies to Dockerfile
2017-06-06 20:01:43 +02:00
James Cole
a8ec4fe2fd New interface for budget overview. 2017-06-06 19:30:31 +02:00
James Cole
65ccb2d443 Fix error display #662 2017-06-06 19:29:10 +02:00
James Cole
0e929602a8 Verify currency data routine. 2017-06-06 07:23:54 +02:00
James Cole
5329e026dc Fixed various currency displays. 2017-06-06 07:18:09 +02:00
James Cole
a7412e43b3 Beter message for #662 2017-06-06 06:56:32 +02:00
Sergey Besedin
eeae24e058 Add pgsql dependencies 2017-06-06 01:22:09 +03:00
James Cole
17b6cc43d5 Fix display of foreign currencies in charts. 2017-06-05 22:11:54 +02:00
James Cole
b69a2ef0cd Can handle multi-currency balances better. 2017-06-05 15:09:17 +02:00
James Cole
6d1296094e Fixes a lot of issues in scrutinizer. 2017-06-05 11:20:38 +02:00
James Cole
c4039b53e6 Various code cleanup. 2017-06-05 11:12:50 +02:00
James Cole
64831b4c86 Code cleanup and refactoring. 2017-06-05 08:31:22 +02:00
James Cole
1dec270907 These changes fix the tests. 2017-06-05 07:37:53 +02:00
James Cole
f72f8b03df Catch empty currency preference 2017-06-05 07:03:32 +02:00
James Cole
0b47e5d05d Removed unnecessary variable. 2017-06-05 07:03:20 +02:00
James Cole
a487c7b4b2 Make sure amounts are formatted, and fixed some issues. 2017-06-04 23:39:26 +02:00
James Cole
3838b21459 New translations firefly.php (French) 2017-06-04 13:41:19 +02:00
James Cole
7801274d33 New translations firefly.php (German) 2017-06-04 13:41:15 +02:00
James Cole
a505406ee7 New translations firefly.php (Chinese Traditional) 2017-06-04 13:41:03 +02:00
James Cole
9487a95c13 New translations firefly.php (Polish) 2017-06-04 13:40:54 +02:00
James Cole
3b2fe13902 New translations firefly.php (Slovenian) 2017-06-04 13:40:47 +02:00
James Cole
db2898dfe5 New translations auth.php (Spanish) 2017-06-04 13:40:44 +02:00
James Cole
e08fd399d2 New translations csv.php (Spanish) 2017-06-04 13:40:40 +02:00
James Cole
e45ffba010 New translations passwords.php (Spanish) 2017-06-04 13:40:39 +02:00
James Cole
f7fde93ed2 New translations firefly.php (Dutch) 2017-06-04 13:40:37 +02:00
James Cole
3cf53604a1 New translations firefly.php (Portuguese, Brazilian) 2017-06-04 13:40:31 +02:00
James Cole
e041a5e037 New translations help.php (Spanish) 2017-06-04 13:40:19 +02:00
James Cole
6c8e10255b New translations form.php (Spanish) 2017-06-04 13:40:17 +02:00
James Cole
3464ab1527 New translations firefly.php (Spanish) 2017-06-04 13:40:13 +02:00
James Cole
82e74a2afd Big update to properly support multi currencies. 2017-06-04 13:39:16 +02:00
James Cole
771ebde295 Update journal collector so currency information is taken from the transaction. 2017-06-04 08:49:37 +02:00
James Cole
4ce4c3138c Update export routine so currency information is taken from the transaction. 2017-06-04 08:49:22 +02:00
James Cole
d37b46effc Database upgrade routine. 2017-06-04 08:48:54 +02:00
James Cole
0868aac750 Small update for 4.5.0 SQL update. 2017-06-04 08:48:40 +02:00
James Cole
4ff5f33966 Prep for solid multi-currency configuration. 2017-06-02 13:01:43 +02:00
James Cole
e1aebbe12b Remove non-existing charts. 2017-06-02 13:01:24 +02:00
James Cole
8273f467b6 Refactor some JS functions. 2017-06-02 13:00:43 +02:00
James Cole
74664afa68 Was not able to remove opening balance. 2017-06-02 13:00:24 +02:00
James Cole
c05f344371 Code clean up [skip ci] 2017-06-02 13:00:09 +02:00
James Cole
ec1507d644 Add some documentation [skip ci] 2017-06-02 12:59:27 +02:00
James Cole
8cdc1f0014 Rename several twig files. 2017-06-02 12:59:14 +02:00
James Cole
2b1ab5c6ef Fixed edit of multi currency transaction, ##651 2017-06-02 07:05:42 +02:00
James Cole
01fedc0bf8 Fix for #593, as inspired by @nhaarman. 2017-06-02 06:45:38 +02:00
James Cole
1bd82d71a2 New translations list.php (Spanish) 2017-05-25 16:50:09 +02:00
James Cole
1e9dacb6e4 New translations pagination.php (Spanish) 2017-05-25 16:40:16 +02:00
James Cole
94939ea3d3 New translations firefly.php (Portuguese, Brazilian) 2017-05-25 16:40:13 +02:00
James Cole
c3ff69d147 New translations list.php (Spanish) 2017-05-25 16:40:09 +02:00
James Cole
0fad9d4ac7 New translations validation.php (Spanish) 2017-05-25 16:40:07 +02:00
James Cole
70cd8ffb72 New translations validation.php (Spanish) 2017-05-25 16:30:10 +02:00
James Cole
61535bf4b8 New translations firefly.php (Spanish) 2017-05-25 16:30:08 +02:00
James Cole
4adcbf9e48 New translations demo.php (Spanish) 2017-05-25 16:20:11 +02:00
James Cole
3eba3167fd New translations firefly.php (Spanish) 2017-05-25 16:20:07 +02:00
James Cole
0608fd7732 New translations demo.php (Spanish) 2017-05-25 16:10:06 +02:00
James Cole
1f41f27e89 New translations breadcrumbs.php (Spanish) 2017-05-25 16:00:11 +02:00
James Cole
ded0df9303 New translations config.php (Spanish) 2017-05-25 16:00:06 +02:00
James Cole
2a7ba1893a New translations form.php (Slovenian) 2017-05-16 15:10:18 +02:00
James Cole
6b3b19632a New translations help.php (Slovenian) 2017-05-16 15:10:15 +02:00
James Cole
98bb0731df New translations list.php (Slovenian) 2017-05-16 15:10:12 +02:00
James Cole
a102f7044e New translations list.php (Slovenian) 2017-05-15 09:20:09 +02:00
James Cole
f1028dbaed New translations list.php (Slovenian) 2017-05-15 09:10:14 +02:00
James Cole
438ce5c3db New translations list.php (Slovenian) 2017-05-15 09:00:35 +02:00
James Cole
b995a1d091 New translations list.php (Slovenian) 2017-05-15 08:50:08 +02:00
James Cole
e072f83507 New translations list.php (Slovenian) 2017-05-14 10:10:08 +02:00
James Cole
79154bba25 New translations pagination.php (Slovenian) 2017-05-14 10:10:06 +02:00
James Cole
613eb7522c New translations pagination.php (Slovenian) 2017-05-14 10:00:10 +02:00
James Cole
0eb5653713 New translations csv.php (Slovenian) 2017-05-14 10:00:08 +02:00
James Cole
0d624f021b New translations csv.php (Slovenian) 2017-05-14 09:30:23 +02:00
James Cole
b263047f4e New translations csv.php (Slovenian) 2017-05-14 09:20:21 +02:00
James Cole
4410e1bbd7 New translations csv.php (Slovenian) 2017-05-14 09:10:12 +02:00
James Cole
8c3871e8de New translations csv.php (Slovenian) 2017-05-14 09:00:09 +02:00
James Cole
2eafd3cc15 Should fix #644 2017-05-14 08:57:43 +02:00
James Cole
368df66947 New translations validation.php (Slovenian) 2017-05-14 08:40:06 +02:00
James Cole
9f9a3ea8fd New translations breadcrumbs.php (Slovenian) 2017-05-14 01:20:08 +02:00
James Cole
f66286105f New translations validation.php (Slovenian) 2017-05-14 01:20:07 +02:00
James Cole
0f0f912370 Partial JS focus [skip ci] 2017-05-12 06:21:26 +02:00
James Cole
9fa0e37a5d Merge pull request #641 from firefly-iii/l10n_develop
New Crowdin translations
2017-05-12 06:20:05 +02:00
James Cole
a0cb51ff70 Merge branch 'develop' into l10n_develop 2017-05-12 06:19:56 +02:00
James Cole
a6305ddea4 New translations auth.php (Spanish) 2017-05-10 20:40:44 +02:00
James Cole
fb8638fe6a New translations breadcrumbs.php (Spanish) 2017-05-10 20:40:42 +02:00
James Cole
0009f1f865 New translations csv.php (Spanish) 2017-05-10 20:40:41 +02:00
James Cole
d449c35025 New translations passwords.php (Spanish) 2017-05-10 20:40:39 +02:00
James Cole
1893d1a2c2 New translations demo.php (Spanish) 2017-05-10 20:40:37 +02:00
James Cole
0c4539e4fa New translations validation.php (Spanish) 2017-05-10 20:40:31 +02:00
James Cole
feacddd1d7 Merge pull request #645 from elamperti/unfinished-translations-es_ES
Unfinished translations for Spanish language
2017-05-10 20:36:55 +02:00
Enrico Lamperti
0c44fe6ce0 Add translations for Spanish language 2017-05-07 21:24:07 -03:00
James Cole
17fb6983d8 Fix issue #637 with cash accounts. 2017-05-07 19:45:40 +02:00
James Cole
5fb73bdb01 Fix bug #642 2017-05-07 19:24:53 +02:00
James Cole
7f082ea389 Remove focus thing 2017-05-06 10:20:27 +02:00
James Cole
9856a1831a New translations firefly.php (Slovenian) 2017-05-04 17:40:13 +02:00
James Cole
dd17a20b60 New translations firefly.php (Slovenian) 2017-05-04 17:30:12 +02:00
578 changed files with 22586 additions and 14542 deletions

View File

@@ -4,20 +4,12 @@
## Feature requests
If you are requesting a new feature, please check out the list of [often requested features](https://firefly-iii.github.io/requested-features/).
## Bugs
If you find a bug, please take the time and see if the [demo site](https://firefly-iii.nder.be/) is also suffering from this bug. Include as many log files and details as you think are necessary.
## Installation problems
Take the time to read the [installation guide FAQ](https://firefly-iii.github.io/installation-guide-faq/) and make sure you search through closed issues for the problems other people have had. Your problem may be among them!
I am always interested in expanding Firefly III's many features. If you are requesting a new feature, please check out the list of [often requested features](https://firefly-iii.github.io/requested-features/).
## Pull requests
I can only accept pull requests against the `develop` branch, never the `master` branch.
When contributing to Firefly III, please first discuss the change you wish to make via issue, email, or any other method. I can only accept pull requests against the `develop` branch, never the `master` branch.
## Translations :us: :fr: :de:
If you see a spelling error, grammatical error or a weird translation in your language, please join [our CrowdIn](https://crowdin.com/project/firefly-iii) project. There, you can submit your translations and fixes. The GitHub repository will download these automatically and they will be included in the next release.
If you see a spelling error, grammatical error or a weird translation in your language, please join [our CrowdIn](https://crowdin.com/project/firefly-iii) project. There, you can submit your translations and fixes. The GitHub repository will download these automatically and they will be included in the next release.

11
.github/SUPPORT.md vendored Normal file
View File

@@ -0,0 +1,11 @@
# Welcome to Firefly III on Github!
:+1::tada: Thank you for taking the time to contribute something to Firefly III!
## Bugs
First of all: thank you for reporting a bug instead of ditching the tool altogether. If you find a bug, please take the time and see if the [demo site](https://firefly-iii.nder.be/) is also suffering from this bug. Include as many log files and details as you think are necessary. Bugs have a lot of priority!
## Installation problems
Please take the time to read the [installation guide FAQ](https://firefly-iii.github.io/installation-guide-faq/) and make sure you search through closed issues for the problems other people have had. Your problem may be among them! If not, open an issue and I will help where I can.

1
.gitignore vendored
View File

@@ -5,3 +5,4 @@ Homestead.json
Homestead.yaml
.env
public/google*.html
report.html

View File

@@ -1,6 +1,5 @@
language: php
php:
- 7.0
- 7.1
cache:
@@ -16,7 +15,7 @@ install:
- php artisan optimize
- php artisan env
- cp .env.testing .env
- mv storage/database/databasecopy.sqlite storage/database/database.sqlite
- wget -q https://github.com/firefly-iii/test-data/raw/master/storage/database.sqlite -O storage/database/database.sqlite
- mkdir -p build/logs
script:

View File

@@ -2,6 +2,117 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [4.6.4] - 2017-08-13
### Added
- PHP7.1 support
- Routine to decrypt attachments from the command line, for issue #671
- A routine that can check if your password has been stolen in the past.
- Split transaction shows amount left to be split
### Changed
- Importer can (potentially) handle new import routines such as banks.
- Importer can fall back from JSON errors
### Deprecated
- Initial release.
### Removed
- PHP7.0 support
- Support for extended tag modes
- Remove "time jumps" to non-empty periods
### Fixed
- #717, reported by @NiceGuyIT
- #718, reported by @wtercato
- #722, reported by @simonsmiley
- #648, reported by @skibbipl
- #730, reported by @ragnarkarlsson
- #733, reported by @xpfgsyb
- #735, reported by @kristophr
- #739, reported by @skibbipl
- #515, reported by @schwalberich
- #743, reported by @simonsmiley
- #746, reported by @tannie
- #747, reported by @tannie
### Security
- Initial release.
## [4.6.3.1] - 2017-07-23
### Fixed
- Hotfix to close issue #715
## [4.6.3] - 2017-07-23
This will be the last release to support PHP 7.0.
### Added
- New guidelines and new introduction tour to aid new users.
- Rules can now be applied at will to transactions, not just rule groups.
### Changed
- Improved category overview.
- Improved budget overview.
- Improved budget report.
- Improved command line import responsiveness and speed.
- All code comparisons are now strict.
- Improve search page.
- Charts are easier to read thanks to @simonsmiley
- Fixed #708.
### Fixed
- Fixed bug where import would not respect default account. #694
- Fixed various broken paths
- Fixed several import inconsistencies.
- Various bug fixes.
### Security
- Initial release.
## [4.6.2] - 2017-07-08
### Added
- Links added to boxes, idea by @simonsmiley
### Fixed
- Various bugs in import routine
## [4.6.1] - 2017-07-02
### Fixed
- Fixed several small issues all around.
## [4.6.0] - 2017-06-28
### Changed
- Revamped import routine. Will be buggy.
### Fixed
- Issue #667, postgresql reported by @skibbipl.
- Issue #680 by @Xeli
- Fixed #660
- Fixes #672, reported by @dzaikos
- Translation error fixed by
- Fix a bug where the balance routine forgot to account for accounts without a currency preference.
- Various other bugfixes.
## [4.5.0] - 2017-06-07
### Added
- Better support for multi-currency transactions and display of transactions, accounts and everything. This requires a database overhaul (moving the currency information to specific transactions) so be careful when upgrading.
- Translations for Spanish and Slovenian.
- New interface for budget page, ~~stolen from~~ inspired by YNAB.
- Expanded Docker to work with postgresql as well, thanks to @kressh
### Fixed
- PostgreSQL support in database upgrade routine (#644, reported by @skibbipl)
- Frontpage budget chart was off, fix by @nhaarman
- Was not possible to remove opening balance.
## [4.4.3] - 2017-05-03
### Added
- Added support for Slovenian

46
CODE_OF_CONDUCT.md Normal file
View File

@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at thegrumpydictator@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/

View File

@@ -11,13 +11,14 @@ RUN apt-get update -y && \
libtidy-dev \
libxml2-dev \
libsqlite3-dev \
libpq-dev \
libbz2-dev \
gettext-base \
locales && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-install -j$(nproc) curl gd intl json mcrypt readline tidy zip bcmath xml mbstring pdo_sqlite pdo_mysql bz2
RUN docker-php-ext-install -j$(nproc) curl gd intl json mcrypt readline tidy zip bcmath xml mbstring pdo_sqlite pdo_mysql bz2 pdo_pgsql
# Generate locales supported by firefly
RUN echo "en_US.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8" > /etc/locale.gen && locale-gen

View File

@@ -1,6 +1,6 @@
# Firefly III: A personal finances manager
[![Requires PHP7](https://img.shields.io/badge/php-7.0-red.svg)](https://secure.php.net/downloads.php) [![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable)](https://packagist.org/packages/grumpydictator/firefly-iii) [![License](https://img.shields.io/badge/license-CC%20BY--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-sa/4.0/) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=44UKUT455HUFA)
[![Requires PHP7.1](https://img.shields.io/badge/php-7.1-red.svg)](https://secure.php.net/downloads.php) [![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable)](https://packagist.org/packages/grumpydictator/firefly-iii) [![License](https://img.shields.io/badge/license-CC%20BY--SA%204.0-lightgrey.svg)](https://creativecommons.org/licenses/by-sa/4.0/) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=44UKUT455HUFA)
[![The index of Firefly III](https://i.nder.be/hurdhgyg/400)](https://i.nder.be/h2b37243) [![The account overview of Firefly III](https://i.nder.be/hnkfkdpr/400)](https://i.nder.be/hv70pbwc)
@@ -12,11 +12,9 @@
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy?template=https://github.com/firefly-iii/firefly-iii/tree/master)
Firefly III can be run on Heroku. Register for a free Heroku account and instantly run Firefly III on your very own cloud instance.
Firefly III can be run on Heroku. Register for a free Heroku account and instantly run Firefly III on your very own cloud instance. There is also a [demo site](https://firefly-iii.nder.be) with an example financial administration already present.
There is also a [demo site](https://firefly-iii.nder.be) with an example financial administration already present.
## Installation
## Getting started
To install Firefly III, you'll need a web server (preferrably on Linux) and access to the command line. Then, please read the [installation guide](https://firefly-iii.github.io/using-installing.html).
@@ -26,7 +24,7 @@ Personal financial management is pretty difficult, and everybody has their own a
Firefly works on the principle that if you know where you're money is going, you can stop it from going there.
#### Some advantages of using Firefly
### Some advantages of using Firefly
- Firefly can import any CSV file, so migrating from other systems is easy.
- Firefly runs on your own server, so you are fully in control of your data. Remember, there is no such thing as "the cloud", its just somebody elses computer!
@@ -35,6 +33,25 @@ Firefly works on the principle that if you know where you're money is going, you
Firefly is pretty awesome. [You can read more about Firefly III, and its features, on the Github Pages](https://firefly-iii.github.io/).
### Contributing
Please read [CONTRIBUTING.md](https://github.com/firefly-iii/firefly-iii/blob/master/.github/CONTRIBUTING.md) for details on contributing, and the process for submitting pull requests. Please check out the [code of conduct](https://github.com/firefly-iii/firefly-iii/blob/master/CODE_OF_CONDUCT.md) as well.
### Versioning
We use [SemVer](http://semver.org/) for versioning. For the versions available, see [the tags](https://github.com/firefly-iii/firefly-iii/tags) on this repository.
### Authors
* James Cole
* Over time, [many people have contributed to Firefly III](https://github.com/firefly-iii/firefly-iii/graphs/contributors).
### License
This work [is licensed](https://github.com/firefly-iii/firefly-iii/blob/master/LICENSE) under a [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/).
### Other stuff
If you like Firefly and if it helps you save lots of money, why not send me [a dime for every dollar saved](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=44UKUT455HUFA) (this is a joke, although the Paypal form works just fine, try it!)
If you want to contact me, please open an issue or [email me](mailto:thegrumpydictator@gmail.com).

View File

@@ -14,10 +14,14 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use Artisan;
use FireflyIII\Import\Logging\CommandHandler;
use FireflyIII\Import\Routine\ImportRoutine;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Console\Command;
use Illuminate\Support\MessageBag;
use Log;
use Monolog\Formatter\LineFormatter;
/**
* Class CreateImport
@@ -51,6 +55,7 @@ class CreateImport extends Command
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength) // cannot be helped
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five exactly.
*/
public function handle()
{
@@ -73,30 +78,55 @@ class CreateImport extends Command
return;
}
$this->info(sprintf('Going to create a job to import file: %s', $file));
$this->info(sprintf('Using configuration file: %s', $configuration));
$this->info(sprintf('Import into user: #%d (%s)', $user->id, $user->email));
$this->info(sprintf('Type of import: %s', $type));
$this->line(sprintf('Going to create a job to import file: %s', $file));
$this->line(sprintf('Using configuration file: %s', $configuration));
$this->line(sprintf('Import into user: #%d (%s)', $user->id, $user->email));
$this->line(sprintf('Type of import: %s', $type));
/** @var ImportJobRepositoryInterface $jobRepository */
$jobRepository = app(ImportJobRepositoryInterface::class);
$jobRepository->setUser($user);
$job = $jobRepository->create($type);
$this->line(sprintf('Created job "%s"...', $job->key));
$this->line(sprintf('Created job "%s"', $job->key));
Artisan::call('firefly:encrypt-file', ['file' => $file, 'key' => $job->key]);
$this->line('Stored import data...');
$job->configuration = $configurationData;
$job->status = 'settings_complete';
$job->status = 'configured';
$job->save();
$this->line('Stored configuration...');
if ($this->option('start') === true) {
$this->line('The import will start in a moment. This process is not visible...');
Log::debug('Go for import!');
Artisan::call('firefly:start-import', ['key' => $job->key]);
$this->line('Done!');
// normally would refer to other firefly:start-import but that doesn't seem to work all to well...
$monolog = Log::getMonolog();
$handler = new CommandHandler($this);
$formatter = new LineFormatter(null, null, false, true);
$handler->setFormatter($formatter);
$monolog->pushHandler($handler);
// start the actual routine:
/** @var ImportRoutine $routine */
$routine = app(ImportRoutine::class);
$routine->setJob($job);
$routine->run();
// give feedback.
/** @var MessageBag $error */
foreach ($routine->errors as $index => $error) {
$this->error(sprintf('Error importing line #%d: %s', $index, $error));
}
$this->line(
sprintf('The import has finished. %d transactions have been imported out of %d records.', $routine->journals->count(), $routine->lines)
);
}
return;

View File

@@ -0,0 +1,104 @@
<?php
/**
* DecryptAttachment.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
use Illuminate\Console\Command;
use Log;
/**
* Class DecryptAttachment
*
* @package FireflyIII\Console\Commands
*/
class DecryptAttachment extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Decrypts an attachment and dumps the content in a file in the given directory.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature
= 'firefly:decrypt-attachment {id:The ID of the attachment.} {name:The file name of the attachment.}
{directory:Where the file must be stored.}';
/**
* Create a new command instance.
*
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*/
public function handle()
{
/** @var AttachmentRepositoryInterface $repository */
$repository = app(AttachmentRepositoryInterface::class);
$attachmentId = intval($this->argument('id'));
$attachment = $repository->findWithoutUser($attachmentId);
$attachmentName = trim($this->argument('name'));
$storagePath = realpath(trim($this->argument('directory')));
if (is_null($attachment->id)) {
$this->error(sprintf('No attachment with id #%d', $attachmentId));
Log::error(sprintf('DecryptAttachment: No attachment with id #%d', $attachmentId));
return;
}
if ($attachmentName !== $attachment->filename) {
$this->error('File name does not match.');
Log::error('DecryptAttachment: File name does not match.');
return;
}
if (!is_dir($storagePath)) {
$this->error(sprintf('Path "%s" is not a directory.', $storagePath));
Log::error(sprintf('DecryptAttachment: Path "%s" is not a directory.', $storagePath));
return;
}
if (!is_writable($storagePath)) {
$this->error(sprintf('Path "%s" is not writable.', $storagePath));
Log::error(sprintf('DecryptAttachment: Path "%s" is not writable.', $storagePath));
return;
}
$fullPath = $storagePath . DIRECTORY_SEPARATOR . $attachment->filename;
$content = $repository->getContent($attachment);
$this->line(sprintf('Going to write content for attachment #%d into file "%s"', $attachment->id, $fullPath));
$result = file_put_contents($fullPath, $content);
if ($result === false) {
$this->error('Could not write to file.');
return;
}
$this->info(sprintf('%d bytes written. Exiting now..', $result));
return;
}
}

View File

@@ -13,12 +13,11 @@ declare(strict_types=1);
namespace FireflyIII\Console\Commands;
use FireflyIII\Import\ImportProcedure;
use FireflyIII\Import\Logging\CommandHandler;
use FireflyIII\Import\Routine\ImportRoutine;
use FireflyIII\Models\ImportJob;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Console\Command;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Log;
/**
@@ -75,15 +74,18 @@ class Import extends Command
$monolog = Log::getMonolog();
$handler = new CommandHandler($this);
$monolog->pushHandler($handler);
$importProcedure = new ImportProcedure;
$result = $importProcedure->runImport($job);
// display result to user:
$this->presentResults($result);
$this->line('The import has completed.');
/** @var ImportRoutine $routine */
$routine = app(ImportRoutine::class);
$routine->setJob($job);
$routine->run();
// get any errors from the importer:
$this->presentErrors($job);
/** @var MessageBag $error */
foreach ($routine->errors as $index => $error) {
$this->error(sprintf('Error importing line #%d: %s', $index, $error));
}
$this->line(sprintf('The import has finished. %d transactions have been imported out of %d records.', $routine->journals->count(), $routine->lines));
return;
}
@@ -96,12 +98,14 @@ class Import extends Command
private function isValid(ImportJob $job): bool
{
if (is_null($job)) {
Log::error('This job does not seem to exist.');
$this->error('This job does not seem to exist.');
return false;
}
if ($job->status != 'settings_complete') {
if ($job->status !== 'configured') {
Log::error(sprintf('This job is not ready to be imported (status is %s).', $job->status));
$this->error('This job is not ready to be imported.');
return false;
@@ -109,36 +113,4 @@ class Import extends Command
return true;
}
/**
* @param ImportJob $job
*/
private function presentErrors(ImportJob $job)
{
$extendedStatus = $job->extended_status;
if (isset($extendedStatus['errors']) && count($extendedStatus['errors']) > 0) {
$this->line(sprintf('The following %d error(s) occured during the import:', count($extendedStatus['errors'])));
foreach ($extendedStatus['errors'] as $error) {
$this->error($error);
}
}
}
/**
* @param Collection $result
*/
private function presentResults(Collection $result)
{
/**
* @var int $index
* @var TransactionJournal $journal
*/
foreach ($result as $index => $journal) {
if (!is_null($journal->id)) {
$this->line(sprintf('Line #%d has been imported as transaction #%d.', $index, $journal->id));
continue;
}
$this->error(sprintf('Could not store line #%d', $index));
}
}
}

View File

@@ -32,9 +32,11 @@ use Illuminate\Database\QueryException;
use Log;
use Preferences;
use Schema;
use Steam;
/**
* Class UpgradeDatabase
* @SuppressWarnings(PHPMD.CouplingBetweenObjects) // it just touches a lot of things.
*
* @package FireflyIII\Console\Commands
*/
@@ -72,11 +74,59 @@ class UpgradeDatabase extends Command
$this->repairPiggyBanks();
$this->updateAccountCurrencies();
$this->updateJournalCurrencies();
$this->currencyInfoToTransactions();
$this->verifyCurrencyInfo();
$this->info('Firefly III database is up to date.');
}
/**
* Moves the currency id info to the transaction instead of the journal.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // cannot be helped.
*/
private function currencyInfoToTransactions()
{
$count = 0;
$set = TransactionJournal::with('transactions')->get();
/** @var TransactionJournal $journal */
foreach ($set as $journal) {
/** @var Transaction $transaction */
foreach ($journal->transactions as $transaction) {
if (is_null($transaction->transaction_currency_id)) {
$transaction->transaction_currency_id = $journal->transaction_currency_id;
$transaction->save();
$count++;
}
}
// read and use the foreign amounts when present.
if ($journal->hasMeta('foreign_amount')) {
$amount = Steam::positive($journal->getMeta('foreign_amount'));
// update both transactions:
foreach ($journal->transactions as $transaction) {
$transaction->foreign_amount = $amount;
if (bccomp($transaction->amount, '0') === -1) {
// update with negative amount:
$transaction->foreign_amount = bcmul($amount, '-1');
}
// set foreign currency id:
$transaction->foreign_currency_id = intval($journal->getMeta('foreign_currency_id'));
$transaction->save();
}
$journal->deleteMeta('foreign_amount');
$journal->deleteMeta('foreign_currency_id');
}
}
$this->line(sprintf('Updated currency information for %d transactions', $count));
}
/**
* Migrate budget repetitions to new format.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's 5.
*/
private function migrateRepetitions()
{
@@ -104,6 +154,8 @@ class UpgradeDatabase extends Command
/**
* Make sure there are only transfers linked to piggy bank events.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // cannot be helped.
*/
private function repairPiggyBanks()
{
@@ -111,6 +163,7 @@ class UpgradeDatabase extends Command
if (!Schema::hasTable('piggy_bank_events')) {
return;
}
$set = PiggyBankEvent::with(['PiggyBank', 'TransactionJournal', 'TransactionJournal.TransactionType'])->get();
/** @var PiggyBankEvent $event */
foreach ($set as $event) {
@@ -162,7 +215,7 @@ class UpgradeDatabase extends Command
}
/**
*
* Make sure all accounts have proper currency info.
*/
private function updateAccountCurrencies()
{
@@ -172,42 +225,38 @@ class UpgradeDatabase extends Command
/** @var Account $account */
foreach ($accounts as $account) {
// get users preference, fall back to system pref.
$defaultCurrencyCode = Preferences::getForUser($account->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
$defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first();
$accountCurrency = intval($account->getMeta('currency_id'));
$openingBalance = $account->getOpeningBalance();
$openingBalanceCurrency = intval($openingBalance->transaction_currency_id);
$defaultCurrencyCode = Preferences::getForUser($account->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
$defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first();
$accountCurrency = intval($account->getMeta('currency_id'));
$openingBalance = $account->getOpeningBalance();
$obCurrency = intval($openingBalance->transaction_currency_id);
// both 0? set to default currency:
if ($accountCurrency === 0 && $openingBalanceCurrency === 0) {
if ($accountCurrency === 0 && $obCurrency === 0) {
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $defaultCurrency->id]);
$this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode));
continue;
}
// opening balance 0, account not zero? just continue:
if ($accountCurrency > 0 && $openingBalanceCurrency === 0) {
continue;
}
// account is set to 0, opening balance is not?
if ($accountCurrency === 0 && $openingBalanceCurrency > 0) {
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $openingBalanceCurrency]);
if ($accountCurrency === 0 && $obCurrency > 0) {
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]);
$this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $defaultCurrencyCode));
continue;
}
// both are equal, just continue:
if ($accountCurrency === $openingBalanceCurrency) {
continue;
}
// do not match:
if ($accountCurrency !== $openingBalanceCurrency) {
if ($accountCurrency !== $obCurrency) {
// update opening balance:
$openingBalance->transaction_currency_id = $accountCurrency;
$openingBalance->save();
$this->line(sprintf('Account #%d ("%s") now has a correct currency for opening balance.', $account->id, $account->name));
continue;
}
// opening balance 0, account not zero? just continue:
// both are equal, just continue:
}
}
@@ -269,9 +318,11 @@ class UpgradeDatabase extends Command
$repository = app(CurrencyRepositoryInterface::class);
$notification = '%s #%d uses %s but should use %s. It has been updated. Please verify this in Firefly III.';
$transfer = 'Transfer #%d has been updated to use the correct currencies. Please verify this in Firefly III.';
$driver = DB::connection()->getDriverName();
$pgsql = ['pgsql', 'postgresql'];
foreach ($types as $type => $operator) {
$set = TransactionJournal
$query = TransactionJournal
::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')->leftJoin(
'transactions', function (JoinClause $join) use ($operator) {
$join->on('transaction_journals.id', '=', 'transactions.transaction_journal_id')->where('transactions.amount', $operator, '0');
@@ -280,9 +331,15 @@ class UpgradeDatabase extends Command
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
->where('transaction_types.type', $type)
->where('account_meta.name', 'currency_id')
->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'))
->get(['transaction_journals.*', 'account_meta.data as expected_currency_id', 'transactions.amount as transaction_amount']);
->where('account_meta.name', 'currency_id');
if (in_array($driver, $pgsql)) {
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('cast(account_meta.data as int)'));
}
if (!in_array($driver, $pgsql)) {
$query->where('transaction_journals.transaction_currency_id', '!=', DB::raw('account_meta.data'));
}
$set = $query->get(['transaction_journals.*', 'account_meta.data as expected_currency_id', 'transactions.amount as transaction_amount']);
/** @var TransactionJournal $journal */
foreach ($set as $journal) {
$expectedCurrency = $repository->find(intval($journal->expected_currency_id));
@@ -334,4 +391,25 @@ class UpgradeDatabase extends Command
}
}
}
/**
*
*/
private function verifyCurrencyInfo()
{
$count = 0;
$transactions = Transaction::get();
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
$currencyId = intval($transaction->transaction_currency_id);
$foreignId = intval($transaction->foreign_currency_id);
if ($currencyId === $foreignId) {
$transaction->foreign_currency_id = null;
$transaction->foreign_amount = null;
$transaction->save();
$count++;
}
}
$this->line(sprintf('Updated currency information for %d transactions', $count));
}
}

View File

@@ -50,10 +50,10 @@ class UpgradeFireflyInstructions extends Command
public function handle()
{
if ($this->argument('task') == 'update') {
if ($this->argument('task') === 'update') {
$this->updateInstructions();
}
if ($this->argument('task') == 'install') {
if ($this->argument('task') === 'install') {
$this->installInstructions();
}
}

View File

@@ -1,10 +1,22 @@
<?php
declare(strict_types=1);
/**
* UseEncryption.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
namespace FireflyIII\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
/**
* Class UseEncryption
*/
class UseEncryption extends Command
{
/**

View File

@@ -259,7 +259,7 @@ class VerifyDatabase extends Command
{
$plural = str_plural($name);
$class = sprintf('FireflyIII\Models\%s', ucfirst($name));
$field = $name == 'tag' ? 'tag' : 'name';
$field = $name === 'tag' ? 'tag' : 'name';
$set = $class::leftJoin($name . '_transaction_journal', $plural . '.id', '=', $name . '_transaction_journal.' . $name . '_id')
->leftJoin('users', $plural . '.user_id', '=', 'users.id')
->distinct()

View File

@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace FireflyIII\Console;
use FireflyIII\Console\Commands\CreateImport;
use FireflyIII\Console\Commands\DecryptAttachment;
use FireflyIII\Console\Commands\EncryptFile;
use FireflyIII\Console\Commands\Import;
use FireflyIII\Console\Commands\ScanAttachments;
@@ -63,6 +64,7 @@ class Kernel extends ConsoleKernel
ScanAttachments::class,
UpgradeDatabase::class,
UseEncryption::class,
DecryptAttachment::class,
];
/**

View File

@@ -26,9 +26,9 @@ class StoredTransactionJournal extends Event
use SerializesModels;
/** @var TransactionJournal */
/** @var TransactionJournal */
public $journal;
/** @var int */
/** @var int */
public $piggyBankId;
/**

View File

@@ -26,7 +26,7 @@ class UpdatedTransactionJournal extends Event
use SerializesModels;
/** @var TransactionJournal */
/** @var TransactionJournal */
public $journal;
/**

View File

@@ -303,7 +303,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')
->leftJoin('accounts AS opposing_accounts', 'opposing.account_id', '=', 'opposing_accounts.id')
->leftJoin('transaction_types', 'transaction_journals.transaction_type_id', 'transaction_types.id')
->leftJoin('transaction_currencies', 'transaction_journals.transaction_currency_id', '=', 'transaction_currencies.id')
->leftJoin('transaction_currencies', 'transactions.transaction_currency_id', '=', 'transaction_currencies.id')
->whereIn('transactions.account_id', $accountIds)
->where('transaction_journals.user_id', $this->job->user_id)
->where('transaction_journals.date', '>=', $this->start->format('Y-m-d'))
@@ -338,7 +338,7 @@ class JournalExportCollector extends BasicCollector implements CollectorInterfac
'transaction_journals.encrypted as journal_encrypted',
'transaction_journals.transaction_type_id',
'transaction_types.type as transaction_type',
'transaction_journals.transaction_currency_id',
'transactions.transaction_currency_id',
'transaction_currencies.code AS transaction_currency_code',
]

View File

@@ -45,11 +45,11 @@ final class Entry
public $transaction_type;
public $source_account_id;
public $source_account_name;
public $asset_account_id;
public $asset_account_name;
public $destination_account_id;
public $destination_account_name;
public $opposing_account_id;
public $opposing_account_name;
public $budget_id;
public $budget_name;
@@ -71,24 +71,24 @@ final class Entry
*/
public static function fromObject($object): Entry
{
$entry = new self;
$entry->journal_id = $object->transaction_journal_id;
$entry->description = Steam::decrypt(intval($object->journal_encrypted), $object->journal_description);
$entry->amount = $object->amount;
$entry->date = $object->date;
$entry->transaction_type = $object->transaction_type;
$entry->currency_code = $object->transaction_currency_code;
$entry->source_account_id = $object->account_id;
$entry->source_account_name = Steam::decrypt(intval($object->account_name_encrypted), $object->account_name);
$entry->destination_account_id = $object->opposing_account_id;
$entry->destination_account_name = Steam::decrypt(intval($object->opposing_account_encrypted), $object->opposing_account_name);
$entry->category_id = $object->category_id ?? '';
$entry->category_name = $object->category_name ?? '';
$entry->budget_id = $object->budget_id ?? '';
$entry->budget_name = $object->budget_name ?? '';
$entry = new self;
$entry->journal_id = $object->transaction_journal_id;
$entry->description = Steam::decrypt(intval($object->journal_encrypted), $object->journal_description);
$entry->amount = $object->amount;
$entry->date = $object->date;
$entry->transaction_type = $object->transaction_type;
$entry->currency_code = $object->transaction_currency_code;
$entry->asset_account_id = $object->account_id;
$entry->asset_account_name = Steam::decrypt(intval($object->account_name_encrypted), $object->account_name);
$entry->opposing_account_id = $object->opposing_account_id;
$entry->opposing_account_name = Steam::decrypt(intval($object->opposing_account_encrypted), $object->opposing_account_name);
$entry->category_id = $object->category_id ?? '';
$entry->category_name = $object->category_name ?? '';
$entry->budget_id = $object->budget_id ?? '';
$entry->budget_name = $object->budget_name ?? '';
// update description when transaction description is different:
if (!is_null($object->description) && $object->description != $entry->description) {
if (!is_null($object->description) && $object->description !== $entry->description) {
$entry->description = $entry->description . ' (' . $object->description . ')';
}

View File

@@ -110,9 +110,16 @@ class ChartJsGenerator implements GeneratorInterface
];
// sort by value, keep keys.
// different sort when values are positive and when they're negative.
asort($data);
$next = next($data);
if (!is_bool($next) && bccomp($next, '0') === 1) {
// next is positive, sort other way around.
arsort($data);
}
unset($next);
$index = 0;
$index = 0;
foreach ($data as $key => $value) {
// make larger than 0

View File

@@ -22,10 +22,15 @@ interface GeneratorInterface
{
/**
* Will generate a (ChartJS) compatible array from the given input. Expects this format:
* Will generate a Chart JS compatible array from the given input. Expects this format
*
* Will take labels for all from first set.
*
* 0: [
* 'label' => 'label of set',
* 'type' => bar or line, optional
* 'yAxisID' => ID of yAxis, optional, will not be included when unused.
* 'fill' => if to fill a line? optional, will not be included when unused.
* 'entries' =>
* [
* 'label-of-entry' => 'value'
@@ -33,12 +38,16 @@ interface GeneratorInterface
* ]
* 1: [
* 'label' => 'label of another set',
* 'type' => bar or line, optional
* 'yAxisID' => ID of yAxis, optional, will not be included when unused.
* 'fill' => if to fill a line? optional, will not be included when unused.
* 'entries' =>
* [
* 'label-of-entry' => 'value'
* ]
* ]
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
*
* @param array $data
*

View File

@@ -19,6 +19,7 @@ use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Transaction;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Support\Collection;
use Steam;
@@ -147,6 +148,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
private function getAuditReport(Account $account, Carbon $date): array
{
/** @var CurrencyRepositoryInterface $currencyRepos */
$currencyRepos = app(CurrencyRepositoryInterface::class);
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
@@ -155,15 +158,21 @@ class MonthReportGenerator implements ReportGeneratorInterface
$journals = $journals->reverse();
$dayBeforeBalance = Steam::balance($account, $date);
$startBalance = $dayBeforeBalance;
$currency = $currencyRepos->find(intval($account->getMeta('currency_id')));
/** @var Transaction $journal */
foreach ($journals as $transaction) {
$transaction->before = $startBalance;
$transactionAmount = $transaction->transaction_amount;
$newBalance = bcadd($startBalance, $transactionAmount);
$transaction->after = $newBalance;
$startBalance = $newBalance;
if ($currency->id === $transaction->foreign_currency_id) {
$transactionAmount = $transaction->transaction_foreign_amount;
}
$newBalance = bcadd($startBalance, $transactionAmount);
$transaction->after = $newBalance;
$startBalance = $newBalance;
$transaction->currency = $currency;
}
/*

View File

@@ -15,7 +15,6 @@ namespace FireflyIII\Generator\Report;
use FireflyIII\Models\Transaction;
use Illuminate\Support\Collection;
use Log;
/**

View File

@@ -14,6 +14,7 @@ namespace FireflyIII\Generator\Report\Tag;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Generator\Report\Support;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\NegativeAmountFilter;
use FireflyIII\Helpers\Filter\OpposingAccountFilter;
@@ -30,7 +31,7 @@ use Log;
*
* @package FireflyIII\Generator\Report\Tag
*/
class MonthReportGenerator implements ReportGeneratorInterface
class MonthReportGenerator extends Support implements ReportGeneratorInterface
{
/** @var Collection */

View File

@@ -42,6 +42,10 @@ class StoredJournalEventHandler
/**
* StoredJournalEventHandler constructor.
*
* @param PRI $repository
* @param JRI $journalRepository
* @param RGRI $ruleGroupRepository
*/
public function __construct(PRI $repository, JRI $journalRepository, RGRI $ruleGroupRepository)
{

View File

@@ -23,7 +23,7 @@ use FireflyIII\Support\Events\BillScanner;
/**
* @codeCoverageIgnore
*
*
* Class UpdatedJournalEventHandler
*
* @package FireflyIII\Handlers\Events
@@ -35,6 +35,8 @@ class UpdatedJournalEventHandler
/**
* StoredJournalEventHandler constructor.
*
* @param RuleGroupRepositoryInterface $ruleGroupRepository
*/
public function __construct(RuleGroupRepositoryInterface $ruleGroupRepository)
{
@@ -52,7 +54,7 @@ class UpdatedJournalEventHandler
{
// get all the user's rule groups, with the rules, order by 'order'.
$journal = $updatedJournalEvent->journal;
$groups = $this->repository->getActiveGroups($journal->user);
$groups = $this->repository->getActiveGroups($journal->user);
/** @var RuleGroup $group */
foreach ($groups as $group) {

View File

@@ -74,6 +74,7 @@ class UserEventHandler
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
// @codeCoverageIgnoreEnd
return true;
@@ -96,16 +97,17 @@ class UserEventHandler
}
// get the email address
$email = $event->user->email;
$address = route('index');
$uri = route('index');
$ipAddress = $event->ipAddress;
// send email.
try {
Mail::to($email)->send(new RegisteredUserMail($address, $ipAddress));
Mail::to($email)->send(new RegisteredUserMail($uri, $ipAddress));
// @codeCoverageIgnoreStart
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
// @codeCoverageIgnoreEnd
return true;

View File

@@ -18,9 +18,10 @@ use FireflyIII\Models\Attachment;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Collection;
use Illuminate\Support\MessageBag;
use Log;
use Storage;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use Log;
/**
* Class AttachmentHelper
*
@@ -98,7 +99,7 @@ class AttachmentHelper implements AttachmentHelperInterface
*
* @return bool
*/
public function saveAttachmentsForModel(Model $model, array $files = null): bool
public function saveAttachmentsForModel(Model $model, ?array $files): bool
{
if (is_array($files)) {
foreach ($files as $entry) {
@@ -157,11 +158,14 @@ class AttachmentHelper implements AttachmentHelperInterface
$attachment->size = $file->getSize();
$attachment->uploaded = 0;
$attachment->save();
Log::debug('Created attachment:', $attachment->toArray());
$fileObject = $file->openFile('r');
$fileObject->rewind();
$content = $fileObject->fread($file->getSize());
$encrypted = Crypt::encrypt($content);
Log::debug(sprintf('Full file length is %d and upload size is %d.', strlen($content), $file->getSize()));
Log::debug(sprintf('Encrypted content is %d', strlen($encrypted)));
// store it:
$this->uploadDisk->put($attachment->fileName(), $encrypted);
@@ -202,6 +206,7 @@ class AttachmentHelper implements AttachmentHelperInterface
/**
* @codeCoverageIgnore
*
* @param UploadedFile $file
*
* @return bool

View File

@@ -55,6 +55,6 @@ interface AttachmentHelperInterface
*
* @return bool
*/
public function saveAttachmentsForModel(Model $model, array $files = null): bool;
public function saveAttachmentsForModel(Model $model, ?array $files): bool;
}

View File

@@ -147,13 +147,13 @@ class BalanceLine
if ($this->getBudget() instanceof BudgetModel && !is_null($this->getBudget()->id)) {
return $this->getBudget()->name;
}
if ($this->getRole() == self::ROLE_DEFAULTROLE) {
if ($this->getRole() === self::ROLE_DEFAULTROLE) {
return strval(trans('firefly.no_budget'));
}
if ($this->getRole() == self::ROLE_TAGROLE) {
if ($this->getRole() === self::ROLE_TAGROLE) {
return strval(trans('firefly.coveredWithTags'));
}
if ($this->getRole() == self::ROLE_DIFFROLE) {
if ($this->getRole() === self::ROLE_DIFFROLE) {
return strval(trans('firefly.leftUnbalanced'));
}

View File

@@ -96,7 +96,7 @@ class Bill
{
$set = $this->bills->sortBy(
function (BillLine $bill) {
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
$active = intval($bill->getBill()->active) === 0 ? 1 : 0;
$name = $bill->getBill()->name;
return $active . $name;

View File

@@ -60,24 +60,35 @@ class JournalCollector implements JournalCollectorInterface
'transaction_journals.description',
'transaction_journals.date',
'transaction_journals.encrypted',
'transaction_currencies.code as transaction_currency_code',
'transaction_types.type as transaction_type_type',
'transaction_journals.bill_id',
'bills.name as bill_name',
'bills.name_encrypted as bill_name_encrypted',
'transactions.id as id',
'transactions.amount as transaction_amount',
'transactions.description as transaction_description',
'transactions.account_id',
'transactions.identifier',
'transactions.transaction_journal_id',
'transactions.amount as transaction_amount',
'transactions.transaction_currency_id as transaction_currency_id',
'transaction_currencies.code as transaction_currency_code',
'transaction_currencies.symbol as transaction_currency_symbol',
'transaction_currencies.decimal_places as transaction_currency_dp',
'transactions.foreign_amount as transaction_foreign_amount',
'transactions.foreign_currency_id as foreign_currency_id',
'foreign_currencies.code as foreign_currency_code',
'foreign_currencies.symbol as foreign_currency_symbol',
'foreign_currencies.decimal_places as foreign_currency_dp',
'accounts.name as account_name',
'accounts.encrypted as account_encrypted',
'account_types.type as account_type',
];
/** @var bool */
private $filterInternalTransfers;
/** @var bool */
private $filterTransfers = false;
/** @var array */
private $filters = [InternalTransferFilter::class];
@@ -388,6 +399,10 @@ class JournalCollector implements JournalCollectorInterface
*/
public function setPage(int $page): JournalCollectorInterface
{
if ($page < 1) {
$page = 1;
}
$this->page = $page;
if ($page > 0) {
@@ -484,17 +499,19 @@ class JournalCollector implements JournalCollectorInterface
Log::debug('journalCollector::startQuery');
/** @var EloquentBuilder $query */
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transactions.transaction_currency_id')
->leftJoin('transaction_currencies as foreign_currencies', 'foreign_currencies.id', 'transactions.foreign_currency_id')
->whereNull('transactions.deleted_at')
->whereNull('transaction_journals.deleted_at')
->where('transaction_journals.user_id', $this->user->id)
->orderBy('transaction_journals.date', 'DESC')
->orderBy('transaction_journals.order', 'ASC')
->orderBy('transaction_journals.id', 'DESC');
->orderBy('transaction_journals.id', 'DESC')
->orderBy('transaction_journals.description', 'DESC');
$this->query = $query;
@@ -660,6 +677,7 @@ class JournalCollector implements JournalCollectorInterface
$this->query->leftJoin('account_types as opposing_account_types', 'opposing_accounts.account_type_id', '=', 'opposing_account_types.id');
$this->query->whereNull('opposing.deleted_at');
$this->fields[] = 'opposing.id as opposing_id';
$this->fields[] = 'opposing.account_id as opposing_account_id';
$this->fields[] = 'opposing_accounts.name as opposing_account_name';
$this->fields[] = 'opposing_accounts.encrypted as opposing_account_encrypted';

View File

@@ -53,4 +53,4 @@ class AmountFilter implements FilterInterface
}
);
}
}
}

View File

@@ -31,4 +31,4 @@ class EmptyFilter implements FilterInterface
{
return $set;
}
}
}

View File

@@ -23,4 +23,4 @@ interface FilterInterface
*/
public function filter(Collection $set): Collection;
}
}

View File

@@ -26,7 +26,7 @@ use Log;
*/
class InternalTransferFilter implements FilterInterface
{
/** @var array */
/** @var array */
private $accounts = [];
/**
@@ -70,4 +70,4 @@ class InternalTransferFilter implements FilterInterface
}
}
}

View File

@@ -44,4 +44,4 @@ class NegativeAmountFilter implements FilterInterface
}
);
}
}
}

View File

@@ -60,4 +60,4 @@ class OpposingAccountFilter implements FilterInterface
}
);
}
}
}

View File

@@ -47,4 +47,4 @@ class PositiveAmountFilter implements FilterInterface
}
);
}
}
}

View File

@@ -41,11 +41,13 @@ class TransferFilter implements FilterInterface
continue;
}
// make property string:
$journalId = $transaction->transaction_journal_id;
$amount = Steam::positive($transaction->transaction_amount);
$accountIds = [intval($transaction->account_id), intval($transaction->opposing_account_id)];
$journalId = $transaction->transaction_journal_id;
$amount = Steam::positive($transaction->transaction_amount);
$accountIds = [intval($transaction->account_id), intval($transaction->opposing_account_id)];
$transactionIds = [$transaction->id, intval($transaction->opposing_id)];
sort($accountIds);
$key = $journalId . '-' . join(',', $accountIds) . '-' . $amount;
sort($transactionIds);
$key = $journalId . '-' . join(',', $transactionIds) . '-' . join(',', $accountIds) . '-' . $amount;
if (!isset($count[$key])) {
// not yet counted? add to new set and count it:
$new->push($transaction);
@@ -55,4 +57,4 @@ class TransferFilter implements FilterInterface
return $new;
}
}
}

View File

@@ -27,6 +27,7 @@ use Route;
*/
class Help implements HelpInterface
{
const CACHEKEY = 'help_%s_%s';
/** @var string */
protected $userAgent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36';
@@ -38,7 +39,7 @@ class Help implements HelpInterface
*/
public function getFromCache(string $route, string $language): string
{
$line = sprintf('help.%s.%s', $route, $language);
$line = sprintf(self::CACHEKEY, $route, $language);
return Cache::get($line);
}
@@ -64,12 +65,12 @@ class Help implements HelpInterface
return '';
}
Log::debug(sprintf('Status code is %d', $result->status_code));
if ($result->status_code === 200) {
$content = trim($result->body);
}
if (strlen($content) > 0) {
Log::debug('Content is longer than zero. Expect something.');
$converter = new CommonMarkConverter();
@@ -98,7 +99,7 @@ class Help implements HelpInterface
*/
public function inCache(string $route, string $language): bool
{
$line = sprintf('help.%s.%s', $route, $language);
$line = sprintf(self::CACHEKEY, $route, $language);
$result = Cache::has($line);
if ($result) {
Log::debug(sprintf('Cache has this entry: %s', 'help.' . $route . '.' . $language));
@@ -120,7 +121,7 @@ class Help implements HelpInterface
*/
public function putInCache(string $route, string $language, string $content)
{
$key = sprintf('help.%s.%s', $route, $language);
$key = sprintf(self::CACHEKEY, $route, $language);
if (strlen($content) > 0) {
Log::debug(sprintf('Will store entry in cache: %s', $key));
Cache::put($key, $content, 10080); // a week.

View File

@@ -244,7 +244,7 @@ class BalanceReportHelper implements BalanceReportHelperInterface
foreach ($accounts as $account) {
$leftEntry = $tagsLeft->filter(
function (Tag $tag) use ($account) {
return $tag->account_id == $account->id;
return $tag->account_id === $account->id;
}
);
$left = '0';

View File

@@ -56,7 +56,7 @@ class BudgetReportHelper implements BudgetReportHelperInterface
/** @var Budget $budget */
foreach ($set as $budget) {
$budgetLimits = $this->repository->getBudgetLimits($budget, $start, $end);
if ($budgetLimits->count() == 0) { // no budget limit(s) for this budget
if ($budgetLimits->count() === 0) { // no budget limit(s) for this budget
$spent = $this->repository->spentInPeriod(new Collection([$budget]), $accounts, $start, $end);// spent for budget in time range
if (bccomp($spent, '0') === -1) {

View File

@@ -187,7 +187,7 @@ class PopupReport implements PopupReportInterface
$journals = $journals->filter(
function (Transaction $transaction) use ($report) {
// get the destinations:
$destinations = $transaction->destinationAccountList($transaction->transactionJournal)->pluck('id')->toArray();
$destinations = $transaction->transactionJournal->destinationAccountList()->pluck('id')->toArray();
// do these intersect with the current list?
return !empty(array_intersect($report, $destinations));
@@ -196,4 +196,4 @@ class PopupReport implements PopupReportInterface
return $journals;
}
}
}

View File

@@ -80,4 +80,4 @@ interface PopupReportInterface
* @return Collection
*/
public function byIncome(Account $account, array $attributes): Collection;
}
}

View File

@@ -194,7 +194,7 @@ class AccountController extends Controller
return view(
'accounts.edit', compact(
'allCurrencies', 'currencySelectList', 'account', 'currency', 'subTitle', 'subTitleIcon', 'openingBalance', 'what', 'roles'
'allCurrencies', 'currencySelectList', 'account', 'currency', 'subTitle', 'subTitleIcon', 'what', 'roles'
)
);
}
@@ -219,8 +219,8 @@ class AccountController extends Controller
$start->subDay();
$ids = $accounts->pluck('id')->toArray();
$startBalances = Steam::balancesById($ids, $start);
$endBalances = Steam::balancesById($ids, $end);
$startBalances = Steam::balancesByAccounts($accounts, $start);
$endBalances = Steam::balancesByAccounts($accounts, $end);
$activities = Steam::getLastActivities($ids);
$accounts->each(
@@ -253,7 +253,7 @@ class AccountController extends Controller
$currencyRepos = app(CurrencyRepositoryInterface::class);
$range = Preferences::get('viewRange', '1M')->data;
$subTitleIcon = config('firefly.subIconsByIdentifier.' . $account->accountType->type);
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$chartUri = route('chart.account.single', [$account->id]);
$start = null;
@@ -274,55 +274,31 @@ class AccountController extends Controller
if (strlen($moment) > 0 && $moment !== 'all') {
$start = new Carbon($moment);
$end = Navigation::endOfPeriod($start, $range);
$subTitle = trans(
'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
$fStart = $start->formatLocalized($this->monthAndDayFormat);
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$chartUri = route('chart.account.period', [$account->id, $start->format('Y-m-d')]);
$periods = $this->getPeriodOverview($account);
}
// prep for current period
// prep for current period view
if (strlen($moment) === 0) {
$start = clone session('start', Navigation::startOfPeriod(new Carbon, $range));
$end = clone session('end', Navigation::endOfPeriod(new Carbon, $range));
$subTitle = trans(
'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
$fStart = $start->formatLocalized($this->monthAndDayFormat);
$fEnd = $end->formatLocalized($this->monthAndDayFormat);
$subTitle = trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$periods = $this->getPeriodOverview($account);
}
$count = 0;
$loop = 0;
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at loop start.');
while ($count === 0 && $loop < 3) {
$loop++;
$collector = app(JournalCollectorInterface::class);
Log::info('Count is zero, search for journals.');
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
if (!is_null($start)) {
$collector->setRange($start, $end);
}
$journals = $collector->getPaginatedJournals();
$journals->setPath('accounts/show/' . $account->id . '/' . $moment);
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfPeriod($start, $range);
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
// grab journals:
$collector = app(JournalCollectorInterface::class);
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
if (!is_null($start)) {
$collector->setRange($start, $end);
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
$journals = $collector->getPaginatedJournals();
$journals->setPath(route('accounts.show', [$account->id, $moment]));
return view(
'accounts.show',
@@ -421,7 +397,7 @@ class AccountController extends Controller
$start = $repository->oldestJournalDate($account);
$range = Preferences::get('viewRange', '1M')->data;
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfX(new Carbon, $range);
$end = Navigation::endOfX(new Carbon, $range, null);
$entries = new Collection;
// properties for cache

View File

@@ -98,10 +98,13 @@ class AttachmentController extends Controller
*/
public function download(AttachmentRepositoryInterface $repository, Attachment $attachment)
{
if ($repository->exists($attachment)) {
$content = $repository->getContent($attachment);
$quoted = sprintf('"%s"', addcslashes(basename($attachment->filename), '"\\'));
/** @var LaravelResponse $response */
$response = response($content, 200);
$response
@@ -149,7 +152,8 @@ class AttachmentController extends Controller
{
$image = 'images/page_green.png';
if ($attachment->mime == 'application/pdf') {
if ($attachment->mime === 'application/pdf') {
$image = 'images/page_white_acrobat.png';
}
$file = public_path($image);

View File

@@ -17,6 +17,7 @@ use Config;
use FireflyConfig;
use FireflyIII\Events\RegisteredUser;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\UserRegistrationRequest;
use FireflyIII\User;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
@@ -52,11 +53,11 @@ class RegisterController extends Controller
}
/**
* @param Request $request
* @param UserRegistrationRequest|Request $request
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|\Illuminate\View\View
*/
public function register(Request $request)
public function register(UserRegistrationRequest $request)
{
// is allowed to?
$singleUserMode = FireflyConfig::get('single_user_mode', Config::get('firefly.configuration.single_user_mode'))->data;

View File

@@ -175,7 +175,7 @@ class BillController extends Controller
*/
public function rescan(Request $request, BillRepositoryInterface $repository, Bill $bill)
{
if (intval($bill->active) == 0) {
if (intval($bill->active) === 0) {
$request->session()->flash('warning', strval(trans('firefly.cannot_scan_inactive_bill')));
return redirect(URL::previous());
@@ -206,7 +206,7 @@ class BillController extends Controller
/** @var Carbon $date */
$date = session('start');
$year = $date->year;
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$yearAverage = $repository->getYearAverage($bill, $date);
$overallAverage = $repository->getOverallAverage($bill);
@@ -217,7 +217,7 @@ class BillController extends Controller
$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation()
->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('/bills/show/' . $bill->id);
$journals->setPath(route('bills.show', [$bill->id]));
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill, new Carbon);
$hideBill = true;

View File

@@ -15,6 +15,7 @@ namespace FireflyIII\Http\Controllers;
use Amount;
use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Http\Requests\BudgetFormRequest;
@@ -80,7 +81,7 @@ class BudgetController extends Controller
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$budgetLimit = $this->repository->updateLimitAmount($budget, $start, $end, $amount);
if ($amount == 0) {
if ($amount === 0) {
$budgetLimit = null;
}
Preferences::mark();
@@ -166,16 +167,38 @@ class BudgetController extends Controller
}
/**
* @param string|null $moment
*
* @return View
*/
public function index()
public function index(string $moment = null)
{
$range = Preferences::get('viewRange', '1M')->data;
$start = session('start', new Carbon);
$end = session('end', new Carbon);
// make date if present:
if (!is_null($moment) || strlen(strval($moment)) !== 0) {
try {
$start = new Carbon($moment);
$end = Navigation::endOfPeriod($start, $range);
} catch (Exception $e) {
// start and end are already defined.
}
}
$next = clone $end;
$next->addDay();
$prev = clone $start;
$prev->subDay();
$prev = Navigation::startOfPeriod($prev, $range);
$this->repository->cleanupBudgets();
$budgets = $this->repository->getActiveBudgets();
$inactive = $this->repository->getInactiveBudgets();
$start = session('start', new Carbon);
$end = session('end', new Carbon);
$periodStart = $start->formatLocalized($this->monthAndDayFormat);
$periodEnd = $end->formatLocalized($this->monthAndDayFormat);
$budgetInformation = $this->collectBudgetInformation($budgets, $start, $end);
@@ -184,9 +207,44 @@ class BudgetController extends Controller
$spent = array_sum(array_column($budgetInformation, 'spent'));
$budgeted = array_sum(array_column($budgetInformation, 'budgeted'));
// select thing for last 12 periods:
$previousLoop = [];
$previousDate = clone $start;
$count = 0;
while ($count < 12) {
$previousDate->subDay();
$previousDate = Navigation::startOfPeriod($previousDate, $range);
$format = $previousDate->format('Y-m-d');
$previousLoop[$format] = Navigation::periodShow($previousDate, $range);
$count++;
}
// select thing for next 12 periods:
$nextLoop = [];
$nextDate = clone $end;
$nextDate->addDay();
$count = 0;
while ($count < 12) {
$format = $nextDate->format('Y-m-d');
$nextLoop[$format] = Navigation::periodShow($nextDate, $range);
$nextDate = Navigation::endOfPeriod($nextDate, $range);
$count++;
$nextDate->addDay();
}
// display info
$currentMonth = Navigation::periodShow($start, $range);
$nextText = Navigation::periodShow($next, $range);
$prevText = Navigation::periodShow($prev, $range);
return view(
'budgets.index',
compact('available', 'periodStart', 'periodEnd', 'budgetInformation', 'inactive', 'budgets', 'spent', 'budgeted')
compact(
'available', 'currentMonth', 'next', 'nextText', 'prev', 'prevText',
'periodStart', 'periodEnd', 'budgetInformation', 'inactive', 'budgets',
'spent', 'budgeted', 'previousLoop', 'nextLoop', 'start'
)
);
}
@@ -235,37 +293,15 @@ class BudgetController extends Controller
);
}
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$count = 0;
$loop = 0;
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at no-budget loop start.');
while ($count === 0 && $loop < 3) {
$loop++;
Log::info('Count is zero, search for journals.');
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withOpposingAccount();
$journals = $collector->getPaginatedJournals();
$journals->setPath('/budgets/list/no-budget');
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfPeriod($start, $range);
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.without_budget_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setLimit($pageSize)->setPage($page)
->withoutBudget()->withOpposingAccount();
$journals = $collector->getPaginatedJournals();
$journals->setPath(route('budgets.no-budget'));
return view('budgets.no-budget', compact('journals', 'subTitle', 'moment', 'periods', 'start', 'end'));
}
@@ -299,7 +335,7 @@ class BudgetController extends Controller
/** @var Carbon $start */
$start = session('first', Carbon::create()->startOfYear());
$end = new Carbon;
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$limits = $this->getLimits($budget, $start, $end);
$repetition = null;
@@ -308,7 +344,7 @@ class BudgetController extends Controller
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('/budgets/show/' . $budget->id);
$journals->setPath(route('budgets.show', [$budget->id]));
$subTitle = trans('firefly.all_journals_for_budget', ['name' => $budget->name]);
@@ -326,11 +362,11 @@ class BudgetController extends Controller
*/
public function showByBudgetLimit(Request $request, Budget $budget, BudgetLimit $budgetLimit)
{
if ($budgetLimit->budget->id != $budget->id) {
if ($budgetLimit->budget->id !== $budget->id) {
throw new FireflyException('This budget limit is not part of this budget.');
}
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$subTitle = trans(
'firefly.budget_in_period', [
@@ -346,7 +382,7 @@ class BudgetController extends Controller
$collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date)
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('/budgets/show/' . $budget->id . '/' . $budgetLimit->id);
$journals->setPath(route('budgets.show', [$budget->id, $budgetLimit->id]));
$start = session('first', Carbon::create()->startOfYear());
@@ -509,7 +545,7 @@ class BudgetController extends Controller
$start = $first->date ?? new Carbon;
$range = Preferences::get('viewRange', '1M')->data;
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfX(new Carbon, $range);
$end = Navigation::endOfX(new Carbon, $range, null);
$entries = new Collection;
// properties for cache

View File

@@ -164,10 +164,12 @@ class CategoryController extends Controller
public function noCategory(Request $request, JournalRepositoryInterface $repository, string $moment = '')
{
// default values:
$range = Preferences::get('viewRange', '1M')->data;
$start = null;
$end = null;
$periods = new Collection;
$range = Preferences::get('viewRange', '1M')->data;
$start = null;
$end = null;
$periods = new Collection;
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
// prep for "all" view.
if ($moment === 'all') {
@@ -199,37 +201,13 @@ class CategoryController extends Controller
);
}
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$count = 0;
$loop = 0;
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at no-cat loop start.');
while ($count === 0 && $loop < 3) {
$loop++;
Log::info('Count is zero, search for journals.');
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutCategory()->withOpposingAccount();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath('/categories/list/no-category');
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfPeriod($start, $range);
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.without_category_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutCategory()->withOpposingAccount();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath(route('categories.no-category'));
return view('categories.no-category', compact('journals', 'subTitle', 'moment', 'periods', 'start', 'end'));
}
@@ -247,10 +225,8 @@ class CategoryController extends Controller
// default values:
$subTitle = $category->name;
$subTitleIcon = 'fa-bar-chart';
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$count = 0;
$loop = 0;
$range = Preferences::get('viewRange', '1M')->data;
$start = null;
$end = null;
@@ -287,34 +263,15 @@ class CategoryController extends Controller
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at category loop start.');
while ($count === 0 && $loop < 3) {
$loop++;
Log::info('Count is zero, search for journals.');
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount()
->setCategory($category)->withBudgetInformation()->withCategoryInformation();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath('categories/show/' . $category->id);
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfPeriod($start, $range);
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_category',
['name' => $category->name, 'start' => $start->formatLocalized($this->monthAndDayFormat),
'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount()
->setCategory($category)->withBudgetInformation()->withCategoryInformation();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath(route('categories.show', [$category->id]));
return view('categories.show', compact('category', 'moment', 'journals', 'periods', 'subTitle', 'subTitleIcon', 'start', 'end'));
}
@@ -382,7 +339,7 @@ class CategoryController extends Controller
$start = $first->date ?? new Carbon;
$range = Preferences::get('viewRange', '1M')->data;
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfX(new Carbon, $range);
$end = Navigation::endOfX(new Carbon, $range, null);
$entries = new Collection;
// properties for cache
@@ -463,12 +420,12 @@ class CategoryController extends Controller
$accountRepository = app(AccountRepositoryInterface::class);
$accounts = $accountRepository->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
$first = $repository->firstUseDate($category);
if ($first->year == 1900) {
if ($first->year === 1900) {
$first = new Carbon;
}
$range = Preferences::get('viewRange', '1M')->data;
$first = Navigation::startOfPeriod($first, $range);
$end = Navigation::endOfX(new Carbon, $range);
$end = Navigation::endOfX(new Carbon, $range, null);
$entries = new Collection;
// properties for entries with their amounts.

View File

@@ -14,7 +14,6 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use Exception;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
@@ -115,9 +114,8 @@ class AccountController extends Controller
$start->subDay();
$accounts = $repository->getAccountsByType([AccountType::EXPENSE, AccountType::BENEFICIARY]);
$ids = $accounts->pluck('id')->toArray();
$startBalances = Steam::balancesById($ids, $start);
$endBalances = Steam::balancesById($ids, $end);
$startBalances = Steam::balancesByAccounts($accounts, $start);
$endBalances = Steam::balancesByAccounts($accounts, $end);
$chartData = [];
foreach ($accounts as $account) {
@@ -129,6 +127,7 @@ class AccountController extends Controller
$chartData[$account->name] = $diff;
}
}
arsort($chartData);
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
$cache->store($data);
@@ -336,7 +335,7 @@ class AccountController extends Controller
/**
* @param Account $account
* @param Carbon $start
* @param Carbon $start
*
* @return \Illuminate\Http\JsonResponse
* @throws FireflyException
@@ -411,9 +410,8 @@ class AccountController extends Controller
$accounts = $repository->getAccountsByType([AccountType::REVENUE]);
$start->subDay();
$ids = $accounts->pluck('id')->toArray();
$startBalances = Steam::balancesById($ids, $start);
$endBalances = Steam::balancesById($ids, $end);
$startBalances = Steam::balancesByAccounts($accounts, $start);
$endBalances = Steam::balancesByAccounts($accounts, $end);
foreach ($accounts as $account) {
$id = $account->id;
@@ -427,7 +425,7 @@ class AccountController extends Controller
}
arsort($chartData);
$data = $this->generator->singleSet(strval(trans('firefly.spent')), $chartData);
$data = $this->generator->singleSet(strval(trans('firefly.earned')), $chartData);
$cache->store($data);
return Response::json($data);

View File

@@ -31,6 +31,7 @@ use Illuminate\Support\Collection;
use Navigation;
use Preferences;
use Response;
use Steam;
/**
* Class BudgetController
@@ -123,7 +124,7 @@ class BudgetController extends Controller
*/
public function budgetLimit(Budget $budget, BudgetLimit $budgetLimit)
{
if ($budgetLimit->budget->id != $budget->id) {
if ($budgetLimit->budget->id !== $budget->id) {
throw new FireflyException('This budget limit is not part of this budget.');
}
@@ -162,7 +163,7 @@ class BudgetController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function expenseAsset(Budget $budget, BudgetLimit $budgetLimit = null)
public function expenseAsset(Budget $budget, ?BudgetLimit $budgetLimit)
{
$cache = new CacheProperties;
$cache->addProperty($budget->id);
@@ -207,7 +208,7 @@ class BudgetController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function expenseCategory(Budget $budget, BudgetLimit $budgetLimit = null)
public function expenseCategory(Budget $budget, ?BudgetLimit $budgetLimit)
{
$cache = new CacheProperties;
$cache->addProperty($budget->id);
@@ -254,7 +255,7 @@ class BudgetController extends Controller
*
* @return \Illuminate\Http\JsonResponse
*/
public function expenseExpense(Budget $budget, BudgetLimit $budgetLimit = null)
public function expenseExpense(Budget $budget, ?BudgetLimit $budgetLimit)
{
$cache = new CacheProperties;
$cache->addProperty($budget->id);
@@ -320,12 +321,12 @@ class BudgetController extends Controller
['label' => strval(trans('firefly.overspent')), 'entries' => [], 'type' => 'bar',],
];
/** @var Budget $budget */
foreach ($budgets as $budget) {
// get relevant repetitions:
$limits = $this->repository->getBudgetLimits($budget, $start, $end);
$expenses = $this->getExpensesForBudget($limits, $budget, $start, $end);
foreach ($expenses as $name => $row) {
$chartData[0]['entries'][$name] = $row['spent'];
$chartData[1]['entries'][$name] = $row['left'];
@@ -529,9 +530,7 @@ class BudgetController extends Controller
$rows = $this->spentInPeriodMulti($budget, $limits);
foreach ($rows as $name => $row) {
if (bccomp($row['spent'], '0') !== 0 || bccomp($row['left'], '0') !== 0) {
$return[$name]['spent'] = bcmul($row['spent'], '-1');
$return[$name]['left'] = $row['left'];
$return[$name]['overspent'] = bcmul($row['overspent'], '-1');
$return[$name] = $row;
}
}
unset($rows, $row);
@@ -563,6 +562,7 @@ class BudgetController extends Controller
/** @var BudgetLimit $budgetLimit */
foreach ($limits as $budgetLimit) {
$expenses = $this->repository->spentInPeriod(new Collection([$budget]), new Collection, $budgetLimit->start_date, $budgetLimit->end_date);
$expenses = Steam::positive($expenses);
if ($limits->count() > 1) {
$name = $budget->name . ' ' . trans(
@@ -578,10 +578,14 @@ class BudgetController extends Controller
* left: amount of budget limit min spent, or 0 when < 0.
* spent: spent, or amount of budget limit when > amount
*/
$amount = $budgetLimit->amount;
$left = bccomp(bcadd($amount, $expenses), '0') < 1 ? '0' : bcadd($amount, $expenses);
$spent = bccomp($expenses, $amount) === 1 ? $expenses : bcmul($amount, '-1');
$overspent = bccomp(bcadd($amount, $expenses), '0') < 1 ? bcadd($amount, $expenses) : '0';
$amount = $budgetLimit->amount;
$leftInLimit = bcsub($amount, $expenses);
$hasOverspent = bccomp($leftInLimit, '0') === -1;
$left = $hasOverspent ? '0' : bcsub($amount, $expenses);
$spent = $hasOverspent ? $amount : $expenses;
$overspent = $hasOverspent ? Steam::positive($leftInLimit) : '0';
$return[$name] = [
'left' => $left,
'overspent' => $overspent,

View File

@@ -67,7 +67,7 @@ class CategoryController extends Controller
$start = $repository->firstUseDate($category);
if ($start->year == 1900) {
if ($start->year === 1900) {
$start = new Carbon;
}
@@ -277,10 +277,10 @@ class CategoryController extends Controller
*/
public function specificPeriod(CategoryRepositoryInterface $repository, Category $category, Carbon $date)
{
$range = Preferences::get('viewRange', '1M')->data;
$start = Navigation::startOfPeriod($date, $range);
$end = Navigation::endOfPeriod($date, $range);
$data = $this->makePeriodChart($repository, $category, $start, $end);
$range = Preferences::get('viewRange', '1M')->data;
$start = Navigation::startOfPeriod($date, $range);
$end = Navigation::endOfPeriod($date, $range);
$data = $this->makePeriodChart($repository, $category, $start, $end);
return Response::json($data);
}
@@ -336,9 +336,9 @@ class CategoryController extends Controller
$sum = bcadd($spent, $earned);
$label = trim(Navigation::periodShow($start, '1D'));
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'),12);
$chartData[1]['entries'][$label] = round($earned,12);
$chartData[2]['entries'][$label] = round($sum,12);
$chartData[0]['entries'][$label] = round(bcmul($spent, '-1'), 12);
$chartData[1]['entries'][$label] = round($earned, 12);
$chartData[2]['entries'][$label] = round($sum, 12);
$start->addDay();

View File

@@ -16,7 +16,6 @@ namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
use FireflyIII\Generator\Report\Category\MonthReportGenerator;
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\NegativeAmountFilter;
@@ -248,7 +247,7 @@ class CategoryReportController extends Controller
// remove all empty entries to prevent cluttering:
$newSet = [];
foreach ($chartData as $key => $entry) {
if (!array_sum($entry['entries']) == 0) {
if (!array_sum($entry['entries']) === 0) {
$newSet[$key] = $chartData[$key];
}
}

View File

@@ -67,11 +67,10 @@ class ReportController extends Controller
if ($cache->has()) {
return Response::json($cache->get()); // @codeCoverageIgnore
}
$ids = $accounts->pluck('id')->toArray();
$current = clone $start;
$chartData = [];
while ($current < $end) {
$balances = Steam::balancesById($ids, $current);
$balances = Steam::balancesByAccounts($accounts, $current);
$sum = $this->arraySum($balances);
$label = $current->formatLocalized(strval(trans('config.month_and_day')));
$chartData[$label] = $sum;
@@ -104,7 +103,7 @@ class ReportController extends Controller
$cache->addProperty($accounts);
$cache->addProperty($end);
if ($cache->has()) {
//return Response::json($cache->get()); // @codeCoverageIgnore
return Response::json($cache->get()); // @codeCoverageIgnore
}
Log::debug('Going to do operations for accounts ', $accounts->pluck('id')->toArray());
$format = Navigation::preferredCarbonLocalizedFormat($start, $end);
@@ -250,7 +249,7 @@ class ReportController extends Controller
$cache->addProperty($accounts);
$cache->addProperty($end);
if ($cache->has()) {
// return $cache->get(); // @codeCoverageIgnore
return $cache->get(); // @codeCoverageIgnore
}
$currentStart = clone $start;

View File

@@ -231,7 +231,7 @@ class TagReportController extends Controller
// remove all empty entries to prevent cluttering:
$newSet = [];
foreach ($chartData as $key => $entry) {
if (!array_sum($entry['entries']) == 0) {
if (!array_sum($entry['entries']) === 0) {
$newSet[$key] = $chartData[$key];
}
}
@@ -364,4 +364,4 @@ class TagReportController extends Controller
return $grouped;
}
}
}

View File

@@ -18,10 +18,13 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Support\Facades\Preferences;
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Log;
use Route;
use Session;
use URL;
use View;
@@ -47,22 +50,50 @@ class Controller extends BaseController
*/
public function __construct()
{
// for transaction lists:
View::share('hideBudgets', false);
View::share('hideCategories', false);
View::share('hideBills', false);
View::share('hideTags', false);
// is site a demo site?
$isDemoSite = FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
View::share('IS_DEMO_SITE', $isDemoSite);
View::share('DEMO_USERNAME', env('DEMO_USERNAME', ''));
View::share('DEMO_PASSWORD', env('DEMO_PASSWORD', ''));
// translations:
$this->middleware(
function ($request, $next) {
// translations for specific strings:
$this->monthFormat = (string)trans('config.month');
$this->monthAndDayFormat = (string)trans('config.month_and_day');
$this->dateTimeFormat = (string)trans('config.date_time');
// get shown-intro-preference:
if (auth()->check()) {
// some routes have a "what" parameter, which indicates a special page:
$specificPage = is_null(Route::current()->parameter('what')) ? '' : '_' . Route::current()->parameter('what');
$page = str_replace('.', '_', Route::currentRouteName());
// indicator if user has seen the help for this page ( + special page):
$key = 'shown_demo_' . $page . $specificPage;
// is there an intro for this route?
$intro = config('intro.' . $page);
$specialIntro = config('intro.' . $page . $specificPage);
$shownDemo = true;
// either must be array and either must be > 0
if ((is_array($intro) || is_array($specialIntro)) && (count($intro) > 0 || count($specialIntro) > 0)) {
$shownDemo = Preferences::get($key, false)->data;
Log::debug(sprintf('Check if user has already seen intro with key "%s". Result is %d', $key, $shownDemo));
}
View::share('shownDemo', $shownDemo);
View::share('current_route_name', $page);
View::share('original_route_name', Route::currentRouteName());
}
return $next($request);
}
);

View File

@@ -25,62 +25,95 @@ use Response;
*/
class HelpController extends Controller
{
/** @var HelpInterface */
private $help;
/**
* HelpController constructor.
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
$this->help = app(HelpInterface::class);
return $next($request);
}
);
}
/**
* @param HelpInterface $help
* @param $route
*
* @return \Illuminate\Http\JsonResponse
*/
public function show(HelpInterface $help, string $route)
public function show(string $route)
{
$language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data;
$content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
$html = $this->getHelpText($route, $language);
if (!$help->hasRoute($route)) {
return Response::json(['html' => $html]);
}
/**
* @param string $route
* @param string $language
*
* @return string
*/
private function getHelpText(string $route, string $language): string
{
// get language and default variables.
$content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
// if no such route, log error and return default text.
if (!$this->help->hasRoute($route)) {
Log::error('No such route: ' . $route);
return Response::json($content);
return $content;
}
if ($help->inCache($route, $language)) {
$content = $help->getFromCache($route, $language);
// help content may be cached:
if ($this->help->inCache($route, $language)) {
$content = $this->help->getFromCache($route, $language);
Log::debug(sprintf('Help text %s was in cache.', $language));
return Response::json($content);
return $content;
}
$content = $help->getFromGithub($route, $language);
$notYourLanguage = '<p><em>' . strval(trans('firefly.help_may_not_be_your_language')) . '</em></p>';
// get help content from Github:
$content = $this->help->getFromGithub($route, $language);
// get backup language content (try English):
// content will have 0 length when Github failed. Try en_US when it does:
if (strlen($content) === 0) {
$language = 'en_US';
if ($help->inCache($route, $language)) {
// also check cache first:
if ($this->help->inCache($route, $language)) {
Log::debug(sprintf('Help text %s was in cache.', $language));
$content = $notYourLanguage . $help->getFromCache($route, $language);
}
if (!$help->inCache($route, $language)) {
$content = trim($notYourLanguage . $help->getFromGithub($route, $language));
$content = $this->help->getFromCache($route, $language);
return $content;
}
$content = $this->help->getFromGithub($route, $language);
}
if ($content === $notYourLanguage) {
$content = '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
// help still empty?
if (strlen($content) !== 0) {
$this->help->putInCache($route, $language, $content);
return $content;
}
$help->putInCache($route, $language, $content);
return Response::json($content);
return '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>';
}

View File

@@ -21,9 +21,11 @@ use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Routing\Route;
use Illuminate\Support\Collection;
use Log;
use Preferences;
use Route as RouteFacade;
use Session;
use View;
@@ -107,7 +109,7 @@ class HomeController extends Controller
$types = config('firefly.accountTypesByIdentifier.asset');
$count = $repository->count($types);
if ($count == 0) {
if ($count === 0) {
return redirect(route('new-user.index'));
}
@@ -120,7 +122,6 @@ class HomeController extends Controller
$start = session('start', Carbon::now()->startOfMonth());
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$showTour = Preferences::get('tour', true)->data;
$accounts = $repository->getAccountsById($frontPage->data);
$showDepositsFrontpage = Preferences::get('showDepositsFrontpage', false)->data;
@@ -137,10 +138,34 @@ class HomeController extends Controller
}
return view(
'index', compact('count', 'showTour', 'title', 'subTitle', 'mainTitleIcon', 'transactions', 'showDepositsFrontpage', 'billCount')
'index', compact('count', 'subTitle', 'transactions', 'showDepositsFrontpage', 'billCount')
);
}
public function routes()
{
$set = RouteFacade::getRoutes();
$ignore = ['chart.', 'javascript.', 'json.', 'report-data.', 'popup.', 'debugbar.'];
/** @var Route $route */
foreach ($set as $route) {
$name = $route->getName();
if (!is_null($name) && in_array('GET', $route->methods()) && strlen($name) > 0) {
$found = false;
foreach ($ignore as $string) {
if (strpos($name, $string) !== false) {
$found = true;
}
}
if (!$found) {
echo 'touch ' . $route->getName() . '.md;';
}
}
}
return '&nbsp;';
}
/**
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/

View File

@@ -0,0 +1,49 @@
<?php
/**
* BankController.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Import;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Support\Import\Prerequisites\PrerequisitesInterface;
class BankController extends Controller
{
public function postPrerequisites()
{
}
/**
* @param string $bank
*/
public function prerequisites(string $bank)
{
$class = config(sprintf('firefly.import_pre.%s', $bank));
/** @var PrerequisitesInterface $object */
$object = app($class);
$object->setUser(auth()->user());
if ($object->hasPrerequisites()) {
$view = $object->getView();
$parameters = $object->getViewParameters();
return view($view, $parameters);
}
if (!$object->hasPrerequisites()) {
echo 'redirect to import form.';
}
}
}

View File

@@ -0,0 +1,306 @@
<?php
/**
* FileController.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Import;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\ImportUploadRequest;
use FireflyIII\Import\Configurator\ConfiguratorInterface;
use FireflyIII\Import\Routine\ImportRoutine;
use FireflyIII\Models\ImportJob;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Http\Response as LaravelResponse;
use Log;
use Response;
use Session;
use View;
/**
* Class FileController.
*
* @package FireflyIII\Http\Controllers\Import
*/
class FileController extends Controller
{
/** @var ImportJobRepositoryInterface */
public $repository;
/**
*
*/
public function __construct()
{
parent::__construct();
$this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-archive');
View::share('title', trans('firefly.import_index_title'));
$this->repository = app(ImportJobRepositoryInterface::class);
return $next($request);
}
);
}
/**
* This is step 3. This repeats until the job is configured.
*
* @param ImportJob $job
*
* @return View
* @throws FireflyException
*/
public function configure(ImportJob $job)
{
// create configuration class:
$configurator = $this->makeConfigurator($job);
// is the job already configured?
if ($configurator->isJobConfigured()) {
$this->repository->updateStatus($job, 'configured');
return redirect(route('import.file.status', [$job->key]));
}
$view = $configurator->getNextView();
$data = $configurator->getNextData();
$subTitle = trans('firefly.import_config_bread_crumb');
$subTitleIcon = 'fa-wrench';
return view($view, compact('data', 'job', 'subTitle', 'subTitleIcon'));
}
/**
* Generate a JSON file of the job's configuration and send it to the user.
*
* @param ImportJob $job
*
* @return LaravelResponse
*/
public function download(ImportJob $job)
{
Log::debug('Now in download()', ['job' => $job->key]);
$config = $job->configuration;
// This is CSV import specific:
$config['column-roles-complete'] = false;
$config['column-mapping-complete'] = false;
$config['initial-config-complete'] = false;
$config['delimiter'] = $config['delimiter'] === "\t" ? 'tab' : $config['delimiter'];
$result = json_encode($config, JSON_PRETTY_PRINT);
$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));
/** @var LaravelResponse $response */
$response = response($result, 200);
$response->header('Content-disposition', 'attachment; filename=' . $name)
->header('Content-Type', 'application/json')
->header('Content-Description', 'File Transfer')
->header('Connection', 'Keep-Alive')
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
->header('Content-Length', strlen($result));
return $response;
}
/**
* This is step 1. Upload a file.
*
* @return View
*/
public function index()
{
$subTitle = trans('firefly.import_index_sub_title');
$subTitleIcon = 'fa-home';
$importFileTypes = [];
$defaultImportType = config('firefly.default_import_format');
foreach (array_keys(config('firefly.import_formats')) as $type) {
$importFileTypes[$type] = trans('firefly.import_file_type_' . $type);
}
return view('import.file.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
}
/**
* This is step 2. It creates an Import Job. Stores the import.
*
* @param ImportUploadRequest $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function initialize(ImportUploadRequest $request)
{
Log::debug('Now in initialize()');
// create import job:
$type = $request->get('import_file_type');
$job = $this->repository->create($type);
Log::debug('Created new job', ['key' => $job->key, 'id' => $job->id]);
// process file:
$this->repository->processFile($job, $request->files->get('import_file'));
// process config, if present:
if ($request->files->has('configuration_file')) {
$this->repository->processConfiguration($job, $request->files->get('configuration_file'));
}
$this->repository->updateStatus($job, 'initialized');
return redirect(route('import.file.configure', [$job->key]));
}
/**
*
* Show status of import job in JSON.
*
* @param ImportJob $job
*
* @return \Illuminate\Http\JsonResponse
*/
public function json(ImportJob $job)
{
$result = [
'started' => false,
'finished' => false,
'running' => false,
'errors' => array_values($job->extended_status['errors']),
'percentage' => 0,
'show_percentage' => false,
'steps' => $job->extended_status['steps'],
'done' => $job->extended_status['done'],
'statusText' => trans('firefly.import_status_job_' . $job->status),
'status' => $job->status,
'finishedText' => '',
];
if ($job->extended_status['steps'] !== 0) {
$result['percentage'] = round(($job->extended_status['done'] / $job->extended_status['steps']) * 100, 0);
$result['show_percentage'] = true;
}
if ($job->status === 'finished') {
$tagId = $job->extended_status['tag'];
/** @var TagRepositoryInterface $repository */
$repository = app(TagRepositoryInterface::class);
$tag = $repository->find($tagId);
$result['finished'] = true;
$result['finishedText'] = trans('firefly.import_status_finished_job', ['link' => route('tags.show', [$tag->id, 'all']), 'tag' => $tag->tag]);
}
if ($job->status === 'running') {
$result['started'] = true;
$result['running'] = true;
}
return Response::json($result);
}
/**
* Step 4. Save the configuration.
*
* @param Request $request
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function postConfigure(Request $request, ImportJob $job)
{
Log::debug('Now in postConfigure()', ['job' => $job->key]);
$configurator = $this->makeConfigurator($job);
// is the job already configured?
if ($configurator->isJobConfigured()) {
return redirect(route('import.file.status', [$job->key]));
}
$data = $request->all();
$configurator->configureJob($data);
// get possible warning from configurator:
$warning = $configurator->getWarningMessage();
if (strlen($warning) > 0) {
Session::flash('warning', $warning);
}
// return to configure
return redirect(route('import.file.configure', [$job->key]));
}
/**
* @param ImportJob $job
*
* @return \Illuminate\Http\JsonResponse
* @throws FireflyException
*/
public function start(ImportJob $job)
{
/** @var ImportRoutine $routine */
$routine = app(ImportRoutine::class);
$routine->setJob($job);
$result = $routine->run();
if ($result) {
return Response::json(['run' => 'ok']);
}
throw new FireflyException('Job did not complete succesfully.');
}
/**
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function status(ImportJob $job)
{
$statuses = ['configured', 'running', 'finished'];
if (!in_array($job->status, $statuses)) {
return redirect(route('import.file.configure', [$job->key]));
}
$subTitle = trans('firefly.import_status_sub_title');
$subTitleIcon = 'fa-star';
return view('import.file.status', compact('job', 'subTitle', 'subTitleIcon'));
}
/**
* @param ImportJob $job
*
* @return ConfiguratorInterface
* @throws FireflyException
*/
private function makeConfigurator(ImportJob $job): ConfiguratorInterface
{
$type = $job->file_type;
$key = sprintf('firefly.import_configurators.%s', $type);
$className = config($key);
if (is_null($className)) {
throw new FireflyException('Cannot find configurator class for this job.'); // @codeCoverageIgnore
}
/** @var ConfiguratorInterface $configurator */
$configurator = app($className);
$configurator->setJob($job);
return $configurator;
}
}

View File

@@ -12,32 +12,19 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Crypt;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Requests\ImportUploadRequest;
use FireflyIII\Import\ImportProcedureInterface;
use FireflyIII\Import\Setup\SetupInterface;
use FireflyIII\Models\ImportJob;
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use Illuminate\Http\Request;
use Illuminate\Http\Response as LaravelResponse;
use Log;
use Response;
use Session;
use SplFileObject;
use Storage;
use Symfony\Component\HttpFoundation\File\UploadedFile;
use View;
/**
* Class ImportController
* Class ImportController.
*
* @package FireflyIII\Http\Controllers
*/
class ImportController extends Controller
{
/** @var ImportJobRepositoryInterface */
public $repository;
/**
*
*/
@@ -48,121 +35,23 @@ class ImportController extends Controller
$this->middleware(
function ($request, $next) {
View::share('mainTitleIcon', 'fa-archive');
View::share('title', trans('firefly.import_data_full'));
View::share('title', trans('firefly.import_index_title'));
$this->repository = app(ImportJobRepositoryInterface::class);
return $next($request);
}
);
}
/**
* This is the last step before the import starts.
*
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function complete(ImportJob $job)
{
Log::debug('Now in complete()', ['job' => $job->key]);
if (!$this->jobInCorrectStep($job, 'complete')) {
return $this->redirectToCorrectStep($job);
}
$subTitle = trans('firefly.import_complete');
$subTitleIcon = 'fa-star';
return view('import.complete', compact('job', 'subTitle', 'subTitleIcon'));
}
/**
* This is step 3.
* This is the first step in configuring the job. It can only be executed
* when the job is set to "import_status_never_started".
*
* @param ImportJob $job
*
* @return View
* @throws FireflyException
*/
public function configure(ImportJob $job)
{
Log::debug('Now at start of configure()');
if (!$this->jobInCorrectStep($job, 'configure')) {
return $this->redirectToCorrectStep($job);
}
// actual code
$importer = $this->makeImporter($job);
$importer->configure();
$data = $importer->getConfigurationData();
$subTitle = trans('firefly.configure_import');
$subTitleIcon = 'fa-wrench';
return view('import.' . $job->file_type . '.configure', compact('data', 'job', 'subTitle', 'subTitleIcon'));
}
/**
* Generate a JSON file of the job's config and send it to the user.
*
* @param ImportJob $job
*
* @return mixed
*/
public function download(ImportJob $job)
{
Log::debug('Now in download()', ['job' => $job->key]);
$config = $job->configuration;
$config['column-roles-complete'] = false;
$config['column-mapping-complete'] = false;
$config['delimiter'] = $config['delimiter'] === "\t" ? 'tab' : $config['delimiter'];
$result = json_encode($config, JSON_PRETTY_PRINT);
$name = sprintf('"%s"', addcslashes('import-configuration-' . date('Y-m-d') . '.json', '"\\'));
/** @var LaravelResponse $response */
$response = response($result, 200);
$response->header('Content-disposition', 'attachment; filename=' . $name)
->header('Content-Type', 'application/json')
->header('Content-Description', 'File Transfer')
->header('Connection', 'Keep-Alive')
->header('Expires', '0')
->header('Cache-Control', 'must-revalidate, post-check=0, pre-check=0')
->header('Pragma', 'public')
->header('Content-Length', strlen($result));
return $response;
}
/**
* @param ImportJob $job
*
* @return View
*/
public function finished(ImportJob $job)
{
if (!$this->jobInCorrectStep($job, 'finished')) {
return $this->redirectToCorrectStep($job);
}
// if there is a tag (there might not be), we can link to it:
$tagId = $job->extended_status['importTag'] ?? 0;
$subTitle = trans('firefly.import_finished');
$subTitleIcon = 'fa-star';
return view('import.finished', compact('job', 'subTitle', 'subTitleIcon', 'tagId'));
}
/**
* This is step 1. Upload a file.
* General import index
*
* @return View
*/
public function index()
{
Log::debug('Now at index');
$subTitle = trans('firefly.import_data_index');
$subTitle = trans('firefly.import_index_sub_title');
$subTitleIcon = 'fa-home';
$importFileTypes = [];
$defaultImportType = config('firefly.default_import_format');
@@ -174,331 +63,4 @@ class ImportController extends Controller
return view('import.index', compact('subTitle', 'subTitleIcon', 'importFileTypes', 'defaultImportType'));
}
/**
* @param ImportJob $job
*
* @return \Illuminate\Http\JsonResponse
*/
public function json(ImportJob $job)
{
$result = [
'showPercentage' => false,
'started' => false,
'finished' => false,
'running' => false,
'errors' => $job->extended_status['errors'],
'percentage' => 0,
'steps' => $job->extended_status['total_steps'],
'stepsDone' => $job->extended_status['steps_done'],
'statusText' => trans('firefly.import_status_' . $job->status),
'finishedText' => '',
];
$percentage = 0;
if ($job->extended_status['total_steps'] !== 0) {
$percentage = round(($job->extended_status['steps_done'] / $job->extended_status['total_steps']) * 100, 0);
}
if ($job->status === 'import_complete') {
$tagId = $job->extended_status['importTag'];
/** @var TagRepositoryInterface $repository */
$repository = app(TagRepositoryInterface::class);
$tag = $repository->find($tagId);
$result['finished'] = true;
$result['finishedText'] = trans('firefly.import_finished_link', ['link' => route('tags.show', [$tag->id]), 'tag' => $tag->tag]);
}
if ($job->status === 'import_running') {
$result['started'] = true;
$result['running'] = true;
$result['showPercentage'] = true;
$result['percentage'] = $percentage;
}
return Response::json($result);
}
/**
* Step 4. Save the configuration.
*
* @param Request $request
* @param ImportJobRepositoryInterface $repository
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function postConfigure(Request $request, ImportJobRepositoryInterface $repository, ImportJob $job)
{
Log::debug('Now in postConfigure()', ['job' => $job->key]);
if (!$this->jobInCorrectStep($job, 'process')) {
return $this->redirectToCorrectStep($job);
}
Log::debug('Continue postConfigure()', ['job' => $job->key]);
// actual code
$importer = $this->makeImporter($job);
$data = $request->all();
$files = $request->files;
$importer->saveImportConfiguration($data, $files);
// update job:
$repository->updateStatus($job, 'import_configuration_saved');
// return redirect to settings.
// this could loop until the user is done.
return redirect(route('import.settings', [$job->key]));
}
/**
* This step 6. Depending on the importer, this will process the
* settings given and store them.
*
* @param Request $request
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws FireflyException
*/
public function postSettings(Request $request, ImportJob $job)
{
Log::debug('Now in postSettings()', ['job' => $job->key]);
if (!$this->jobInCorrectStep($job, 'store-settings')) {
return $this->redirectToCorrectStep($job);
}
$importer = $this->makeImporter($job);
$importer->storeSettings($request);
// return redirect to settings (for more settings perhaps)
return redirect(route('import.settings', [$job->key]));
}
/**
* Step 5. Depending on the importer, this will show the user settings to
* fill in.
*
* @param ImportJobRepositoryInterface $repository
* @param ImportJob $job
*
* @return View
*/
public function settings(ImportJobRepositoryInterface $repository, ImportJob $job)
{
Log::debug('Now in settings()', ['job' => $job->key]);
if (!$this->jobInCorrectStep($job, 'settings')) {
return $this->redirectToCorrectStep($job);
}
Log::debug('Continue in settings()');
$importer = $this->makeImporter($job);
$subTitle = trans('firefly.settings_for_import');
$subTitleIcon = 'fa-wrench';
// now show settings screen to user.
if ($importer->requireUserSettings()) {
Log::debug('Job requires user config.');
$data = $importer->getDataForSettings();
$view = $importer->getViewForSettings();
return view($view, compact('data', 'job', 'subTitle', 'subTitleIcon'));
}
Log::debug('Job does NOT require user config.');
$repository->updateStatus($job, 'settings_complete');
// if no more settings, save job and continue to process thing.
return redirect(route('import.complete', [$job->key]));
// ask the importer for the requested action.
// for example pick columns or map data.
// depends of course on the data in the job.
}
/**
* @param ImportProcedureInterface $importProcedure
* @param ImportJob $job
*/
public function start(ImportProcedureInterface $importProcedure, ImportJob $job)
{
set_time_limit(0);
if ($job->status == 'settings_complete') {
$importProcedure->runImport($job);
}
}
/**
* This is the last step before the import starts.
*
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function status(ImportJob $job)
{ //
Log::debug('Now in status()', ['job' => $job->key]);
if (!$this->jobInCorrectStep($job, 'status')) {
return $this->redirectToCorrectStep($job);
}
$subTitle = trans('firefly.import_status');
$subTitleIcon = 'fa-star';
return view('import.status', compact('job', 'subTitle', 'subTitleIcon'));
}
/**
* This is step 2. It creates an Import Job. Stores the import.
*
* @param ImportUploadRequest $request
* @param ImportJobRepositoryInterface $repository
* @param UserRepositoryInterface $userRepository
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function upload(ImportUploadRequest $request, ImportJobRepositoryInterface $repository, UserRepositoryInterface $userRepository)
{
Log::debug('Now in upload()');
// create import job:
$type = $request->get('import_file_type');
$job = $repository->create($type);
Log::debug('Created new job', ['key' => $job->key, 'id' => $job->id]);
/** @var UploadedFile $upload */
$upload = $request->files->get('import_file');
$newName = $job->key . '.upload';
$uploaded = new SplFileObject($upload->getRealPath());
$content = $uploaded->fread($uploaded->getSize());
$contentEncrypted = Crypt::encrypt($content);
$disk = Storage::disk('upload');
// user is demo user, replace upload with prepared file.
if ($userRepository->hasRole(auth()->user(), 'demo')) {
$stubsDisk = Storage::disk('stubs');
$content = $stubsDisk->get('demo-import.csv');
$contentEncrypted = Crypt::encrypt($content);
$disk->put($newName, $contentEncrypted);
Log::debug('Replaced upload with demo file.');
// also set up prepared configuration.
$configuration = json_decode($stubsDisk->get('demo-configuration.json'), true);
$repository->setConfiguration($job, $configuration);
Log::debug('Set configuration for demo user', $configuration);
// also flash info
Session::flash('info', trans('demo.import-configure-security'));
}
if (!$userRepository->hasRole(auth()->user(), 'demo')) {
// user is not demo, process original upload:
$disk->put($newName, $contentEncrypted);
Log::debug('Uploaded file', ['name' => $upload->getClientOriginalName(), 'size' => $upload->getSize(), 'mime' => $upload->getClientMimeType()]);
}
// store configuration file's content into the job's configuration thing. Otherwise, leave it empty.
// demo user's configuration upload is ignored completely.
if ($request->files->has('configuration_file') && !auth()->user()->hasRole('demo')) {
/** @var UploadedFile $configFile */
$configFile = $request->files->get('configuration_file');
Log::debug(
'Uploaded configuration file',
['name' => $configFile->getClientOriginalName(), 'size' => $configFile->getSize(), 'mime' => $configFile->getClientMimeType()]
);
$configFileObject = new SplFileObject($configFile->getRealPath());
$configRaw = $configFileObject->fread($configFileObject->getSize());
$configuration = json_decode($configRaw, true);
// @codeCoverageIgnoreStart
if (!is_null($configuration) && is_array($configuration)) {
Log::debug('Found configuration', $configuration);
$repository->setConfiguration($job, $configuration);
}
// @codeCoverageIgnoreEnd
}
return redirect(route('import.configure', [$job->key]));
}
/**
* @param ImportJob $job
* @param string $method
*
* @return bool
*/
private function jobInCorrectStep(ImportJob $job, string $method): bool
{
Log::debug('Now in jobInCorrectStep()', ['job' => $job->key, 'method' => $method]);
switch ($method) {
case 'configure':
case 'process':
return $job->status === 'import_status_never_started';
case 'settings':
case 'store-settings':
Log::debug(sprintf('Job %d with key %s has status %s', $job->id, $job->key, $job->status));
return $job->status === 'import_configuration_saved';
case 'finished':
return $job->status === 'import_complete';
case 'complete':
return $job->status === 'settings_complete';
case 'status':
return ($job->status === 'settings_complete') || ($job->status === 'import_running');
}
return false; // @codeCoverageIgnore
}
/**
* @param ImportJob $job
*
* @return SetupInterface
* @throws FireflyException
*/
private function makeImporter(ImportJob $job): SetupInterface
{
// create proper importer (depends on job)
$type = strtolower($job->file_type);
// validate type:
$validTypes = array_keys(config('firefly.import_formats'));
if (in_array($type, $validTypes)) {
/** @var SetupInterface $importer */
$importer = app('FireflyIII\Import\Setup\\' . ucfirst($type) . 'Setup');
$importer->setJob($job);
return $importer;
}
throw new FireflyException(sprintf('"%s" is not a valid file type', $type)); // @codeCoverageIgnore
}
/**
* @param ImportJob $job
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @throws FireflyException
*/
private function redirectToCorrectStep(ImportJob $job)
{
Log::debug('Now in redirectToCorrectStep()', ['job' => $job->key]);
switch ($job->status) {
case 'import_status_never_started':
Log::debug('Will redirect to configure()');
return redirect(route('import.configure', [$job->key]));
case 'import_configuration_saved':
Log::debug('Will redirect to settings()');
return redirect(route('import.settings', [$job->key]));
case 'settings_complete':
Log::debug('Will redirect to complete()');
return redirect(route('import.complete', [$job->key]));
case 'import_complete':
Log::debug('Will redirect to finished()');
return redirect(route('import.finished', [$job->key]));
}
throw new FireflyException('Cannot redirect for job state ' . $job->status); // @codeCoverageIgnore
}
}

View File

@@ -12,6 +12,7 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Amount;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
@@ -19,9 +20,9 @@ use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Illuminate\Http\Request;
use Log;
use Navigation;
use Preferences;
use Session;
/**
* Class JavascriptController
@@ -34,7 +35,7 @@ class JavascriptController extends Controller
* @param AccountRepositoryInterface $repository
* @param CurrencyRepositoryInterface $currencyRepository
*
* @return $this
* @return \Illuminate\Http\Response
*/
public function accounts(AccountRepositoryInterface $repository, CurrencyRepositoryInterface $currencyRepository)
{
@@ -63,7 +64,7 @@ class JavascriptController extends Controller
/**
* @param CurrencyRepositoryInterface $repository
*
* @return $this
* @return \Illuminate\Http\Response
*/
public function currencies(CurrencyRepositoryInterface $repository)
{
@@ -71,8 +72,8 @@ class JavascriptController extends Controller
$data = ['currencies' => [],];
/** @var TransactionCurrency $currency */
foreach ($currencies as $currency) {
$currencyId = $currency->id;
$entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$currencyId = $currency->id;
$entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$data['currencies'][$currencyId] = $entry;
}
@@ -88,11 +89,6 @@ class JavascriptController extends Controller
*/
public function variables(Request $request)
{
$picker = $this->getDateRangePicker();
$start = Session::get('start');
$end = Session::get('end');
$linkTitle = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
$firstDate = session('first')->format('Y-m-d');
$localeconv = localeconv();
$accounting = Amount::getJsConfig($localeconv);
$localeconv = localeconv();
@@ -100,15 +96,16 @@ class JavascriptController extends Controller
$localeconv['frac_digits'] = $defaultCurrency->decimal_places;
$pref = Preferences::get('language', config('firefly.default_language', 'en_US'));
$lang = $pref->data;
$data = [
'picker' => $picker,
'linkTitle' => $linkTitle,
'firstDate' => $firstDate,
'currencyCode' => Amount::getCurrencyCode(),
'currencySymbol' => Amount::getCurrencySymbol(),
'accounting' => $accounting,
'localeconv' => $localeconv,
'language' => $lang,
$dateRange = $this->getDateRangeConfig();
$data = [
'currencyCode' => Amount::getCurrencyCode(),
'currencySymbol' => Amount::getCurrencySymbol(),
'accounting' => $accounting,
'localeconv' => $localeconv,
'language' => $lang,
'dateRangeTitle' => $dateRange['title'],
'dateRangeConfig' => $dateRange['configuration'],
];
$request->session()->keep(['two-factor-secret']);
@@ -119,40 +116,73 @@ class JavascriptController extends Controller
/**
* @return array
* @throws FireflyException
*/
private function getDateRangePicker(): array
private function getDateRangeConfig(): array
{
$viewRange = Preferences::get('viewRange', '1M')->data;
$start = Session::get('start');
$end = Session::get('end');
$start = session('start');
$end = session('end');
$first = session('first');
$title = sprintf('%s - %s', $start->formatLocalized($this->monthAndDayFormat), $end->formatLocalized($this->monthAndDayFormat));
$isCustom = session('is_custom_range');
$ranges = [
// first range is the current range:
$title => [$start, $end],
];
Log::debug(sprintf('viewRange is %s', $viewRange));
$prevStart = clone $start;
$prevEnd = clone $start;
$nextStart = clone $end;
$nextEnd = clone $end;
if ($viewRange === 'custom') {
$days = $start->diffInDays($end);
$prevStart->subDays($days);
$nextEnd->addDays($days);
unset($days);
// get the format for the ranges:
$format = $this->getFormatByRange($viewRange);
// when current range is a custom range, add the current period as the next range.
if ($isCustom) {
Log::debug('Custom is true.');
$index = $start->formatLocalized($format);
$customPeriodStart = Navigation::startOfPeriod($start, $viewRange);
$customPeriodEnd = Navigation::endOfPeriod($customPeriodStart, $viewRange);
$ranges[$index] = [$customPeriodStart, $customPeriodEnd];
}
// then add previous range and next range
$previousDate = Navigation::subtractPeriod($start, $viewRange);
$index = $previousDate->formatLocalized($format);
$previousStart = Navigation::startOfPeriod($previousDate, $viewRange);
$previousEnd = Navigation::endOfPeriod($previousStart, $viewRange);
$ranges[$index] = [$previousStart, $previousEnd];
if ($viewRange !== 'custom') {
$prevStart = Navigation::subtractPeriod($start, $viewRange);// subtract for previous period
$prevEnd = Navigation::endOfPeriod($prevStart, $viewRange);
$nextStart = Navigation::addPeriod($start, $viewRange, 0); // add for previous period
$nextEnd = Navigation::endOfPeriod($nextStart, $viewRange);
}
$nextDate = Navigation::addPeriod($start, $viewRange, 0);
$index = $nextDate->formatLocalized($format);
$nextStart = Navigation::startOfPeriod($nextDate, $viewRange);
$nextEnd = Navigation::endOfPeriod($nextStart, $viewRange);
$ranges[$index] = [$nextStart, $nextEnd];
$ranges = [];
$ranges['current'] = [$start->format('Y-m-d'), $end->format('Y-m-d')];
$ranges['previous'] = [$prevStart->format('Y-m-d'), $prevEnd->format('Y-m-d')];
$ranges['next'] = [$nextStart->format('Y-m-d'), $nextEnd->format('Y-m-d')];
// everything
$index = strval(trans('firefly.everything'));
$ranges[$index] = [$first, new Carbon];
$return = [
'title' => $title,
'configuration' => [
'apply' => strval(trans('firefly.apply')),
'cancel' => strval(trans('firefly.cancel')),
'from' => strval(trans('firefly.from')),
'to' => strval(trans('firefly.to')),
'customRange' => strval(trans('firefly.customRange')),
'start' => $start->format('Y-m-d'),
'end' => $end->format('Y-m-d'),
'ranges' => $ranges,
],
];
return $return;
}
private function getFormatByRange(string $viewRange): string
{
switch ($viewRange) {
default:
throw new FireflyException('The date picker does not yet support "' . $viewRange . '".'); // @codeCoverageIgnore
throw new FireflyException(sprintf('The date picker does not yet support "%s".', $viewRange)); // @codeCoverageIgnore
case '1D':
case 'custom':
$format = (string)trans('config.month_and_day');
@@ -174,18 +204,6 @@ class JavascriptController extends Controller
break;
}
$current = $start->formatLocalized($format);
$next = $nextStart->formatLocalized($format);
$prev = $prevStart->formatLocalized($format);
return [
'start' => $start->format('Y-m-d'),
'end' => $end->format('Y-m-d'),
'current' => $current,
'previous' => $prev,
'next' => $next,
'ranges' => $ranges,
];
return $format;
}
}

View File

@@ -41,7 +41,6 @@ class ExchangeController extends Controller
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
$rate = $repository->getExchangeRate($fromCurrency, $toCurrency, $date);
$amount = null;
if (is_null($rate->id)) {
Log::debug(sprintf('No cached exchange rate in database for %s to %s on %s', $fromCurrency->code, $toCurrency->code, $date->format('Y-m-d')));
$preferred = env('EXCHANGE_RATE_SERVICE', config('firefly.preferred_exchange_service'));
@@ -63,4 +62,4 @@ class ExchangeController extends Controller
return Response::json($return);
}
}
}

View File

@@ -0,0 +1,166 @@
<?php
/**
* IntroController.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Controllers\Json;
use FireflyIII\Support\Facades\Preferences;
use Log;
use Response;
/**
* Class IntroController
*
* @package FireflyIII\Http\Controllers\Json
*/
class IntroController
{
/**
* @param string $route
* @param string $specificPage
*
* @return \Illuminate\Http\JsonResponse
*/
public function getIntroSteps(string $route, string $specificPage = '')
{
$steps = $this->getBasicSteps($route);
$specificSteps = $this->getSpecificSteps($route, $specificPage);
if (count($specificSteps) === 0) {
return Response::json($steps);
}
if ($this->hasOutroStep($route)) {
// save last step:
$lastStep = $steps[count($steps) - 1];
// remove last step:
array_pop($steps);
// merge arrays and add last step again
$steps = array_merge($steps, $specificSteps);
$steps[] = $lastStep;
}
if (!$this->hasOutroStep($route)) {
$steps = array_merge($steps, $specificSteps);
}
return Response::json($steps);
}
/**
* @param string $route
*
* @return bool
*/
public function hasOutroStep(string $route): bool
{
$routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey));
if (!is_array($elements)) {
return false;
}
$keys = array_keys($elements);
return in_array('outro', $keys);
}
/**
* @param string $route
* @param string $specialPage
*
* @return \Illuminate\Http\JsonResponse
*/
public function postEnable(string $route, string $specialPage = '')
{
$route = str_replace('.', '_', $route);
$key = 'shown_demo_' . $route;
if ($specialPage !== '') {
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as NOT done: %s with special "%s" (%s)', $route, $specialPage, $key));
Preferences::set($key, false);
return Response::json(['message' => trans('firefly.intro_boxes_after_refresh')]);
}
/**
* @param string $route
* @param string $specialPage
*
* @return \Illuminate\Http\JsonResponse
*/
public function postFinished(string $route, string $specialPage = '')
{
$key = 'shown_demo_' . $route;
if ($specialPage !== '') {
$key .= '_' . $specialPage;
}
Log::debug(sprintf('Going to mark the following route as done: %s with special "%s" (%s)', $route, $specialPage, $key));
Preferences::set($key, true);
return Response::json(['result' => sprintf('Reported demo watched for route "%s".', $route)]);
}
/**
* @param string $route
*
* @return array
*/
private function getBasicSteps(string $route): array
{
$routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey));
$steps = [];
if (is_array($elements) && count($elements) > 0) {
foreach ($elements as $key => $options) {
$currentStep = $options;
// get the text:
$currentStep['intro'] = trans('intro.' . $route . '_' . $key);
// save in array:
$steps[] = $currentStep;
}
}
return $steps;
}
/**
* @param string $route
* @param string $specificPage
*
* @return array
*/
private function getSpecificSteps(string $route, string $specificPage): array
{
$steps = [];
// user is on page with specific instructions:
if (strlen($specificPage) > 0) {
$routeKey = str_replace('.', '_', $route);
$elements = config(sprintf('intro.%s', $routeKey . '_' . $specificPage));
if (is_array($elements) && count($elements) > 0) {
foreach ($elements as $key => $options) {
$currentStep = $options;
// get the text:
$currentStep['intro'] = trans('intro.' . $route . '_' . $specificPage . '_' . $key);
// save in array:
$steps[] = $currentStep;
}
}
}
return $steps;
}
}

View File

@@ -15,12 +15,10 @@ namespace FireflyIII\Http\Controllers;
use Amount;
use Carbon\Carbon;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
@@ -28,7 +26,6 @@ use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Http\Request;
use Preferences;
use Response;
/**
@@ -116,10 +113,11 @@ class JsonController extends Controller
* Since both this method and the chart use the exact same data, we can suffice
* with calling the one method in the bill repository that will get this amount.
*/
$amount = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
$amount = bcmul($amount, '-1');
$amount = $repository->getBillsPaidInRange($start, $end); // will be a negative amount.
$amount = bcmul($amount, '-1');
$currency = Amount::getDefaultCurrency();
$data = ['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
$data = ['box' => 'bills-paid', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
return Response::json($data);
}
@@ -131,19 +129,19 @@ class JsonController extends Controller
*/
public function boxBillsUnpaid(BillRepositoryInterface $repository)
{
$start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth());
$amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
$data = ['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
$start = session('start', Carbon::now()->startOfMonth());
$end = session('end', Carbon::now()->endOfMonth());
$amount = $repository->getBillsUnpaidInRange($start, $end); // will be a positive amount.
$currency = Amount::getDefaultCurrency();
$data = ['box' => 'bills-unpaid', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
return Response::json($data);
}
/**
* @param AccountTaskerInterface $accountTasker
* @param AccountRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
* @internal param AccountTaskerInterface $accountTasker
* @internal param AccountRepositoryInterface $repository
*
*/
public function boxIn()
@@ -167,18 +165,19 @@ class JsonController extends Controller
->setTypes([TransactionType::DEPOSIT])
->withOpposingAccount();
$amount = strval($collector->getJournals()->sum('transaction_amount'));
$data = ['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
$amount = strval($collector->getJournals()->sum('transaction_amount'));
$currency = Amount::getDefaultCurrency();
$data = ['box' => 'in', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
$cache->store($data);
return Response::json($data);
}
/**
* @param AccountTaskerInterface $accountTasker
* @param AccountRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
* @internal param AccountTaskerInterface $accountTasker
* @internal param AccountRepositoryInterface $repository
*
*/
public function boxOut()
{
@@ -200,9 +199,9 @@ class JsonController extends Controller
$collector->setAllAssetAccounts()->setRange($start, $end)
->setTypes([TransactionType::WITHDRAWAL])
->withOpposingAccount();
$amount = strval($collector->getJournals()->sum('transaction_amount'));
$data = ['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount];
$amount = strval($collector->getJournals()->sum('transaction_amount'));
$currency = Amount::getDefaultCurrency();
$data = ['box' => 'out', 'amount' => Amount::formatAnything($currency, $amount, false), 'amount_raw' => $amount];
$cache->store($data);
return Response::json($data);
@@ -236,16 +235,6 @@ class JsonController extends Controller
return Response::json($return);
}
/**
* @return \Illuminate\Http\JsonResponse
*/
public function endTour()
{
Preferences::set('tour', false);
return Response::json('true');
}
/**
* Returns a JSON list of all beneficiaries.
*
@@ -292,34 +281,6 @@ class JsonController extends Controller
}
/**
*
*/
public function tour()
{
$pref = Preferences::get('tour', true);
if (!$pref) {
throw new FireflyException('Cannot find preference for tour. Exit.'); // @codeCoverageIgnore
}
$headers = ['main-content', 'sidebar-toggle', 'account-menu', 'budget-menu', 'report-menu', 'transaction-menu', 'option-menu', 'main-content-end'];
$steps = [];
foreach ($headers as $header) {
$steps[] = [
'element' => '#' . $header,
'title' => trans('help.' . $header . '-title'),
'content' => trans('help.' . $header . '-text'),
];
}
$steps[0]['orphan'] = true;// orphan and backdrop for first element.
$steps[0]['backdrop'] = true;
$steps[1]['placement'] = 'left';// sidebar position left:
$steps[7]['orphan'] = true; // final in the center again.
$steps[7]['backdrop'] = true;
$template = view('json.tour')->render();
return Response::json(['steps' => $steps, 'template' => $template]);
}
/**
* @param JournalCollectorInterface $collector
* @param string $what
@@ -364,7 +325,7 @@ class JsonController extends Controller
$keys = array_keys(config('firefly.rule-triggers'));
$triggers = [];
foreach ($keys as $key) {
if ($key != 'user_action') {
if ($key !== 'user_action') {
$triggers[$key] = trans('firefly.rule_trigger_' . $key . '_choice');
}
}

View File

@@ -54,7 +54,6 @@ class NewUserController extends Controller
View::share('title', trans('firefly.welcome'));
View::share('mainTitleIcon', 'fa-fire');
$types = config('firefly.accountTypesByIdentifier.asset');
$count = $repository->count($types);
@@ -74,30 +73,13 @@ class NewUserController extends Controller
*/
public function submit(NewUserFormRequest $request, AccountRepositoryInterface $repository)
{
$count = 1;
// create normal asset account:
$this->createAssetAccount($request, $repository);
// create savings account
$savingBalance = strval($request->get('savings_balance')) === '' ? '0' : strval($request->get('savings_balance'));
if (bccomp($savingBalance, '0') !== 0) {
$this->createSavingsAccount($request, $repository);
$count++;
}
$this->createSavingsAccount($request, $repository);
// create credit card.
$limit = strval($request->get('credit_card_limit')) === '' ? '0' : strval($request->get('credit_card_limit'));
if (bccomp($limit, '0') !== 0) {
$this->storeCreditCard($request, $repository);
$count++;
}
$message = strval(trans('firefly.stored_new_accounts_new_user'));
if ($count == 1) {
$message = strval(trans('firefly.stored_new_account_new_user'));
}
Session::flash('success', $message);
Session::flash('success', strval(trans('firefly.stored_new_accounts_new_user')));
Preferences::mark();
return redirect(route('index'));
@@ -152,29 +134,4 @@ class NewUserController extends Controller
return true;
}
/**
* @param NewUserFormRequest $request
* @param AccountRepositoryInterface $repository
*
* @return bool
*/
private function storeCreditCard(NewUserFormRequest $request, AccountRepositoryInterface $repository): bool
{
$creditAccount = [
'name' => 'Credit card',
'iban' => null,
'accountType' => 'asset',
'virtualBalance' => round($request->get('credit_card_limit'), 12),
'active' => true,
'accountRole' => 'ccAsset',
'openingBalance' => null,
'openingBalanceDate' => null,
'openingBalanceCurrency' => intval($request->input('amount_currency_id_credit_card_limit')),
'ccType' => 'monthlyFull',
'ccMonthlyPaymentDate' => Carbon::now()->year . '-01-01',
];
$repository->store($creditAccount);
return true;
}
}

View File

@@ -89,7 +89,7 @@ class PiggyBankController extends Controller
/** @var Carbon $date */
$date = session('end', Carbon::now()->endOfMonth());
$leftOnAccount = $piggyBank->leftOnAccount($date);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount?? '0';
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount ?? '0';
$leftToSave = bcsub($piggyBank->targetamount, $savedSoFar);
$maxAmount = min($leftOnAccount, $leftToSave);
@@ -276,18 +276,29 @@ class PiggyBankController extends Controller
*/
public function postAdd(Request $request, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$amount = $request->get('amount');
$amount = $request->get('amount');
$currency = Amount::getDefaultCurrency();
if ($repository->canAddAmount($piggyBank, $amount)) {
$repository->addAmount($piggyBank, $amount);
Session::flash('success', strval(trans('firefly.added_amount_to_piggy', ['amount' => Amount::format($amount, false), 'name' => $piggyBank->name])));
Session::flash(
'success', strval(
trans(
'firefly.added_amount_to_piggy',
['amount' => Amount::formatAnything($currency, $amount, false), 'name' => $piggyBank->name]
)
)
);
Preferences::mark();
return redirect(route('piggy-banks.index'));
}
Log::error('Cannot add ' . $amount . ' because canAddAmount returned false.');
Session::flash('error', strval(trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)])));
Session::flash(
'error', strval(
trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)])
)
);
return redirect(route('piggy-banks.index'));
}
@@ -301,11 +312,13 @@ class PiggyBankController extends Controller
*/
public function postRemove(Request $request, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$amount = $request->get('amount');
$amount = $request->get('amount');
$currency = Amount::getDefaultCurrency();
if ($repository->canRemoveAmount($piggyBank, $amount)) {
$repository->removeAmount($piggyBank, $amount);
Session::flash(
'success', strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::format($amount, false), 'name' => $piggyBank->name]))
'success',
strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => $piggyBank->name]))
);
Preferences::mark();
@@ -314,7 +327,11 @@ class PiggyBankController extends Controller
$amount = strval(round($request->get('amount'), 12));
Session::flash('error', strval(trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)])));
Session::flash(
'error', strval(
trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::formatAnything($currency, $amount, false), 'name' => e($piggyBank->name)])
)
);
return redirect(route('piggy-banks.index'));
}
@@ -380,7 +397,7 @@ class PiggyBankController extends Controller
// @codeCoverageIgnoreEnd
}
return redirect($this->getPreviousUri('piggy-banks.edit.uri'));
return redirect($this->getPreviousUri('piggy-banks.create.uri'));
}
/**

View File

@@ -120,7 +120,7 @@ class CategoryController extends Controller
foreach ($categories as $category) {
$spent = $repository->spentInPeriod(new Collection([$category]), $accounts, $start, $end);
if (bccomp($spent, '0') !== 0) {
$report[$category->id] = ['name' => $category->name, 'spent' => $spent];
$report[$category->id] = ['name' => $category->name, 'spent' => $spent, 'id' => $category->id];
}
}

View File

@@ -15,10 +15,7 @@ namespace FireflyIII\Http\Controllers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountTaskerInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Support\Collection;

View File

@@ -13,12 +13,18 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use ExpandedForm;
use FireflyIII\Http\Requests\RuleFormRequest;
use FireflyIII\Http\Requests\SelectTransactionsRequest;
use FireflyIII\Http\Requests\TestRuleFormRequest;
use FireflyIII\Jobs\ExecuteRuleOnExistingTransactions;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Rule;
use FireflyIII\Models\RuleAction;
use FireflyIII\Models\RuleGroup;
use FireflyIII\Models\RuleTrigger;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
use FireflyIII\Rules\TransactionMatcher;
@@ -188,6 +194,41 @@ class RuleController extends Controller
return view('rules.rule.edit', compact('rule', 'subTitle', 'primaryTrigger', 'oldTriggers', 'oldActions', 'triggerCount', 'actionCount'));
}
/**
* Execute the given rule on a set of existing transactions
*
* @param SelectTransactionsRequest $request
* @param AccountRepositoryInterface $repository
* @param Rule $rule
*
* @return \Illuminate\Http\RedirectResponse
* @internal param RuleGroup $ruleGroup
*/
public function execute(SelectTransactionsRequest $request, AccountRepositoryInterface $repository, Rule $rule)
{
// Get parameters specified by the user
$accounts = $repository->getAccountsById($request->get('accounts'));
$startDate = new Carbon($request->get('start_date'));
$endDate = new Carbon($request->get('end_date'));
// Create a job to do the work asynchronously
$job = new ExecuteRuleOnExistingTransactions($rule);
// Apply parameters to the job
$job->setUser(auth()->user());
$job->setAccounts($accounts);
$job->setStartDate($startDate);
$job->setEndDate($endDate);
// Dispatch a new job to execute it in a queue
$this->dispatch($job);
// Tell the user that the job is queued
Session::flash('success', strval(trans('firefly.applied_rule_selection', ['title' => $rule->title])));
return redirect()->route('rules.index');
}
/**
* @param RuleGroupRepositoryInterface $repository
*
@@ -238,6 +279,25 @@ class RuleController extends Controller
}
/**
* @param AccountRepositoryInterface $repository
* @param Rule $rule
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function selectTransactions(AccountRepositoryInterface $repository, Rule $rule)
{
// does the user have shared accounts?
$accounts = $repository->getAccountsByType([AccountType::ASSET]);
$accountList = ExpandedForm::makeSelectList($accounts);
$checkedAccounts = array_keys($accountList);
$first = session('first')->format('Y-m-d');
$today = Carbon::create()->format('Y-m-d');
$subTitle = (string)trans('firefly.apply_rule_selection', ['title' => $rule->title]);
return view('rules.rule.select-transactions', compact('checkedAccounts', 'accountList', 'first', 'today', 'rule', 'subTitle'));
}
/**
* @param RuleFormRequest $request
* @param RuleRepositoryInterface $repository
@@ -282,7 +342,7 @@ class RuleController extends Controller
// build trigger array from response
$triggers = $this->getValidTriggerList($request);
if (count($triggers) == 0) {
if (count($triggers) === 0) {
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);
}
@@ -294,19 +354,66 @@ class RuleController extends Controller
$matcher->setLimit($limit);
$matcher->setRange($range);
$matcher->setTriggers($triggers);
$matchingTransactions = $matcher->findMatchingTransactions();
$matchingTransactions = $matcher->findTransactionsByTriggers();
// Warn the user if only a subset of transactions is returned
$warning = '';
if (count($matchingTransactions) == $limit) {
if (count($matchingTransactions) === $limit) {
$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]);
}
if (count($matchingTransactions) == 0) {
if (count($matchingTransactions) === 0) {
$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]);
}
// Return json response
$view = view('list.journals-tiny-tasker', ['transactions' => $matchingTransactions])->render();
$view = view('list.journals-tiny', ['transactions' => $matchingTransactions])->render();
return Response::json(['html' => $view, 'warning' => $warning]);
}
/**
* This method allows the user to test a certain set of rule triggers. The rule triggers are grabbed from
* the rule itself.
*
* This method will parse and validate those rules and create a "TransactionMatcher" which will attempt
* to find transaction journals matching the users input. A maximum range of transactions to try (range) and
* a maximum number of transactions to return (limit) are set as well.
*
*
* @param Rule $rule
*
* @return \Illuminate\Http\JsonResponse
*/
public function testTriggersByRule(Rule $rule)
{
$triggers = $rule->ruleTriggers;
if (count($triggers) === 0) {
return Response::json(['html' => '', 'warning' => trans('firefly.warning_no_valid_triggers')]);
}
$limit = config('firefly.test-triggers.limit');
$range = config('firefly.test-triggers.range');
/** @var TransactionMatcher $matcher */
$matcher = app(TransactionMatcher::class);
$matcher->setLimit($limit);
$matcher->setRange($range);
$matcher->setRule($rule);
$matchingTransactions = $matcher->findTransactionsByRule();
// Warn the user if only a subset of transactions is returned
$warning = '';
if (count($matchingTransactions) === $limit) {
$warning = trans('firefly.warning_transaction_subset', ['max_num_transactions' => $limit]);
}
if (count($matchingTransactions) === 0) {
$warning = trans('firefly.warning_no_matching_transactions', ['num_transactions' => $range]);
}
// Return json response
$view = view('list.journals-tiny', ['transactions' => $matchingTransactions])->render();
return Response::json(['html' => $view, 'warning' => $warning]);
}
@@ -440,7 +547,7 @@ class RuleController extends Controller
/** @var RuleTrigger $entry */
foreach ($rule->ruleTriggers as $entry) {
if ($entry->trigger_type != 'user_action') {
if ($entry->trigger_type !== 'user_action') {
$count = ($index + 1);
$triggers[] = view(
'rules.partials.trigger',

View File

@@ -178,7 +178,7 @@ class RuleGroupController extends Controller
$this->dispatch($job);
// Tell the user that the job is queued
Session::flash('success', strval(trans('firefly.executed_group_on_existing_transactions', ['title' => $ruleGroup->title])));
Session::flash('success', strval(trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title])));
return redirect()->route('rules.index');
}
@@ -197,7 +197,7 @@ class RuleGroupController extends Controller
$checkedAccounts = array_keys($accountList);
$first = session('first')->format('Y-m-d');
$today = Carbon::create()->format('Y-m-d');
$subTitle = (string)trans('firefly.execute_on_existing_transactions');
$subTitle = (string)trans('firefly.apply_rule_group_selection', ['title' => $ruleGroup->title]);
return view('rules.rule-group.select-transactions', compact('checkedAccounts', 'accountList', 'first', 'today', 'ruleGroup', 'subTitle'));
}
@@ -246,14 +246,14 @@ class RuleGroupController extends Controller
* @param RuleGroupRepositoryInterface $repository
* @param RuleGroup $ruleGroup
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
*/
public function update(RuleGroupFormRequest $request, RuleGroupRepositoryInterface $repository, RuleGroup $ruleGroup)
{
$data = [
'title' => $request->input('title'),
'description' => $request->input('description'),
'active' => intval($request->input('active')) == 1,
'active' => intval($request->input('active')) === 1,
];
$repository->update($ruleGroup, $data);

View File

@@ -15,7 +15,7 @@ namespace FireflyIII\Http\Controllers;
use FireflyIII\Support\Search\SearchInterface;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Response;
use View;
/**
@@ -51,47 +51,29 @@ class SearchController extends Controller
*/
public function index(Request $request, SearchInterface $searcher)
{
// yes, hard coded values:
$minSearchLen = 1;
$limit = 20;
$fullQuery = $request->get('q');
// ui stuff:
$subTitle = '';
// parse search terms:
$searcher->parseQuery($fullQuery);
$query = $searcher->getWordsAsString();
$subTitle = trans('breadcrumbs.search_result', ['query' => $query]);
// query stuff
$query = null;
$result = [];
$rawQuery = $request->get('q');
$hasModifiers = true;
$modifiers = [];
return view('search.index', compact('query', 'fullQuery', 'subTitle'));
}
if (!is_null($request->get('q')) && strlen($request->get('q')) >= $minSearchLen) {
// parse query, find modifiers:
// set limit for search
$searcher->setLimit($limit);
$searcher->parseQuery($request->get('q'));
public function search(Request $request, SearchInterface $searcher)
{
$fullQuery = $request->get('query');
$transactions = $searcher->searchTransactions();
$accounts = new Collection;
$categories = new Collection;
$tags = new Collection;
$budgets = new Collection;
// parse search terms:
$searcher->parseQuery($fullQuery);
$searcher->setLimit(20);
$transactions = $searcher->searchTransactions();
$html = view('search.search', compact('transactions'))->render();
// no special search thing?
if (!$searcher->hasModifiers()) {
$hasModifiers = false;
$accounts = $searcher->searchAccounts();
$categories = $searcher->searchCategories();
$budgets = $searcher->searchBudgets();
$tags = $searcher->searchTags();
}
$query = $searcher->getWordsAsString();
$subTitle = trans('firefly.search_results_for', ['query' => $query]);
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
return Response::json(['count' => $transactions->count(), 'html' => $html]);
}
return view('search.index', compact('rawQuery', 'hasModifiers', 'modifiers', 'subTitle', 'limit', 'query', 'result'));
}
}

View File

@@ -15,13 +15,13 @@ namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Http\Requests\TagFormRequest;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use FireflyIII\Support\CacheProperties;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Log;
use Navigation;
use Preferences;
use Session;
@@ -78,22 +78,16 @@ class TagController extends Controller
}
/**
* @param Request $request
* Create a new tag.
*
* @return View
*/
public function create(Request $request)
public function create()
{
$subTitle = trans('firefly.new_tag');
$subTitleIcon = 'fa-tag';
$apiKey = env('GOOGLE_MAPS_API_KEY', '');
$preFilled = [
'tagMode' => 'nothing',
];
if (!$request->old('tagMode')) {
Session::flash('preFilled', $preFilled);
}
// put previous url in session if not redirect from store (not "create another").
if (session('tags.create.fromStore') !== true) {
$this->rememberPreviousUri('tags.create.uri');
@@ -106,6 +100,8 @@ class TagController extends Controller
}
/**
* Delete a tag
*
* @param Tag $tag
*
* @return View
@@ -140,38 +136,18 @@ class TagController extends Controller
}
/**
* @param Tag $tag
* Edit a tag
*
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return View
*/
public function edit(Tag $tag, TagRepositoryInterface $repository)
public function edit(Tag $tag)
{
$subTitle = trans('firefly.edit_tag', ['tag' => $tag->tag]);
$subTitleIcon = 'fa-tag';
$apiKey = env('GOOGLE_MAPS_API_KEY', '');
/*
* Default tag options (again)
*/
$tagOptions = $this->tagOptions;
/*
* Can this tag become another type?
*/
$allowAdvance = $repository->tagAllowAdvance($tag);
$allowToBalancingAct = $repository->tagAllowBalancing($tag);
// edit tag options:
if ($allowAdvance === false) {
unset($tagOptions['advancePayment']);
}
if ($allowToBalancingAct === false) {
unset($tagOptions['balancingAct']);
}
// put previous url in session if not redirect from store (not "return_to_edit").
if (session('tags.edit.fromUpdate') !== true) {
$this->rememberPreviousUri('tags.edit.uri');
@@ -180,10 +156,12 @@ class TagController extends Controller
Session::flash('gaEventCategory', 'tags');
Session::flash('gaEventAction', 'edit');
return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions', 'apiKey'));
return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'apiKey'));
}
/**
* View all tags
*
* @param TagRepositoryInterface $repository
*
* @return View
@@ -193,6 +171,8 @@ class TagController extends Controller
$title = 'Tags';
$mainTitleIcon = 'fa-tags';
$types = ['nothing', 'balancingAct', 'advancePayment'];
$hasTypes = 0; // which types of tag the user actually has.
$counts = []; // how many of each type?
$count = $repository->count();
// loop each types and get the tags, group them by year.
@@ -208,10 +188,13 @@ class TagController extends Controller
return strtolower($date . $tag->tag);
}
);
if ($tags->count() > 0) {
$hasTypes++;
}
$counts[$type] = $tags->count();
/** @var Tag $tag */
foreach ($tags as $tag) {
$year = is_null($tag->date) ? trans('firefly.no_year') : $tag->date->year;
$monthFormatted = is_null($tag->date) ? trans('firefly.no_month') : $tag->date->formatLocalized($this->monthFormat);
@@ -219,7 +202,7 @@ class TagController extends Controller
}
}
return view('tags.index', compact('title', 'mainTitleIcon', 'types', 'collection', 'count'));
return view('tags.index', compact('title', 'mainTitleIcon', 'counts', 'hasTypes', 'types', 'collection', 'count'));
}
/**
@@ -235,16 +218,15 @@ class TagController extends Controller
// default values:
$subTitle = $tag->tag;
$subTitleIcon = 'fa-tag';
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$count = 0;
$loop = 0;
$range = Preferences::get('viewRange', '1M')->data;
$start = null;
$end = null;
$periods = new Collection;
$apiKey = env('GOOGLE_MAPS_API_KEY', '');
$sum = '0';
$path = route('tags.show', [$tag->id]);
// prep for "all" view.
@@ -252,7 +234,8 @@ class TagController extends Controller
$subTitle = trans('firefly.all_journals_for_tag', ['tag' => $tag->tag]);
$start = $repository->firstUseDate($tag);
$end = new Carbon;
$sum = $repository->sumOfTag($tag);
$sum = $repository->sumOfTag($tag, null, null);
$path = route('tags.show', [$tag->id, 'all']);
}
// prep for "specific date" view.
@@ -266,6 +249,7 @@ class TagController extends Controller
);
$periods = $this->getPeriodOverview($tag);
$sum = $repository->sumOfTag($tag, $start, $end);
$path = route('tags.show', [$tag->id, $moment]);
}
// prep for current period
@@ -278,32 +262,14 @@ class TagController extends Controller
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at tag loop start.');
while ($count === 0 && $loop < 3) {
$loop++;
Log::info('Count is zero, search for journals.');
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount()
->setTag($tag)->withBudgetInformation()->withCategoryInformation();
$journals = $collector->getPaginatedJournals();
$journals->setPath('tags/show/' . $tag->id);
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfPeriod($start, $range);
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.journals_in_period_for_tag',
['tag' => $tag->tag, 'start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withOpposingAccount()
->setTag($tag)->withBudgetInformation()->withCategoryInformation()->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath($path);
return view('tags.show', compact('apiKey', 'tag', 'periods', 'subTitle', 'subTitleIcon', 'journals', 'sum', 'start', 'end', 'moment'));
}

View File

@@ -174,14 +174,23 @@ class ConvertController extends Controller
switch ($joined) {
default:
throw new FireflyException('Cannot handle ' . $joined); // @codeCoverageIgnore
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: // one
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT:
// one
$destination = $sourceAccount;
break;
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER: // two
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER:
// two
$destination = $accountRepository->find(intval($data['destination_account_asset']));
break;
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: // three
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: // five
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:
// three and five
if ($data['destination_account_expense'] === '') {
// destination is a cash account.
$destination = $accountRepository->getCashAccount();
return $destination;
}
$data = [
'name' => $data['destination_account_expense'],
'accountType' => 'expense',
@@ -191,8 +200,9 @@ class ConvertController extends Controller
];
$destination = $accountRepository->store($data);
break;
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER: // four
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: // six
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER:
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT:
// four and six
$destination = $destinationAccount;
break;
}
@@ -219,8 +229,16 @@ class ConvertController extends Controller
switch ($joined) {
default:
throw new FireflyException('Cannot handle ' . $joined); // @codeCoverageIgnore
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT: // one
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT: // six
case TransactionType::WITHDRAWAL . '-' . TransactionType::DEPOSIT:
case TransactionType::TRANSFER . '-' . TransactionType::DEPOSIT:
if ($data['source_account_revenue'] === '') {
// destination is a cash account.
$destination = $accountRepository->getCashAccount();
return $destination;
}
$data = [
'name' => $data['source_account_revenue'],
'accountType' => 'revenue',
@@ -230,14 +248,14 @@ class ConvertController extends Controller
];
$source = $accountRepository->store($data);
break;
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER: // two
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL: // five
case TransactionType::WITHDRAWAL . '-' . TransactionType::TRANSFER:
case TransactionType::TRANSFER . '-' . TransactionType::WITHDRAWAL:
$source = $sourceAccount;
break;
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL: // three
case TransactionType::DEPOSIT . '-' . TransactionType::WITHDRAWAL:
$source = $destinationAccount;
break;
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER: // four
case TransactionType::DEPOSIT . '-' . TransactionType::TRANSFER:
$source = $accountRepository->find(intval($data['source_account_asset']));
break;
}

View File

@@ -19,6 +19,7 @@ use FireflyIII\Http\Requests\MassDeleteJournalRequest;
use FireflyIII\Http\Requests\MassEditJournalRequest;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
@@ -85,7 +86,7 @@ class MassController extends Controller
foreach ($ids as $journalId) {
/** @var TransactionJournal $journal */
$journal = $repository->find(intval($journalId));
if (!is_null($journal->id) && $journalId == $journal->id) {
if (!is_null($journal->id) && intval($journalId) === $journal->id) {
$set->push($journal);
}
}
@@ -126,17 +127,15 @@ class MassController extends Controller
$budgetRepository = app(BudgetRepositoryInterface::class);
$budgets = $budgetRepository->getBudgets();
// skip transactions that have multiple destinations
// or multiple sources:
// skip transactions that have multiple destinations, multiple sources or are an opening balance.
$filtered = new Collection;
$messages = [];
/**
* @var int $index
* @var TransactionJournal $journal
*/
foreach ($journals as $index => $journal) {
$sources = $journal->sourceAccountList($journal);
$destinations = $journal->destinationAccountList($journal);
foreach ($journals as $journal) {
$sources = $journal->sourceAccountList();
$destinations = $journal->destinationAccountList();
if ($sources->count() > 1) {
$messages[] = trans('firefly.cannot_edit_multiple_source', ['description' => $journal->description, 'id' => $journal->id]);
continue;
@@ -146,6 +145,10 @@ class MassController extends Controller
$messages[] = trans('firefly.cannot_edit_multiple_dest', ['description' => $journal->description, 'id' => $journal->id]);
continue;
}
if ($journal->transactionType->type === TransactionType::OPENING_BALANCE) {
$messages[] = trans('firefly.cannot_edit_opening_balance');
continue;
}
$filtered->push($journal);
}
@@ -158,13 +161,21 @@ class MassController extends Controller
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'mass-edit');
// set some values to be used in the edit routine:
// collect some useful meta data for the mass edit:
$filtered->each(
function (TransactionJournal $journal) {
$journal->amount = $journal->amountPositive();
$sources = $journal->sourceAccountList();
$destinations = $journal->destinationAccountList();
$journal->transaction_count = $journal->transactions()->count();
$transaction = $journal->positiveTransaction();
$currency = $transaction->transactionCurrency;
$journal->amount = floatval($transaction->amount);
$sources = $journal->sourceAccountList();
$destinations = $journal->destinationAccountList();
$journal->transaction_count = $journal->transactions()->count();
$journal->currency_symbol = $currency->symbol;
$journal->transaction_type_type = $journal->transactionType->type;
$journal->foreign_amount = floatval($transaction->foreign_amount);
$journal->foreign_currency = $transaction->foreignCurrency;
if (!is_null($sources->first())) {
$journal->source_account_id = $sources->first()->id;
$journal->source_account_name = $sources->first()->editname;
@@ -201,13 +212,17 @@ class MassController extends Controller
if ($journal) {
// get optional fields:
$what = strtolower($journal->transactionTypeStr());
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0;
$sourceAccountId = $request->get('source_account_id')[$journal->id] ?? 0;
$sourceAccountName = $request->get('source_account_name')[$journal->id] ?? '';
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0;
$destAccountId = $request->get('destination_account_id')[$journal->id] ?? 0;
$destAccountName = $request->get('destination_account_name')[$journal->id] ?? '';
$budgetId = $request->get('budget_id')[$journal->id] ?? 0;
$budgetId = $request->get('budget_id')[$journal->id] ?? 0;
$category = $request->get('category')[$journal->id];
$tags = $journal->tags->pluck('tag')->toArray();
$amount = round($request->get('amount')[$journal->id], 12);
$foreignAmount = isset($request->get('foreign_amount')[$journal->id]) ? round($request->get('foreign_amount')[$journal->id], 12) : null;
$foreignCurrencyId = isset($request->get('foreign_currency_id')[$journal->id]) ?
intval($request->get('foreign_currency_id')[$journal->id]) : null;
// build data array
$data = [
@@ -218,16 +233,19 @@ class MassController extends Controller
'source_account_name' => $sourceAccountName,
'destination_account_id' => intval($destAccountId),
'destination_account_name' => $destAccountName,
'amount' => round($request->get('amount')[$journal->id], 12),
'currency_id' => $journal->transaction_currency_id,
'amount' => $foreignAmount,
'native_amount' => $amount,
'source_amount' => $amount,
'date' => new Carbon($request->get('date')[$journal->id]),
'interest_date' => $journal->interest_date,
'book_date' => $journal->book_date,
'process_date' => $journal->process_date,
'budget_id' => intval($budgetId),
'currency_id' => $foreignCurrencyId,
'foreign_amount' => $foreignAmount,
'destination_amount' => $foreignAmount,
'category' => $category,
'tags' => $tags,
];
// call repository update function.
$repository->update($journal, $data);
@@ -235,6 +253,7 @@ class MassController extends Controller
$count++;
}
}
}
Preferences::mark();
Session::flash('success', trans('firefly.mass_edited_transactions_success', ['amount' => $count]));

View File

@@ -21,6 +21,7 @@ use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Http\Requests\JournalFormRequest;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
@@ -54,6 +55,9 @@ class SingleController extends Controller
/** @var PiggyBankRepositoryInterface */
private $piggyBanks;
/** @var JournalRepositoryInterface */
private $repository;
/**
*
*/
@@ -74,6 +78,7 @@ class SingleController extends Controller
$this->piggyBanks = app(PiggyBankRepositoryInterface::class);
$this->attachments = app(AttachmentHelperInterface::class);
$this->currency = app(CurrencyRepositoryInterface::class);
$this->repository = app(JournalRepositoryInterface::class);
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
@@ -93,27 +98,35 @@ class SingleController extends Controller
$category = $journal->categories()->first();
$categoryName = is_null($category) ? '' : $category->name;
$tags = join(',', $journal->tags()->get()->pluck('tag')->toArray());
/** @var Transaction $transaction */
$transaction = $journal->transactions()->first();
$amount = Steam::positive($transaction->amount);
$foreignAmount = is_null($transaction->foreign_amount) ? null : Steam::positive($transaction->foreign_amount);
$preFilled = [
'description' => $journal->description,
'source_account_id' => $source->id,
'source_account_name' => $source->name,
'destination_account_id' => $destination->id,
'destination_account_name' => $destination->name,
'amount' => $journal->amountPositive(),
'date' => $journal->date->format('Y-m-d'),
'budget_id' => $budgetId,
'category' => $categoryName,
'tags' => $tags,
'interest_date' => $journal->getMeta('interest_date'),
'book_date' => $journal->getMeta('book_date'),
'process_date' => $journal->getMeta('process_date'),
'due_date' => $journal->getMeta('due_date'),
'payment_date' => $journal->getMeta('payment_date'),
'invoice_date' => $journal->getMeta('invoice_date'),
'internal_reference' => $journal->getMeta('internal_reference'),
'notes' => $journal->getMeta('notes'),
'description' => $journal->description,
'source_account_id' => $source->id,
'source_account_name' => $source->name,
'destination_account_id' => $destination->id,
'destination_account_name' => $destination->name,
'amount' => $amount,
'source_amount' => $amount,
'destination_amount' => $foreignAmount,
'foreign_amount' => $foreignAmount,
'native_amount' => $foreignAmount,
'amount_currency_id_amount' => $transaction->foreign_currency_id ?? 0,
'date' => $journal->date->format('Y-m-d'),
'budget_id' => $budgetId,
'category' => $categoryName,
'tags' => $tags,
'interest_date' => $journal->getMeta('interest_date'),
'book_date' => $journal->getMeta('book_date'),
'process_date' => $journal->getMeta('process_date'),
'due_date' => $journal->getMeta('due_date'),
'payment_date' => $journal->getMeta('payment_date'),
'invoice_date' => $journal->getMeta('invoice_date'),
'internal_reference' => $journal->getMeta('internal_reference'),
'notes' => $journal->getMeta('notes'),
];
Session::flash('preFilled', $preFilled);
@@ -161,7 +174,7 @@ class SingleController extends Controller
*
* @param TransactionJournal $journal
*
* @return View
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function delete(TransactionJournal $journal)
{
@@ -186,12 +199,12 @@ class SingleController extends Controller
}
/**
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $transactionJournal
* @param TransactionJournal $transactionJournal
*
* @return \Illuminate\Http\RedirectResponse
* @internal param JournalRepositoryInterface $repository
*/
public function destroy(JournalRepositoryInterface $repository, TransactionJournal $transactionJournal)
public function destroy(TransactionJournal $transactionJournal)
{
// @codeCoverageIgnoreStart
if ($this->isOpeningBalance($transactionJournal)) {
@@ -201,7 +214,7 @@ class SingleController extends Controller
$type = $transactionJournal->transactionTypeStr();
Session::flash('success', strval(trans('firefly.deleted_' . strtolower($type), ['description' => e($transactionJournal->description)])));
$repository->delete($transactionJournal);
$this->repository->delete($transactionJournal);
Preferences::mark();
@@ -220,10 +233,7 @@ class SingleController extends Controller
return $this->redirectToAccount($journal);
}
// @codeCoverageIgnoreEnd
$count = $journal->transactions()->count();
if ($count > 2) {
if ($this->isSplitJournal($journal)) {
return redirect(route('transactions.split.edit', [$journal->id]));
}
@@ -238,6 +248,8 @@ class SingleController extends Controller
$sourceAccounts = $journal->sourceAccountList();
$destinationAccounts = $journal->destinationAccountList();
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$pTransaction = $journal->positiveTransaction();
$foreignCurrency = !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency;
$preFilled = [
'date' => $journal->dateAsString(),
'interest_date' => $journal->dateAsString('interest_date'),
@@ -250,8 +262,6 @@ class SingleController extends Controller
'source_account_name' => $sourceAccounts->first()->edit_name,
'destination_account_id' => $destinationAccounts->first()->id,
'destination_account_name' => $destinationAccounts->first()->edit_name,
'amount' => $journal->amountPositive(),
'currency' => $journal->transactionCurrency,
// new custom fields:
'due_date' => $journal->dateAsString('due_date'),
@@ -260,30 +270,25 @@ class SingleController extends Controller
'interal_reference' => $journal->getMeta('internal_reference'),
'notes' => $journal->getMeta('notes'),
// exchange rate fields
'native_amount' => $journal->amountPositive(),
'native_currency' => $journal->transactionCurrency,
// amount fields
'amount' => $pTransaction->amount,
'source_amount' => $pTransaction->amount,
'native_amount' => $pTransaction->amount,
'destination_amount' => $pTransaction->foreign_amount,
'currency' => $pTransaction->transactionCurrency,
'source_currency' => $pTransaction->transactionCurrency,
'native_currency' => $pTransaction->transactionCurrency,
'foreign_currency' => $foreignCurrency,
'destination_currency' => $foreignCurrency,
];
// if user has entered a foreign currency, update some fields
$foreignCurrencyId = intval($journal->getMeta('foreign_currency_id'));
if ($foreignCurrencyId > 0) {
// update some fields in pre-filled.
// @codeCoverageIgnoreStart
$preFilled['amount'] = $journal->getMeta('foreign_amount');
$preFilled['currency'] = $this->currency->find(intval($journal->getMeta('foreign_currency_id')));
// @codeCoverageIgnoreEnd
// amounts for withdrawals and deposits:
// amount, native_amount, source_amount, destination_amount
if (($journal->isWithdrawal() || $journal->isDeposit()) && !is_null($pTransaction->foreign_amount)) {
$preFilled['amount'] = $pTransaction->foreign_amount;
$preFilled['currency'] = $pTransaction->foreignCurrency;
}
if ($journal->isWithdrawal() && $destinationAccounts->first()->accountType->type == AccountType::CASH) {
$preFilled['destination_account_name'] = '';
}
if ($journal->isDeposit() && $sourceAccounts->first()->accountType->type == AccountType::CASH) {
$preFilled['source_account_name'] = '';
}
Session::flash('preFilled', $preFilled);
Session::flash('gaEventCategory', 'transactions');
Session::flash('gaEventAction', 'edit-' . $what);
@@ -319,6 +324,7 @@ class SingleController extends Controller
return redirect(route('transactions.create', [$request->input('what')]))->withInput();
}
/** @var array $files */
$files = $request->hasFile('attachments') ? $request->file('attachments') : null;
$this->attachments->saveAttachmentsForModel($journal, $files);
@@ -401,4 +407,20 @@ class SingleController extends Controller
// redirect to previous URL.
return redirect($this->getPreviousUri('transactions.edit.uri'));
}
/**
* @param TransactionJournal $journal
*
* @return bool
*/
private function isSplitJournal(TransactionJournal $journal): bool
{
$count = $this->repository->countTransactions($journal);
if ($count > 2) {
return true;
}
return false;
}
}

View File

@@ -93,7 +93,7 @@ class SplitController extends Controller
}
$uploadSize = min(Steam::phpBytes(ini_get('upload_max_filesize')), Steam::phpBytes(ini_get('post_max_size')));
$currencies = ExpandedForm::makeSelectList($this->currencies->get());
$currencies = $this->currencies->get();
$assetAccounts = ExpandedForm::makeSelectList($this->accounts->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]));
$optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
$budgets = ExpandedForm::makeSelectListWithEmpty($this->budgets->getActiveBudgets());
@@ -114,7 +114,7 @@ class SplitController extends Controller
'transactions.split.edit',
compact(
'subTitleIcon', 'currencies', 'optionalFields',
'preFilled', 'subTitle', 'amount', 'sourceAccounts', 'uploadSize', 'destinationAccounts', 'assetAccounts',
'preFilled', 'subTitle', 'uploadSize', 'assetAccounts',
'budgets', 'journal'
)
);
@@ -130,7 +130,6 @@ class SplitController extends Controller
*/
public function update(Request $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
if ($this->isOpeningBalance($journal)) {
return $this->redirectToAccount($journal);
}
@@ -179,7 +178,6 @@ class SplitController extends Controller
'journal_source_account_id' => $request->get('journal_source_account_id'),
'journal_source_account_name' => $request->get('journal_source_account_name'),
'journal_destination_account_id' => $request->get('journal_destination_account_id'),
'currency_id' => $request->get('currency_id'),
'what' => $request->get('what'),
'date' => $request->get('date'),
// all custom fields:
@@ -218,10 +216,9 @@ class SplitController extends Controller
'journal_source_account_id' => $request->old('journal_source_account_id', $sourceAccounts->first()->id),
'journal_source_account_name' => $request->old('journal_source_account_name', $sourceAccounts->first()->name),
'journal_destination_account_id' => $request->old('journal_destination_account_id', $destinationAccounts->first()->id),
'currency_id' => $request->old('currency_id', $journal->transaction_currency_id),
'destinationAccounts' => $destinationAccounts,
'what' => strtolower($journal->transactionTypeStr()),
'date' => $request->old('date', $journal->date),
'date' => $request->old('date', $journal->date->format('Y-m-d')),
'tags' => join(',', $journal->tags->pluck('tag')->toArray()),
// all custom fields:
@@ -253,14 +250,22 @@ class SplitController extends Controller
/** @var array $transaction */
foreach ($transactions as $index => $transaction) {
$set = [
'description' => $transaction['description'],
'source_account_id' => $transaction['source_account_id'],
'source_account_name' => $transaction['source_account_name'],
'destination_account_id' => $transaction['destination_account_id'],
'destination_account_name' => $transaction['destination_account_name'],
'amount' => round($transaction['destination_amount'], 12),
'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
'category' => $transaction['category'],
'description' => $transaction['description'],
'source_account_id' => $transaction['source_account_id'],
'source_account_name' => $transaction['source_account_name'],
'destination_account_id' => $transaction['destination_account_id'],
'destination_account_name' => $transaction['destination_account_name'],
'amount' => round($transaction['destination_amount'], 12),
'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
'category' => $transaction['category'],
'transaction_currency_id' => $transaction['transaction_currency_id'],
'transaction_currency_code' => $transaction['transaction_currency_code'],
'transaction_currency_symbol' => $transaction['transaction_currency_symbol'],
'foreign_amount' => round($transaction['foreign_destination_amount'], 12),
'foreign_currency_id' => $transaction['foreign_currency_id'],
'foreign_currency_code' => $transaction['foreign_currency_code'],
'foreign_currency_symbol' => $transaction['foreign_currency_symbol'],
];
// set initial category and/or budget:
@@ -294,8 +299,12 @@ class SplitController extends Controller
'destination_account_id' => $transaction['destination_account_id'] ?? 0,
'destination_account_name' => $transaction['destination_account_name'] ?? '',
'amount' => round($transaction['amount'] ?? 0, 12),
'foreign_amount' => !isset($transaction['foreign_amount']) ? null : round($transaction['foreign_amount'] ?? 0, 12),
'budget_id' => isset($transaction['budget_id']) ? intval($transaction['budget_id']) : 0,
'category' => $transaction['category'] ?? '',
'transaction_currency_id' => intval($transaction['transaction_currency_id']),
'foreign_currency_id' => $transaction['foreign_currency_id'] ?? null,
];
}
Log::debug(sprintf('Found %d splits in request data.', count($return)));

View File

@@ -18,7 +18,6 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
use FireflyIII\Helpers\Filter\InternalTransferFilter;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
use FireflyIII\Support\CacheProperties;
@@ -71,14 +70,13 @@ class TransactionController extends Controller
// default values:
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $what);
$types = config('firefly.transactionTypesByWhat.' . $what);
$page = intval($request->get('page')) == 0 ? 1 : intval($request->get('page'));
$page = intval($request->get('page'));
$pageSize = intval(Preferences::get('transactionPageSize', 50)->data);
$count = 0;
$loop = 0;
$range = Preferences::get('viewRange', '1M')->data;
$start = null;
$end = null;
$periods = new Collection;
$path = route('transactions.index', [$what]);
// prep for "all" view.
if ($moment === 'all') {
@@ -86,12 +84,14 @@ class TransactionController extends Controller
$first = $repository->first();
$start = $first->date ?? new Carbon;
$end = new Carbon;
$path = route('transactions.index', [$what, 'all']);
}
// prep for "specific date" view.
if (strlen($moment) > 0 && $moment !== 'all') {
$start = new Carbon($moment);
$end = Navigation::endOfPeriod($start, $range);
$path = route('transactions.index', [$what, $moment]);
$subTitle = trans(
'firefly.title_' . $what . '_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
@@ -109,32 +109,14 @@ class TransactionController extends Controller
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
// grab journals, but be prepared to jump a period back to get the right ones:
Log::info('Now at transaction loop start.');
while ($count === 0 && $loop < 3) {
$loop++;
Log::info('Count is zero, search for journals.');
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setTypes($types)->setLimit($pageSize)->setPage($page)->withOpposingAccount();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath('/budgets/list/no-budget');
$count = $journals->getCollection()->count();
if ($count === 0) {
$start->subDay();
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfPeriod($start, $range);
Log::info(sprintf('Count is still zero, go back in time to "%s" and "%s"!', $start->format('Y-m-d'), $end->format('Y-m-d')));
}
}
if ($moment != 'all' && $loop > 1) {
$subTitle = trans(
'firefly.title_' . $what . '_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
);
}
/** @var JournalCollectorInterface $collector */
$collector = app(JournalCollectorInterface::class);
$collector->setAllAssetAccounts()->setRange($start, $end)->setTypes($types)->setLimit($pageSize)->setPage($page)->withOpposingAccount();
$collector->removeFilter(InternalTransferFilter::class);
$journals = $collector->getPaginatedJournals();
$journals->setPath($path);
return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'journals', 'periods', 'start', 'end', 'moment'));
@@ -171,7 +153,7 @@ class TransactionController extends Controller
* @param TransactionJournal $journal
* @param JournalTaskerInterface $tasker
*
* @return View
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector|View
*/
public function show(TransactionJournal $journal, JournalTaskerInterface $tasker)
{
@@ -179,21 +161,12 @@ class TransactionController extends Controller
return $this->redirectToAccount($journal);
}
$events = $tasker->getPiggyBankEvents($journal);
$transactions = $tasker->getTransactionsOverview($journal);
$what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
$subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
$foreignCurrency = null;
$events = $tasker->getPiggyBankEvents($journal);
$transactions = $tasker->getTransactionsOverview($journal);
$what = strtolower($journal->transaction_type_type ?? $journal->transactionType->type);
$subTitle = trans('firefly.' . $what) . ' "' . e($journal->description) . '"';
if ($journal->hasMeta('foreign_currency_id')) {
// @codeCoverageIgnoreStart
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
$foreignCurrency = $repository->find(intval($journal->getMeta('foreign_currency_id')));
// @codeCoverageIgnoreEnd
}
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions', 'foreignCurrency'));
return view('transactions.show', compact('journal', 'events', 'subTitle', 'what', 'transactions'));
}
@@ -211,7 +184,7 @@ class TransactionController extends Controller
$start = $first->date ?? new Carbon;
$range = Preferences::get('viewRange', '1M')->data;
$start = Navigation::startOfPeriod($start, $range);
$end = Navigation::endOfX(new Carbon, $range);
$end = Navigation::endOfX(new Carbon, $range, null);
$entries = new Collection;
$types = config('firefly.transactionTypesByWhat.' . $what);

View File

@@ -38,19 +38,19 @@ class AccountFormRequest extends Request
public function getAccountData(): array
{
return [
'name' => $this->string('name'),
'active' => $this->boolean('active'),
'accountType' => $this->string('what'),
'currency_id' => $this->integer('currency_id'),
'virtualBalance' => $this->float('virtualBalance'),
'iban' => $this->string('iban'),
'BIC' => $this->string('BIC'),
'accountNumber' => $this->string('accountNumber'),
'accountRole' => $this->string('accountRole'),
'openingBalance' => $this->float('openingBalance'),
'openingBalanceDate' => $this->date('openingBalanceDate'),
'ccType' => $this->string('ccType'),
'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'),
'name' => $this->string('name'),
'active' => $this->boolean('active'),
'accountType' => $this->string('what'),
'currency_id' => $this->integer('currency_id'),
'virtualBalance' => $this->float('virtualBalance'),
'iban' => $this->string('iban'),
'BIC' => $this->string('BIC'),
'accountNumber' => $this->string('accountNumber'),
'accountRole' => $this->string('accountRole'),
'openingBalance' => $this->float('openingBalance'),
'openingBalanceDate' => $this->date('openingBalanceDate'),
'ccType' => $this->string('ccType'),
'ccMonthlyPaymentDate' => $this->string('ccMonthlyPaymentDate'),
];
}

View File

@@ -38,8 +38,9 @@ class ImportUploadRequest extends Request
$types = array_keys(config('firefly.import_formats'));
return [
'import_file' => 'required|file',
'import_file_type' => 'required|in:' . join(',', $types),
'import_file' => 'required|file',
'import_file_type' => 'required|in:' . join(',', $types),
'configuration_file' => 'file',
];
}

View File

@@ -37,7 +37,7 @@ class ProfileFormRequest extends Request
{
return [
'current_password' => 'required',
'new_password' => 'required|confirmed',
'new_password' => 'required|confirmed|secure_password',
'new_password_confirmation' => 'required',
];
}

View File

@@ -37,7 +37,7 @@ class TagFormRequest extends Request
*/
public function collectTagData(): array
{
if ($this->get('setTag') == 'true') {
if ($this->get('setTag') === 'true') {
$latitude = $this->string('latitude');
$longitude = $this->string('longitude');
$zoomLevel = $this->integer('zoomLevel');
@@ -54,7 +54,6 @@ class TagFormRequest extends Request
'latitude' => $latitude,
'longitude' => $longitude,
'zoomLevel' => $zoomLevel,
'tagMode' => $this->string('tagMode'),
];
return $data;
@@ -84,7 +83,6 @@ class TagFormRequest extends Request
'latitude' => 'numeric|min:-90|max:90',
'longitude' => 'numeric|min:-90|max:90',
'zoomLevel' => 'numeric|min:0|max:80',
'tagMode' => 'required|in:nothing,balancingAct,advancePayment',
];
}
}

View File

@@ -51,7 +51,7 @@ class UserFormRequest extends Request
return [
'id' => 'required|exists:users,id',
'email' => 'email|required',
'password' => 'confirmed',
'password' => 'confirmed|secure_password',
'blocked_code' => 'between:0,30',
'blocked' => 'between:0,1|numeric',
];

View File

@@ -0,0 +1,42 @@
<?php
/**
* UserRegistrationRequest.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Http\Requests;
/**
* Class UserRegistrationRequest
*
*
* @package FireflyIII\Http\Requests
*/
class UserRegistrationRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only everybody
return true;
}
/**
* @return array
*/
public function rules()
{
return [
'email' => 'email|required',
'password' => 'confirmed|secure_password',
];
}
}

View File

@@ -10,6 +10,7 @@
*/
declare(strict_types=1);
use Carbon\Carbon;
use DaveJamesMiller\Breadcrumbs\Generator as BreadCrumbGenerator;
use FireflyIII\Exceptions\FireflyException;
@@ -78,10 +79,10 @@ Breadcrumbs::register(
$breadcrumbs->push(trans('firefly.everything'), route('accounts.show', [$account->id, 'all']));
}
// when is specific period or when empty:
if ($moment !== 'all') {
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('accounts.show', [$account->id, $moment, $start, $end]));
}
@@ -91,7 +92,7 @@ Breadcrumbs::register(
Breadcrumbs::register(
'accounts.delete', function (BreadCrumbGenerator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account, '', new Carbon, new Carbon);
$breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('firefly.delete_account', ['name' => e($account->name)]), route('accounts.delete', [$account->id]));
}
);
@@ -99,7 +100,7 @@ Breadcrumbs::register(
Breadcrumbs::register(
'accounts.edit', function (BreadCrumbGenerator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account, '', new Carbon, new Carbon);
$breadcrumbs->parent('accounts.show', $account, '(nothing)', new Carbon, new Carbon);
$what = config('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->push(trans('firefly.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', [$account->id]));
@@ -257,8 +258,8 @@ Breadcrumbs::register(
if ($moment === 'all') {
$breadcrumbs->push(trans('firefly.everything'), route('budgets.no-budget', ['all']));
}
// when is specific period:
if ($moment !== 'all') {
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
@@ -312,13 +313,13 @@ Breadcrumbs::register(
Breadcrumbs::register(
'categories.edit', function (BreadCrumbGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category, '', new Carbon, new Carbon);
$breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('firefly.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id]));
}
);
Breadcrumbs::register(
'categories.delete', function (BreadCrumbGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category, '', new Carbon, new Carbon);
$breadcrumbs->parent('categories.show', $category, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('firefly.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id]));
}
);
@@ -333,8 +334,8 @@ Breadcrumbs::register(
if ($moment === 'all') {
$breadcrumbs->push(trans('firefly.everything'), route('categories.show', [$category->id, 'all']));
}
// when is specific period:
if ($moment !== 'all') {
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
@@ -354,8 +355,8 @@ Breadcrumbs::register(
if ($moment === 'all') {
$breadcrumbs->push(trans('firefly.everything'), route('categories.no-category', ['all']));
}
// when is specific period:
if ($moment !== 'all') {
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
@@ -469,25 +470,29 @@ Breadcrumbs::register(
$breadcrumbs->push(trans('firefly.import'), route('import.index'));
}
);
/**
* FILE IMPORT
*/
Breadcrumbs::register(
'import.complete', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) {
'import.file.index', function (BreadCrumbGenerator $breadcrumbs) {
$breadcrumbs->parent('import.index');
$breadcrumbs->push(trans('firefly.bread_crumb_import_complete', ['key' => $job->key]), route('import.complete', [$job->key]));
}
);
Breadcrumbs::register(
'import.configure', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) {
$breadcrumbs->parent('import.index');
$breadcrumbs->push(trans('firefly.bread_crumb_configure_import', ['key' => $job->key]), route('import.configure', [$job->key]));
}
);
Breadcrumbs::register(
'import.finished', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) {
$breadcrumbs->parent('import.index');
$breadcrumbs->push(trans('firefly.bread_crumb_import_finished', ['key' => $job->key]), route('import.finished', [$job->key]));
$breadcrumbs->push(trans('firefly.import_file'), route('import.file.index'));
}
);
Breadcrumbs::register(
'import.file.configure', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) {
$breadcrumbs->parent('import.file.index');
$breadcrumbs->push(trans('firefly.import_config_sub_title', ['key' => $job->key]), route('import.file.configure', [$job->key]));
}
);
Breadcrumbs::register(
'import.file.status', function (BreadCrumbGenerator $breadcrumbs, ImportJob $job) {
$breadcrumbs->parent('import.file.index');
$breadcrumbs->push(trans('firefly.import_status_bread_crumb', ['key' => $job->key]), route('import.file.status', [$job->key]));
}
);
/**
* PREFERENCES
@@ -686,7 +691,7 @@ Breadcrumbs::register(
Breadcrumbs::register(
'search.index', function (BreadCrumbGenerator $breadcrumbs, $query) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search.index'));
$breadcrumbs->push(trans('breadcrumbs.search_result', ['query' => e($query)]), route('search.index'));
}
);
@@ -710,14 +715,14 @@ Breadcrumbs::register(
Breadcrumbs::register(
'tags.edit', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag, '', new Carbon, new Carbon);
$breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', [$tag->id]));
}
);
Breadcrumbs::register(
'tags.delete', function (BreadCrumbGenerator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag, '', new Carbon, new Carbon);
$breadcrumbs->parent('tags.show', $tag, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', [$tag->id]));
}
);
@@ -726,16 +731,17 @@ Breadcrumbs::register(
Breadcrumbs::register(
'tags.show', function (BreadCrumbGenerator $breadcrumbs, Tag $tag, string $moment, Carbon $start, Carbon $end) {
$breadcrumbs->parent('tags.index');
$breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id], $moment));
$breadcrumbs->push(e($tag->tag), route('tags.show', [$tag->id, $moment]));
if ($moment === 'all') {
$breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id], $moment));
$breadcrumbs->push(trans('firefly.everything'), route('tags.show', [$tag->id, $moment]));
}
if ($moment !== 'all') {
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
);
$breadcrumbs->push($title, route('tags.show', [$tag->id], $moment));
$breadcrumbs->push($title, route('tags.show', [$tag->id, $moment]));
}
}
);
@@ -753,8 +759,8 @@ Breadcrumbs::register(
$breadcrumbs->push(trans('firefly.everything'), route('transactions.index', [$what, 'all']));
}
// when is specific period:
if ($moment !== 'all') {
// when is specific period or when empty:
if ($moment !== 'all' && $moment !== '(nothing)') {
$title = trans(
'firefly.between_dates_breadcrumb', ['start' => $start->formatLocalized(strval(trans('config.month_and_day'))),
'end' => $end->formatLocalized(strval(trans('config.month_and_day')))]
@@ -767,7 +773,7 @@ Breadcrumbs::register(
Breadcrumbs::register(
'transactions.create', function (BreadCrumbGenerator $breadcrumbs, string $what) {
$breadcrumbs->parent('transactions.index', $what, '', new Carbon, new Carbon);
$breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', [$what]));
}
);
@@ -789,7 +795,7 @@ Breadcrumbs::register(
'transactions.show', function (BreadCrumbGenerator $breadcrumbs, TransactionJournal $journal) {
$what = strtolower($journal->transactionType->type);
$breadcrumbs->parent('transactions.index', $what, '', new Carbon, new Carbon);
$breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push($journal->description, route('transactions.show', [$journal->id]));
}
);
@@ -809,18 +815,20 @@ Breadcrumbs::register(
* MASS TRANSACTION EDIT / DELETE
*/
Breadcrumbs::register(
'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals) {
'transactions.mass.edit', function (BreadCrumbGenerator $breadcrumbs, Collection $journals): void {
if ($journals->count() > 0) {
$journalIds = $journals->pluck('id')->toArray();
$what = strtolower($journals->first()->transactionType->type);
$breadcrumbs->parent('transactions.index', $what, '', new Carbon, new Carbon);
$breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.edit', $journalIds));
return;
}
$breadcrumbs->parent('index');
return;
}
);
@@ -829,7 +837,7 @@ Breadcrumbs::register(
$journalIds = $journals->pluck('id')->toArray();
$what = strtolower($journals->first()->transactionType->type);
$breadcrumbs->parent('transactions.index', $what, '', new Carbon, new Carbon);
$breadcrumbs->parent('transactions.index', $what, '(nothing)', new Carbon, new Carbon);
$breadcrumbs->push(trans('firefly.mass_edit_journals'), route('transactions.mass.delete', $journalIds));
}
);

View File

@@ -0,0 +1,72 @@
<?php
/**
* ConfiguratorInterface.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Configurator;
use FireflyIII\Models\ImportJob;
/**
* Interface ConfiguratorInterface
*
* @package FireflyIII\Import\Configurator
*/
interface ConfiguratorInterface
{
/**
* ConfiguratorInterface constructor.
*/
public function __construct();
/**
* Store any data from the $data array into the job.
*
* @param array $data
*
* @return bool
*/
public function configureJob(array $data): bool;
/**
* Return the data required for the next step in the job configuration.
*
* @return array
*/
public function getNextData(): array;
/**
* Returns the view of the next step in the job configuration.
*
* @return string
*/
public function getNextView(): string;
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string;
/**
* Returns true when the initial configuration for this job is complete.
*
* @return bool
*/
public function isJobConfigured(): bool;
/**
* @param ImportJob $job
*
* @return void
*/
public function setJob(ImportJob $job);
}

View File

@@ -0,0 +1,175 @@
<?php
/**
* CsvConfigurator.php
* Copyright (c) 2017 thegrumpydictator@gmail.com
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Configurator;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\ImportJob;
use FireflyIII\Support\Import\Configuration\ConfigurationInterface;
use FireflyIII\Support\Import\Configuration\Csv\Initial;
use FireflyIII\Support\Import\Configuration\Csv\Map;
use FireflyIII\Support\Import\Configuration\Csv\Roles;
use Log;
/**
* Class CsvConfigurator
*
* @package FireflyIII\Import\Configurator
*/
class CsvConfigurator implements ConfiguratorInterface
{
/** @var ImportJob */
private $job;
/** @var string */
private $warning = '';
/**
* ConfiguratorInterface constructor.
*/
public function __construct()
{
}
/**
* Store any data from the $data array into the job.
*
* @param array $data
*
* @return bool
* @throws FireflyException
*/
public function configureJob(array $data): bool
{
$class = $this->getConfigurationClass();
$job = $this->job;
/** @var ConfigurationInterface $object */
$object = new $class($this->job);
$object->setJob($job);
$result = $object->storeConfiguration($data);
$this->warning = $object->getWarningMessage();
return $result;
}
/**
* Return the data required for the next step in the job configuration.
*
* @return array
* @throws FireflyException
*/
public function getNextData(): array
{
$class = $this->getConfigurationClass();
$job = $this->job;
/** @var ConfigurationInterface $object */
$object = app($class);
$object->setJob($job);
return $object->getData();
}
/**
* @return string
* @throws FireflyException
*/
public function getNextView(): string
{
if (!$this->job->configuration['initial-config-complete']) {
return 'import.csv.initial';
}
if (!$this->job->configuration['column-roles-complete']) {
return 'import.csv.roles';
}
if (!$this->job->configuration['column-mapping-complete']) {
return 'import.csv.map';
}
throw new FireflyException('No view for state');
}
/**
* Return possible warning to user.
*
* @return string
*/
public function getWarningMessage(): string
{
return $this->warning;
}
/**
* @return bool
*/
public function isJobConfigured(): bool
{
$config = $this->job->configuration;
$config['initial-config-complete'] = $config['initial-config-complete'] ?? false;
$config['column-roles-complete'] = $config['column-roles-complete'] ?? false;
$config['column-mapping-complete'] = $config['column-mapping-complete'] ?? false;
$this->job->configuration = $config;
$this->job->save();
if ($this->job->configuration['initial-config-complete']
&& $this->job->configuration['column-roles-complete']
&& $this->job->configuration['column-mapping-complete']
) {
return true;
}
return false;
}
/**
* @param ImportJob $job
*/
public function setJob(ImportJob $job)
{
$this->job = $job;
if (is_null($this->job->configuration) || count($this->job->configuration) === 0) {
Log::debug(sprintf('Gave import job %s initial configuration.', $this->job->key));
$this->job->configuration = config('csv.default_config');
$this->job->save();
}
}
/**
* @return string
* @throws FireflyException
*/
private function getConfigurationClass(): string
{
$class = false;
switch (true) {
case (!$this->job->configuration['initial-config-complete']):
$class = Initial::class;
break;
case (!$this->job->configuration['column-roles-complete']):
$class = Roles::class;
break;
case (!$this->job->configuration['column-mapping-complete']):
$class = Map::class;
break;
default:
break;
}
if ($class === false || strlen($class) === 0) {
throw new FireflyException('Cannot handle current job state in getConfigurationClass().');
}
if (!class_exists($class)) {
throw new FireflyException(sprintf('Class %s does not exist in getConfigurationClass().', $class));
}
return $class;
}
}

View File

@@ -1,69 +0,0 @@
<?php
/**
* AccountId.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Log;
/**
* Class AccountId
*
* @package FireflyIII\Import\Converter
*/
class AccountId extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Account
*/
public function convert($value)
{
$value = intval(trim($value));
Log::debug('Going to convert using AssetAccountId', ['value' => $value]);
if ($value === 0) {
$this->setCertainty(0);
return new Account;
}
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$account = $repository->find(intval($this->mapping[$value]));
if (!is_null($account->id)) {
Log::debug('Found account by ID', ['id' => $account->id]);
$this->setCertainty(100);
return $account;
}
}
$account = $repository->find($value);// not mapped? Still try to find it first:
if (!is_null($account->id)) {
$this->setCertainty(90);
Log::debug('Found account by ID ', ['id' => $account->id]);
return $account;
}
$this->setCertainty(0); // should not really happen. If the ID does not match FF, what is FF supposed to do?
return new Account;
}
}

View File

@@ -18,7 +18,7 @@ namespace FireflyIII\Import\Converter;
*
* @package FireflyIII\Import\Converter
*/
class Amount extends BasicConverter implements ConverterInterface
class Amount implements ConverterInterface
{
/**
@@ -28,18 +28,20 @@ class Amount extends BasicConverter implements ConverterInterface
*
* @param $value
*
* @return float
* @return string
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function convert($value): float
public function convert($value): string
{
$len = strlen($value);
$decimalPosition = $len - 3;
$decimal = null;
if (($len > 2 && $value{$decimalPosition} == '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) {
if (($len > 2 && $value{$decimalPosition} === '.') || ($len > 2 && strpos($value, '.') > $decimalPosition)) {
$decimal = '.';
}
if ($len > 2 && $value{$decimalPosition} == ',') {
if ($len > 2 && $value{$decimalPosition} === ',') {
$decimal = ',';
}
@@ -59,10 +61,7 @@ class Amount extends BasicConverter implements ConverterInterface
$value = str_replace($search, '', $value);
}
$this->setCertainty(90);
return round(floatval($value), 12);
return strval(round(floatval($value), 12));
}
}

View File

@@ -1,87 +0,0 @@
<?php
/**
* AssetAccountIban.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Log;
/**
* Class AssetAccountIban
*
* @package FireflyIII\Import\Converter
*/
class AssetAccountIban extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Account
*/
public function convert($value): Account
{
$value = trim($value);
Log::debug('Going to convert ', ['value' => $value]);
if (strlen($value) === 0) {
$this->setCertainty(0);
return new Account;
}
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$account = $repository->find(intval($this->mapping[$value]));
if (!is_null($account->id)) {
$this->setCertainty(100);
Log::debug('Found account by ID', ['id' => $account->id]);
return $account;
}
}
// not mapped? Still try to find it first:
$account = $repository->findByIban($value, [AccountType::ASSET]);
if (!is_null($account->id)) {
Log::debug('Found account by IBAN', ['id' => $account->id]);
$this->setCertainty(50);
return $account;
}
$account = $repository->store(
['name' => 'Asset account with IBAN ' . $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0,
'active' => true, 'openingBalance' => 0]
);
if (is_null($account->id)) {
$this->setCertainty(0);
Log::info('Could not store new asset account by IBAN', $account->getErrors()->toArray());
return new Account;
}
$this->setCertainty(100);
return $account;
}
}

View File

@@ -1,90 +0,0 @@
<?php
/**
* AssetAccountName.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Log;
/**
* Class AssetAccountName
*
* @package FireflyIII\Import\Converter
*/
class AssetAccountName extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Account
*/
public function convert($value)
{
$value = trim($value);
Log::debug('Going to convert using AssetAccountName', ['value' => $value]);
if (strlen($value) === 0) {
$this->setCertainty(0);
return new Account;
}
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$account = $repository->find(intval($this->mapping[$value]));
if (!is_null($account->id)) {
Log::debug('Found account by ID', ['id' => $account->id]);
$this->setCertainty(100);
return $account;
}
}
// not mapped? Still try to find it first:
$account = $repository->findByName($value, [AccountType::ASSET]);
if (!is_null($account->id)) {
Log::debug('Found asset account by name', ['value' => $value, 'id' => $account->id]);
return $account;
}
$account = $repository->store(
['name' => $value, 'iban' => null, 'openingBalance' => 0, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0,
'active' => true]
);
if (is_null($account->id)) {
$this->setCertainty(0);
Log::info('Could not store new asset account by name', $account->getErrors()->toArray());
return new Account;
}
$this->setCertainty(100);
Log::debug('Created new asset account ', ['name' => $account->name, 'id' => $account->id]);
return $account;
}
}

View File

@@ -1,96 +0,0 @@
<?php
/**
* AssetAccountNumber.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Log;
/**
* Class AssetAccountNumber
*
* @package FireflyIII\Import\Converter
*/
class AssetAccountNumber extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Account
*/
public function convert($value)
{
$value = trim($value);
Log::debug('Going to convert using AssetAccountNumber', ['value' => $value]);
if (strlen($value) === 0) {
return new Account;
}
/** @var AccountRepositoryInterface $repository */
$repository = app(AccountRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$account = $repository->find(intval($this->mapping[$value]));
if (!is_null($account->id)) {
Log::debug('Found account by ID', ['id' => $account->id]);
return $account;
}
}
// not mapped? Still try to find it first:
$account = $repository->findByAccountNumber($value, [AccountType::ASSET]);
if (!is_null($account->id)) {
Log::debug('Found account by name', ['id' => $account->id]);
$this->setCertainty(50);
return $account;
}
// try to find by the name we would give it:
$accountName = 'Asset account with number ' . e($value);
$account = $repository->findByName($accountName, [AccountType::ASSET]);
if (!is_null($account->id)) {
Log::debug('Found account by name', ['id' => $account->id]);
$this->setCertainty(50);
return $account;
}
$account = $repository->store(
['name' => $accountName, 'openingBalance' => 0, 'iban' => null, 'user' => $this->user->id,
'accountType' => 'asset',
'virtualBalance' => 0, 'accountNumber' => $value, 'active' => true]
);
if (is_null($account->id)) {
$this->setCertainty(0);
Log::info('Could not store new asset account by account number', $account->getErrors()->toArray());
return new Account;
}
$this->setCertainty(100);
return $account;
}
}

View File

@@ -1,85 +0,0 @@
<?php
/**
* BasicConverter.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\User;
/**
* Class BasicConverter
*
* @package FireflyIII\Import\Converter
*/
class BasicConverter
{
/** @var int */
public $certainty = 50;
/** @var array */
public $config;
/** @var bool */
public $doMap;
/** @var array */
public $mapping = [];
/** @var User */
public $user;
/**
* @return int
*/
public function getCertainty(): int
{
return $this->certainty;
}
/**
* @param int $certainty
*/
protected function setCertainty(int $certainty)
{
$this->certainty = $certainty;
}
/**
* @param array $config
*/
public function setConfig(array $config)
{
$this->config = $config;
}
/**
* @param mixed $doMap
*/
public function setDoMap(bool $doMap)
{
$this->doMap = $doMap;
}
/**
* @param array $mapping
*
*/
public function setMapping(array $mapping)
{
$this->mapping = $mapping;
}
/**
* @param User $user
*/
public function setUser(User $user)
{
$this->user = $user;
}
}

View File

@@ -1,76 +0,0 @@
<?php
/**
* BillId.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Log;
/**
* Class BillId
*
* @package FireflyIII\Import\Converter
*/
class BillId extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Bill
*/
public function convert($value)
{
$value = intval(trim($value));
Log::debug('Going to convert using BillId', ['value' => $value]);
if ($value === 0) {
$this->setCertainty(0);
return new Bill;
}
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$bill = $repository->find(intval($this->mapping[$value]));
if (!is_null($bill->id)) {
Log::debug('Found bill by ID', ['id' => $bill->id]);
$this->setCertainty(100);
return $bill;
}
}
// not mapped? Still try to find it first:
$bill = $repository->find($value);
if (!is_null($bill->id)) {
Log::debug('Found bill by ID ', ['id' => $bill->id]);
$this->setCertainty(100);
return $bill;
}
// should not really happen. If the ID does not match FF, what is FF supposed to do?
Log::info(sprintf('Could not find bill with ID %d. Will return NULL', $value));
$this->setCertainty(0);
return new Bill;
}
}

View File

@@ -1,99 +0,0 @@
<?php
/**
* BillName.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Log;
/**
* Class BillName
*
* @package FireflyIII\Import\Converter
*/
class BillName extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Bill
* @throws FireflyException
*/
public function convert($value)
{
$value = trim($value);
Log::debug('Going to convert using BillName', ['value' => $value]);
if (strlen($value) === 0) {
$this->setCertainty(0);
return new Bill;
}
/** @var BillRepositoryInterface $repository */
$repository = app(BillRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$bill = $repository->find(intval($this->mapping[$value]));
if (!is_null($bill->id)) {
Log::debug('Found bill by ID', ['id' => $bill->id]);
$this->setCertainty(100);
return $bill;
}
}
// not mapped? Still try to find it first:
$bill = $repository->findByName($value);
if (!is_null($bill->id)) {
Log::debug('Found bill by name ', ['id' => $bill->id]);
$this->setCertainty(100);
return $bill;
}
// create new bill. Use a lot of made up values.
$bill = $repository->store(
[
'name' => $value,
'match' => $value,
'amount_min' => 1,
'user' => $this->user->id,
'amount_max' => 10,
'date' => date('Ymd'),
'repeat_freq' => 'monthly',
'skip' => 0,
'automatch' => 0,
'active' => 1,
]
);
if (is_null($bill->id)) {
$this->setCertainty(0);
Log::info('Could not store new bill by name', $bill->getErrors()->toArray());
return new Bill;
}
$this->setCertainty(100);
return $bill;
}
}

View File

@@ -1,76 +0,0 @@
<?php
/**
* BudgetId.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Log;
/**
* Class BudgetId
*
* @package FireflyIII\Import\Converter
*/
class BudgetId extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Budget
*/
public function convert($value)
{
$value = intval(trim($value));
Log::debug('Going to convert using BudgetId', ['value' => $value]);
if ($value === 0) {
$this->setCertainty(0);
return new Budget;
}
/** @var BudgetRepositoryInterface $repository */
$repository = app(BudgetRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$budget = $repository->find(intval($this->mapping[$value]));
if (!is_null($budget->id)) {
Log::debug('Found budget by ID', ['id' => $budget->id]);
$this->setCertainty(100);
return $budget;
}
}
// not mapped? Still try to find it first:
$budget = $repository->find($value);
if (!is_null($budget->id)) {
Log::debug('Found budget by ID ', ['id' => $budget->id]);
$this->setCertainty(100);
return $budget;
}
// should not really happen. If the ID does not match FF, what is FF supposed to do?
$this->setCertainty(0);
Log::info(sprintf('Could not find budget with ID %d. Will return NULL', $value));
return new Budget;
}
}

View File

@@ -1,80 +0,0 @@
<?php
/**
* BudgetName.php
* Copyright (C) 2016 thegrumpydictator@gmail.com
*
* This software may be modified and distributed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International License.
*
* See the LICENSE file for details.
*/
declare(strict_types=1);
namespace FireflyIII\Import\Converter;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Log;
/**
* Class BudgetName
*
* @package FireflyIII\Import\Converter
*/
class BudgetName extends BasicConverter implements ConverterInterface
{
/**
* @param $value
*
* @return Budget
*/
public function convert($value)
{
$value = trim($value);
Log::debug('Going to convert using BudgetName', ['value' => $value]);
if (strlen($value) === 0) {
$this->setCertainty(0);
return new Budget;
}
/** @var BudgetRepositoryInterface $repository */
$repository = app(BudgetRepositoryInterface::class);
$repository->setUser($this->user);
if (isset($this->mapping[$value])) {
Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
$budget = $repository->find(intval($this->mapping[$value]));
if (!is_null($budget->id)) {
Log::debug('Found budget by ID', ['id' => $budget->id]);
$this->setCertainty(100);
return $budget;
}
}
// not mapped? Still try to find it first:
$budget = $repository->findByName($value);
if (!is_null($budget->id)) {
Log::debug('Found budget by name ', ['id' => $budget->id]);
$this->setCertainty(100);
return $budget;
}
// create new budget. Use a lot of made up values.
$budget = $repository->store(
[
'name' => $value,
'user' => $this->user->id,
]
);
$this->setCertainty(100);
return $budget;
}
}

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