Compare commits

...

1588 Commits

Author SHA1 Message Date
James Cole
3d9755ca8c Merge branch 'release/3.4.0.9' 2015-05-24 11:53:43 +02:00
James Cole
b5cf2d03e6 New version. 2015-05-24 11:53:34 +02:00
James Cole
e3b35b8f35 Add code climate file [skip ci] 2015-05-24 11:46:41 +02:00
James Cole
1c1fe672bd Some code cleanup [skip ci] 2015-05-24 11:41:52 +02:00
James Cole
6c71f68ed8 Should cover models. 2015-05-24 11:13:46 +02:00
James Cole
8f2f912cdf New (empty) tests for models. 2015-05-24 10:01:00 +02:00
James Cole
bf6ea16acb Fixed test. 2015-05-24 09:29:44 +02:00
James Cole
288546c2b9 Fixed some math. 2015-05-24 08:00:40 +02:00
James Cole
724db6c34c Built some new tests 2015-05-24 07:43:48 +02:00
James Cole
067c451c1d Fixed tests 2015-05-23 21:41:04 +02:00
James Cole
11e3696191 Cleanup tests. 2015-05-23 21:23:51 +02:00
James Cole
41e20664de Fixed coverage. 2015-05-23 21:18:20 +02:00
James Cole
d8de90d6f3 Ignore constructors. 2015-05-23 20:49:57 +02:00
James Cole
b01e8299d3 Fixed tests 2015-05-23 20:47:31 +02:00
James Cole
1ec11e3e2e Compartmentalised all tests. 2015-05-23 19:41:54 +02:00
James Cole
422f429725 Experimental count thing. 2015-05-23 17:38:16 +02:00
James Cole
5c55fa5fbb Remove encrypted amounts because it stinks. 2015-05-23 17:33:04 +02:00
James Cole
80d845fdf2 Save but don't use. 2015-05-23 17:18:23 +02:00
James Cole
601fe68346 Don't multiply transactions. 2015-05-23 17:14:36 +02:00
James Cole
9e050fb059 Updated some tests. 2015-05-23 17:11:16 +02:00
James Cole
99d4adf5e6 Translations [skip ci] 2015-05-23 15:57:38 +02:00
James Cole
85f8d1e8e9 Math is hard [skip ci] 2015-05-23 15:45:01 +02:00
James Cole
8334d3d99f Translation error [skip ci] 2015-05-23 15:43:48 +02:00
James Cole
cff08d19eb Slowly move away from using the raw 'transactions.amount' field. 2015-05-23 15:42:19 +02:00
James Cole
2d86390bc1 Experimental query.Code cleanup [skip ci] 2015-05-23 09:11:59 +02:00
James Cole
7a20835571 Code cleanup [skip ci] 2015-05-23 09:09:25 +02:00
James Cole
ff3c9676b5 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 09:05:08 +02:00
James Cole
055f97dab1 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 09:03:52 +02:00
James Cole
8a867e71a1 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 09:02:27 +02:00
James Cole
b8275b4734 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 09:01:38 +02:00
James Cole
36b951b146 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 09:01:07 +02:00
James Cole
c5a5f17643 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 09:00:11 +02:00
James Cole
16b909c4df Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 08:59:23 +02:00
James Cole
92b7648e03 Encrypt more stuff in the cleanup routine [skip ci] 2015-05-23 08:58:21 +02:00
James Cole
ca46ebe3b2 Encrypt bill amounts [skip ci] 2015-05-23 08:57:02 +02:00
James Cole
676e48254a Whoops [skip ci] 2015-05-23 08:55:16 +02:00
James Cole
b15b55227d Add another cleanup routine. [skip ci] 2015-05-23 08:54:25 +02:00
James Cole
3c3b723913 Some code cleanup [skip ci] 2015-05-23 08:51:24 +02:00
James Cole
f05002c729 Updated models for encryption. 2015-05-23 08:46:46 +02:00
James Cole
1c2cbd5b40 New stuff for encrypted amounts. 2015-05-23 07:47:36 +02:00
James Cole
54c6ca9f45 Expanded some tests. 2015-05-22 20:25:12 +02:00
James Cole
c10efbb170 Also encrypt meta data for reminders. 2015-05-22 19:19:18 +02:00
James Cole
a496ad5814 Simple routine to encrypt entries which were not encrypted yet. 2015-05-22 19:18:00 +02:00
James Cole
50cf7f6a3b Merge branch 'release/3.4.0.8' 2015-05-22 18:55:13 +02:00
James Cole
f946f10afd Merge branch 'release/3.4.0.8' into develop 2015-05-22 18:55:13 +02:00
James Cole
eecb4db34c Built chart tests. 2015-05-22 18:31:57 +02:00
James Cole
1f865d3ea4 Improved coverage. 2015-05-22 15:05:32 +02:00
James Cole
623bb4b350 New tests. 2015-05-22 10:17:20 +02:00
James Cole
dc8ad673a6 New test to cover some reminder stuff. 2015-05-22 08:52:30 +02:00
James Cole
4914ad821e Fixed coverage for transaction controller. 2015-05-22 08:03:34 +02:00
James Cole
f099cbadc3 Version increment. 2015-05-22 07:16:36 +02:00
James Cole
42cda384c8 Fix help routes 2015-05-22 07:15:40 +02:00
James Cole
23c91b9990 Some translations, playing around with popups. [skip ci] 2015-05-21 23:05:31 +02:00
James Cole
ff0379182e Sort chart [skip ci] 2015-05-21 18:57:14 +02:00
James Cole
e08a23948f Fixed chart. [skip ci] 2015-05-21 18:50:23 +02:00
James Cole
bd56de6d36 Fix other translations [skip ci] 2015-05-21 17:47:10 +02:00
James Cole
42970aea80 Fix some translations. 2015-05-21 17:45:01 +02:00
James Cole
003a05ee8d Fixed the category chart. 2015-05-21 17:27:48 +02:00
James Cole
ffb11b01a6 Some new translations. 2015-05-21 07:44:44 +02:00
James Cole
e426f5d5da Some new translations. 2015-05-21 07:30:38 +02:00
James Cole
6989f61e1b Extra translations [skip ci] 2015-05-20 20:10:01 +02:00
James Cole
0e6677ccb3 Remove cash accounts from list [skip ci] 2015-05-20 20:04:27 +02:00
James Cole
8f104d555a Added newlines to files. 2015-05-20 19:56:14 +02:00
James Cole
b1d3158db1 Code cleanup. 2015-05-20 19:55:53 +02:00
James Cole
7645005d5a Return of account id. 2015-05-20 18:18:05 +02:00
James Cole
411f77fd29 Fixed some other displays of money 2015-05-20 18:09:44 +02:00
James Cole
568ab26db1 Spell check [skip ci] 2015-05-20 17:06:47 +02:00
James Cole
29652108f0 Fixed tests. 2015-05-20 17:04:53 +02:00
James Cole
f07e4dc711 Fix sort. [skip ci] 2015-05-20 07:21:40 +02:00
James Cole
8a2ac457c2 Name fix [skip ci] 2015-05-20 07:21:01 +02:00
James Cole
9e54eecfaa Fixed some views. 2015-05-20 07:20:02 +02:00
James Cole
95ef691077 Fixed some more reports and charts. [skip ci] 2015-05-20 07:07:46 +02:00
James Cole
7a0ad5a587 Fixed a chart [skip ci] 2015-05-20 06:50:24 +02:00
James Cole
42b49d0e4b Added some correcting methods. [skip ci] 2015-05-20 06:50:15 +02:00
James Cole
9217c2f003 Corrected some charts [skip ci] 2015-05-20 06:49:51 +02:00
James Cole
fbdf66998d Added a forgotten chart, corrected some others. [skip ci] 2015-05-20 06:49:22 +02:00
James Cole
deda9d3c54 Add corrected expense routes [skip ci] 2015-05-20 06:49:03 +02:00
James Cole
a5d78f20ae Add corrected income and expense methods [skip ci] 2015-05-20 06:48:52 +02:00
James Cole
5ed09e3f38 Call the corrected spent function [skip ci] 2015-05-20 06:47:53 +02:00
James Cole
3e9774cd66 Merge branch 'release/3.4.0.7' 2015-05-18 18:23:07 +02:00
James Cole
54387c8fdf Merge branch 'release/3.4.0.7' into develop 2015-05-18 18:23:07 +02:00
James Cole
7eec949a13 Push new release. 2015-05-18 18:23:01 +02:00
James Cole
4113c4ff40 Fixed the tests. 2015-05-18 17:57:44 +02:00
James Cole
1bf0968bfe Show correct icon. [skip ci] 2015-05-18 17:05:22 +02:00
James Cole
374b90fb00 Show correct amount [skip ci] 2015-05-18 17:04:10 +02:00
James Cole
064e60e9d5 Show tag amount better [skip ci] 2015-05-18 17:02:18 +02:00
James Cole
b637455970 New translations [skip ci] 2015-05-18 16:59:01 +02:00
James Cole
68158937d1 Fixed translation [skip ci] 2015-05-18 06:56:59 +02:00
James Cole
adb1356b7a Small bug fix in display of income vs. expenses [skip ci] 2015-05-18 06:55:36 +02:00
James Cole
d880ccb8e0 Small bug fix in display of income vs. expenses [skip ci] 2015-05-18 06:54:46 +02:00
James Cole
050fb1d1ef Some translations [skip ci] 2015-05-17 18:06:00 +02:00
James Cole
6580752bde Now includes chart! [skip ci] 2015-05-17 18:03:16 +02:00
James Cole
c9df265c9b Included bills in month report. [skip ci] 2015-05-17 17:54:13 +02:00
James Cole
098e5bc162 Small translation fix [skip ci] 2015-05-17 17:27:56 +02:00
James Cole
4b2dcc74d4 Expanded the amount thing. 2015-05-17 16:12:00 +02:00
James Cole
a9254c5c9a Some new translations, better tag view [skip ci] 2015-05-17 15:55:24 +02:00
James Cole
7ce57e6ccb Fix a view, fix tag format. 2015-05-17 15:24:30 +02:00
James Cole
0fcb32a66f Fix update error. 2015-05-17 15:17:06 +02:00
James Cole
9946535f01 Some new bread crumbs [skip ci] 2015-05-17 15:12:45 +02:00
James Cole
2b17396d6b Fix some translations. 2015-05-17 13:44:58 +02:00
James Cole
b01d5bc237 Translation fixes [skip ci] 2015-05-17 12:53:32 +02:00
James Cole
b123860304 More stuff. 2015-05-17 12:49:09 +02:00
James Cole
033f5b67db Code cleanup 2015-05-17 11:28:58 +02:00
James Cole
6280448dfb Fixed more tests. 2015-05-17 10:47:12 +02:00
James Cole
01cd3333e4 Fixing tests. 2015-05-17 10:36:11 +02:00
James Cole
63050907b9 Code cleanup. 2015-05-17 10:30:18 +02:00
James Cole
beedf7d780 Cleaning up 2015-05-17 10:10:58 +02:00
James Cole
6b8194261f Clean up and simplify code. 2015-05-17 10:01:47 +02:00
James Cole
dbb1c4d534 Fixed some reports. 2015-05-17 09:35:49 +02:00
James Cole
e6263f9ff5 Some cleaning up 2015-05-17 09:18:44 +02:00
James Cole
6ca119c4db Minor changes [skip ci] 2015-05-17 09:04:55 +02:00
James Cole
c483a1ab3a Ignore simple classes. 2015-05-16 19:08:54 +02:00
James Cole
2e7edd033c Some expanded things. 2015-05-16 16:47:52 +02:00
James Cole
c576902501 Fixed tests. 2015-05-16 16:04:51 +02:00
James Cole
66c2951594 Cleanup 2015-05-16 15:52:09 +02:00
James Cole
b812881cdb More hip report stuff. 2015-05-16 15:43:58 +02:00
James Cole
cdeac2c6db Should simplify reports. 2015-05-16 14:51:23 +02:00
James Cole
bca2ddd529 Budget report thing. 2015-05-16 14:14:22 +02:00
James Cole
e7285c6499 Some overhauls. 2015-05-16 13:53:08 +02:00
James Cole
bdff275672 Simplified report code. 2015-05-16 13:06:38 +02:00
James Cole
bec58a1ee6 Experimental test coverage. 2015-05-16 10:34:38 +02:00
James Cole
f64616748c Expenses only [skip ci] 2015-05-16 10:18:32 +02:00
James Cole
512ce15973 Small tweaks in charts. 2015-05-16 10:13:41 +02:00
James Cole
ed8b301574 Routes and JS cleanup. 2015-05-16 10:05:22 +02:00
James Cole
d22a6c019c Fixed lots of chart references. 2015-05-16 09:57:31 +02:00
James Cole
a0cb1b9d9e Clean up and split chart controllers 2015-05-16 09:41:14 +02:00
James Cole
a5294c62ea Renamed a method. 2015-05-16 09:26:54 +02:00
James Cole
e155d3311c Fixed tests 2015-05-16 09:25:14 +02:00
James Cole
0a372b0daf Cleanup tests 2015-05-16 09:16:32 +02:00
James Cole
69143399d1 Moved some stuff around. 2015-05-16 09:09:52 +02:00
James Cole
3270d3bf96 Cleanup. 2015-05-16 08:14:26 +02:00
James Cole
3896a66122 Fixed tests. 2015-05-16 08:09:15 +02:00
James Cole
b94781aef1 Some optimisations. 2015-05-16 08:05:04 +02:00
James Cole
bed1adc367 Fixed budget. 2015-05-16 07:56:15 +02:00
James Cole
ae54497efa Differ between shared and normal transactions (not build yet). 2015-05-16 07:49:02 +02:00
James Cole
06b747c221 Some cleanup and translations. 2015-05-16 07:28:58 +02:00
James Cole
f159beee0d Fixed preferences tests. 2015-05-15 23:24:55 +02:00
James Cole
49d7dea086 Fixed some coverage. 2015-05-15 23:02:42 +02:00
James Cole
3e65733dc5 Small fix in report view [skip ci] 2015-05-15 22:12:31 +02:00
James Cole
cc375d58bb Fixed tests. 2015-05-15 22:06:52 +02:00
James Cole
911c7c662a Expanded reports. 2015-05-15 22:00:00 +02:00
James Cole
aae003be33 Some more cleaning up and fixing 2015-05-15 21:01:24 +02:00
James Cole
aede03d8b2 Some more layout changes. 2015-05-15 20:43:50 +02:00
James Cole
f0f5ada7de More changes to reports. 2015-05-15 20:38:39 +02:00
James Cole
58365121a3 Fixed tests. 2015-05-15 20:15:58 +02:00
James Cole
d5a154d2e6 Cleaned up reports and associated views. 2015-05-15 20:07:51 +02:00
James Cole
b20f369aef Some new tests. 2015-05-15 18:39:59 +02:00
James Cole
abb8aa0b29 Merge branch 'feature/translations' into develop 2015-05-15 18:38:26 +02:00
James Cole
5368a0f1d7 Some new translations. 2015-05-14 19:44:20 +02:00
James Cole
d3897eece7 This should fix the tests on the translations branch. 2015-05-14 18:15:31 +02:00
James Cole
a82b829da9 More translations. 2015-05-14 18:00:56 +02:00
James Cole
9f5058e81a Some new translations. 2015-05-14 17:52:50 +02:00
James Cole
5b19263720 Some more [skip ci] 2015-05-14 16:43:12 +02:00
James Cole
9d5a0db0d9 [skip ci] 2015-05-14 16:36:08 +02:00
James Cole
4bd8a7014f Count things [skip ci] 2015-05-14 16:35:41 +02:00
James Cole
353e96d951 Better (and translated) delete forms. [skip ci] 2015-05-14 16:32:35 +02:00
James Cole
149a6f92b0 Translations [skip ci] 2015-05-14 15:56:23 +02:00
James Cole
d66426c137 Nieuw vertalingen [skip ci] 2015-05-14 15:53:56 +02:00
James Cole
4fc9966392 Chart translations [skip ci] 2015-05-14 13:43:58 +02:00
James Cole
417766f0db Various date localisation. [skip ci] 2015-05-14 13:41:21 +02:00
James Cole
de9ac97887 Also english. [skip ci] 2015-05-14 13:19:26 +02:00
James Cole
6be42f112a Charts and titles in Dutch. [skip ci] 2015-05-14 13:17:53 +02:00
James Cole
3895ae63c7 Some translations for lists [skip ci] 2015-05-14 13:00:43 +02:00
James Cole
607d416d54 Better translation for 'balance' [skip ci] 2015-05-14 12:11:56 +02:00
James Cole
038693dc86 More index translations [skip ci] 2015-05-14 12:10:42 +02:00
James Cole
cc9be13544 Added a bread crumb [skip ci] 2015-05-14 11:50:48 +02:00
James Cole
9c1474087f Forgot one [skip ci] 2015-05-14 11:50:04 +02:00
James Cole
831de2bcf4 New menu translations [skip ci] 2015-05-14 11:48:59 +02:00
James Cole
eb687333bb Small edits to buttons and others. [skip ci] 2015-05-14 11:31:54 +02:00
James Cole
5cc7966d54 Some new form things. [skip ci] 2015-05-14 11:25:43 +02:00
James Cole
d1a34e7a6f Breadcrumbs translated to English. [skip ci] 2015-05-14 11:22:20 +02:00
James Cole
d63d791717 Translated all bread crumbs to Dutch. [skip ci] 2015-05-14 11:17:56 +02:00
James Cole
015570c741 Small translations as a basic start [skip ci] 2015-05-14 10:26:15 +02:00
James Cole
8400ebc9c6 Added a language test, added Dutch basic file. [skip ci] 2015-05-14 10:03:57 +02:00
James Cole
9f99e7c0af Edit and set language [skip ci] 2015-05-14 09:59:30 +02:00
James Cole
392c1fc399 Add language selector to preferences [skip ci] 2015-05-14 09:56:41 +02:00
James Cole
d3cea7a89c Add new supported languages [skip ci] 2015-05-14 09:52:58 +02:00
James Cole
1dcf7407e6 Cleanup [skip ci] 2015-05-14 09:51:54 +02:00
James Cole
d543c033a3 Small fixes to translations. 2015-05-14 09:50:07 +02:00
James Cole
aaa186be5e Merge branch 'release/3.4.0.6' 2015-05-14 09:21:23 +02:00
James Cole
2054b5b3dd Merge branch 'release/3.4.0.6' into develop 2015-05-14 09:21:23 +02:00
James Cole
98ae5b0ca0 New read me. 2015-05-14 09:21:12 +02:00
James Cole
36c8171d0f Clean up and tests. 2015-05-14 09:01:10 +02:00
James Cole
3603eb94cc Different budget query [skip ci] 2015-05-14 08:08:25 +02:00
James Cole
0e068d4ccf Fixed some tests. 2015-05-13 21:37:11 +02:00
James Cole
199f348ff4 Smaller mobile pages. 2015-05-13 21:32:33 +02:00
James Cole
b22655fb7c Fix helper 2015-05-13 21:32:27 +02:00
James Cole
06cc9618ba Some new tests 2015-05-13 21:32:21 +02:00
James Cole
b9019c8c7f Smaller screens update [skip ci] 2015-05-13 06:34:17 +02:00
James Cole
77e133e67c Some cleaning up for mobile screens [skip ci] 2015-05-13 06:31:32 +02:00
James Cole
571e7df807 Some tiny optimisations. 2015-05-12 20:51:03 +02:00
James Cole
22f4d2979a Added some more ignores, edited some middleware. 2015-05-11 22:12:53 +02:00
James Cole
e46e366694 Added some tests to cover an event. 2015-05-11 21:45:31 +02:00
James Cole
7b4bc23815 Merge branch 'release/3.4.0.5' 2015-05-10 19:18:57 +02:00
James Cole
9ca79f767c Merge branch 'release/3.4.0.5' into develop 2015-05-10 19:18:57 +02:00
James Cole
274dba7408 Update read me. 2015-05-10 19:18:49 +02:00
James Cole
31708ca29e Ignore some code. 2015-05-10 19:18:43 +02:00
James Cole
671b025588 More ignore stuff. 2015-05-10 13:40:29 +02:00
James Cole
a7956e4856 Adding lots of ignore statements because testing the models is pointless. 2015-05-10 13:22:00 +02:00
James Cole
355862025a Auth and password controller. 2015-05-10 13:06:02 +02:00
James Cole
a2a39ee0f8 Ignore piggy bank part. 2015-05-10 09:35:42 +02:00
James Cole
ec8e39c16f Fixed currency tests. 2015-05-10 09:26:44 +02:00
James Cole
88f714999e Add test to get full coverage. 2015-05-10 08:53:49 +02:00
James Cole
c0c2aa3be0 Fixed one test. 2015-05-10 08:49:15 +02:00
James Cole
822044820e Ignored more files. 2015-05-10 08:26:42 +02:00
James Cole
6ffc182142 Ignore lots of code in test coverage. 2015-05-10 08:08:07 +02:00
James Cole
3d54a78573 Tag repository tests 2015-05-10 07:48:33 +02:00
James Cole
8ddf7d953a Ignore constructor. 2015-05-10 07:09:21 +02:00
James Cole
8b9e9ad103 Tests for reminder repository. 2015-05-10 07:07:17 +02:00
James Cole
5737224c40 Simplified translations [skip ci] 2015-05-09 22:42:45 +02:00
James Cole
ec9aacbcae More new tests. 2015-05-09 22:30:16 +02:00
James Cole
9395454997 Small optimalizations [skip ci] 2015-05-09 19:27:25 +02:00
James Cole
66198a8d98 Expanded bread crumb [skip ci] 2015-05-09 19:23:37 +02:00
James Cole
96ed9a4256 Finished journal repository. 2015-05-09 18:30:58 +02:00
James Cole
10e54b2263 Tested part of the journal repository. 2015-05-09 18:11:48 +02:00
James Cole
cf00922ad2 Merge branch 'release/3.4.0.4' 2015-05-09 15:13:20 +02:00
James Cole
84e8e007a5 Merge branch 'release/3.4.0.4' into develop 2015-05-09 15:13:20 +02:00
James Cole
d07b2e773b Update read me 2015-05-09 15:13:14 +02:00
James Cole
506ef7b0b9 Covered currency repository. 2015-05-09 15:11:12 +02:00
James Cole
2cd5dae8e2 New read me [skip ci] 2015-05-09 15:08:56 +02:00
James Cole
a1cd49c111 First attempt at translations. 2015-05-09 13:56:03 +02:00
James Cole
aca2973aef Experimental chart [skip ci] 2015-05-09 13:55:07 +02:00
James Cole
0a7a691c95 Experimental chart [skip ci] 2015-05-09 13:53:58 +02:00
James Cole
72906a7afd Experimental chart [skip ci] 2015-05-09 13:52:33 +02:00
James Cole
d1a4a83570 Covered category repository. 2015-05-09 13:14:02 +02:00
James Cole
e0396b29e8 Add GA beacon [skip ci] 2015-05-09 10:43:37 +02:00
James Cole
536833cfe0 Fixed tests. 2015-05-09 10:25:52 +02:00
James Cole
317b02d1b9 Finished budget repository tests. 2015-05-09 10:23:13 +02:00
James Cole
75e279ea0d Update read me [skip ci] 2015-05-09 09:17:09 +02:00
James Cole
dc2ad21f4c Updated read me [skip ci] 2015-05-09 09:15:39 +02:00
James Cole
484d49aae1 Fixed tests 2015-05-09 09:15:27 +02:00
James Cole
ca39438ad4 Small update to the read me. [skip ci] 2015-05-09 09:11:54 +02:00
James Cole
49a65ebff4 New budget repository tests. 2015-05-09 09:05:37 +02:00
James Cole
befdc05084 Rewrote read me. [skip ci] 2015-05-08 19:34:03 +02:00
James Cole
1fbffe761b Merge branch 'release/3.4.0.3' into develop 2015-05-08 17:35:03 +02:00
James Cole
36aad379ff Merge branch 'release/3.4.0.3' 2015-05-08 17:35:02 +02:00
James Cole
540cfa072e Update read me. 2015-05-08 17:34:54 +02:00
James Cole
3b049c15cc Updated composer.json [skip ci] 2015-05-08 17:15:16 +02:00
James Cole
3e93ed0a17 Small JS fix. [skip ci] 2015-05-08 17:13:49 +02:00
James Cole
d7d9358136 Fix sorting [skip ci] 2015-05-08 17:04:24 +02:00
James Cole
5cf0939ff9 Fixed sorting [skip ci] 2015-05-08 17:03:20 +02:00
James Cole
8dc6f91d3c Add sort options. [skip ci] 2015-05-08 17:00:39 +02:00
James Cole
a3a25db230 New tests. 2015-05-08 16:44:57 +02:00
James Cole
c06f18c815 Some new tests 2015-05-08 14:00:49 +02:00
James Cole
6802f04036 First two tests for bill repository. 2015-05-08 12:50:39 +02:00
James Cole
beeccdf345 New (incomplete) tests [skip ci] 2015-05-08 12:44:42 +02:00
James Cole
58241ed39d Covered account repository. 2015-05-08 12:42:12 +02:00
James Cole
31128020f0 Merge branch 'release/3.4.0.2' 2015-05-08 07:57:06 +02:00
James Cole
6c48afc37b Merge branch 'release/3.4.0.2' into develop 2015-05-08 07:57:06 +02:00
James Cole
7a2f169dfc Push new version. 2015-05-08 07:56:55 +02:00
James Cole
ed910b99a7 Update travis configuration [skip ci] 2015-05-08 07:48:04 +02:00
James Cole
54195c0826 Updated tests. 2015-05-08 07:39:05 +02:00
James Cole
cefbbcd1df Fixed some tests. 2015-05-08 07:27:29 +02:00
James Cole
cc01592085 Cover some more account repository. 2015-05-08 06:01:39 +02:00
James Cole
5a98a5252d Added tests. 2015-05-07 21:26:00 +02:00
James Cole
184e8b1132 Some new tests. 2015-05-07 20:56:27 +02:00
James Cole
2b6b896c2e Some more coverage. 2015-05-06 18:09:45 +02:00
James Cole
96d06b7a93 Added incomplete tests. 2015-05-05 22:46:28 +02:00
James Cole
f54f1611b5 First tests for account repository. 2015-05-05 20:46:13 +02:00
James Cole
69ad757e8b Lazily remove todo's [skip ci] 2015-05-05 13:03:39 +02:00
James Cole
e0beb796ad Some cleaning up [skip ci] 2015-05-05 13:03:04 +02:00
James Cole
f331e7d820 Removed unnecessary imports (use statements) [skip ci] 2015-05-05 12:57:27 +02:00
James Cole
cbb62d3d78 Added new line at the end of files. [skip ci] 2015-05-05 12:51:57 +02:00
James Cole
c85bc59c1d Merge branch 'release/3.4.0.1' into develop 2015-05-05 12:35:23 +02:00
James Cole
8081eeb007 Merge branch 'release/3.4.0.1' 2015-05-05 12:35:22 +02:00
James Cole
56f91bd10d Increment version. 2015-05-05 12:35:11 +02:00
James Cole
8e20b78731 Cleanup. 2015-05-05 10:30:39 +02:00
James Cole
23a09b7081 Code cleanup. 2015-05-05 10:23:01 +02:00
James Cole
67fdd27499 Various code cleanup [skip ci] 2015-05-05 07:51:02 +02:00
James Cole
e1941daedd Updated phpdoc. [skip ci] 2015-05-05 07:48:34 +02:00
James Cole
f28bc568a4 Some cleanup [skip ci] 2015-05-05 07:43:16 +02:00
James Cole
f24cfe39aa Expanded some tests. 2015-05-05 07:41:30 +02:00
James Cole
59d2bf3f79 Covered transaction controller. 2015-05-05 07:28:04 +02:00
James Cole
3176e54614 Partial coverage of the transaction controller. 2015-05-04 23:46:14 +02:00
James Cole
eb090f7265 Better factory. 2015-05-04 22:33:52 +02:00
James Cole
6d3a9bfd18 Some cleaning up 2015-05-04 22:33:03 +02:00
James Cole
76f08b7acb Full coverage for chart controller. 2015-05-04 19:28:49 +02:00
James Cole
1ff99346aa Update chart [skip ci] 2015-05-04 18:51:51 +02:00
James Cole
369695ab32 Update chart [skip ci] 2015-05-04 18:51:38 +02:00
James Cole
7e23dd1d66 Update composer.lock [skip ci] 2015-05-04 18:45:32 +02:00
James Cole
0205d3fc5c Overspent transactions have a separate colour [skip ci] 2015-05-04 18:45:20 +02:00
James Cole
4660cf2ad5 Fixed a bug in the display of the current currency code. 2015-05-03 16:16:43 +02:00
James Cole
e26d08d674 Update git ignore. [skip ci] 2015-05-03 16:14:15 +02:00
James Cole
0932bf2797 Don't need these files [skip ci] 2015-05-03 16:13:38 +02:00
James Cole
f560fc6d76 Covered search controller. 2015-05-03 15:55:19 +02:00
James Cole
aa6209af00 Covered tag controller. 2015-05-03 15:00:39 +02:00
James Cole
4a51176193 General cleanup. 2015-05-03 12:58:55 +02:00
James Cole
bb84f7a434 Fixed parameter order [skip ci] 2015-05-03 12:54:39 +02:00
James Cole
48168b1ef0 Covered report controller. 2015-05-03 11:02:34 +02:00
James Cole
8281c7c83e Don't escape currency symbol [skip ci] 2015-05-03 10:11:16 +02:00
James Cole
a07c1e3c71 See code. [skip ci] 2015-05-03 10:07:18 +02:00
James Cole
0766bb31fe Better amount formatting [skip ci] 2015-05-03 10:03:50 +02:00
James Cole
ff4472c1a5 FormatAmountPlain is HTML safe [skip ci] 2015-05-03 10:01:38 +02:00
James Cole
17424740e5 Show plain amount instead of coloured amounts. [skip ci] 2015-05-03 10:00:47 +02:00
James Cole
dad0b2fcd3 Show plain amount instead of coloured amounts. [skip ci] 2015-05-03 10:00:03 +02:00
James Cole
c48dbf030f Covered the reminder controller. 2015-05-03 09:55:22 +02:00
James Cole
617808d603 Covered profile controller with tests. 2015-05-03 09:19:14 +02:00
James Cole
845149deee Boxes are empty, so even when it's zero, place the amount. 2015-05-03 08:56:44 +02:00
James Cole
1a9e009327 Merge branch 'release/3.4' into develop 2015-05-02 23:51:45 +02:00
James Cole
ae90815708 Merge branch 'release/3.4' 2015-05-02 23:51:44 +02:00
James Cole
1c460343b7 New version! 2015-05-02 23:51:34 +02:00
James Cole
26079622f9 Fixed JSON controller tests. 2015-05-02 23:39:39 +02:00
James Cole
06c6d6096f Fixed coverage. 2015-05-02 23:28:04 +02:00
James Cole
c8183aea51 Format amount [skip ci] 2015-05-02 22:50:40 +02:00
James Cole
7531134ad2 Some tag related fine tuning. 2015-05-02 22:41:32 +02:00
James Cole
cd0c6439c2 Delete tags now possible. 2015-05-02 22:30:59 +02:00
James Cole
c918c93f51 Forget me own head next. [skip ci] 2015-05-02 22:13:37 +02:00
James Cole
97d3bd68ed Show balance act tags. 2015-05-02 22:12:26 +02:00
James Cole
75f1e034ae Fixed menu. [skip ci] 2015-05-02 22:09:21 +02:00
James Cole
8e72f218f1 Show HTML 2015-05-02 22:05:57 +02:00
James Cole
d643e05c5a Basic amount format fix. 2015-05-02 22:05:18 +02:00
James Cole
fea44834d0 Fixed test to match fixed controller. 2015-05-02 21:22:27 +02:00
James Cole
195a2d7523 Removed all the old views. 2015-05-02 21:18:04 +02:00
James Cole
b2fd346ef8 Merge branch 'feature/twig' into develop 2015-05-02 21:16:21 +02:00
James Cole
1ff8b62cb7 And now with actual coverage. 2015-05-02 19:44:31 +02:00
James Cole
c7ae15a41a This should fix all twig tests. Let's find out! 2015-05-02 19:44:12 +02:00
James Cole
efe6f59f79 Last templates. Should cover everything. [skip ci] 2015-05-02 19:19:47 +02:00
James Cole
8e31d0491d Fixed search [skip ci] 2015-05-02 18:30:59 +02:00
James Cole
73d4a10351 Fixed reports [skip ci] 2015-05-02 18:26:55 +02:00
James Cole
81d9d4dbc7 Various files updated to twig [skip ci] 2015-05-02 13:20:49 +02:00
James Cole
184ec13f99 Fixed bills [skip ci] 2015-05-02 12:51:02 +02:00
James Cole
dee0422eff Fix preferences [skip ci] 2015-05-02 12:22:19 +02:00
James Cole
81a2975f1a Show piggy banks [skip ci] 2015-05-02 11:32:45 +02:00
James Cole
5cd2ef4a5e Some generic templates and the first piggy bank ones [skip ci] 2015-05-02 10:53:54 +02:00
James Cole
466c2a68c2 Add delete form [skip ci] 2015-05-02 10:42:41 +02:00
James Cole
0fb9fba531 New currency routes 2015-05-02 10:40:20 +02:00
James Cole
356dd2c6cd Creat / edit / index [skip ci] 2015-05-02 10:37:16 +02:00
James Cole
32c4661233 Fixed no budget / no category bread crumb [skip ci] 2015-05-02 09:49:37 +02:00
James Cole
a245b504ec Fixed bread crumbs. 2015-05-02 09:31:57 +02:00
James Cole
a2f5fbdfd3 Working on two more views [skip ci] 2015-05-02 09:29:34 +02:00
James Cole
04be26adc5 Fixed title [skip ci] 2015-05-02 09:26:20 +02:00
James Cole
be0adb7cf2 Create / edit category 2015-05-02 09:25:45 +02:00
James Cole
84fd92bf5a Categories [skip ci] 2015-05-02 09:21:42 +02:00
James Cole
ee4e061739 Removed code from budget index [skip ci] 2015-05-02 09:21:32 +02:00
James Cole
4a2b01cd9a Menu fixes [skip ci] 2015-05-02 09:16:17 +02:00
James Cole
efdd6460fb Fixed injection. 2015-05-02 09:08:41 +02:00
James Cole
803827e05c Fixed more views. [skip ci] 2015-05-02 09:06:07 +02:00
James Cole
a41d5e9ab3 New budget [skip ci] 2015-05-02 08:32:20 +02:00
James Cole
e94333f877 Can view budgets [skip ci] 2015-05-02 08:28:24 +02:00
James Cole
6dbb80d687 Optimisations [skip ci] 2015-05-02 08:09:54 +02:00
James Cole
31a1031624 And delete is fixed. 2015-05-01 23:39:45 +02:00
James Cole
f8e9ce0d52 Can edit as well. 2015-05-01 23:35:35 +02:00
James Cole
11baa968cd Can create accounts. 2015-05-01 23:17:17 +02:00
James Cole
3e5e5b376f Made it almost to the accounts. 2015-05-01 22:44:35 +02:00
James Cole
bda18f296d Optimised Twig extensions. 2015-05-01 20:17:06 +02:00
James Cole
287d110c84 Small bug fix in budget chart. 2015-05-01 18:45:42 +02:00
James Cole
c98275e73a More templates converted to twig. 2015-05-01 18:44:49 +02:00
James Cole
aa573cc951 Fix redirect 2015-05-01 14:32:31 +02:00
James Cole
883d3d86e3 Update a test. 2015-05-01 14:32:26 +02:00
James Cole
fb047bd5f4 Fix migration. 2015-05-01 08:34:53 +02:00
James Cole
66a04d8365 Slightly different chart on index. 2015-05-01 08:34:44 +02:00
James Cole
a0e501f9fd First attempt at implementing Twig. 2015-05-01 08:29:41 +02:00
James Cole
8b40d3346d An attempt at showing tag info. 2015-05-01 06:47:24 +02:00
James Cole
eddf5cd250 Fix button, close #74 2015-05-01 06:38:48 +02:00
James Cole
ee5c534ca3 Took the time to fix the tests. 2015-04-30 17:32:00 +02:00
James Cole
fd4e77ae0f Catch empty tags. 2015-04-28 21:01:54 +02:00
James Cole
b747c50aa3 Fix method to return object, not key. 2015-04-28 21:00:26 +02:00
James Cole
deebdd86a6 And another small JS fix [skip ci] 2015-04-28 20:20:16 +02:00
James Cole
b2db79cc10 Fixed some small CSS / JS problems. 2015-04-28 20:17:31 +02:00
James Cole
bbab370b1e Some new code. 2015-04-28 17:10:52 +02:00
James Cole
db4adf399d Cleaning up. 2015-04-28 15:26:30 +02:00
James Cole
0683c87e52 Small check in tags. 2015-04-28 14:08:58 +02:00
James Cole
3f62b647fc Removed code related to "related transactions". 2015-04-28 13:50:53 +02:00
James Cole
2562a5b30d Don't save all tags unconditionally. 2015-04-28 13:47:13 +02:00
James Cole
e232f2e223 Delete tags 2015-04-28 11:04:46 +02:00
James Cole
21644ff4dd Routes will throw 404's 2015-04-28 11:04:38 +02:00
James Cole
be96a4fce5 Show tags in transaction. 2015-04-28 10:51:56 +02:00
James Cole
a1cabcbed3 Show tag icons. 2015-04-28 10:50:43 +02:00
James Cole
ce933b1f06 Edit and update tags. 2015-04-28 10:36:13 +02:00
James Cole
51ae130922 Fixed the build by adding new migrations for each step. 2015-04-28 09:54:22 +02:00
James Cole
da1bc18a47 Better list for piggy banks. 2015-04-28 09:15:31 +02:00
James Cole
e7165a526b First attempt at basic tag functionality. 2015-04-28 08:58:01 +02:00
James Cole
6081cc399f Small bug fixes and cleaning up. 2015-04-28 08:12:12 +02:00
James Cole
7c5c24e15d Moved edit buttons. 2015-04-26 07:42:55 +02:00
James Cole
e3e55b4347 Moved all create-buttons lower. 2015-04-26 07:39:49 +02:00
James Cole
40d8e7d1ad Fixed a bug where transfers away from a piggy bank's account would not properly reflect the piggy bank. 2015-04-24 12:06:13 +02:00
James Cole
59e23b89f2 Removed unnecessary sort. 2015-04-24 11:54:23 +02:00
James Cole
cc33af8193 Could not set order. 2015-04-24 10:00:56 +02:00
James Cole
0e1e7eb2a9 Merge branch 'release/3.3.9' 2015-04-22 08:08:14 +02:00
James Cole
52a28a7758 Merge branch 'release/3.3.9' into develop 2015-04-22 08:08:14 +02:00
James Cole
3f752d6832 New read me. 2015-04-22 08:08:05 +02:00
James Cole
fe714e9989 Built a routine that will allow you to completely delete an account. 2015-04-22 07:54:56 +02:00
James Cole
0d3213a379 Covered the preferences controller. 2015-04-21 17:19:14 +02:00
James Cole
44056629e8 Use local db instead of constant migrating. 2015-04-20 22:08:24 +02:00
James Cole
54125c05d3 New tests and prep for future runs. 2015-04-20 21:57:20 +02:00
James Cole
7d32e50f25 Mentioned wrong amount. 2015-04-20 20:56:28 +02:00
James Cole
4af9ff49a0 Fixed a bug in the report controller that grouped transactions wrong. 2015-04-20 20:54:55 +02:00
James Cole
23faef845c Merge branch 'release/3.3.8' 2015-04-20 18:07:02 +02:00
James Cole
41dad4091a Merge branch 'release/3.3.8' into develop 2015-04-20 18:07:02 +02:00
James Cole
daf859b977 Updated read me. 2015-04-20 18:06:37 +02:00
James Cole
f47ba6c977 Update example file. 2015-04-20 18:06:21 +02:00
James Cole
4b9b207d92 Removed development references. 2015-04-20 17:59:04 +02:00
James Cole
875cbf66af 1 should be 0 2015-04-19 19:10:53 +02:00
James Cole
412d6d4fd7 Small CSS fix for piggy banks [skip ci] 2015-04-19 17:43:04 +02:00
James Cole
91c6deeb1f Renamed another field. 2015-04-19 14:28:17 +02:00
James Cole
6d1978fd9a Showed the wrong value. 2015-04-19 14:27:08 +02:00
James Cole
52d23b6ef5 Referred to an id which turned out to be a index. 2015-04-19 14:19:25 +02:00
James Cole
0656ccbdd9 Fixed a bug where the query would include deleted transactions. 2015-04-19 13:57:43 +02:00
James Cole
e774ebd0a3 Possible bug in account create thing. [skip ci] 2015-04-18 16:04:21 +02:00
James Cole
edbda32a84 Fix balance. 2015-04-13 21:13:05 +02:00
James Cole
721fa04e3c Added home screen information about piggy banks. 2015-04-13 20:43:58 +02:00
James Cole
9fd8d8915d amount > queryAmount 2015-04-12 10:53:53 +02:00
James Cole
7a9f5ebdd1 Added "what" variable. 2015-04-12 10:22:15 +02:00
James Cole
a3423f0321 Add the correct path to category overview. 2015-04-12 10:19:37 +02:00
James Cole
c37e9a4467 Covered the JSON controller. 2015-04-11 19:59:41 +02:00
James Cole
6157d82a0b time format 2015-04-11 18:52:03 +02:00
James Cole
38b27fec92 Without moment.js 2015-04-11 18:49:57 +02:00
James Cole
c43439bb68 Test for date. 2015-04-11 18:47:37 +02:00
James Cole
8d9561d7a5 Removed data-value. 2015-04-11 18:45:01 +02:00
James Cole
2a72cce3b7 Included date format. 2015-04-11 15:11:45 +02:00
James Cole
d3bbb6fb1f Removed date value. 2015-04-11 15:11:19 +02:00
James Cole
7b6723e9a2 Update date format. 2015-04-11 15:10:29 +02:00
James Cole
1ee741460d Updated empty entries as well. 2015-04-11 15:09:48 +02:00
James Cole
967b0b493b Switched dates around. 2015-04-11 15:07:42 +02:00
James Cole
b53aaf7dde Fixed sort format. 2015-04-11 15:06:10 +02:00
James Cole
714c13bdbf Include moment.js 2015-04-11 15:04:16 +02:00
James Cole
651a4fd3cc Sortable accounts. 2015-04-11 15:01:42 +02:00
James Cole
505aee22bb Sortable categories. 2015-04-11 14:53:22 +02:00
James Cole
ca3d59dc33 Another fix. 2015-04-11 12:51:58 +02:00
James Cole
13890e32a1 Fixed a view and a botched include. 2015-04-11 12:50:56 +02:00
James Cole
df8976eabe Journals that no longer match a bill will be removed. 2015-04-11 12:40:47 +02:00
James Cole
3e01daa172 Query & loop optimizations. 2015-04-11 12:36:17 +02:00
James Cole
f6999f355b Some foreach loop cleaning up. 2015-04-11 12:27:56 +02:00
James Cole
5c06b45eb1 Code cleanup. 2015-04-11 07:32:11 +02:00
James Cole
1802bb967a Moved JSON money boxes to individual functions. 2015-04-11 07:24:07 +02:00
James Cole
d8d92f147f Removed logging, found bug. 2015-04-10 07:29:36 +02:00
James Cole
4a95bdd8ba Added temporary debug to google chart. 2015-04-10 07:25:24 +02:00
James Cole
db5d94d956 Added temporary debug entries. 2015-04-10 07:19:45 +02:00
James Cole
06f2e34bb5 Renamed the amount variable so it stops interfering with another variable 2015-04-10 06:57:39 +02:00
James Cole
2ef7a01945 Fixed a bug where the bill chart and boxes would inaccurately reflect the amount of bills yet to pay. 2015-04-10 06:52:36 +02:00
James Cole
d3f642551d Fixed a small bug in the bill-chart and simplified yet another Json box. 2015-04-09 21:36:58 +02:00
James Cole
490997157e Switched two queries around. 2015-04-09 21:30:35 +02:00
James Cole
2432af7883 Simplified the in and out-box. 2015-04-09 21:29:58 +02:00
James Cole
7abeece3f0 Simplified the "out"-box. 2015-04-09 21:27:35 +02:00
James Cole
3851652821 Renamed various fields from 'amount' to 'queryAmount' to prevent interfering with the getAmountAttribute property. 2015-04-09 21:18:18 +02:00
James Cole
1d67d2250a Renamed various fields from 'amount' to 'queryAmount' to prevent interfering with the getAmountAttribute property. 2015-04-09 21:16:35 +02:00
James Cole
37f40d8637 Renamed various fields from 'amount' to 'queryAmount' to prevent interfering with the getAmountAttribute property. 2015-04-09 21:14:15 +02:00
James Cole
0224d1d59b Accidentally commented out date limits in query. 2015-04-09 21:01:08 +02:00
James Cole
587b94153d Removed some foreach() routines that are no longer necessary now that getAmountAttribute() exists. 2015-04-09 20:58:57 +02:00
James Cole
5124ce0302 Fixed a bug where getAmountAttribute would interfere with queries that contained a "amount"-field. 2015-04-09 20:52:47 +02:00
James Cole
950c4045b0 Fix total savings to accurately reflect end of current period. 2015-04-09 19:10:24 +02:00
James Cole
9c8ba66873 Order categories by name. 2015-04-09 17:54:24 +02:00
James Cole
25d1d1be1b Merge pull request #72 from vbali/feature/savings-total
Add savings total for savings widget on dashboard
2015-04-09 17:47:24 +02:00
James Cole
339c352505 Fixed a bug where categories would be created even though they already existed. 2015-04-09 17:46:47 +02:00
Balazs Varkonyi
c587081fe4 Add savings total for savings widget on dashboard 2015-04-09 11:52:35 +02:00
James Cole
8f9b1b866b Included full home controller tests. 2015-04-07 20:54:43 +02:00
James Cole
ff5ecf6182 More tests. 2015-04-07 19:58:49 +02:00
James Cole
05670cf393 Optimize test code. 2015-04-07 18:52:15 +02:00
James Cole
f10f5d30bf Mock previously unmocked calls. 2015-04-07 18:48:34 +02:00
James Cole
0d336727e8 Automated code cleanup. 2015-04-07 18:26:14 +02:00
James Cole
bf354275b3 Some general cleaning up. 2015-04-07 18:25:21 +02:00
James Cole
1932bf277a More tests 2015-04-07 17:51:22 +02:00
James Cole
192db4bb6e Accidentally included JS twice. 2015-04-07 10:14:20 +02:00
James Cole
701efb943d Lots of new tests. 2015-04-07 10:14:10 +02:00
James Cole
b2674971f1 Updated composer.lock. 2015-04-06 09:20:45 +02:00
James Cole
c907cb4cf1 General cleanup and new (incomplete) tests. 2015-04-06 09:15:59 +02:00
James Cole
bb1462b4d9 Merge branch 'release/3.3.7' 2015-04-05 21:15:01 +02:00
James Cole
1035f0e139 Merge branch 'release/3.3.7' into develop 2015-04-05 21:15:01 +02:00
James Cole
8475757716 Removed iconv() commented code. See other commit. 2015-04-05 21:14:41 +02:00
James Cole
20ffd8d61b New read me. 2015-04-05 21:14:25 +02:00
James Cole
8601428c4c Fixed a bug in the form request that wouldn't accept fairly long names. 2015-04-05 21:12:54 +02:00
James Cole
59998573ee Removed iconv thing that doesn't seem to matter. See screenshot at https://imgur.com/8r26ZZu 2015-04-05 21:12:31 +02:00
James Cole
293cd72001 Add currency tests. 2015-04-05 20:47:19 +02:00
James Cole
22ab9ebb2f Included tests for the category controller. 2015-04-05 19:43:20 +02:00
James Cole
9136e592d3 Included bill controller. 2015-04-05 18:20:06 +02:00
James Cole
ed8e392616 Fixed budget controller tests. 2015-04-05 15:53:03 +02:00
James Cole
e57ce6e644 Test now works. 2015-04-05 15:25:35 +02:00
James Cole
8204e46086 Removed inspiring quotes. 2015-04-05 10:38:53 +02:00
James Cole
9e365d9f80 Mar tests. 2015-04-05 10:36:28 +02:00
James Cole
6b40a933e9 And.. completed the account controller. 2015-04-04 22:53:49 +02:00
James Cole
8520a5002f Another attempt at fixing some tests. I'm probably searching in the wrong direction with this. 2015-04-04 22:27:51 +02:00
James Cole
b38ed06f6e New tests. 2015-04-04 21:52:56 +02:00
James Cole
48427b1143 A mediocre fix for the database failures. 2015-04-04 21:33:36 +02:00
James Cole
5d505f4ed0 Fixed more tests but the factories are not perfect yet. 2015-04-04 21:23:37 +02:00
James Cole
0c02a08954 Merge pull request #65 from vbali/master
Fixes for chart and account creation
2015-04-04 06:50:30 +02:00
Balazs Varkonyi
0221bd0f80 Merge branch 'hotfix/diff–fix' 2015-04-04 01:56:25 +02:00
Balazs Varkonyi
28216cbcb5 Removed merge conflict from CategoryController 2015-04-04 01:56:19 +02:00
Balazs Varkonyi
3e08a8cd6b Merge branch 'hotfix/account-fix' 2015-04-04 01:37:05 +02:00
Balazs Varkonyi
67fafdeef7 Return the new account from firstOrCreateEncrypted 2015-04-04 01:36:55 +02:00
Balazs Varkonyi
cc82505b66 Merge branch 'hotfix/chart-fix' 2015-04-04 01:33:36 +02:00
Balazs Varkonyi
fd5f075f63 Chart fix for accounts with accented letters 2015-04-04 01:31:57 +02:00
James Cole
a115960411 Merge branch 'release/3.3.6'
Conflicts:
	app/Http/Controllers/CategoryController.php
2015-04-03 23:31:29 +02:00
James Cole
e9fa4ca816 New version in read me. 2015-04-03 23:30:54 +02:00
James Cole
75d92bc7f0 Allow FF to send events. 2015-04-03 23:22:23 +02:00
James Cole
74aa6e911e Make boxes respond to unpaid / paid credit card bills. 2015-04-03 23:10:51 +02:00
James Cole
9d000c1898 Added amount because debug. 2015-04-03 23:05:50 +02:00
James Cole
b2254875b2 Expanded to credit cards. 2015-04-03 22:54:21 +02:00
James Cole
78d04230d5 New CC help text. 2015-04-03 21:25:04 +02:00
James Cole
1c04477393 Support credit cards (in name only). 2015-04-03 21:12:54 +02:00
James Cole
2a9679c94e Textual fix in bill [skip ci] 2015-04-03 21:05:41 +02:00
James Cole
6009f8ecde Better chart for bills. 2015-04-03 21:05:01 +02:00
James Cole
35cdbec70a Clean up for budget limits. 2015-04-03 19:39:36 +02:00
James Cole
0faef542c1 Fixed a bug in the budget controller. 2015-04-03 19:11:55 +02:00
James Cole
8b085af6a1 First attempt at account controller::index. 2015-04-03 12:14:40 +02:00
James Cole
e3b11a9eb2 New test for edit form that is more inclusive. 2015-04-03 09:30:44 +02:00
James Cole
72fc88f3c6 Even more tests. 2015-04-03 08:55:24 +02:00
James Cole
a5b759f268 Updates TestCase.php 2015-04-03 08:37:53 +02:00
James Cole
6a9ffae25d New tests and factories. 2015-04-03 08:31:50 +02:00
James Cole
64c031c7fe Small updates [skip ci] 2015-04-03 07:44:44 +02:00
James Cole
720926c50d Tests now run without a database, as they should. 2015-04-03 07:33:18 +02:00
James Cole
36ec974284 Add heavy but working migrate routine. Will fix the tests but must be optimised. Also, should not be necessary. 2015-04-02 22:51:00 +02:00
James Cole
cff77c39e2 Update travis-ci and composer.lock and composer.json 2015-04-02 22:46:50 +02:00
James Cole
056a0a1736 Smaller boxes. 2015-04-02 22:43:12 +02:00
James Cole
f301da83c6 Fixed the tests. 2015-04-02 22:39:31 +02:00
James Cole
5362231efa Ignore virtual balance in select places. 2015-04-01 19:46:16 +02:00
James Cole
4bb14cad73 Allow virtual balance to be ignored. 2015-04-01 19:45:13 +02:00
James Cole
7f5188f5a4 Added something fancy called "virtual balance". 2015-04-01 19:42:14 +02:00
James Cole
a80b7aac6c Fix more redirections. 2015-04-01 18:59:34 +02:00
James Cole
83f32478fa Fixed more redirections. 2015-04-01 09:43:19 +02:00
James Cole
7578ec6801 Fix redirections in budget. 2015-04-01 09:40:19 +02:00
James Cole
e14a32f76f Also fix delete/destroy redirection routine. 2015-04-01 09:23:51 +02:00
James Cole
58faa189ac Can now actually store transactions without an expense / revenue account. 2015-04-01 09:17:07 +02:00
James Cole
9b4f87d44a Fix checkbox for edit screen. 2015-04-01 09:16:51 +02:00
James Cole
7830a64170 Fix redirect. 2015-04-01 09:16:41 +02:00
James Cole
8f0fa02107 Better redirection for new transactions. 2015-04-01 09:12:49 +02:00
James Cole
e000fb5d80 Optimized decryption. 2015-03-31 22:46:11 +02:00
James Cole
566fadad15 Add decryption routine. 2015-03-31 21:18:22 +02:00
James Cole
cf23858c10 Gokje. 2015-03-31 20:52:48 +02:00
James Cole
216a223617 Fix in year list. 2015-03-31 20:49:02 +02:00
James Cole
638f38d823 New flush method. 2015-03-31 20:46:37 +02:00
James Cole
98ee70f04e Fix range thing. 2015-03-31 20:45:06 +02:00
James Cole
b365db5a4b New hidden id field. 2015-03-31 20:39:28 +02:00
James Cole
02e55496df Remove reminders when piggy bank is reminded. 2015-03-31 20:22:51 +02:00
James Cole
e11e53913a Some new code + GA 2015-03-31 19:21:49 +02:00
James Cole
f8a5fb4225 Fixed tests. 2015-03-31 17:49:47 +02:00
James Cole
3a49450461 Made sure migrations can be rolled back. 2015-03-31 15:38:44 +02:00
James Cole
3c375fb955 Remove build stuff because sqlite does not work with change things. 2015-03-31 15:24:13 +02:00
James Cole
011fea2cc6 Fix encryption in home chart. 2015-03-31 15:10:22 +02:00
James Cole
a079eec2cb Better unicity for objects. 2015-03-31 14:16:25 +02:00
James Cole
776b37f4ea Clean up some code, optimise the 503 error. 2015-03-30 21:24:56 +02:00
James Cole
a4d8bbe3da Fixed a bug where certain types of accounts could not be validated. 2015-03-30 20:16:33 +02:00
James Cole
72166743fa Merge branches 'develop' and 'develop' of https://github.com/JC5/firefly-iii into develop 2015-03-30 20:08:40 +02:00
James Cole
c4312c0b11 Extra large code cleanup. 2015-03-30 20:08:27 +02:00
James Cole
38ba645415 Add hidden-xs class. 2015-03-30 09:23:18 +02:00
James Cole
ac12a47071 Hide inactive budgets when there are none. 2015-03-29 21:29:37 +02:00
James Cole
bea321939e Code rearrange and optimise. 2015-03-29 21:27:51 +02:00
James Cole
210f84b6ea Allow edit from budget overview, and allow changing of active setting. 2015-03-29 21:27:13 +02:00
James Cole
d4c642741f Fixed division by zero. 2015-03-29 21:09:33 +02:00
James Cole
e6b1b58379 Enable inactive budgets. 2015-03-29 19:50:29 +02:00
James Cole
8d982c1a90 Some extensions. 2015-03-29 19:44:59 +02:00
James Cole
be10e836dc Updated composer.lock 2015-03-29 19:40:22 +02:00
James Cole
9be05e7e17 Small optimisations. 2015-03-29 18:28:49 +02:00
James Cole
bd96b2819f Removed double code. 2015-03-29 12:32:00 +02:00
James Cole
f601af3da0 Cleaned up report controller. 2015-03-29 12:25:46 +02:00
James Cole
70a01c082b Removed some double code. 2015-03-29 12:12:06 +02:00
James Cole
bcf066ead7 Cleaned up some double code. 2015-03-29 11:51:26 +02:00
James Cole
24dd3578ed Merge branch 'release/3.3.5' into develop 2015-03-29 08:43:55 +02:00
James Cole
d5c39d54d8 Merge branch 'release/3.3.5' 2015-03-29 08:43:54 +02:00
James Cole
6e3f6abc67 New read me. 2015-03-29 08:43:46 +02:00
James Cole
463201df2c New gitignore. 2015-03-29 08:43:03 +02:00
James Cole
a7501c396f Renamed some methods. 2015-03-29 08:24:56 +02:00
James Cole
4c8bc49a7e Add newlines. 2015-03-29 08:22:48 +02:00
James Cole
f254674f88 Add newlines. 2015-03-29 08:21:33 +02:00
James Cole
a97c267378 Added new lines 2015-03-29 08:20:37 +02:00
James Cole
eaa947894b Updated composer.son 2015-03-29 08:20:30 +02:00
James Cole
fb3a26510b Removed some unused use statements. 2015-03-29 08:20:20 +02:00
James Cole
bfe8b14e49 Cleaned up. 2015-03-29 08:18:15 +02:00
James Cole
afb47eb742 Add newlines. 2015-03-29 08:14:32 +02:00
James Cole
ba97f96288 Removed unused use statements. 2015-03-29 08:03:53 +02:00
James Cole
ecbafb8f4b Removed commented out code. 2015-03-29 07:59:18 +02:00
James Cole
12d3800d67 Removed unused use statements. 2015-03-29 07:51:56 +02:00
James Cole
d586b82372 New composer.son file. 2015-03-29 07:45:14 +02:00
James Cole
ba9877c9b4 Add typehints to object parameters 2015-03-29 07:43:20 +02:00
James Cole
907933f3df Removed debug logic and bad operators. 2015-03-29 07:32:24 +02:00
James Cole
2e91d21a88 Add return to form routine to budgets. 2015-03-28 18:22:36 +01:00
James Cole
dca395a018 Merge branch 'release/3.3.4' 2015-03-28 17:45:56 +01:00
James Cole
625070a5b9 Merge branch 'release/3.3.4' into develop 2015-03-28 17:45:56 +01:00
James Cole
f875c7cbf5 Updated read me file. 2015-03-28 17:45:46 +01:00
James Cole
eed88fc103 Don't fail on repeated piggy banks, just log it. 2015-03-28 17:45:15 +01:00
James Cole
6fc54d1d27 Fixed the tests 2015-03-28 07:00:53 +01:00
James Cole
0ef52bf909 Remove recurring transactions [skip ci] 2015-03-28 06:59:43 +01:00
James Cole
95e34af6ef Update script [skip ci] 2015-03-28 06:51:54 +01:00
James Cole
650b99ead2 Ignore apple files. [skip ci] 2015-03-28 06:50:26 +01:00
James Cole
57941a19de Excutable. 2015-03-28 06:48:54 +01:00
James Cole
6157db0b6a Some new tests 2015-03-28 06:48:38 +01:00
James Cole
c9358acf5d Update tests and token replace routine. 2015-03-28 06:25:36 +01:00
James Cole
ed29eb8a5d New lock file. 2015-03-28 06:19:37 +01:00
James Cole
bcf7452312 Some new tests. 2015-03-28 06:19:09 +01:00
James Cole
b9000519e4 Fixed unique piggy check. 2015-03-27 20:20:52 +01:00
James Cole
2694297466 Fixed a bug where start / end would be used incorrectly. 2015-03-27 19:48:55 +01:00
James Cole
53ff5c1490 Wrong operator, 2015-03-27 19:47:31 +01:00
James Cole
32a036b076 Add certainty to chart. 2015-03-27 19:45:47 +01:00
James Cole
aae2ab2693 Unnecessary if statement. 2015-03-27 19:43:53 +01:00
James Cole
4ef23e28a3 Update year report. 2015-03-27 19:43:20 +01:00
James Cole
38beb7f8d2 Fallback. 2015-03-27 19:42:35 +01:00
James Cole
0129a66906 Debug hidden accounts in year reports. 2015-03-27 19:37:00 +01:00
James Cole
45bced7b34 Hide accounts with no activity during a year. 2015-03-27 19:34:37 +01:00
James Cole
7f5a55dffb Small updates to read me. 2015-03-27 19:21:51 +01:00
James Cole
80289df6d3 Capital letter 2015-03-27 18:58:28 +01:00
James Cole
2115c3ced8 Read me 2015-03-27 18:58:11 +01:00
James Cole
1c2d0e6618 Updated read me file 2015-03-27 18:57:49 +01:00
James Cole
ea4f7f79ce Removed more references. 2015-03-27 18:17:15 +01:00
James Cole
b17f8ac311 Removed references to repeated expenses. 2015-03-27 18:15:10 +01:00
James Cole
6870d13b72 Removed repeated expenses. 2015-03-27 18:14:17 +01:00
James Cole
81fa304fd2 Removed repeated expenses. 2015-03-27 18:13:53 +01:00
James Cole
a663ddb0d9 Hide accounts with no activity. 2015-03-27 13:39:12 +01:00
James Cole
f7969afc22 Hide accounts with no activity in budget report. 2015-03-27 13:36:33 +01:00
James Cole
52ce4cd313 Resort array. 2015-03-27 13:25:46 +01:00
James Cole
247175881f Moved some code. 2015-03-27 13:24:04 +01:00
James Cole
fcf5009338 Moved some code around. 2015-03-27 13:20:48 +01:00
James Cole
12542d8f63 Auto fill transaction descriptions. 2015-03-27 13:16:14 +01:00
James Cole
e94194e28b New favicon. 2015-03-27 13:04:53 +01:00
James Cole
115499f3b2 New favicon. 2015-03-27 11:59:07 +01:00
James Cole
12af05b94f Only display budgets when there's money in the envelope or when there's money spent. 2015-03-27 09:43:29 +01:00
James Cole
88b83d8164 Merge branch 'release/3.3.3' into develop 2015-03-27 09:36:04 +01:00
James Cole
fcc22c692a Merge branch 'release/3.3.3' 2015-03-27 09:36:03 +01:00
James Cole
a876e8005c New version. 2015-03-27 09:35:52 +01:00
James Cole
2288e3705a Fixed order view. 2015-03-27 09:29:14 +01:00
James Cole
e8b58154e0 Bug fix. 2015-03-27 09:24:26 +01:00
James Cole
4393475af3 Remove debug. 2015-03-27 09:22:08 +01:00
James Cole
3fc560597c Validation bug. 2015-03-27 09:21:09 +01:00
James Cole
9f9af0b693 Moved to account list. 2015-03-27 08:11:13 +01:00
James Cole
a83fe2caea Correct ordering (everywhere). 2015-03-27 07:32:06 +01:00
James Cole
30c5376217 Fix order. 2015-03-27 07:29:01 +01:00
James Cole
6dddd6629d Thing with order and should fix Travis. 2015-03-27 07:20:32 +01:00
James Cole
f80de12cb5 Fix sorting. 2015-03-26 22:53:34 +01:00
James Cole
544ffca3a5 Sortable transactions. 2015-03-26 22:52:49 +01:00
James Cole
e0730c7b39 Fixed double named accounts. 2015-03-26 18:05:23 +01:00
James Cole
3d59d141c4 Push! 2015-03-26 17:46:08 +01:00
James Cole
ccddc2623d Merge branch 'develop' of github.com:JC5/firefly-iii into develop 2015-03-26 17:45:58 +01:00
James Cole
fcc47b58b4 Return to edit / create screen when user indicates. 2015-03-26 17:45:03 +01:00
James Cole
f67ac2e25e Update AccountController.php 2015-03-26 14:50:49 +01:00
James Cole
26127c9ccf Update AccountController.php 2015-03-26 14:49:02 +01:00
James Cole
d624efa799 Fix registration bug. 2015-03-25 22:30:36 +01:00
James Cole
ed3d40a4e0 Whoops. 2015-03-25 22:29:32 +01:00
James Cole
6e90ce5496 Cant dismiss reminders again. 2015-03-25 19:12:33 +01:00
James Cole
ab851b1be4 Fixed transfers 2015-03-25 17:44:06 +01:00
James Cole
340de53825 Use normal logging. 2015-03-25 17:42:33 +01:00
James Cole
a867b60af0 Update CategoryController.php 2015-03-25 16:14:28 +01:00
James Cole
26eafb0bd2 Update CategoryController.php 2015-03-25 16:13:39 +01:00
James Cole
0dbe44764b Update GoogleChartController.php 2015-03-25 16:00:06 +01:00
James Cole
2159df6802 Update GoogleChartController.php
Fixed chart.
2015-03-25 15:58:37 +01:00
James Cole
23389b9f17 Update FireflyValidator.php
Update uniqueForUser.
2015-03-25 15:56:32 +01:00
James Cole
6d3e3b894a Update AccountFormRequest.php
Update rules to include belongsToUser.
2015-03-25 15:55:39 +01:00
James Cole
55340aefa3 Remove code. 2015-03-24 21:06:45 +01:00
James Cole
94bc751e41 Sum starts at 0. 2015-03-24 21:05:15 +01:00
James Cole
89259c11e2 Fix chart. 2015-03-24 21:04:53 +01:00
James Cole
6bbaf1523c Fixed a bug in relevantOnDate 2015-03-24 21:00:42 +01:00
James Cole
fa3f18b60f Expand log for event. 2015-03-24 20:56:58 +01:00
James Cole
3dc794002f This should catch the missing piggy bank events. 2015-03-24 20:54:25 +01:00
James Cole
f50b133f2e Cleaned up some icons, improved routine for repeated expenses. 2015-03-21 21:33:52 +01:00
James Cole
1d6f6d28c9 Update font in calendar. 2015-03-21 10:29:25 +01:00
James Cole
c913de3c8b Fix percentage. 2015-03-21 08:56:24 +01:00
James Cole
bbc7b54a38 Catch 0 start balance. 2015-03-21 08:55:55 +01:00
James Cole
05fa1b40d1 Support > 100% 2015-03-21 08:53:43 +01:00
James Cole
6a88c8634d Added a block with savings. 2015-03-21 08:51:34 +01:00
James Cole
8ae1efa230 Added type savings account. 2015-03-20 23:17:59 +01:00
James Cole
ab8df4c8ab Fixed css reference. 2015-03-20 22:50:50 +01:00
James Cole
c259a46ed3 Clean up sql codes. 2015-03-20 22:39:07 +01:00
James Cole
5dc0677599 Fixed search sort 2015-03-20 18:30:17 +01:00
James Cole
7ed662ecc2 Fixed search in encrypted entries. 2015-03-20 18:21:14 +01:00
James Cole
4361cc69d4 Update font options in charts. 2015-03-20 15:54:40 +01:00
James Cole
461cbcbc28 Update to use Roboto font. 2015-03-20 13:34:59 +01:00
James Cole
09ae6c488b Fixed a bug where the session date would be edited by a chart. 2015-03-20 08:16:16 +01:00
James Cole
271a0ade26 Add code coverage to phpunit. 2015-03-18 22:24:54 +01:00
James Cole
4b076d227a Touch db so it can be created. 2015-03-18 22:17:18 +01:00
James Cole
3c4e7158a1 Config for test database. 2015-03-18 22:16:00 +01:00
James Cole
0b16765f37 Add sudo: false to enable container based builds. 2015-03-18 21:51:56 +01:00
James Cole
20c2ff3443 Add debug output to phpunit. 2015-03-18 21:43:19 +01:00
James Cole
96f2e598f4 Better position for titles. 2015-03-16 19:03:52 +01:00
James Cole
7374f0f9dd Removed Material Design. 2015-03-16 18:02:52 +01:00
James Cole
ccc44a74a0 Removed debug information. 2015-03-15 19:02:33 +01:00
James Cole
66cd63a68d Fixed a bug. 2015-03-15 18:08:52 +01:00
James Cole
decf7e5485 Set order in title. 2015-03-15 18:02:40 +01:00
James Cole
063c8025aa Allow piggy banks to be ordered. 2015-03-15 18:00:33 +01:00
James Cole
2fa7d2bd56 Add some text alignments. 2015-03-15 14:24:25 +01:00
James Cole
e55e7bce74 Misspelled a class name. 2015-03-15 14:23:26 +01:00
James Cole
f572445a65 Small updates. 2015-03-15 09:34:57 +01:00
James Cole
8b4f656d90 Switched to Google Material design line charts. 2015-03-15 08:38:12 +01:00
James Cole
6c1e093ebd Merge branch 'release/3.3.2' into develop 2015-03-14 22:06:12 +01:00
James Cole
6dd1b4537a Merge branch 'release/3.3.2' 2015-03-14 22:06:11 +01:00
James Cole
39ca9bea72 Update read me. 2015-03-14 22:06:01 +01:00
James Cole
999103277e Updated composer. 2015-03-14 22:05:36 +01:00
James Cole
3cc57ab89c Remove hash routine from user model. 2015-03-14 22:00:57 +01:00
James Cole
4e830079de New icon. 2015-03-14 17:31:17 +01:00
James Cole
ea7231e9fe Update mail config. 2015-03-14 17:25:35 +01:00
James Cole
ddfaca6d0c Cleanup and added some icons. 2015-03-14 17:21:43 +01:00
James Cole
3b11bd0593 Fixed some basic tests. 2015-03-13 08:44:07 +01:00
James Cole
3f89057528 Fixed a bug where the home budget chart would not actually list transactions without a budget. 2015-03-13 07:10:26 +01:00
James Cole
2f1073712f Merge pull request #63 from niekvanderkooy/fix-migrations
Fix migrations
2015-03-13 07:00:55 +01:00
James Cole
678e504c48 Fix charts to match report. 2015-03-10 20:26:52 +01:00
James Cole
e69545fd95 Include shared accounts. 2015-03-10 20:07:02 +01:00
James Cole
a7ed025cd6 Fine tune query. 2015-03-10 20:05:27 +01:00
James Cole
3d8e1f2484 Forgot the javascript. 2015-03-10 20:03:44 +01:00
James Cole
c38c9608da Fine tune query. 2015-03-10 20:01:49 +01:00
James Cole
2396b75e3c Fine tune income. 2015-03-10 20:00:43 +01:00
James Cole
e5c19b7562 Small fixes. 2015-03-10 19:58:05 +01:00
James Cole
114788567d More code for previous. 2015-03-10 19:57:20 +01:00
James Cole
17ae4b7d2a See if we can easily generate reports with shared accounts. 2015-03-10 19:51:24 +01:00
Niek van der Kooy
12d652bd0e We cannot entirely drop the foreign key constraint, since it is originally created (and dropped) in v3.2.1. 2015-03-10 18:25:23 +01:00
Niek van der Kooy
ff1bed97b8 We need to include models we use
Probably some left over L5 migration stuff, since you wouldn't notice it until reversing a migration
2015-03-10 18:24:28 +01:00
Niek van der Kooy
56490f0e84 Fix error when reverting changed migration.
When reverting changed migration, the down would fail because the foreign key constraint has to be dropped before you are able to rename the column.
2015-03-10 18:04:31 +01:00
James Cole
0b028a8923 Correctly order account names. 2015-03-10 17:26:31 +01:00
James Cole
43ac541cb8 Add reminders to top right menu. 2015-03-08 20:27:07 +01:00
James Cole
5218443678 Can now successfully act on reminders. 2015-03-08 20:20:58 +01:00
James Cole
d9028ed9b7 Small optimizations to the reminders 2015-03-08 09:00:04 +01:00
James Cole
9b9bd11ebb Small fix to table fix. 2015-03-07 19:42:45 +01:00
James Cole
07011ec5f7 Tiny chart improvement because I said so 2015-03-07 19:41:56 +01:00
James Cole
c3990ac32f Small updates to icons and code. 2015-03-07 12:34:03 +01:00
James Cole
081ff3ff55 View single reminder. 2015-03-07 09:29:43 +01:00
James Cole
93996ada96 Expanded reminders. 2015-03-07 09:21:06 +01:00
James Cole
a60671d4c1 First stuff for acting on reminders. 2015-03-06 20:33:23 +01:00
James Cole
3f716cc369 First new display of piggy bank reminders. 2015-03-06 17:23:29 +01:00
James Cole
9f23cffd1b Clean up code. 2015-03-06 15:26:21 +01:00
James Cole
07c416cfbf Fix set reminder. 2015-03-06 15:24:36 +01:00
James Cole
389fcc1c8d Update reminder in database. 2015-03-06 15:21:44 +01:00
James Cole
fa07811375 Add logging for debug purposes. 2015-03-06 15:18:07 +01:00
James Cole
fc91a50979 Reimplemented a routine that creates reminders. Cannot act on them yet. 2015-03-06 15:12:07 +01:00
James Cole
f9c518f321 Smaller font for boxes. 2015-03-06 10:10:07 +01:00
James Cole
015b439f0d New icons. 2015-03-06 08:30:15 +01:00
James Cole
0675622508 Experiment with boxes. 2015-03-06 08:20:27 +01:00
James Cole
e9969bdd5f Update the ranges to reflect the current dates. 2015-03-05 21:13:38 +01:00
James Cole
1139f950ed Fixed some views. 2015-03-04 21:11:47 +01:00
James Cole
284732c7a6 Better list for bills. 2015-03-04 20:58:57 +01:00
James Cole
0cb0720d8b No popup when the amount is zero. 2015-03-04 20:57:40 +01:00
James Cole
8ad1ede0c5 Popups in the reports as we've always promised. 2015-03-04 20:47:00 +01:00
James Cole
a349aac8a4 Fix balance thing. 2015-03-04 19:09:57 +01:00
James Cole
83b169c6ef Search related transfers, cleanup. 2015-03-04 16:04:17 +01:00
James Cole
49c37baac5 Update to related manager. 2015-03-04 15:30:44 +01:00
James Cole
8d62088576 Order bills. 2015-03-04 09:44:48 +01:00
James Cole
f5437a17f8 Lots of changes. 2015-03-04 09:42:47 +01:00
James Cole
92af4e5c96 Layout tweaks. 2015-03-04 05:12:05 +01:00
James Cole
0619adb0cd Support any bill in any range. 2015-03-03 17:40:17 +01:00
James Cole
65a5107854 Small layout updates. 2015-03-03 09:35:06 +01:00
James Cole
0fcc1e252b Mail user registration confirmation. 2015-03-03 09:29:02 +01:00
James Cole
4b7f817475 Removed panel for table. 2015-03-03 09:19:16 +01:00
James Cole
0439599971 Layout update. 2015-03-03 09:15:28 +01:00
James Cole
fa344d5308 Do not update when no event connected. 2015-03-03 08:46:14 +01:00
James Cole
f0316f09ed Do not over / undercorrect 2015-03-02 20:29:10 +01:00
James Cole
b1af6bab28 Cleaning up and bug fixing. 2015-03-02 20:05:28 +01:00
James Cole
ad2aebb54d Sort account list. 2015-03-02 15:46:31 +01:00
James Cole
23fc652092 Table border. 2015-03-02 15:45:24 +01:00
James Cole
f0a5756f25 Add a panel-body for the layout. 2015-03-02 15:45:00 +01:00
James Cole
14c7ad201a Paginated the account list. 2015-03-02 15:44:06 +01:00
James Cole
08ca3c89d3 Expanded account view. 2015-03-02 15:27:36 +01:00
James Cole
edda470bf8 Add everything range 2015-03-02 13:19:13 +01:00
James Cole
7183d72e5c Update chart to include other budget repetitions. 2015-03-02 12:50:51 +01:00
James Cole
5e38ebfce5 Merge branch 'feature/date-range' into develop 2015-03-02 12:35:34 +01:00
James Cole
56e36847a5 New code for new date range thing. 2015-03-02 12:35:14 +01:00
James Cole
6dba916d02 New code & css for date range. 2015-03-02 12:04:40 +01:00
James Cole
fd57086ffd Better mostly report lists. 2015-03-02 11:54:20 +01:00
James Cole
d98d366eea Some small bug fixes in the account views. 2015-03-02 11:42:27 +01:00
James Cole
b261b0b447 Shared expense should of course be shared asset. 2015-03-02 11:27:46 +01:00
James Cole
c6042a9053 Try to fix modal dialog for piggy banks. 2015-03-01 19:47:42 +01:00
James Cole
ae1245abec Fixed update transactions. 2015-03-01 19:31:00 +01:00
James Cole
e26d2376fc Fixed piggy bank delete routine. 2015-03-01 19:26:30 +01:00
James Cole
bb36ad64a7 Moved the form. 2015-03-01 13:39:16 +01:00
James Cole
262d4f92d4 Fixed a bug where consecutive payments from one source would not be summed up. 2015-03-01 10:55:20 +01:00
James Cole
675530458c Account show didn't show anything. 2015-03-01 10:44:10 +01:00
James Cole
19e34b460f Update event. 2015-03-01 08:34:59 +01:00
James Cole
dddb8cdbc0 This loops. 2015-03-01 08:25:12 +01:00
James Cole
0d0df5f143 Scan bills when editing and creating journals. 2015-03-01 08:15:24 +01:00
James Cole
d1cf683f57 Some layout and content updates 2015-03-01 07:50:26 +01:00
James Cole
d099c33e5b No more code climate for now. 2015-02-27 21:40:49 +01:00
James Cole
21fb41545b Now with son_path variable. 2015-02-27 21:24:14 +01:00
James Cole
4c56814785 Do code coverage from phpunit. 2015-02-27 21:15:21 +01:00
James Cole
cffe05e22b Add coveralls to composer.json 2015-02-27 21:01:18 +01:00
James Cole
4237850299 Restoring code coverage 2015-02-27 20:52:49 +01:00
James Cole
b5fc36a8e1 Clean up test stuff. 2015-02-27 20:46:39 +01:00
James Cole
4586c1ef52 Removed all test cases. 2015-02-27 20:45:17 +01:00
James Cole
2722f0b749 Merge branch 'release/3.3.1' 2015-02-27 20:42:12 +01:00
James Cole
d6cf7c4872 Merge branch 'release/3.3.1' into develop 2015-02-27 20:42:12 +01:00
James Cole
3aedfed432 Updated version. 2015-02-27 20:42:04 +01:00
James Cole
edeaf13259 New CSS / JS code. 2015-02-27 18:05:40 +01:00
James Cole
c1290c4e9b Forgot to commit one view. 2015-02-27 16:53:06 +01:00
James Cole
b2c1527b17 Lost a lot of stuff along the way. 2015-02-27 16:48:33 +01:00
James Cole
a4a65ea56e Merge branch 'release/3.3' into develop 2015-02-27 16:15:30 +01:00
James Cole
ccf0e1875e Merge branch 'release/3.3' 2015-02-27 16:15:29 +01:00
James Cole
9c009aceaf Updated the readme. 2015-02-27 16:15:16 +01:00
James Cole
da4b1c7276 Merge branch 'laravel5' into develop
Conflicts:
	resources/views/reports/month.blade.php

Upgraded to Laravel 5.
2015-02-27 16:13:36 +01:00
James Cole
add098d5c0 Update example environment file and composer lock. 2015-02-27 16:09:00 +01:00
James Cole
aca096548c Fixed user login and authentication. 2015-02-27 16:08:46 +01:00
James Cole
75aa3abcae Update and create transactions. 2015-02-27 14:27:04 +01:00
James Cole
e685d262cc Sub/addDay routine to fix the account list. 2015-02-27 12:55:24 +01:00
James Cole
d2599d6ef9 Removed a subDay() call that ruined some reports. 2015-02-27 12:54:24 +01:00
James Cole
cd5223d98d Removed a group clause that broke the budget report. 2015-02-27 12:15:58 +01:00
James Cole
7b68d9047d Order budgets by name. 2015-02-27 12:02:14 +01:00
James Cole
9a7ea06d66 Order budgets by name 2015-02-27 11:58:49 +01:00
James Cole
c69ef34ac9 Order accounts by name. 2015-02-27 11:57:47 +01:00
James Cole
021999d05f Ignore .env file. 2015-02-27 11:46:07 +01:00
James Cole
6054430a5e Remove default .env file. 2015-02-27 11:45:47 +01:00
James Cole
8f578ed95a Search controller. 2015-02-27 11:09:23 +01:00
James Cole
fc5c339e27 Repeated expenses. 2015-02-27 11:02:08 +01:00
James Cole
defad3d820 More code. 2015-02-25 21:19:06 +01:00
James Cole
c0f96aa948 Piggy banks 2015-02-25 19:32:33 +01:00
James Cole
f2eae2fc98 Implemented the help. 2015-02-25 16:10:02 +01:00
James Cole
0e4f786978 Fixed currencies. 2015-02-25 15:57:43 +01:00
James Cole
d36b2318fd New code for bills. 2015-02-25 15:19:14 +01:00
James Cole
d83b508bbc Add and remove transactions. 2015-02-24 22:53:38 +01:00
James Cole
5b9c2cdc13 Newly converted code. 2015-02-24 21:10:25 +01:00
James Cole
49066c282a Updates 2015-02-23 21:55:52 +01:00
James Cole
3e28c0c00a Extra report and cleanup. 2015-02-23 21:19:16 +01:00
James Cole
220d689f69 Reports! 2015-02-23 20:25:48 +01:00
James Cole
5a0a28a04c Stuff for categories. 2015-02-22 16:19:32 +01:00
James Cole
b44e69e09b Fixed tests. 2015-02-22 15:45:32 +01:00
James Cole
fcbe10f5ec New code. 2015-02-22 15:40:13 +01:00
James Cole
182fe170fd Up to budgets now! 2015-02-22 09:46:21 +01:00
James Cole
184e9bdaf6 Fixed even more tests! 2015-02-22 08:38:46 +01:00
James Cole
0096f50cde Update month.blade.php
Add decryption routine.
2015-02-21 12:20:42 +01:00
James Cole
460f14deca Some new code. 2015-02-21 12:16:41 +01:00
James Cole
910ad45bee Update test [skip ci] 2015-02-14 17:35:45 +01:00
James Cole
74e319855d Updated the test to be more dynamic. 2015-02-14 17:31:51 +01:00
James Cole
9af0fb4cd5 Update tests 2015-02-14 16:22:33 +01:00
James Cole
185f5cce29 environment files. 2015-02-14 16:13:28 +01:00
James Cole
aca1174566 New git ignore. 2015-02-14 16:11:20 +01:00
James Cole
e791f7fde2 Fixed test. 2015-02-14 15:53:56 +01:00
James Cole
7bba7fcf66 Should fix the test. 2015-02-14 14:31:43 +01:00
James Cole
1d78f98ec8 This should complete the account handler. 2015-02-14 14:25:29 +01:00
James Cole
7ed2e03654 Merge pull request #62 from kilya11/master
Handle foreign keys
2015-02-11 14:29:19 +01:00
Ilya Kil
549e0f3477 Handle foreign keys
Installation fails without these changes
2015-02-11 13:19:24 +01:00
James Cole
7785ec0222 Code cleanup. 2015-02-11 07:35:10 +01:00
James Cole
ca504965f9 Should allow to store new accounts. 2015-02-09 07:56:24 +01:00
James Cole
3841259779 First attempt at storing an account. 2015-02-09 07:23:39 +01:00
James Cole
169d1065cc Removed debug 2015-02-08 09:45:00 +01:00
James Cole
e864f5507a No exit is kind of cheating. 2015-02-08 09:35:09 +01:00
James Cole
434b4ded4a Reimplemented forms, added an overdue fix. 2015-02-08 01:15:15 +01:00
James Cole
3d01669cea Reinstated soft deletes, added first steps for account controller. 2015-02-07 23:19:28 +01:00
James Cole
1499b2cd40 Login and some routes fixed. 2015-02-07 22:50:47 +01:00
James Cole
6b54ef8398 More code. 2015-02-07 13:15:40 +01:00
James Cole
07ad43f7a2 Updated models and tests to match. 2015-02-07 12:15:53 +01:00
James Cole
72e72c60c2 Laravel 4 > Laravel 5 2015-02-07 12:00:31 +01:00
James Cole
f9a242d33e Updated codeception config. 2015-02-07 11:05:56 +01:00
James Cole
b0f43eaa07 Moved C3 handler. 2015-02-07 11:01:47 +01:00
James Cole
b02046b884 Moar packages! 2015-02-07 10:52:51 +01:00
James Cole
864c931ee9 Fixed factory muffin 2015-02-07 10:46:14 +01:00
James Cole
5cd8da6d91 Added factory muffin. 2015-02-07 10:42:40 +01:00
James Cole
4a4671c2ae Add debug info to codeception 2015-02-07 10:39:36 +01:00
James Cole
8de142cd9a Add c3 code coverage. 2015-02-07 10:38:27 +01:00
James Cole
1a42bec51c Database in the right spot. 2015-02-07 10:32:15 +01:00
James Cole
577e38759e Try again. 2015-02-07 10:30:41 +01:00
James Cole
9cdf43a2c9 Commit new env files. 2015-02-07 10:24:54 +01:00
James Cole
62d43c2cb2 Lets see fit his works. 2015-02-07 10:16:14 +01:00
James Cole
2dc67d1674 Added all the old test things. 2015-02-07 08:42:20 +01:00
James Cole
fb1c78c657 Chart re-implemented and added coveralls and other instructions, which will probably not work at all. 2015-02-07 08:23:44 +01:00
James Cole
37e58ac13a Fixed more of the index. 2015-02-07 06:49:24 +01:00
James Cole
de715c14be Some new stuffs. 2015-02-06 21:23:14 +01:00
James Cole
c4d8a0da05 Fixed the range thing 2015-02-06 20:43:19 +01:00
James Cole
1b54b14671 All kinds of new stuff. 2015-02-06 19:33:31 +01:00
James Cole
a92efbc55f Exceptions. 2015-02-06 19:31:38 +01:00
James Cole
1bd02529e0 New resources mostly. 2015-02-06 07:23:26 +01:00
James Cole
bc16298b6e Some updates. 2015-02-06 05:35:00 +01:00
James Cole
804a97cad7 References 2015-02-06 05:14:27 +01:00
James Cole
ab52bdec15 Not changed much 2015-02-06 05:05:40 +01:00
James Cole
ddc3e82c14 Update references 2015-02-06 05:04:06 +01:00
James Cole
57691471bb Updated models and imports. 2015-02-06 05:01:24 +01:00
James Cole
c502dd445b New and old code. 2015-02-06 04:52:16 +01:00
James Cole
ed475b1b9c Database & seeds. 2015-02-06 04:41:00 +01:00
James Cole
df165a817c Fresh L5 installation. 2015-02-06 04:39:52 +01:00
James Cole
d16015d625 Moved all old code for Laravel 5. 2015-02-06 04:27:37 +01:00
James Cole
a4b3bf3ef4 Moved to hidden "stash" directory. 2015-02-06 04:22:46 +01:00
James Cole
6b006853e6 Stash is a directory which will hold pretty much all code before it's implemented into Laravel 5. 2015-02-06 04:21:22 +01:00
James Cole
6001180e29 Capitalisation for code coverage. 2015-02-04 06:25:19 +01:00
James Cole
662fbed1d0 Added a "valid" email address so certain tests go through. 2015-02-04 06:15:14 +01:00
James Cole
19c7e08c5d Code coverage. 2015-02-03 19:40:13 +01:00
James Cole
72f04aaedc Some cleaning up. 2015-02-01 17:20:51 +01:00
James Cole
2998382969 Check if entries have an encrypted description and act accordingly. 2015-02-01 14:56:25 +01:00
James Cole
37fe79944f Reorder bills [skip ci] 2015-02-01 14:52:40 +01:00
James Cole
536735519a Fixed related transaction tests. 2015-02-01 12:31:11 +01:00
James Cole
6b0a711395 Expanded test coverage. 2015-02-01 12:07:06 +01:00
James Cole
13d3d40376 More code cleanup [skip ci] 2015-02-01 09:30:27 +01:00
James Cole
6873336aca More cleanup [skip ci] 2015-02-01 09:08:39 +01:00
James Cole
c2d2eb53e8 Some code cleanup. 2015-02-01 08:51:27 +01:00
James Cole
210d597a48 Close issue #46 2015-01-31 21:10:00 +01:00
James Cole
e41ede0a6b Forgot the return statement 2015-01-31 17:30:41 +01:00
James Cole
4a8b17ac7c Fixed the search for related transfers. 2015-01-31 17:24:26 +01:00
James Cole
1f5f515d72 Cleanup JS. 2015-01-31 15:10:07 +01:00
James Cole
1e6242b89f Updated composer.lock 2015-01-31 15:10:00 +01:00
James Cole
dde09f9f89 Various code cleanup things inspired by Code Climate [skip ci] 2015-01-31 08:51:40 +01:00
James Cole
916d85c3fe Simplified the account opening balance code. 2015-01-31 08:32:00 +01:00
James Cole
b243ed93aa Merge branch 'release/3.2.5' 2015-01-31 06:35:37 +01:00
James Cole
70d28bbf6e Merge branch 'release/3.2.5' into develop 2015-01-31 06:35:37 +01:00
James Cole
3c76da7132 Update version in readme file. 2015-01-31 06:35:19 +01:00
James Cole
3254565c09 Seed only in test [skip ci] 2015-01-31 06:34:31 +01:00
James Cole
cd0033791f New SQL reference for 3.2.5 [skip ci] 2015-01-31 06:34:10 +01:00
James Cole
2427ee44a5 Updated travis to handle SSL errors when communicating with Code climate. 2015-01-31 06:29:45 +01:00
James Cole
ff0e617b2a This triggers CC 2015-01-31 06:21:40 +01:00
James Cole
e6cfe040b5 Clean up some javascript, small fix for the test reporter 2015-01-31 06:11:55 +01:00
James Cole
94e2f9b6dc Updated tests to understand encrypted database content. 2015-01-30 22:43:52 +01:00
James Cole
512b81ad93 Fixed some tests. 2015-01-30 22:32:12 +01:00
James Cole
fc0e76f431 Some new seeds and the ability to search encrypted transaction journals. 2015-01-30 22:24:02 +01:00
James Cole
9da69358e2 Included code for code climate. 2015-01-30 22:09:47 +01:00
James Cole
aa246b0b2b New full set of favicon. 2015-01-30 21:40:37 +01:00
James Cole
6ed649bc8a Update list of what currency support there is in Firefly. 2015-01-30 18:40:30 +01:00
James Cole
725f5b7110 Creating and editing an account now allows the opening balance to be set in a certain currency. Issue #37 2015-01-30 18:22:55 +01:00
James Cole
5a890c5c3a It is now possible to select a different currency if desired (issue #37). 2015-01-30 18:09:13 +01:00
James Cole
7752329b94 Fixed a bug where the rules where too tight in transaction journal. 2015-01-29 18:21:56 +01:00
James Cole
5f48f13890 Exceptions for stupid sqlite. 2015-01-29 17:44:13 +01:00
James Cole
a734e04561 Default value and rename for encrypted field values. 2015-01-29 17:31:18 +01:00
James Cole
5aa1db293f 3.2.5 will once again be capable of encrypting journal descriptions (and more, in the future). 2015-01-29 05:23:31 +01:00
James Cole
f89aee37f5 Fixed a bug where the referer might not be picked up correctly. 2015-01-29 05:11:00 +01:00
James Cole
538018fed1 Should fix query [skip ci] 2015-01-27 19:22:54 +01:00
James Cole
a2327c50ec Should fix query [skip ci] 2015-01-27 19:19:44 +01:00
James Cole
c2711023e2 Updated query, lets see what happens [skip ci] 2015-01-27 18:52:59 +01:00
James Cole
cac30f0b4c Updated code coverage. 2015-01-25 15:29:09 +01:00
James Cole
4bb17019a4 Test transaction views for transactions without budgets and categories. 2015-01-25 13:17:32 +01:00
James Cole
ba2a40bdf3 Removed unused methods. 2015-01-25 12:21:56 +01:00
James Cole
f3460cca49 Ignore methods in code coverage that are not implemented. 2015-01-25 11:36:34 +01:00
James Cole
64ce53ac30 Test for opening balance. 2015-01-25 10:55:15 +01:00
James Cole
a43238360c Update caps. 2015-01-25 10:50:44 +01:00
James Cole
b2cbadf5d8 New chart route. 2015-01-25 10:06:31 +01:00
James Cole
81640ba06d Revamped and simplified form code. 2015-01-25 10:06:19 +01:00
James Cole
9327430484 Small optimalizations. 2015-01-25 08:28:59 +01:00
James Cole
a24c90eae8 Other redirects [skip ci] 2015-01-24 21:27:07 +01:00
James Cole
1d3987ece6 Fixed the tests. 2015-01-24 17:58:03 +01:00
James Cole
83f5b5e293 New budget charts for year report. 2015-01-24 08:54:33 +01:00
James Cole
f231263085 Updated chart, closed magic number issue. 2015-01-24 08:43:35 +01:00
James Cole
4ad67a87f1 Fixed budget charts. 2015-01-24 07:46:57 +01:00
James Cole
b766d93d9a Fixed the account role view. 2015-01-24 07:15:03 +01:00
James Cole
0905ceb1d5 Codeception will not run in hhvm [skip ci] 2015-01-24 07:00:58 +01:00
James Cole
2fbf837354 Closed #40 [skip ci] 2015-01-24 06:56:02 +01:00
James Cole
4bd79c880c Build in hack. 2015-01-24 06:55:42 +01:00
James Cole
4af041e015 Let's see what happens when we run Hack. 2015-01-24 06:52:22 +01:00
James Cole
8dc3e3ec93 Add an actions menu to the account view. 2015-01-23 06:50:40 +01:00
James Cole
f4b68d26d6 Fixed a bug where a deposit would not get linked to a cash account. 2015-01-23 06:45:20 +01:00
James Cole
1887977b92 Small experimental cleaning up. 2015-01-19 07:21:44 +01:00
James Cole
8eb84acf4f Show the view for transactions without a category. 2015-01-19 06:33:30 +01:00
James Cole
1b685da3e3 Code cleanup and query optimisation. 2015-01-18 21:40:00 +01:00
James Cole
406b658801 Code cleanup. 2015-01-18 21:07:40 +01:00
James Cole
bba1ee1264 Last attempt. 2015-01-18 11:18:06 +01:00
James Cole
02b6191d47 Another attempt at catching the sqlite error. 2015-01-18 11:12:17 +01:00
James Cole
c5a3de09cd Catch a sqlite error. 2015-01-18 10:33:01 +01:00
James Cole
0afe2a680e Gave report a subtitle. 2015-01-18 09:50:51 +01:00
James Cole
03e0510c4f Fixed a bug where certain reports would not show incomes from shared accounts. 2015-01-18 09:49:53 +01:00
James Cole
1068dcb8a4 Cleanup and refactor 2015-01-18 09:49:32 +01:00
James Cole
10a93df653 Clean up test data seeder 2015-01-18 09:48:58 +01:00
James Cole
79ff67852f Deleted an old unique index. 2015-01-18 09:48:48 +01:00
James Cole
a36cab969f Code cleanup. 2015-01-18 09:48:36 +01:00
James Cole
45447646fa Code cleanup. 2015-01-18 09:48:29 +01:00
James Cole
8a0f76ab68 Code cleanup. 2015-01-18 09:48:24 +01:00
James Cole
037135e764 A complete gamble on my side to fix a bug where transfers FROM shared accounts were not counted as income. 2015-01-18 00:10:57 +01:00
James Cole
21e89c3b64 Remove composer.lock when running Travis. 2015-01-17 11:31:12 +01:00
James Cole
bd11ec69fa Reinstated test data seeder, fixed the tests. 2015-01-17 10:41:29 +01:00
James Cole
9e2b34bc12 Various cleanup. 2015-01-17 10:06:12 +01:00
James Cole
0faebc290f Suppress warnings. 2015-01-17 10:05:51 +01:00
James Cole
fc0ef4b79d Small optimizations. 2015-01-17 10:05:43 +01:00
James Cole
027b954b50 Cleanup various factories and libraries. 2015-01-17 08:58:49 +01:00
James Cole
33c830a432 Cleaned up seeders. 2015-01-17 08:58:30 +01:00
James Cole
a7887f1e25 Added inspections for all migrations. 2015-01-17 08:58:19 +01:00
James Cole
fa7a59572a Code cleanup for all controllers. 2015-01-17 08:57:55 +01:00
James Cole
d9c2df5b0d Removed unused methods. 2015-01-17 07:33:43 +01:00
James Cole
a854b2c17e Some code cleanup in the account code. 2015-01-17 07:25:44 +01:00
James Cole
7d4006b205 Fixed some bugs while registering users. 2015-01-17 07:14:01 +01:00
James Cole
86ecca6011 Removed weird config values. 2015-01-16 07:11:03 +01:00
James Cole
0ea5cf2caa Merge branch 'master' of github.com:JC5/firefly-iii
Conflicts:
	app/config/app.php
2015-01-16 07:09:46 +01:00
James Cole
a950e02e9b Revert "Cleanup in preparation of an overhaul."
This reverts commit 5662a02a36.
2015-01-16 07:08:56 +01:00
James Cole
9eec6641dd Cleanup in preparation of an overhaul. 2015-01-16 07:08:56 +01:00
James Cole
18f46676fd Bug fix in new accounts. 2015-01-16 07:08:56 +01:00
James Cole
9735ef6d41 Revert "Cleanup in preparation of an overhaul."
This reverts commit 5662a02a36.
2015-01-16 07:07:57 +01:00
James Cole
d3e8ceee00 Cleanup in preparation of an overhaul. 2015-01-14 12:24:08 +01:00
James Cole
144e329eca Merge branch 'release/3.2.4'
Conflicts:
	app/config/app.php
2015-01-13 20:44:40 +01:00
James Cole
21d5420b2a Bug fix in new accounts. 2015-01-13 20:43:54 +01:00
James Cole
3011b5074d Merge branch 'release/3.2.3' 2015-01-13 19:08:33 +01:00
James Cole
83190572c7 New composer.lock 2015-01-10 18:07:39 +01:00
James Cole
9cf9e5f865 Added a missing field. 2015-01-05 20:22:39 +01:00
James Cole
5bdef7f1c7 Added a missing field. 2015-01-05 20:22:19 +01:00
James Cole
ba285a2d2d Added a missing field. 2015-01-05 20:21:43 +01:00
James Cole
0dff371e62 Added a missing field. 2015-01-05 20:20:03 +01:00
James Cole
ce4a2a5851 Added a missing field. 2015-01-05 20:19:34 +01:00
James Cole
2c978dc89a Removed experimental routes. 2015-01-05 17:53:38 +01:00
James Cole
4b8b819109 Redirect update. 2015-01-04 20:50:35 +01:00
James Cole
c230b3a806 This broke the tests. 2015-01-03 18:09:44 +01:00
James Cole
df08b9c5c6 Updated composer.lock 2015-01-03 13:46:53 +01:00
James Cole
eca65376a3 Fixed a route. 2015-01-03 09:25:40 +01:00
James Cole
88e3705636 Do some redirection. 2015-01-02 22:47:34 +01:00
James Cole
5476509ef5 Disabled some seeds, updated some routes. 2015-01-02 22:44:25 +01:00
James Cole
0bd6636453 SQL reference file [skip ci] 2015-01-02 20:04:26 +01:00
James Cole
105894e00d Small bug in budget helper [skip ci] 2015-01-02 19:53:09 +01:00
James Cole
230a319510 Removed files no longer used [skip ci] 2015-01-02 18:52:55 +01:00
James Cole
ae16a2b14f Routes and views for transactions without a budget / category [skip ci] 2015-01-02 18:48:06 +01:00
James Cole
da0c0742bf Covered some more lines of code. 2015-01-02 13:57:40 +01:00
James Cole
61d60a9048 Updated read me [skip ci] 2015-01-02 12:56:07 +01:00
James Cole
3e28e9a016 Merge branch 'release/3.2.2' 2015-01-02 12:53:44 +01:00
James Cole
423f9fefa9 Removed todo entries and made issues instead. [skip ci] 2015-01-02 12:42:29 +01:00
James Cole
5707dc7579 Lots of cleaning up. 2015-01-02 12:38:13 +01:00
James Cole
3be1cdb249 Some cleaning up in the reports. [skip ci] 2015-01-02 11:04:51 +01:00
James Cole
426d3d948c Added newlines [skip ci] 2015-01-02 10:55:59 +01:00
James Cole
9a3aed8038 Moved code to relate transfers to another class. Still needs some work. 2015-01-02 10:53:18 +01:00
James Cole
fb58bf1bf5 Cleaned up some todo entries [skip ci] 2015-01-02 10:01:33 +01:00
James Cole
a6dbd912c6 Code cleanup. 2015-01-02 09:06:44 +01:00
James Cole
65ce277a20 Updated models [skip ci] 2015-01-02 08:59:16 +01:00
James Cole
0b2d423c87 Updated ignore file. 2015-01-02 06:26:57 +01:00
James Cole
da056092fb Code cleanup [skip ci] 2015-01-02 06:26:04 +01:00
James Cole
45aa85d690 Added new lines [skip ci] 2015-01-02 06:24:48 +01:00
James Cole
5c35fee0c2 New lines at end of file [skip ci] 2015-01-02 06:16:49 +01:00
James Cole
24bdc319dd Some refactoring [skip ci] 2015-01-02 06:05:40 +01:00
James Cole
f1dcc41e42 Removed invalid composer.json entry [skip ci] 2015-01-02 06:00:14 +01:00
James Cole
550f301ba2 Code cleanup [skip ci] 2015-01-02 05:52:38 +01:00
James Cole
d9bf4d1c0d Removed c3.php from lib. [skip ci] 2015-01-02 05:37:25 +01:00
James Cole
c3c1a6eb22 Changed permissions [skip ci] 2015-01-02 05:36:49 +01:00
James Cole
2c4454418e Remove possible xsrf [skip ci] 2015-01-02 05:36:05 +01:00
James Cole
e44de572f5 Code cleanup [skip ci] 2015-01-01 23:12:12 +01:00
James Cole
f27919f91b Fixed transaction journal test. 2015-01-01 22:57:15 +01:00
James Cole
ba9968bde0 Fixed a bug in "number between" tests. 2015-01-01 22:53:03 +01:00
James Cole
05ea8216ff Fixed transaction coverage. 2015-01-01 22:51:38 +01:00
James Cole
fa1695672a Cleaning up. 2015-01-01 22:32:25 +01:00
James Cole
ac6f98fc47 First attempt to make the year charts and month reports report the same thing [skip ci] 2015-01-01 21:35:05 +01:00
James Cole
1a1f89f555 First attempt to make the year charts and month reports report the same thing [skip ci] 2015-01-01 21:27:51 +01:00
James Cole
6c3262e176 First attempt to make the year charts and month reports report the same thing [skip ci] 2015-01-01 21:26:40 +01:00
James Cole
b4bdb48f1e First attempt to make the year charts and month reports report the same thing [skip ci] 2015-01-01 21:23:12 +01:00
James Cole
823afe877b First attempt to make the year charts and month reports report the same thing [skip ci] 2015-01-01 21:20:41 +01:00
James Cole
cb8e082414 Fixed the bill tests. 2015-01-01 21:06:24 +01:00
James Cole
98c1fcc68f New content and tests ensure the coverage of all code. 2015-01-01 20:53:36 +01:00
James Cole
8c439a2852 Added debug information [skip ci] 2015-01-01 20:02:02 +01:00
James Cole
50c6109be7 Fixed broken tests. 2015-01-01 19:50:36 +01:00
James Cole
6e362663b5 Clean up content seeder and tests. 2015-01-01 19:35:10 +01:00
James Cole
74c9feb53f More tests! 2015-01-01 13:43:34 +01:00
James Cole
402e8588cf Even more tests! 2015-01-01 13:32:31 +01:00
James Cole
778a42bcc0 More unit tests. 2015-01-01 13:12:05 +01:00
James Cole
584f7ced84 New tests and new configuration for tests. 2015-01-01 12:33:07 +01:00
James Cole
8e892e7ea5 New unit tests to cover missed methods. 2015-01-01 12:06:42 +01:00
James Cole
3386c8b455 More spelling checks and small clean ups. 2014-12-31 17:15:59 +01:00
James Cole
6fa73ee28d Complexity cleanup [skip ci] 2014-12-31 16:45:12 +01:00
James Cole
8ec8042045 Some spell checking [skip ci] 2014-12-31 16:17:43 +01:00
James Cole
cddc123539 Removed dead code. 2014-12-31 09:02:36 +01:00
James Cole
4c2938c5cd New content and a fix for the bill controller. 2014-12-31 08:31:18 +01:00
James Cole
6d03ddadcc Covered the final lines. 2014-12-31 08:11:00 +01:00
James Cole
64311da4b4 Full coverage for home controller 2014-12-31 07:43:33 +01:00
James Cole
0cbb50ae9d Full coverage for user controller. 2014-12-31 07:17:33 +01:00
James Cole
7e96054dc2 Covered everything in the user controller except configuration controlled statements. 2014-12-31 00:57:12 +01:00
James Cole
578298580e Last tests for transaction controller. 2014-12-31 00:25:17 +01:00
James Cole
ee5afaa6bc First tests for transaction controller. 2014-12-30 22:25:30 +01:00
James Cole
15b023d116 Updated composer.lock [skip ci] 2014-12-30 21:04:01 +01:00
James Cole
1ef96c0b4d Finally updated the transaction controller to have some more sensible code. 2014-12-30 21:03:42 +01:00
James Cole
8c3ae40de1 Some refactoring. 2014-12-30 18:44:58 +01:00
James Cole
94fcfacec4 Tests for search [skip ci] 2014-12-30 18:44:49 +01:00
James Cole
ba7c01c6bc Fixed the tests. 2014-12-30 18:25:38 +01:00
James Cole
9f92e1b7bd Some tests and a rename. 2014-12-30 17:55:46 +01:00
James Cole
1f0e692ee2 New tests for the repeated expenses. 2014-12-30 17:27:31 +01:00
James Cole
0acd75a24f Updated tests for help controller. 2014-12-30 15:55:21 +01:00
James Cole
eedf27f8a5 Fixed the tests [skip ci] 2014-12-30 15:24:10 +01:00
James Cole
b451e207e2 Finally implemented repeated expenses properly. [skip ci] 2014-12-30 15:17:01 +01:00
James Cole
c0c37eec7b Most views now show the transaction the current journal/transaction is set in, even if it's not the current default currency. See issue #37 2014-12-30 06:30:20 +01:00
James Cole
89363ecfa3 Tests for reminders. 2014-12-29 21:49:43 +01:00
James Cole
593e799ca1 New and matching icon for bills [skip ci] #38 2014-12-29 20:39:27 +01:00
James Cole
8fc055cad9 Renamed a container [skip ci] #38 2014-12-29 20:36:56 +01:00
James Cole
75f86462e2 All code for issue #38. 2014-12-29 20:28:17 +01:00
James Cole
40892ccfa7 Some small updates to piggy banks. 2014-12-28 18:03:35 +01:00
James Cole
87fbf9c1a5 Added the ability to see cash accounts. [skip ci] 2014-12-28 09:00:22 +01:00
James Cole
4944b233b6 Greatly expanded report functionality. 2014-12-28 08:54:53 +01:00
James Cole
9f23462c42 Expanded reports. 2014-12-27 17:21:15 +01:00
James Cole
84a24f0333 Something with migrations. 2014-12-27 05:38:33 +01:00
James Cole
7a885bfc3c Fixed various bugs that made tests fail. 2014-12-26 22:59:13 +01:00
James Cole
3ba0cf1454 Expanded summary [skip ci] 2014-12-26 21:14:45 +01:00
James Cole
2d67a3159d Expanded reports 2014-12-26 21:08:44 +01:00
James Cole
290f25f1a0 First attempt at new month report. 2014-12-25 09:50:01 +01:00
James Cole
1659904f81 Various cleanup and spelling fixes. 2014-12-25 08:07:17 +01:00
James Cole
230bd6e40a Tests for the recurring transaction controller. 2014-12-25 08:00:09 +01:00
James Cole
ce27e97b92 More tests! Yay! 2014-12-25 00:42:31 +01:00
James Cole
18c1223c7b Tests for the profile controller 2014-12-24 22:52:14 +01:00
James Cole
8ef659f5de Tests for preferences controller. 2014-12-24 22:39:23 +01:00
James Cole
037452e525 Spelling errors fixed. 2014-12-24 21:20:47 +01:00
James Cole
e3482011d5 Updated two views. 2014-12-24 21:07:20 +01:00
James Cole
62748fa255 Migrations for future version 3.2.2 2014-12-24 20:56:05 +01:00
James Cole
7a9df05f6b A giant rename action in preparation of v3.2.2 2014-12-24 20:55:42 +01:00
James Cole
335279e728 Renamed lots of "piggybank" to "piggyBank". 2014-12-24 19:13:15 +01:00
James Cole
0332104738 Expanded tests for piggy banks. 2014-12-24 19:00:31 +01:00
James Cole
9f04854902 Merge branch 'release/3.2.1' 2014-12-24 14:34:51 +01:00
James Cole
73008a35fe Clean up tests. 2014-12-24 14:33:02 +01:00
James Cole
eae96cd2af Covered currency controller in tests. 2014-12-24 14:02:21 +01:00
James Cole
cb670bb27d Update, edit and delete currencies. 2014-12-24 12:32:18 +01:00
James Cole
fe1fb23e5b Extend JS to include currency code #37 2014-12-24 06:10:39 +01:00
James Cole
c2dd61e96b Methods to grab the requested currency symbol. #37 2014-12-24 05:58:26 +01:00
James Cole
80f5e61b6b Append default data to current currency table (assuming default entries). 2014-12-24 05:51:18 +01:00
James Cole
dbcae16b75 Made two new columns nullable. #37 2014-12-24 05:43:08 +01:00
James Cole
886dcae822 Route for #37 2014-12-23 22:27:58 +01:00
James Cole
ed495ec600 Menu for #37 2014-12-23 22:27:52 +01:00
James Cole
ddb60ccdc5 New view for #37 2014-12-23 22:27:45 +01:00
James Cole
335e2083af Expand helper for #37 2014-12-23 22:27:29 +01:00
James Cole
7b1d9d4962 First basic controller for #37 2014-12-23 22:27:14 +01:00
James Cole
da6ff9f90a Migrations for #37 2014-12-23 22:27:00 +01:00
James Cole
48f26c7bf1 Added a route for future currency options. 2014-12-23 21:55:30 +01:00
James Cole
3ce317b170 New tests. 2014-12-23 21:55:19 +01:00
James Cole
b741565f57 New test content. 2014-12-23 21:55:08 +01:00
James Cole
d8fea44968 New setting called 'budgetMaximum', see issue #36 2014-12-23 21:14:26 +01:00
James Cole
778300b67e Updated view for setting called 'budgetMaximum', see issue #36 2014-12-23 21:14:17 +01:00
James Cole
cb2b44fef3 New setting called 'budgetMaximum', see issue #36 2014-12-23 21:13:59 +01:00
James Cole
cdb5875d6b Some cleaning up for tests. 2014-12-23 21:13:42 +01:00
James Cole
01c5e15bcd Retrieve the new setting called 'budgetMaximum' which allows you to set the maximum budget. 2014-12-23 21:13:32 +01:00
James Cole
f0babb4be7 Made sure the migrations are reversible and updated the test seeder. 2014-12-22 20:43:38 +01:00
James Cole
10b00da874 Try to fix the tests. 2014-12-22 18:41:16 +01:00
James Cole
e9f391b2eb First tests for piggy bank controller. 2014-12-22 07:10:18 +01:00
James Cole
50be39b054 Fixed a bug where an update to a transaction journal would trigger the wrong response. 2014-12-21 18:43:01 +01:00
James Cole
a94e0bb3da Some cleaning up in prep for tests [skip ci] 2014-12-21 18:40:37 +01:00
James Cole
3f65d5d760 Cover JSON controller. 2014-12-21 18:09:35 +01:00
James Cole
48cb528ae4 Increased test coverage. Also updated read me. 2014-12-21 17:59:47 +01:00
James Cole
e62e0345df Also covered help. 2014-12-21 11:15:37 +01:00
James Cole
441f011fba More coverage. 2014-12-21 10:54:25 +01:00
James Cole
af1349160a Lots of clean up in the Google Chart controller. 2014-12-20 22:38:56 +01:00
James Cole
2072607889 Cleanup, mostly I removed the coding standard ignore instructions. 2014-12-20 22:07:21 +01:00
James Cole
073fd5aa0d 4 instead of 3. 2014-12-20 17:41:33 +01:00
James Cole
7b4703e4ff Category controller covered. 2014-12-20 16:53:32 +01:00
James Cole
1484621300 More tests! 2014-12-20 16:06:25 +01:00
James Cole
40709c8367 +x for execute 2014-12-20 15:33:55 +01:00
James Cole
b6ab5770a2 Lets see if this works. 2014-12-20 15:30:48 +01:00
James Cole
83b7cb4ff9 Test updates. 2014-12-20 15:25:22 +01:00
James Cole
256dba66b2 Standard test database. 2014-12-20 15:04:26 +01:00
James Cole
6ac12f8ffa Updated codeception instructions. 2014-12-20 15:01:09 +01:00
James Cole
82e438d29b Updated tests. 2014-12-20 15:00:53 +01:00
James Cole
e86547645c Small bug fixes. 2014-12-20 07:33:59 +01:00
James Cole
8b901084fe Fixed the tests. 2014-12-19 21:36:53 +01:00
James Cole
1a0cbbdb31 Removed previous warning suppressions. 2014-12-19 21:18:42 +01:00
James Cole
30ac62ffb7 All kinds of code cleanup, mostly to get some mess detection fixed. 2014-12-19 20:47:33 +01:00
James Cole
8ab294e90b Move budget / category save. 2014-12-18 19:53:06 +01:00
James Cole
f5edb15f43 Fix bug in create transaction with cash account. 2014-12-18 19:51:08 +01:00
James Cole
eed6107ce7 Revamp migrations. 2014-12-18 19:01:00 +01:00
James Cole
d49dc599a2 Removed references to components. 2014-12-17 21:32:27 +01:00
James Cole
3c5179f145 Removed repair route [skip ci] 2014-12-17 21:21:08 +01:00
James Cole
067d17c09c New repair route [skip ci] 2014-12-17 21:20:23 +01:00
James Cole
4c88c9af86 Fix. [skip ci] 2014-12-17 20:54:33 +01:00
James Cole
1c84afe186 Temporary repair route to fix stuff [skip ci] 2014-12-17 20:52:08 +01:00
James Cole
9d4c4be468 Removed single table inheritance. 2014-12-17 20:47:46 +01:00
James Cole
de7db8db78 Slightly extended tests. 2014-12-16 21:41:16 +01:00
James Cole
407ba4dd6d Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop 2014-12-16 20:26:51 +01:00
James Cole
5135be3000 Expanded test coverage. 2014-12-16 20:25:24 +01:00
James Cole
b8ab7d1a14 Update README.md 2014-12-16 09:15:04 +01:00
James Cole
6211fd8496 Update README.md
Added new badge.
2014-12-16 09:13:29 +01:00
James Cole
a4f273b48b Updated ignore file [skip ci] 2014-12-16 07:09:08 +01:00
James Cole
68d820a97c Attempt #5 for coveralls. 2014-12-16 07:03:52 +01:00
James Cole
ebadfd6358 Attempt #4, disable phpbrowser. 2014-12-16 06:53:07 +01:00
James Cole
cf93a88adc Attempt #3 2014-12-16 06:48:53 +01:00
James Cole
bd2c4252bb Attempt #2. 2014-12-15 20:56:18 +01:00
James Cole
84e7af04b9 Attempt to fix the tests over at Travis. 2014-12-15 20:38:20 +01:00
James Cole
37c63bc6b5 Add some tests. 2014-12-15 20:24:19 +01:00
James Cole
e7d3716549 Universal database stuff. 2014-12-15 20:01:33 +01:00
James Cole
73bc5372c0 Update migrations to include index. 2014-12-15 19:48:59 +01:00
James Cole
b999a8f0fb Some cleaning up. About to release 3.2.1 2014-12-15 19:39:01 +01:00
James Cole
16678aa5e1 Fixed bugs! 2014-12-15 18:16:48 +01:00
James Cole
f9ab49911d Bug fix where the account's balance would be cached when it shouldn't. 2014-12-15 18:03:16 +01:00
James Cole
3fabe2e9fb Small bug fix. 2014-12-15 07:24:01 +01:00
James Cole
9a8a3e94d6 Fix a chart. 2014-12-14 21:27:13 +01:00
James Cole
32ef2ef801 Renamed a table, added a bug fix. 2014-12-14 21:24:20 +01:00
James Cole
76cd3d35e2 Forgot some routes & filters. 2014-12-14 20:41:43 +01:00
James Cole
900dea2c66 Code cleanup. 2014-12-14 20:40:02 +01:00
James Cole
8e6ca0dd05 Some cleaning up. 2014-12-13 23:40:25 +01:00
James Cole
4b4ad7f1a8 Moved all references. 2014-12-13 22:54:52 +01:00
James Cole
21a0a5d573 Remapped all library classes. 2014-12-13 22:11:51 +01:00
James Cole
3cfa3f3b27 Code cleanup. 2014-12-13 21:59:02 +01:00
James Cole
c77b43458e Removed some charts, removed lots of dead code. 2014-12-13 20:03:44 +01:00
James Cole
9ab0a83f7c Default value for when session is empty. 2014-12-13 13:07:32 +01:00
James Cole
d3cda8811d Added some new tests. 2014-12-13 13:07:12 +01:00
James Cole
55740c0d97 Add c3.php to repository. 2014-12-13 09:54:32 +01:00
James Cole
c0a524c8a3 Add debug info. 2014-12-13 09:51:19 +01:00
James Cole
e51c2d10f0 Generate coverage. 2014-12-13 09:39:11 +01:00
James Cole
7af55b7268 Updated some tests, fixed some bugs. 2014-12-13 09:36:30 +01:00
James Cole
7350b1da1b Cleanup and added todo's 2014-12-12 16:22:16 +01:00
James Cole
136adbe723 Some cleanup and a small bug fix. 2014-12-12 07:42:38 +01:00
James Cole
cb2863eaf3 Cleaned up the budget controller. 2014-12-12 07:13:40 +01:00
James Cole
d054f9b92f Added composer.lock. 2014-12-10 19:15:14 +01:00
James Cole
9c83c18137 Fixed some query-heavy things in the report controller. 2014-12-09 18:24:53 +01:00
James Cole
999a7481e4 Removed references to the field "migrated". 2014-12-09 06:37:36 +01:00
James Cole
a3b684b4ed Merge branch 'release/3.2.0'
Conflicts:
	app/config/app.php
2014-12-08 20:46:23 +01:00
James Cole
cb312ca025 Remove packages only found in development. 2014-12-08 20:44:06 +01:00
James Cole
1335a52db3 Remove packages only found in development. 2014-12-08 20:27:33 +01:00
James Cole
727221e2cb Cleanup migrations. 2014-12-08 06:57:12 +01:00
James Cole
360f286ed3 Some cleanup. 2014-12-07 20:45:52 +01:00
James Cole
6aecd77b77 New stuff! 2014-12-07 15:37:53 +01:00
James Cole
ca85cab6fb Merge branch 'release/3.1.6' 2014-12-06 22:29:17 +01:00
James Cole
742479bb01 Update for coveralls. 2014-12-06 22:12:02 +01:00
James Cole
68e54a9297 Include coveralls. 2014-12-06 22:04:29 +01:00
James Cole
056d83eda4 Fixed the codeception command line 2014-12-06 21:59:03 +01:00
James Cole
42ec55d0db Upgrade to php 5.6 2014-12-06 21:53:09 +01:00
James Cole
c89bd89d9a Include codeception in travis. 2014-12-06 21:52:39 +01:00
James Cole
31a0be5bb4 All kinds of cleanup. 2014-12-06 21:48:23 +01:00
James Cole
07610ae8fb All kinds of new stuff for Codeception, which isn't working at ALL 2014-12-06 19:47:43 +01:00
James Cole
dbc95dd878 Cleanup. 2014-12-06 17:53:25 +01:00
James Cole
792e8a9947 Start with code cleanup. 2014-12-06 17:45:29 +01:00
James Cole
d774cde109 Add soft deletes. 2014-12-06 17:37:05 +01:00
James Cole
cc111d14b0 Lots of cleanup and formatting. 2014-12-06 17:34:39 +01:00
James Cole
bb3ba42ce2 Replaced Ardent with another package. 2014-12-06 12:12:55 +01:00
James Cole
f4ecf2d1aa Some new report data. Also, the report page now uses in excess of 3000 queries. Lol 2014-12-06 09:16:54 +01:00
James Cole
1997666196 Update comment to match methods. 2014-12-05 22:50:26 +01:00
James Cole
3aa9057c5f Small fixes. 2014-12-05 22:06:33 +01:00
James Cole
834f8382e9 Added some todo's. 2014-12-05 21:45:48 +01:00
James Cole
357638a26c Also do some account meta on the create screen. 2014-12-05 21:44:01 +01:00
James Cole
919a0c01e4 Expand views and JS. 2014-12-05 21:39:48 +01:00
James Cole
6ff618e388 Expand models. 2014-12-05 21:39:34 +01:00
James Cole
ac765b7e4c Expand model to get meta data 2014-12-05 21:39:26 +01:00
James Cole
2134e87c31 Method to unrelate transactions. 2014-12-05 21:39:16 +01:00
James Cole
0d37288129 Expand account controller with meta data (edit / update routine). 2014-12-05 21:39:04 +01:00
James Cole
7cbd41137d New configuration. 2014-12-05 21:38:45 +01:00
James Cole
ba43d7063f New route to unrelate transactions. 2014-12-05 21:38:36 +01:00
James Cole
c9b2e29ba0 Manage related transactions. 2014-12-04 20:38:45 +01:00
James Cole
4720519aef Clean up models, fixed a bug. 2014-12-01 06:09:27 +01:00
James Cole
d7b0106e7d Expand code for reports. 2014-12-01 05:57:03 +01:00
James Cole
0a2cbaa047 Some new code, transaction groups among them. 2014-11-30 14:52:17 +01:00
James Cole
3e5f615ffc Expand bread crumbs to include opening balances. 2014-11-28 17:29:05 +01:00
James Cole
00dc73e6d9 Added all bread crumbs. 2014-11-28 16:35:11 +01:00
James Cole
aa5b9a1727 More bread crumbs. 2014-11-28 16:15:30 +01:00
James Cole
f63a287a6c More bread crumbs. 2014-11-28 16:09:18 +01:00
James Cole
b9d4c8dcd6 More bread crumbs. 2014-11-28 16:04:06 +01:00
James Cole
94433f1714 Bread crumbs for categories. 2014-11-28 15:58:54 +01:00
James Cole
a4dd4358b4 Small fix for budget bread crumbs. 2014-11-28 15:53:50 +01:00
James Cole
4e79b43395 More bread crumbs. 2014-11-28 15:52:52 +01:00
James Cole
6bb54bfa85 More bread crumbs. 2014-11-28 15:46:44 +01:00
James Cole
0df6c3a8dc Some work on bread crumbs and reports. 2014-11-28 15:41:32 +01:00
James Cole
dc25086eab Updated composer.json 2014-11-28 14:55:59 +01:00
James Cole
3299188edf New report 2014-11-28 14:41:58 +01:00
James Cole
f6afb46f6f Some new help functions, some cleanup. 2014-11-28 14:12:16 +01:00
James Cole
98993cfa9b Updated hasManyThrough 2014-11-28 07:40:59 +01:00
James Cole
5a920d5efd Fix the view for accounts. 2014-11-28 07:40:04 +01:00
James Cole
935276af88 Updated accounts so actions will trigger cache flush. 2014-11-27 16:20:16 +01:00
James Cole
5a505c8469 Show everything on demand. 2014-11-27 15:42:07 +01:00
James Cole
2c2abe8b8e Fixed a bug where editing an expense account wasn't actually possible. 2014-11-27 15:37:31 +01:00
James Cole
638099d989 Fixed a bug where editing an expense account wasn't actually possible. 2014-11-27 15:36:37 +01:00
James Cole
0f32f6be4c Fixed a bug where editing an expense account wasn't actually possible. 2014-11-27 15:35:51 +01:00
James Cole
1f7c98bdcf Installed codeception. 2014-11-26 21:31:12 +01:00
James Cole
72068a4b78 Fixed the preselected piggy bank 2014-11-26 21:11:13 +01:00
James Cole
c8038e0774 A test to see if transfers and transactions and what-not can be related somehow. 2014-11-26 21:07:14 +01:00
James Cole
6b39beecb4 Expanded the report thing. 2014-11-26 20:46:21 +01:00
James Cole
b1ba64db12 New and updated views. 2014-11-26 17:20:43 +01:00
James Cole
ad53832766 Fixed a ORM thing. 2014-11-26 17:20:32 +01:00
James Cole
d5bffc8ed7 Removed debug messages. 2014-11-26 17:20:23 +01:00
James Cole
69b36ddd1d New methods. 2014-11-26 17:20:18 +01:00
James Cole
9f926394a6 Some new reports. 2014-11-26 17:20:05 +01:00
James Cole
1e7ecbdf9d Removed debug messages. 2014-11-26 17:19:59 +01:00
James Cole
beb8a461cf Some new reports. 2014-11-26 17:19:50 +01:00
James Cole
e235a57e2f Fixed a bug where the paginator for transactions would skip pages. 2014-11-26 09:43:21 +01:00
James Cole
114b27079e Added a routine that will cache stuff that costs a lot of queries. 2014-11-25 22:04:50 +01:00
James Cole
6e19bc01f5 Because this function generates a lot of queries, i've disabled it for now. 2014-11-25 21:15:49 +01:00
James Cole
f9dfdeafb3 Fixed a bug where deposits and withdrawals might show the wrong accounts when editing. 2014-11-25 21:09:52 +01:00
James Cole
f05d626e38 Mostly cleanup and bug fixes. 2014-11-25 21:04:00 +01:00
James Cole
918041258e Removed cleanup method. 2014-11-25 20:47:33 +01:00
James Cole
a5b13aa67f A very simple tool to do some cleanup. 2014-11-25 20:44:46 +01:00
James Cole
1383cbd4d5 Fixed a bug where a null transaction would be used anyway. 2014-11-25 20:22:32 +01:00
James Cole
e9b7e82aea Some visual updates to repeated expenses. 2014-11-24 23:02:08 +01:00
James Cole
fd6e7fc1ab Fixed a bug where the associated total amount for a bar would be too high. 2014-11-24 18:08:20 +01:00
James Cole
743deb4227 More stuff for repeated expenses. 2014-11-24 18:06:21 +01:00
James Cole
b051278d2e Expand repeated expenses. 2014-11-24 17:01:37 +01:00
James Cole
bfda4bc199 Lots of new stuff. 2014-11-24 10:12:34 +01:00
James Cole
4456ef2326 Some expansion on the index of repeated expenses, and the first reference to the show page. 2014-11-23 06:29:29 +01:00
James Cole
7336367eff Duh. Bug fixed. 2014-11-22 23:38:58 +01:00
James Cole
9cb6c7697e Some debug information. 2014-11-22 23:38:08 +01:00
James Cole
cd44f51072 Add some floatvals() just in case. 2014-11-22 23:37:03 +01:00
James Cole
d8976379b1 Some debug information. 2014-11-22 23:35:39 +01:00
James Cole
8aa847c718 Expanded the view. 2014-11-22 23:34:38 +01:00
James Cole
6691b238f7 New routes for repeated expenses. 2014-11-22 23:32:34 +01:00
James Cole
cca2758138 New views for the repeated expenses. 2014-11-22 23:32:24 +01:00
James Cole
4a74e68e31 Cleanup and expansion to accomodate repeated expenses. 2014-11-22 23:32:10 +01:00
James Cole
3d3842b9d6 Reinstated "periodshow" and some other stuff. 2014-11-22 23:31:55 +01:00
James Cole
9d889d05e4 Expanded Events to check on repeated expenses. 2014-11-22 23:31:40 +01:00
James Cole
9f920bcfe3 Expanded the transaction controller to show repeated expenses 2014-11-22 23:31:25 +01:00
James Cole
1bb49fa496 Expanded the repeated expenses. 2014-11-22 23:31:06 +01:00
James Cole
6b1d8d3aaa Added the possibility to save per quarter. 2014-11-22 23:30:58 +01:00
James Cole
c6b6ed7fa8 Removed a bunch of methods and code that wasn't used. Also added a repository for repeated expenses. 2014-11-22 23:30:45 +01:00
James Cole
34454261d2 First view for the return of the repeated expenses. 2014-11-22 17:17:28 +01:00
James Cole
ddf9f52737 Mar cleanup. 2014-11-22 08:21:10 +01:00
James Cole
10b969a074 New cleanup command for artisan 2014-11-22 08:17:37 +01:00
James Cole
5df0634380 Cleanup. 2014-11-22 07:34:08 +01:00
James Cole
f0f965421c Implemented some todo's. 2014-11-22 07:30:46 +01:00
James Cole
6381408fba Remove some often used long calls with shorter ones. 2014-11-21 19:33:09 +01:00
James Cole
43e738cb44 Remove todo 2014-11-21 19:19:06 +01:00
James Cole
6d4303aa3f Clone Carbon. 2014-11-21 19:18:53 +01:00
James Cole
13c2db5378 Removed some todo's 2014-11-21 19:18:44 +01:00
James Cole
36f6bda525 Fixed a namespace bug. 2014-11-21 11:21:48 +01:00
James Cole
78886e7b1f Updated git ignore. 2014-11-21 11:18:02 +01:00
James Cole
3dce194930 Use facades. 2014-11-21 11:12:22 +01:00
James Cole
ec776bb6eb Add some hasManyThrough references 2014-11-21 11:11:52 +01:00
James Cole
243d942a6e Remove unused library 2014-11-21 11:11:14 +01:00
James Cole
ea6aba62c4 Remove unused code. 2014-11-21 11:11:03 +01:00
James Cole
73743721b1 Fixed a bug where a non-matching journal would keep its recurring transaction. 2014-11-20 11:36:53 +01:00
James Cole
61eb5b341d Update piggy banks repetitions when the piggy bank is edited. 2014-11-20 11:19:35 +01:00
James Cole
d758f72393 Better visualisation in the budget charts. 2014-11-20 11:15:00 +01:00
James Cole
1b1367f4c2 Make sure the progress bar has a minimal width to improve readability. 2014-11-20 11:10:42 +01:00
James Cole
07388dd58a Ability to dismiss reminders, added some logic to pre fill transaction form. 2014-11-20 07:51:01 +01:00
James Cole
359c71ef2f Fixed a bug where the reminders would be created inactive. 2014-11-20 07:41:48 +01:00
James Cole
93d4d3df1d Wrong column names. 2014-11-20 07:41:30 +01:00
James Cole
d3a7596be2 A fix for a bug that would prevent both the category and the budget to be updated. 2014-11-20 07:12:41 +01:00
James Cole
114d3812cc Some logging. 2014-11-19 21:22:21 +01:00
James Cole
b2d4dcfbf1 Also catch transaction journal updates. 2014-11-19 21:19:13 +01:00
James Cole
0baf8f6d18 First attempt at testing the home controller. 2014-11-19 21:18:29 +01:00
James Cole
2f8e3a0707 Display bug in recurring transactions. 2014-11-19 21:18:16 +01:00
James Cole
d7a4bf22c6 Scan transaction journals for recurring transactions on store. 2014-11-19 21:18:06 +01:00
James Cole
0c2f9d22b9 With no category, the transaction journal store procedure would fail. 2014-11-19 21:17:21 +01:00
James Cole
e75c5aac49 A fix for the phpunit coverage. 2014-11-19 21:16:48 +01:00
James Cole
77e5024f54 Fixed a display bug. I commented this out, but no idea why. 2014-11-19 21:16:23 +01:00
James Cole
7329c0b200 All of this should contain one working test. 2014-11-18 10:33:38 +01:00
James Cole
0afe3c48a1 Fixed some things so coveralls will fire. 2014-11-18 10:18:50 +01:00
James Cole
1ab5e923bc Removed codeception. 2014-11-18 10:11:31 +01:00
James Cole
90b3bd77e7 Empty tests. 2014-11-18 10:11:18 +01:00
James Cole
9c60443f97 Clean up and added some TODO's. 2014-11-18 09:47:50 +01:00
James Cole
058e5602a3 For consistency, renamed some events. 2014-11-18 09:41:43 +01:00
James Cole
eebac2a66d Some formatting, cleanup, and a new chart. 2014-11-18 09:37:54 +01:00
James Cole
7e8f5c9548 Expanded the selection of reminders. 2014-11-18 01:53:52 +01:00
James Cole
d34b49bd48 Fixed a bug where the end date would be incorrectly calculated. 2014-11-18 01:52:08 +01:00
James Cole
ccffae287d Fixed a bug where the end date would be incorrectly calculated. 2014-11-18 01:51:15 +01:00
James Cole
ad69011ac5 Support 'month' as well as 'monthly'. 2014-11-17 23:09:52 +01:00
James Cole
f8ea0f971d This should fix reminders! 2014-11-17 23:08:36 +01:00
James Cole
9918410954 Implemented a proper way of generating reminders (we hope). 2014-11-17 22:32:55 +01:00
James Cole
4f4e6fac16 Fixed a bug where limits and limit repetitions would not be updated and/or created because of double post calls and missing events. 2014-11-17 21:50:11 +01:00
James Cole
15e99bd672 Removed some old code, added todo's. 2014-11-17 20:55:31 +01:00
James Cole
696e9a6fde Some general cleaning up. 2014-11-17 20:45:55 +01:00
James Cole
36cbb3d71f Added some code for reminders but most of its commented out. 2014-11-17 20:18:14 +01:00
Sander Dorigo
f69598c6aa Lots of work on the reminders. 2014-11-17 16:14:28 +01:00
Sander Dorigo
5fc31f3c1e First attempt at generating and showing reminders. 2014-11-17 10:10:57 +01:00
Sander Dorigo
6581ee0ee0 Fixed some more menu stuff. 2014-11-17 09:40:04 +01:00
James Cole
69e7501d47 Start with cleaning up the menu. 2014-11-17 08:20:05 +01:00
James Cole
314abbea8b Code cleanup. 2014-11-17 07:33:18 +01:00
James Cole
82c9a75578 Expand piggy banks 2014-11-16 22:55:34 +01:00
James Cole
651101912c Route for chart. 2014-11-16 20:05:03 +01:00
James Cole
fb0d463040 Chart for piggy banks 2014-11-16 20:03:53 +01:00
James Cole
8c254554eb Display bug for piggy banks with no reminders. 2014-11-16 10:36:23 +01:00
James Cole
2d9c89375a New chart and lots of stuff for piggy banks 2014-11-16 10:31:19 +01:00
James Cole
61aba29df7 More stuffs. Too lazy to explain. 2014-11-15 11:36:27 +01:00
James Cole
8c949e6190 Events that keep track of piggy bank money add/remove 2014-11-15 09:32:25 +01:00
James Cole
6eb9188690 Cleaned up preferences view. 2014-11-15 09:23:07 +01:00
James Cole
6832f2ebd0 Lots of code cleanup. 2014-11-15 07:46:01 +01:00
James Cole
3e02b50ea1 All kinds of todo items because otherwise I'd forget them. 2014-11-14 19:58:01 +01:00
James Cole
7b7743c03e Fixed some bugs 2014-11-14 19:33:50 +01:00
James Cole
de20563275 Removed all event triggers. 2014-11-14 19:33:40 +01:00
James Cole
9e720c3a38 Some view fixes. 2014-11-14 14:33:41 +01:00
James Cole
54685c1f5f Some new lists for recurring transactions. 2014-11-14 12:54:49 +01:00
James Cole
eb8f8fa935 Expanded on categories. 2014-11-14 11:56:45 +01:00
James Cole
9adbbd872c New chart for budgets. 2014-11-14 11:43:08 +01:00
James Cole
4bd38f97a2 Whoops. But not to worry, changed it already. 2014-11-14 10:41:35 +01:00
James Cole
78ab1e200a Remove transactions now works. 2014-11-14 10:39:34 +01:00
James Cole
11280e473d Catch broken journals. 2014-11-14 10:37:19 +01:00
James Cole
f9750a64f8 Fixed transactions lists. 2014-11-14 10:28:18 +01:00
James Cole
ac2ab65471 Got up to categories with the new tables. 2014-11-14 10:17:12 +01:00
James Cole
0530c0402c First full transaction list (again) and removed some google table references. 2014-11-14 09:34:53 +01:00
James Cole
a58a560bbb Fixed the tables (again) for account and for index. 2014-11-14 09:07:13 +01:00
James Cole
96ab112b22 Removed most, if not all, references to Google Charts (the tables part). 2014-11-14 08:52:58 +01:00
James Cole
b388dcc7d4 First attempt at generating proper paging google tables. However, somehow they are kind of messed up, so I'm probably going to drop this. 2014-11-14 08:40:16 +01:00
James Cole
f511a25c94 Added the input when creating new transactions. 2014-11-13 21:27:50 +01:00
James Cole
58d8b6f95b Fixed the charts, added some todo items. 2014-11-13 21:11:00 +01:00
James Cole
953d68c3a2 Build some transaction handling. 2014-11-13 17:01:09 +01:00
James Cole
9e2f7af59b New route for table. 2014-11-13 16:14:07 +01:00
James Cole
840dfa6696 Expanded recurring transactions. 2014-11-13 16:13:32 +01:00
James Cole
4a20c008ff Implementing recurring transactions. 2014-11-13 11:17:39 +01:00
James Cole
981ffe4194 Added a show piggybank view, removed some others. 2014-11-13 07:50:55 +01:00
James Cole
2597633b0e New migration and code cleanup. 2014-11-13 07:25:47 +01:00
James Cole
71d174d765 Code clean up and reformat. 2014-11-12 22:37:44 +01:00
James Cole
4aa9a04516 Code clean up and reformat. 2014-11-12 22:37:09 +01:00
James Cole
258d6a1688 Code clean up and reformat. 2014-11-12 22:36:02 +01:00
James Cole
2e2c12d6a4 General clean up. 2014-11-12 22:21:48 +01:00
James Cole
44d189d7d3 Fixed a bug where the transaction list was a giant mess. 2014-11-12 21:19:31 +01:00
James Cole
ab508a3d9e Recreated the JSON controller to fix auto-complete forms. 2014-11-12 20:52:34 +01:00
James Cole
4e166c7d2e This should fix the transactions again. 2014-11-12 20:46:55 +01:00
Sander Dorigo
7f175a4870 Some more work on the transactions. 2014-11-12 15:34:32 +01:00
Sander Dorigo
0a627f6f9e More work done for the transaction controller. 2014-11-12 15:22:01 +01:00
Sander Dorigo
d34cc65984 Start cleaning up transactions controller. 2014-11-12 14:38:32 +01:00
Sander Dorigo
78d034d366 There's a giant mix brewing between "old" code, bad code and not implemented exceptions. I suspect the next change will be to cut out all old stuff, throw a lot of NotImplementedExceptions and get going. 2014-11-12 10:54:53 +01:00
James Cole
638fa9005f Excluded more files from the "old" libraries and included new ones instead. This should greatly clean up the code base. 2014-11-12 07:31:48 +01:00
James Cole
5cb9907bf8 Various changes to support the removed old code. 2014-11-11 21:09:56 +01:00
Sander Dorigo
f08fcc36fb Half-way through with some cleaning up. 2014-11-11 18:16:59 +01:00
Sander Dorigo
d231cd9f61 Added the homestead configuration because it's not really secret. 2014-11-11 07:35:00 +01:00
Sander Dorigo
86a586f866 Ignore homestead configuration. 2014-11-11 07:26:16 +01:00
Sander Dorigo
9d4cba1620 Fixed some initial startup bugs when working with Homestead. 2014-11-11 07:20:52 +01:00
Sander Dorigo
e9afd55e9d Updated the default user seeder. 2014-11-10 22:36:25 +01:00
Sander Dorigo
9fa326f630 First attempt at unifying code for categories and budgets, which are basically the same thing. 2014-11-10 21:55:22 +01:00
Sander Dorigo
af9473c126 Fixed some bugs in various controllers and started rebuilding the category controller. 2014-11-10 19:03:03 +01:00
Sander Dorigo
cb08df0770 I broke some stuff but it's fixed again. 2014-11-10 18:39:50 +01:00
Sander Dorigo
d49ca2eb11 Merge branch 'master' of https://github.com/JC5/firefly-iii 2014-11-10 18:39:06 +01:00
Sander Dorigo
a3f8841ec3 I have no idea what's happening! 2014-11-10 18:38:58 +01:00
Sander Dorigo
fd678c286d Some cleanup. 2014-11-10 18:37:25 +01:00
Sander Dorigo
2a3f9b621b Removed unused imports. 2014-11-10 18:36:25 +01:00
Sander Dorigo
359e1b3943 Cleanup all models and migrations. 2014-11-10 18:33:00 +01:00
Sander Dorigo
754336b3cf Merge branch 'develop' of https://github.com/JC5/firefly-iii 2014-11-10 11:40:16 +01:00
James Cole
4918f1c4cb Merge pull request #31 from sonikarc/develop
[Fixes #21] Change the majority of View::share to View::make()->with()
2014-11-10 10:37:49 +01:00
Sander Dorigo
5d5e308942 Updated read me. 2014-11-10 07:55:52 +01:00
Stewart Malik
6a18f81cec Merge branch 'develop' of https://github.com/sonikarc/firefly-iii into develop 2014-11-09 16:01:20 +00:00
Stewart Malik
1ff135d172 [Fixes #21] Change the majority of View::share to View::make()->with() 2014-11-10 02:27:19 +10:30
Sander Dorigo
e666e5e9e3 Clean up composer.json 2014-11-09 11:32:18 +01:00
Sander Dorigo
9874e77ddf Remove ignore instructions. 2014-11-09 11:30:00 +01:00
Sander Dorigo
27e3ec693a New screenshot. 2014-11-09 11:20:54 +01:00
Sander Dorigo
6bb1415ad7 Updated readme file. 2014-11-09 11:10:57 +01:00
Sander Dorigo
83594e6f1f Merge branch 'release/3.1.5' 2014-11-09 11:09:38 +01:00
Sander Dorigo
0f6008705c Added a screenshot 2014-11-09 11:08:53 +01:00
Sander Dorigo
c58b653bb7 Updated read me file. 2014-11-09 11:01:57 +01:00
Sander Dorigo
f69b6f9b4e New chart for budget-overview. 2014-11-09 08:42:09 +01:00
Sander Dorigo
7750b06476 Added a "spent"-bar in budgets. 2014-11-09 08:02:47 +01:00
Sander Dorigo
873384a34b Built the 'show'-view for budgets. 2014-11-08 19:11:51 +01:00
Sander Dorigo
ac299e7279 More rounding. 2014-11-08 11:38:50 +01:00
Sander Dorigo
7895d7f5d0 Format amount. 2014-11-08 11:37:55 +01:00
Sander Dorigo
fe05d218fc Allow piggy bank edit/update. 2014-11-08 11:36:20 +01:00
Sander Dorigo
8196313ac0 Optimized queries. 2014-11-08 10:16:12 +01:00
Sander Dorigo
6d8f84654f Also add stuff not in budgets. 2014-11-08 09:15:03 +01:00
Sander Dorigo
ab4f34a96b Extended reports 2014-11-07 22:06:30 +01:00
Sander Dorigo
139d985904 All kinds of fixes and things. I should really start organizing. 2014-11-07 11:18:06 +01:00
Sander Dorigo
44705f0e18 Some bugfixes and cleanup. 2014-11-06 20:33:37 +01:00
Sander Dorigo
ddea7d696a Delete and update routines. 2014-11-06 07:38:15 +01:00
Sander Dorigo
f814f45e36 Test fix for budgeting. 2014-11-05 21:37:24 +01:00
Sander Dorigo
f7117d47c2 Whoops, bugfix. 2014-11-05 21:23:23 +01:00
Sander Dorigo
01b0a1058d Form fix. 2014-11-05 21:22:31 +01:00
Sander Dorigo
21f362c7b9 Lots of stuff for budgets, accounts and others! 2014-11-05 19:57:56 +01:00
Sander Dorigo
aaab7f8e0e Some fixes for budgets 2014-11-04 20:37:00 +01:00
Sander Dorigo
09e1f68c69 Font fix. 2014-11-02 21:26:41 +01:00
Sander Dorigo
03729aa5ae Chart cleanup 2014-11-02 21:24:50 +01:00
Sander Dorigo
ef39f31ea1 First reports. 2014-11-02 18:46:01 +01:00
Sander Dorigo
0f1437dd6a Delete piggy banks. 2014-11-02 16:47:01 +01:00
Sander Dorigo
03aac2f744 Implemented method stub. 2014-11-02 14:59:09 +01:00
Sander Dorigo
2f8b10e82c All kinds of new code, especially for the piggy banks. 2014-11-02 14:58:12 +01:00
Sander Dorigo
3231effd20 Cleanup and fix everything related to piggy banks. 2014-10-31 07:32:43 +01:00
Sander Dorigo
f7722c1189 Clean up piggy bank controller. 2014-10-30 19:26:52 +01:00
Sander Dorigo
70c2450ac4 Clean up the routes. 2014-10-30 19:26:43 +01:00
Sander Dorigo
2d5b0d0f99 Moved some stuff around. 2014-10-30 19:26:28 +01:00
Sander Dorigo
f0c0002a6d Some cleanup 2014-10-30 18:24:10 +01:00
Sander Dorigo
dd9f08d4fa New code for charts. 2014-10-30 18:12:27 +01:00
Sander Dorigo
de2e384225 Merge branch 'feature/google-charts' into develop
Conflicts:
	app/views/accounts/show.blade.php
2014-10-30 18:09:03 +01:00
Sander Dorigo
ffcd1fde0f Even more charts and tables. 2014-10-30 18:06:29 +01:00
Sander Dorigo
d5e1da5948 Some more stats on the piggy banks. 2014-10-29 12:39:15 +01:00
Sander Dorigo
ad479a5c7f Added some placeholders. 2014-10-29 12:33:19 +01:00
Sander Dorigo
0707603b63 Add buttons and a placeholder. 2014-10-29 12:26:26 +01:00
Sander Dorigo
2f9c383004 All new stufs! 2014-10-29 10:30:52 +01:00
Sander Dorigo
8ad0d7af93 Update views and CSS 2014-10-28 16:29:31 +01:00
Sander Dorigo
9b4391c0bf Initial set of code required for GCharts. 2014-10-28 16:29:24 +01:00
Sander Dorigo
da7802a0a4 New controller, updated composer. 2014-10-28 16:15:16 +01:00
Sander Dorigo
9c69949e8c Added edit and new buttons. 2014-10-28 15:59:10 +01:00
Sander Dorigo
b1d7a9451a Cleaner piggybank view. 2014-10-28 11:25:22 +01:00
Sander Dorigo
004488d453 New todo items. 2014-10-28 11:10:40 +01:00
Sander Dorigo
fc91372dd0 Merge branch 'feature/account-cleanup' into develop 2014-10-28 09:33:54 +01:00
Sander Dorigo
5970a9dc91 Merge branch 'master' of https://github.com/JC5/firefly-iii into feature/account-cleanup 2014-10-28 09:32:22 +01:00
Sander Dorigo
264cac4f9b Merge branch 'develop' of https://github.com/JC5/firefly-iii into feature/account-cleanup 2014-10-28 09:32:16 +01:00
Sander Dorigo
633328a965 Removed references to sankey. 2014-10-28 09:29:47 +01:00
Sander Dorigo
4d4b62a766 Add todo-text 2014-10-28 09:28:14 +01:00
Sander Dorigo
aeb2c7deeb Remove function. 2014-10-28 09:27:46 +01:00
Sander Dorigo
c323942d92 Add placeholder. 2014-10-28 09:27:36 +01:00
Sander Dorigo
a0afa25145 Cleanup and prep-work for new charts (will be a new feature). 2014-10-28 09:25:29 +01:00
Sander Dorigo
4533b46436 Updated menu logic 2014-10-28 06:00:41 +01:00
Sander Dorigo
e5f8db78f9 New views and layouts for the account controller. 2014-10-28 05:59:14 +01:00
Sander Dorigo
899f61671f All new library set for the account controller (and others). 2014-10-28 05:58:48 +01:00
Sander Dorigo
d84d88cc10 Completely revamped the account controller. 2014-10-28 05:58:32 +01:00
Sander Dorigo
97e7ac4052 New routes for accounts. 2014-10-28 05:58:10 +01:00
Sander Dorigo
ba4ffa44d2 Fixed a spelling error. 2014-10-27 21:28:58 +01:00
Sander Dorigo
07caeccf68 Code formatting and a reference to a new form element. 2014-10-27 21:28:30 +01:00
Sander Dorigo
d54832f61f Code formatting. 2014-10-27 21:28:15 +01:00
Sander Dorigo
b212753633 A new form field. 2014-10-27 21:27:45 +01:00
James Cole
f38d80cbf5 Update composer.json 2014-10-23 16:42:11 +02:00
James Cole
8bea1acd8e Update composer.json 2014-10-23 16:42:01 +02:00
Sander Dorigo
42458ce11d Merge branch 'release/3.1.4' 2014-10-14 07:32:00 +02:00
Sander Dorigo
aceb683d07 Remove chart when nothing to show. 2014-10-14 07:27:06 +02:00
Sander Dorigo
b7517b49ed Expand match to include expense account. 2014-10-14 07:24:59 +02:00
Sander Dorigo
849b711b79 Recycle code instead of copy pasting. 2014-10-14 07:24:41 +02:00
Sander Dorigo
25585b28c7 Removed "date in the future" demand. 2014-10-14 07:24:27 +02:00
Sander Dorigo
073da8fb2a Small layout changes. 2014-10-13 20:47:36 +02:00
Sander Dorigo
a787ff3f3c Merge branch 'release/3.1.3' 2014-10-13 19:13:44 +02:00
Sander Dorigo
733b6d7eb7 Expand the chart. 2014-10-13 18:50:37 +02:00
Sander Dorigo
36d8dee853 Building a chart for the recurring transactions. 2014-10-13 17:54:20 +02:00
Sander Dorigo
65a2e07d24 Cleaned out most of the "reminders" code. 2014-10-12 09:45:57 +02:00
Sander Dorigo
7c97c558ab No reference to reminders. 2014-10-12 09:41:10 +02:00
Sander Dorigo
a6bb61050c Remove piggy bank reminders. 2014-10-12 09:41:00 +02:00
Sander Dorigo
b184aa2315 No trigger for recurring transactions. 2014-10-12 09:39:40 +02:00
Sander Dorigo
e4595333e7 Do not destroy reminders since there aren't any. 2014-10-12 09:39:29 +02:00
Sander Dorigo
41dd139bde Trigger no longer fires or creates reminders for piggy banks. 2014-10-12 09:37:31 +02:00
Sander Dorigo
c577dd302a Removed unused reminder methods. 2014-10-12 09:36:24 +02:00
Sander Dorigo
0ab87de78b Removed unused routes. 2014-10-12 09:34:47 +02:00
Sander Dorigo
8a22509b41 Removed a no longer used view. 2014-10-12 09:34:30 +02:00
Sander Dorigo
b024c18441 Cleaned out the reminder controller. 2014-10-12 09:34:10 +02:00
Sander Dorigo
d9ac681a68 Bug fixes in recurring transaction matching. 2014-10-12 09:31:25 +02:00
Sander Dorigo
637a5579ec Small cleanup. 2014-10-12 09:29:19 +02:00
Sander Dorigo
4794156e80 Merge branch 'master' into develop 2014-10-12 08:20:31 +02:00
Sander Dorigo
5f4db7874c New view and what-not for feature. 2014-10-12 08:19:18 +02:00
Sander Dorigo
b4ea1839a5 Fixed some bugs in the recurring transaction match. 2014-10-12 08:03:35 +02:00
Sander Dorigo
6a6d889983 Merge branch 'release/3.1.1' 2014-10-12 07:39:27 +02:00
Sander Dorigo
287c2e7af8 Added the ability to change the range preference on the fly. 2014-10-12 07:33:45 +02:00
Sander Dorigo
0fe6acc8cf Merge branch 'feature/recurring-expand' into develop 2014-10-11 21:24:38 +02:00
Sander Dorigo
7d2dab7ca0 First set of code. 2014-10-11 21:23:31 +02:00
Sander Dorigo
f68c1aff26 Cleaned up the show view. 2014-10-11 18:52:24 +02:00
Sander Dorigo
81662473a6 Merge branch 'release/3.1' 2014-10-11 12:11:17 +02:00
Sander Dorigo
d40645be68 Merge branch 'feature/expand-transaction-view' into develop 2014-10-11 09:54:33 +02:00
Sander Dorigo
a53550537f Expand JS 2014-10-11 09:54:26 +02:00
Sander Dorigo
223ad16616 Expand JSON. 2014-10-11 09:54:20 +02:00
Sander Dorigo
3f060979d7 Merge branch 'feature/recurring-at-new-transaction' into develop 2014-10-11 09:21:44 +02:00
Sander Dorigo
2eac9081ea Build trigger. 2014-10-11 09:21:28 +02:00
Sander Dorigo
b3eef4f40b Cleanup. 2014-10-11 09:21:14 +02:00
Sander Dorigo
dd70fbad3f Cleanup old code. 2014-10-11 09:20:59 +02:00
Sander Dorigo
8cb7a1aef8 Installed Twig template engine. 2014-10-11 08:31:17 +02:00
Sander Dorigo
a687140056 Cleaned up date-time navigation, added some stuff to accounts, expanded JSON response for transactions. 2014-10-09 07:24:47 +02:00
Sander Dorigo
3cba673a9c Updated the chart. #23 2014-10-08 21:54:46 +02:00
Sander Dorigo
01de230785 Expanded the summary (related to #23). 2014-10-08 21:53:38 +02:00
Sander Dorigo
e405d06f23 First attempt at a view for transactions without a budget (issue #23) 2014-10-08 21:50:03 +02:00
Sander Dorigo
d9b70f7ad8 Fixed a bug that will properly attach both budgets AND categories 2014-10-08 21:39:27 +02:00
Sander Dorigo
0ef5825d98 Introduced a tiny bug by introducing NULL. 2014-10-08 21:29:28 +02:00
Sander Dorigo
1e76a5fc3f New buttons. 2014-10-08 21:04:31 +02:00
Sander Dorigo
1fbdb3d0ae A temporary fix for the problem that storing a transaction journal doesn't return the actual journal when successful. 2014-10-07 12:26:02 +02:00
Sander Dorigo
d5bcf5497f Various updates to facilitate validating things. 2014-10-06 19:32:09 +02:00
Sander Dorigo
28aaea1aa3 Extended forms and started on recurring transactions. 2014-10-05 19:29:25 +02:00
Sander Dorigo
980d9ce885 Also validate edits. 2014-10-05 08:49:36 +02:00
Sander Dorigo
ec601efa6e close #11, close #10 2014-10-05 08:27:49 +02:00
Sander Dorigo
b3209d3b4d Fixed validation and made some new form elements. 2014-10-05 08:27:18 +02:00
Sander Dorigo
4ce978b9f3 New breadcrumbs. 2014-10-04 07:15:56 +02:00
Sander Dorigo
a84064663a Fixed a bug where editing a transaction would lead to unset variables. 2014-10-03 21:36:42 +02:00
James Cole
6798cea268 Some more bug fixes. 2014-09-28 09:20:25 +02:00
James Cole
8e86196352 Bugfix in limit controller. 2014-09-28 09:09:48 +02:00
James Cole
1b3d345fbd Quick & dirty fixes for the piggy bank controller. 2014-09-28 09:01:57 +02:00
James Cole
7d2627515f Fixed route when removing piggy banks. 2014-09-28 08:52:24 +02:00
James Cole
aa9eb8ca64 Varioux fixes and cleaning up. 2014-09-28 08:47:51 +02:00
James Cole
9015d6ca16 Reordered the account repository and fixed a small bug. 2014-09-27 12:10:58 +02:00
James Cole
217483639d Cleanup. 2014-09-27 07:06:30 +02:00
James Cole
78e80530d3 Place holder for reports. 2014-09-27 07:06:19 +02:00
James Cole
3bbecfe830 Various bug fixes. 2014-09-27 06:06:31 +02:00
James Cole
9ab3679d49 Fixed a chart. 2014-09-27 06:05:53 +02:00
James Cole
fc44a52ba5 Fixed a bug that would recreate accounts if they existed had an old account type. 2014-09-25 07:41:45 +02:00
James Cole
bb2b71bdc0 Removed unused JS files and references. 2014-09-24 07:03:55 +02:00
James Cole
b23d2a9d95 Removed deprecated function. 2014-09-23 22:00:11 +02:00
James Cole
eeb773fd7b Move fonts to match CSS 2014-09-23 21:56:08 +02:00
James Cole
53a582f374 Replaced index.css 2014-09-23 21:53:51 +02:00
James Cole
73110f6a51 Replaced accounts.css 2014-09-23 21:53:24 +02:00
James Cole
5667663fef Replaced recurring.css 2014-09-23 21:52:40 +02:00
James Cole
fb664ba17d Fixed transactions.css 2014-09-23 21:51:39 +02:00
James Cole
0c10190a8e Replaced accounts, budgets and index. 2014-09-23 21:49:52 +02:00
James Cole
183a323ef6 Replaced budget*.js 2014-09-23 21:48:19 +02:00
James Cole
90bada5497 Replaced categories.js 2014-09-23 21:46:35 +02:00
James Cole
7c043e1923 Replaced piggybanks-create.js 2014-09-23 21:44:00 +02:00
James Cole
2720ae3c46 Replaced piggybanks.js 2014-09-23 21:41:34 +02:00
James Cole
401508577e Replaced recurring.js 2014-09-23 21:40:24 +02:00
James Cole
b0a31cebc2 Replaced transactions.js 2014-09-23 21:37:59 +02:00
James Cole
95adb428fa See previous. 2014-09-23 21:35:09 +02:00
James Cole
f92a0310dd Successfully replaced application.css 2014-09-23 21:34:13 +02:00
James Cole
84f0cb3765 Successfully replaced application.js 2014-09-23 21:31:38 +02:00
James Cole
d49e6787d6 Completely removed code sleeve asset management. 2014-09-23 21:28:05 +02:00
James Cole
0884853a6f Updated CSS. Again. Next step: extended debugging. 2014-09-23 21:00:36 +02:00
James Cole
1967c63006 Update packages. 2014-09-23 20:51:41 +02:00
James Cole
9461e7b70a Some package updates. 2014-09-23 20:50:57 +02:00
James Cole
f1e5df566c Remove cache from asset pipeline in an attempt to fix the "not including some files"-bug, although right now I have a clue what's causing it. 2014-09-23 20:32:33 +02:00
James Cole
fb02a0d5ad Update CSS, again. 2014-09-23 15:23:38 +02:00
James Cole
e438a02fa3 Fixed CSS 2014-09-23 15:19:10 +02:00
James Cole
b112452aa1 Different composer instructions. 2014-09-23 07:57:50 +02:00
James Cole
1a2fc81af3 Some more routes and attempt at bug fix. 2014-09-23 07:53:07 +02:00
James Cole
38bbda982c Attempt to include SB stylesheet. 2014-09-23 07:50:53 +02:00
James Cole
41ad6e64d1 Some more cleanup. 2014-09-22 07:25:23 +02:00
James Cole
efcad0b935 First version of a search interface. 2014-09-22 07:25:14 +02:00
James Cole
e892b69a96 Code cleanup. 2014-09-21 16:22:18 +02:00
James Cole
5dfc04e777 Some cleanup. 2014-09-21 15:51:07 +02:00
James Cole
c119a42d70 Clean up edit routines 2014-09-21 15:40:41 +02:00
James Cole
802541b796 Some CSS and style updates. 2014-09-21 12:30:00 +02:00
James Cole
0770c79777 Some cleanup. 2014-09-21 10:58:02 +02:00
James Cole
5f4669341e Completed views for transactions. 2014-09-21 10:55:51 +02:00
James Cole
f15fc80233 Made sure all columns can be sorted on. 2014-09-21 09:37:22 +02:00
James Cole
a7d75ea94a Fixed a bug in the import routine that would mislabel the import account and botch any import process. 2014-09-21 08:54:23 +02:00
James Cole
ba4bddf756 Updated the migration routine, started on data tables. 2014-09-21 08:25:30 +02:00
James Cole
6a26408552 Expanded the 'save transaction' routine and cleaned it up. Still some work to do though. 2014-09-20 08:39:24 +02:00
James Cole
c39c59fff5 Some cleaning up. 2014-09-19 23:05:57 +02:00
James Cole
c1ba8dc6a7 Forgot some files. 2014-09-17 08:56:10 +02:00
James Cole
f2825da878 Updated some routes. 2014-09-17 08:56:02 +02:00
James Cole
c61f1307d8 Fixed all titles, subtitles and icons to properly display new layout. 2014-09-17 08:55:51 +02:00
James Cole
9e88d7a60d These are the limit fixes, previous was category. 2014-09-15 17:57:46 +02:00
James Cole
406ae25162 Fix the limit views. 2014-09-15 17:57:19 +02:00
James Cole
dbfb342021 Fixed for budget views. 2014-09-15 17:46:01 +02:00
James Cole
4632142e06 Fixes for account routes. 2014-09-15 17:03:53 +02:00
James Cole
9ae036f297 Beanstalk is now supported. 2014-09-14 21:59:41 +02:00
James Cole
497b8c48c8 Added a default, higher debug level. 2014-09-14 21:59:30 +02:00
James Cole
5d11949313 Extended log routine. 2014-09-14 21:10:33 +02:00
James Cole
a91c9f04c5 Small cleanup. 2014-09-14 21:10:18 +02:00
James Cole
4f3493f9ff Time-based navigation and some feedback for the user as to his import. 2014-09-14 21:09:52 +02:00
James Cole
49b8742082 Clean up validator because the import would fail. 2014-09-14 21:08:39 +02:00
James Cole
69cee59e23 Moved some import routines to the repositories. 2014-09-14 21:07:43 +02:00
James Cole
19402b9022 Improvements upon the import routine. 2014-09-14 21:06:48 +02:00
James Cole
62ba40b687 Moved some scripts around. 2014-09-14 21:05:56 +02:00
James Cole
f9af9a4fbe Some cleanup in migration controller. 2014-09-13 06:30:31 +02:00
James Cole
c2ab43d0ab Cleanup account controller. 2014-09-13 06:30:09 +02:00
James Cole
af28e6e7b9 Extended cleanup scripts. 2014-09-13 06:29:53 +02:00
James Cole
114ad7f292 Helper that also resets everything. 2014-09-12 21:49:20 +02:00
James Cole
44eb67f94e Some cleanup, some bug fixes. 2014-09-12 21:47:27 +02:00
James Cole
0203fee174 Some small updates to various classes to support new stuff. 2014-09-12 17:34:54 +02:00
James Cole
a1ba340ead Updated the transaction everything so views and forms work with the new transaction controller. 2014-09-12 17:31:12 +02:00
James Cole
0ae9ff4575 Some initial title cleanup in the category controller. 2014-09-12 17:30:12 +02:00
James Cole
5b501cb942 Some initial title cleanup in the budget controller. 2014-09-12 17:29:32 +02:00
James Cole
0255b7a4a0 Experimental new title icon. 2014-09-12 17:29:16 +02:00
James Cole
15ef0bab1d New JSON routes and code. 2014-09-12 17:28:58 +02:00
James Cole
decad6830b Routes to show the different kinds of transactions. 2014-09-12 17:28:44 +02:00
James Cole
b6e0b985c2 Small bug fixed in account scope. 2014-09-11 22:46:11 +02:00
James Cole
c140f71878 Small bug fix in the import routine. 2014-09-11 22:29:49 +02:00
James Cole
87044e6b8e Menu responds way better. 2014-09-11 21:59:39 +02:00
James Cole
affa9014d2 Repositories can now deal with new account types. 2014-09-11 21:59:27 +02:00
James Cole
4bbc3c3bd8 Fix some bugs in the import tasks. 2014-09-11 21:59:10 +02:00
James Cole
d296dbbc23 Cleanup account views, controllers and repositories. 2014-09-11 21:58:51 +02:00
James Cole
9bcd27b847 Cleanup and improve charts. 2014-09-11 21:58:08 +02:00
James Cole
2a54b36db0 New route for different account types (and the creation thereof. 2014-09-11 21:57:57 +02:00
James Cole
77fb02daa4 Merge branch 'new-layout' 2014-09-11 15:53:33 +02:00
James Cole
1963ac191f Merge branch 'master' of https://github.com/JC5/firefly-iii 2014-09-11 15:52:02 +02:00
James Cole
33da8aa987 Merge branch 'master' of https://github.com/JC5/firefly-iii into new-layout 2014-09-11 15:22:12 +02:00
James Cole
0192484044 Revert "Fixed a bug that would stop you from registering."
This reverts commit 7cc7235f2d.
2014-09-11 15:21:37 +02:00
James Cole
3c0863d8ea Fixed a bug that would stop you from registering. 2014-09-11 15:20:45 +02:00
James Cole
710d6dfb74 Lighter chart. 2014-09-11 15:20:45 +02:00
James Cole
2359542d72 Better feedback. 2014-09-11 15:20:45 +02:00
James Cole
e2227271b5 More info on home screen. 2014-09-11 15:18:43 +02:00
James Cole
7a639a1d6e New views coming soon! 2014-09-11 15:18:32 +02:00
James Cole
9edb9b91b2 New account types for new layout (yep). 2014-09-11 10:12:30 +02:00
James Cole
b2adeb20d9 New routes for new layouts. 2014-09-11 10:11:11 +02:00
James Cole
fa665de847 Various chart cleanups. 2014-09-11 10:09:09 +02:00
James Cole
ab9e5f716d Clean up filters, extend index and small fix for title. 2014-09-10 22:22:44 +02:00
James Cole
5788db9f07 Reversed from flot/plot back to high charts. Cleaned up the index. 2014-09-10 20:54:01 +02:00
James Cole
3068a8d58d Some changes to the login view. 2014-09-10 19:44:09 +02:00
James Cole
14aacf42b9 Cleanup for new chart library (foot). 2014-09-10 16:15:28 +02:00
James Cole
d1b97da309 Home view gets a better title. 2014-09-10 14:39:38 +02:00
James Cole
867074e7b2 Cleaned up the menu. Not all links are working. 2014-09-10 08:16:22 +02:00
James Cole
18748510b1 First change; menu is now from sb-admin. 2014-09-10 06:56:57 +02:00
James Cole
bcf71cdf85 Updated the CSS and JS files to include the new CSS and JS. 2014-09-10 06:39:42 +02:00
901 changed files with 69601 additions and 27273 deletions

23
.codeclimate.yml Normal file
View File

@@ -0,0 +1,23 @@
# Save as .codeclimate.yml (note leading .) in project root directory
languages:
JavaScript: true
PHP: true
exclude_paths:
- "public/packages/maximebf/php-debugbar/debugbar.js"
- "public/packages/maximebf/php-debugbar/widgets.js"
- "public/packages/maximebf/php-debugbar/openhandler.js"
- "public/packages/maximebf/php-debugbar/widgets/sqlqueries/widget.js"
- "public/js/bootstrap3-typeahead.min.js"
- "public/js/bootstrap-sortable.js"
- "public/js/bootstrap-tagsinput.min.js"
- "public/js/bootstrap-tagsinput.min.js.map"
- "public/js/daterangepicker.js"
- "public/js/jquery-2.1.3.min.js"
- "public/js/jquery-2.1.3.min.js.map"
- "public/js/jquery-ui.min.js"
- "public/js/metisMenu.js"
- "public/js/moment.min.js"
- "public/js/sb-admin-2.js"
- "tests/*"
- "database/*"
- "storage/*"

View File

@@ -1 +1,3 @@
src_dir: .
coverage_clover: storage/coverage/clover.xml
json_path: storage/coverage/coveralls-upload.json

20
.env.example Normal file
View File

@@ -0,0 +1,20 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=SomeRandomString
DB_CONNECTION=mysql
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=file
SESSION_DRIVER=file
EMAIL_SMTP=
EMAIL_DRIVER=smtp
EMAIL_USERNAME=
EMAIL_PASSWORD=
ANALYTICS_ID=
EMAIL_PRETEND=false
RUNCLEANUP=true

18
.env.testing Normal file
View File

@@ -0,0 +1,18 @@
APP_ENV=testing
APP_DEBUG=true
APP_KEY=SomeRandomString
DB_CONNECTION=sqlite
DB_HOST=localhost
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
CACHE_DRIVER=array
SESSION_DRIVER=array
EMAIL_SMTP=
EMAIL_USERNAME=
EMAIL_PASSWORD=
ANALYTICS_ID=ABC
EMAIL_PRETEND=true

25
.gitignore vendored
View File

@@ -1,10 +1,6 @@
/bootstrap/compiled.php
/vendor
composer.phar
composer.lock
.env.*.php
.env.php
.DS_Store
Thumbs.db
.idea/
tests/_output/*
@@ -14,3 +10,24 @@ index.html*
app/storage/firefly-export*
.vagrant
firefly-iii-import-*.json
tests/_output/*
testing.sqlite
_ide_helper_models.php
clean.sqlite
tests/acceptance/AcceptanceTester.php
tests/functional/FunctionalTester.php
tests/unit/UnitTester.php
pi.php
tests/_data/db.sqlite
tests/_data/dump.sql
db.sqlite_snapshot
c3.php
db.sqlite-journal
tests/_output/*
.env
clover.xml
node_modules/
addNewLines.php
.phpstorm.meta.php
.env.backup
.env.local

View File

@@ -1,13 +1,22 @@
language: php
sudo: false
php:
- 5.5
- 5.4
- hhvm
- 5.6
addons:
code_climate:
repo_token: 26489f9e854fcdf7e7660ba29c1455694685465b1f90329a79f7d2bf448acb61
install:
- composer install
- composer update
- php artisan env
- mv -v .env.testing .env
script:
- phpunit
after_script:
- php vendor/bin/coveralls

115
README.md
View File

@@ -1,64 +1,97 @@
firefly-iii
===========
[![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=master)](https://travis-ci.org/JC5/firefly-iii)
![Still maintained?](http://stillmaintained.com/JC5/firefly-iii.png)
# Firefly III
#### v3.4.0.9
[![Build Status](https://travis-ci.org/JC5/firefly-iii.svg?branch=develop)](https://travis-ci.org/JC5/firefly-iii)
[![Project Status](http://stillmaintained.com/JC5/firefly-iii.png?a=b)](http://stillmaintained.com/JC5/firefly-iii)
[![SensioLabsInsight](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102/mini.png)](https://insight.sensiolabs.com/projects/d44c7012-5f50-41ad-add8-8445330e4102)
[![Code Climate](https://codeclimate.com/github/JC5/firefly-iii/badges/gpa.svg)](https://codeclimate.com/github/JC5/firefly-iii)
[![Coverage Status](https://coveralls.io/repos/JC5/firefly-iii/badge.svg?branch=master)](https://coveralls.io/r/JC5/firefly-iii?branch=master)
[![Latest Stable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/stable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![Total Downloads](https://poser.pugx.org/grumpydictator/firefly-iii/downloads.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![Latest Unstable Version](https://poser.pugx.org/grumpydictator/firefly-iii/v/unstable.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
[![License](https://poser.pugx.org/grumpydictator/firefly-iii/license.svg)](https://packagist.org/packages/grumpydictator/firefly-iii)
![GA](https://ga-beacon.appspot.com/UA-58172398-6/firefly-iii/readme)
## About
Firefly Mark III is a new version of Firefly built upon best practices and lessons learned
from building [Firefly](https://github.com/JC5/Firefly). It's Mark III since the original Firefly never made it outside of my
laptop and [Firefly II](https://github.com/JC5/Firefly) is live.
"Firefly III" is a financial manager. It can help you keep track of expenses, income, budgets and everything in between. It even supports credit cards, shared
household accounts and savings accounts! It's pretty fancy. You should use it to save and organise money.
_Firefly is a system you'll have install yourself on webhosting of your choosing._
Personal financial management is pretty difficult, and everybody has their own approach to it. Some people
make budgets, other people limit their cashflow by throwing away their credit cards, others try to increase
their current cashflow. There are tons of ways to save and earn money.
Firefly works on the principle that if you know where you're money is going, you can stop it from going there.
To get to know Firefly, and to see if it fits you, check out these resources:
- The screenshots below on this very page.
- The featurelist below, also on this very page.
- The [full description](https://github.com/JC5/firefly-iii/wiki/full-description), which will tell you how Firefly works,
and the philosophy behind it.
#### About the name (if you care)
It's III, or 3, because [version 2](https://github.com/JC5/Firefly) and version 1 (not online) preceded it. It has been growing steadily ever since.
## Current features
- [A double-entry bookkeeping system](http://en.wikipedia.org/wiki/Double-entry_bookkeeping_system).
- You can store, edit and remove withdrawals, deposits and transfers. This allows you full financial management;
- It's possible to create, change and manage money using _budgets_;
- [A double-entry bookkeeping system](https://en.wikipedia.org/wiki/Double-entry_bookkeeping_system);
- You can store, edit and remove [withdrawals, deposits and transfers](https://en.wikipedia.org/wiki/Financial_transaction). This allows you full financial management;
- You can manage different types of accounts;
- [Asset](https://en.wikipedia.org/wiki/Asset) accounts
- Shared [asset accounts](https://en.wikipedia.org/wiki/Asset) ([household accounts](https://en.wikipedia.org/wiki/Household))
- Saving accounts
- Credit cards
- It's possible to create, change and manage money using _[budgets](https://en.wikipedia.org/wiki/Envelope_system)_;
- Organize transactions using categories;
- Save towards a goal using piggy banks;
- Predict and anticipate large expenses using "repeated expenses" (ie. yearly taxes);
- Predict and anticipate bills using "recurring transactions" (rent for example).
- Save towards a goal using [piggy banks](https://en.wikipedia.org/wiki/Piggy_bank);
- Predict and anticipate [bills](https://en.wikipedia.org/wiki/Invoice);
- View income / expense [reports](https://en.wikipedia.org/wiki/Financial_statement);
- Organize expenses using tags;
- Lots of help text in case you don't get it.
Everything is organised:
- Clear views that should show you how you're doing;
- Easy navigation through your records;
- Browse back and forth to see previous months or even years;
- Lots of help text in case you don't get it;
- Lots of charts because we all love them.
- Lots of charts because we all love them;
- Financial reporting showing you how well you are doing.
## Changes
## Screenshots
Firefly III will feature, but does not feature yet:
_Please note that everything in these screenshots is fictional and may not be realistic._
- Financial reporting showing you how well you are doing;
- More control over other resources outside of personal finance
- Accounts shared with a partner (household accounts)
- Debts
- Credit cards
- More test-coverage (aka: actual test coverage);
- Firefly will be able to split transactions; a single purchase can be split in multiple entries, for more fine-grained control.
- Firefly will be able to join transactions.
- Transfers and transactions are combined into one internal datatype which is more consistent with what you're actually doing: moving money from A to B. The fact that A or B or both are yours should not matter.
- Any other features I might not have thought of.
![Index](https://i.nder.be/c09vfw90)
Some stuff has been removed:
![Accounts](https://i.nder.be/hkn0vhcg)
![Budgets](https://i.nder.be/h2snx2mw)
![Reports 1](https://i.nder.be/c9f8zy5c)
![Reports 2](https://i.nder.be/ghvs5png)
![Bills](https://i.nder.be/h58kh00p)
![Piggy banks](https://i.nder.be/hkud0h53)
## Running and installing
If you're still interested please read [the installation guide](https://github.com/JC5/firefly-iii/wiki/Installation),
[the upgrade guide](https://github.com/JC5/firefly-iii/wiki/Upgrade-instructions) (if applicable)
and the **[first use guide](https://github.com/JC5/firefly-iii/wiki/First-use)**.
If you want to try out Firefly III, you can do so on [this dedicated website](https://geld.nder.be/).
This site always runs the latest version of Firefly III. If you want to use it, please read the [privacy considerations](https://github.com/JC5/firefly-iii/wiki/Privacy-on-demo-site) for this demo-site.
- The nesting of budgets, categories and beneficiaries is removed because it was pretty pointless.
- Firefly will not encrypt the content of the (MySQL) tables. Old versions of Firefly had this capability but it sucks when searching, sorting and organizing entries.
## Current state
I have the basics up and running. Test coverage is currently non-existent.
Although I have not checked extensively, some forms and views have CSRF vulnerabilities. This is because not all
views escape all characters by default. Will be fixed.
Firefly III is pretty much all grown up. Full test coverage (nerd alert!) is coming. One of the things on the todo-list
is adding translations.
The current layout / look & feel is a pretty basic Bootstrap3 template. I am currently working on a more consistent,
expanded layout which will feature shiny AJAX things and data tables and all the Web 3.0 goodies you've come to expect
from social media sites.
Questions, ideas, bugs or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)!
Questions, ideas or other things to contribute? [Let me know](https://github.com/JC5/firefly-iii/issues/new)!
If you like this tool, feel free to [donate me some beer money](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=2ZMV952UUSCLU&lc=NL&item_name=Development%20of%20Firefly&currency_code=EUR&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted).

12
app/Commands/Command.php Normal file
View File

@@ -0,0 +1,12 @@
<?php namespace FireflyIII\Commands;
/**
* Class Command
*
* @codeCoverageIgnore
* @package FireflyIII\Commands
*/
abstract class Command
{
}

37
app/Console/Kernel.php Normal file
View File

@@ -0,0 +1,37 @@
<?php namespace FireflyIII\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
/**
* Class Kernel
*
* @codeCoverageIgnore
* @package FireflyIII\Console
*/
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands
= [
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*
* @return void
*/
protected function schedule(Schedule $schedule)
{
}
}

14
app/Events/Event.php Normal file
View File

@@ -0,0 +1,14 @@
<?php namespace FireflyIII\Events;
/**
* Class Event
*
* @codeCoverageIgnore
* @package FireflyIII\Events
*/
abstract class Event
{
//
}

View File

@@ -0,0 +1,34 @@
<?php namespace FireflyIII\Events;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;
/**
* Class JournalCreated
*
* @codeCoverageIgnore
* @package FireflyIII\Events
*/
class JournalCreated extends Event
{
use SerializesModels;
public $journal;
public $piggyBankId;
/**
* Create a new event instance.
*
* @param TransactionJournal $journal
* @param $piggyBankId
*/
public function __construct(TransactionJournal $journal, $piggyBankId)
{
//
$this->journal = $journal;
$this->piggyBankId = $piggyBankId;
}
}

View File

@@ -0,0 +1,25 @@
<?php namespace FireflyIII\Events;
use Illuminate\Queue\SerializesModels;
/**
* Class JournalDeleted
*
* @codeCoverageIgnore
* @package FireflyIII\Events
*/
class JournalDeleted extends Event
{
use SerializesModels;
/**
* Create a new event instance.
*
*/
public function __construct()
{
//
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace FireflyIII\Events;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Queue\SerializesModels;
/**
* Class JournalSaved
*
* @codeCoverageIgnore
* @package FireflyIII\Events
*/
class JournalSaved extends Event
{
use SerializesModels;
public $journal;
/**
* Create a new event instance.
*
* @param TransactionJournal $journal
*/
public function __construct(TransactionJournal $journal)
{
//
$this->journal = $journal;
}
}

View File

@@ -0,0 +1,15 @@
<?php
namespace FireflyIII\Exceptions;
/**
* Class FireflyException
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class FireflyException extends \Exception
{
}

View File

@@ -0,0 +1,58 @@
<?php namespace FireflyIII\Exceptions;
use Exception;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
/**
* Class Handler
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class Handler extends ExceptionHandler
{
/**
* A list of the exception types that should not be reported.
*
* @var array
*/
protected $dontReport
= [
'Symfony\Component\HttpKernel\Exception\HttpException'
];
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $e
* @SuppressWarnings(PHPMD.ShortVariable)
*
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $e)
{
if ($this->isHttpException($e)) {
return $this->renderHttpException($e);
} else {
return parent::render($request, $e);
}
}
/**
* Report or log an exception.
*
* This is a great spot to send exceptions to Sentry, Bugsnag, etc.
* @SuppressWarnings(PHPMD.ShortVariable)
*
* @param \Exception $e
*
* @return void
*/
public function report(Exception $e)
{
parent::report($e);
}
}

View File

@@ -0,0 +1,14 @@
<?php
namespace FireflyIII\Exceptions;
/**
* Class NotImplementedException
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class NotImplementedException extends \Exception
{
}

View File

@@ -0,0 +1,13 @@
<?php
namespace FireflyIII\Exceptions;
/**
* Class ValidationExceptions
*
* @codeCoverageIgnore
* @package FireflyIII\Exception
*/
class ValidationException extends \Exception
{
}

View File

@@ -0,0 +1,76 @@
<?php namespace FireflyIII\Handlers\Events;
use Auth;
use FireflyIII\Events\JournalCreated;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
/**
* Class ConnectJournalToPiggyBank
*
* @package FireflyIII\Handlers\Events
*/
class ConnectJournalToPiggyBank
{
/**
* Create the event handler.
*
* @codeCoverageIgnore
*
*/
public function __construct()
{
//
}
/**
* Handle the event when journal is saved.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @param JournalCreated $event
*
* @return boolean
*/
public function handle(JournalCreated $event)
{
/** @var TransactionJournal $journal */
$journal = $event->journal;
$piggyBankId = $event->piggyBankId;
/** @var PiggyBank $piggyBank */
$piggyBank = Auth::user()->piggybanks()->where('piggy_banks.id', $piggyBankId)->first(['piggy_banks.*']);
if (is_null($piggyBank)) {
return false;
}
// update piggy bank rep for date of transaction journal.
$repetition = $piggyBank->piggyBankRepetitions()->relevantOnDate($journal->date)->first();
if (is_null($repetition)) {
return false;
}
$amount = $journal->amount;
/** @var Transaction $transaction */
foreach ($journal->transactions()->get() as $transaction) {
if ($transaction->account_id == $piggyBank->account_id) {
if ($transaction->amount < 0) {
$amount = $transaction->amount * -1;
}
}
}
$repetition->currentamount += $amount;
$repetition->save();
PiggyBankEvent::create(['piggy_bank_id' => $piggyBank->id, 'transaction_journal_id' => $journal->id, 'date' => $journal->date, 'amount' => $amount]);
return true;
}
}

View File

@@ -0,0 +1,53 @@
<?php namespace FireflyIII\Handlers\Events;
use App;
use FireflyIII\Events\JournalSaved;
use Log;
/**
* Class RescanJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class RescanJournal
{
/**
* Create the event handler.
*
*/
public function __construct()
{
//
}
/**
* Handle the event.
*
* @param JournalSaved $event
*
* @return void
*/
public function handle(JournalSaved $event)
{
$journal = $event->journal;
Log::debug('Triggered saved event for journal #' . $journal->id . ' (' . $journal->description . ')');
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$list = $journal->user->bills()->where('active', 1)->where('automatch', 1)->get();
Log::debug('Found ' . $list->count() . ' bills to check.');
/** @var \FireflyIII\Models\Bill $bill */
foreach ($list as $bill) {
Log::debug('Now calling bill #' . $bill->id . ' (' . $bill->name . ')');
$repository->scan($bill, $journal);
}
Log::debug('Done!');
}
}

View File

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

View File

@@ -0,0 +1,90 @@
<?php
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
* Class Account
*
* @package FireflyIII\Helpers\Collection
*/
class Account
{
/** @var Collection */
protected $accounts;
/** @var float */
protected $difference;
/** @var float */
protected $end;
/** @var float */
protected $start;
/**
* @return \Illuminate\Support\Collection
*/
public function getAccounts()
{
return $this->accounts;
}
/**
* @param \Illuminate\Support\Collection $accounts
*/
public function setAccounts($accounts)
{
$this->accounts = $accounts;
}
/**
* @return float
*/
public function getDifference()
{
return $this->difference;
}
/**
* @param float $difference
*/
public function setDifference($difference)
{
$this->difference = $difference;
}
/**
* @return float
*/
public function getEnd()
{
return $this->end;
}
/**
* @param float $end
*/
public function setEnd($end)
{
$this->end = $end;
}
/**
* @return float
*/
public function getStart()
{
return $this->start;
}
/**
* @param float $start
*/
public function setStart($start)
{
$this->start = $start;
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Balance
*
* @package FireflyIII\Helpers\Collection
*/
class Balance
{
/** @var BalanceHeader */
protected $balanceHeader;
/** @var Collection */
protected $balanceLines;
/**
*
*/
public function __construct()
{
$this->balanceLines = new Collection;
}
/**
* @param BalanceLine $line
*/
public function addBalanceLine(BalanceLine $line)
{
$this->balanceLines->push($line);
}
/**
* @return BalanceHeader
*/
public function getBalanceHeader()
{
return $this->balanceHeader;
}
/**
* @param BalanceHeader $balanceHeader
*/
public function setBalanceHeader($balanceHeader)
{
$this->balanceHeader = $balanceHeader;
}
/**
* @return \Illuminate\Support\Collection
*/
public function getBalanceLines()
{
return $this->balanceLines;
}
}

View File

@@ -0,0 +1,74 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
/**
* @codeCoverageIgnore
*
* Class BalanceEntry
*
* @package FireflyIII\Helpers\Collection
*/
class BalanceEntry
{
/** @var AccountModel */
protected $account;
/** @var float */
protected $left = 0.0;
/** @var float */
protected $spent = 0.0;
/**
* @return AccountModel
*/
public function getAccount()
{
return $this->account;
}
/**
* @param AccountModel $account
*/
public function setAccount($account)
{
$this->account = $account;
}
/**
* @return float
*/
public function getLeft()
{
return $this->left;
}
/**
* @param float $left
*/
public function setLeft($left)
{
$this->left = $left;
}
/**
* @return float
*/
public function getSpent()
{
return $this->spent;
}
/**
* @param float $spent
*/
public function setSpent($spent)
{
$this->spent = $spent;
}
}

View File

@@ -0,0 +1,46 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class BalanceHeader
*
* @package FireflyIII\Helpers\Collection
*/
class BalanceHeader
{
/** @var Collection */
protected $accounts;
/**
*
*/
public function __construct()
{
$this->accounts = new Collection;
}
/**
* @param AccountModel $account
*/
public function addAccount(AccountModel $account)
{
$this->accounts->push($account);
}
/**
* @return Collection
*/
public function getAccounts()
{
return $this->accounts;
}
}

View File

@@ -0,0 +1,170 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class BalanceLine
*
* @package FireflyIII\Helpers\Collection
*/
class BalanceLine
{
const ROLE_DEFAULTROLE = 1;
const ROLE_TAGROLE = 2;
const ROLE_DIFFROLE = 3;
/** @var Collection */
protected $balanceEntries;
/** @var BudgetModel */
protected $budget;
/** @var LimitRepetition */
protected $repetition;
protected $role = self::ROLE_DEFAULTROLE;
/**
*
*/
public function __construct()
{
$this->balanceEntries = new Collection;
}
/**
* @param BalanceEntry $balanceEntry
*/
public function addBalanceEntry(BalanceEntry $balanceEntry)
{
$this->balanceEntries->push($balanceEntry);
}
/**
* @return string
*/
public function getTitle()
{
if ($this->getBudget() instanceof BudgetModel) {
return $this->getBudget()->name;
}
if ($this->getRole() == self::ROLE_DEFAULTROLE) {
return trans('firefly.noBudget');
}
if ($this->getRole() == self::ROLE_TAGROLE) {
return trans('firefly.coveredWithTags');
}
if ($this->getRole() == self::ROLE_DIFFROLE) {
return trans('firefly.leftUnbalanced');
}
}
/**
* @return BudgetModel
*/
public function getBudget()
{
return $this->budget;
}
/**
* @param BudgetModel $budget
*/
public function setBudget($budget)
{
$this->budget = $budget;
}
/**
* @return int
*/
public function getRole()
{
return $this->role;
}
/**
* @param int $role
*/
public function setRole($role)
{
$this->role = $role;
}
/**
* If a BalanceLine has a budget/repetition, each BalanceEntry in this BalanceLine
* should have a "spent" value, which is the amount of money that has been spent
* on the given budget/repetition. If you subtract all those amounts from the budget/repetition's
* total amount, this is returned:
*
* @return float
*/
public function leftOfRepetition()
{
$start = $this->getRepetition() ? $this->getRepetition()->amount : 0;
/** @var BalanceEntry $balanceEntry */
foreach ($this->getBalanceEntries() as $balanceEntry) {
$start += $balanceEntry->getSpent();
}
return $start;
}
/**
* @return LimitRepetition
*/
public function getRepetition()
{
return $this->repetition;
}
/**
* @param LimitRepetition $repetition
*/
public function setRepetition($repetition)
{
$this->repetition = $repetition;
}
/**
* @return Collection
*/
public function getBalanceEntries()
{
return $this->balanceEntries;
}
/**
* @param Collection $balanceEntries
*/
public function setBalanceEntries($balanceEntries)
{
$this->balanceEntries = $balanceEntries;
}
/**
* If the BalanceEntries for a BalanceLine have a "left" value, the amount
* of money left in the entire BalanceLine is returned here:
*
* @return float
*/
public function sumOfLeft()
{
$sum = 0.0;
/** @var BalanceEntry $balanceEntry */
foreach ($this->getBalanceEntries() as $balanceEntry) {
$sum += $balanceEntry->getLeft();
}
return $sum;
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Bill as BillModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
* Class Bill
*
* @package FireflyIII\Helpers\Collection
*/
class Bill
{
/**
* @var Collection
*/
protected $bills;
/**
*
*/
public function __construct()
{
$this->bills = new Collection;
}
/**
* @param BillLine $bill
*/
public function addBill(BillLine $bill)
{
$this->bills->push($bill);
}
/**
* @return Collection
*/
public function getBills()
{
$this->bills->sortBy(
function (BillLine $bill) {
$active = intval($bill->getBill()->active) == 0 ? 1 : 0;
$name = $bill->getBill()->name;
return $active . $name;
}
);
return $this->bills;
}
}

View File

@@ -0,0 +1,127 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Bill as BillModel;
/**
* @codeCoverageIgnore
*
* Class BillLine
*
* @package FireflyIII\Helpers\Collection
*/
class BillLine
{
/** @var bool */
protected $active;
/** @var float */
protected $amount;
/** @var BillModel */
protected $bill;
/** @var bool */
protected $hit;
/** @var float */
protected $max;
/** @var float */
protected $min;
/**
* @return float
*/
public function getAmount()
{
return $this->amount;
}
/**
* @param float $amount
*/
public function setAmount($amount)
{
$this->amount = $amount;
}
/**
* @return BillModel
*/
public function getBill()
{
return $this->bill;
}
/**
* @param BillModel $bill
*/
public function setBill($bill)
{
$this->bill = $bill;
}
/**
* @return float
*/
public function getMax()
{
return $this->max;
}
/**
* @param float $max
*/
public function setMax($max)
{
$this->max = $max;
}
/**
* @return float
*/
public function getMin()
{
return $this->min;
}
/**
* @param float $min
*/
public function setMin($min)
{
$this->min = $min;
}
/**
* @return boolean
*/
public function isActive()
{
return $this->active;
}
/**
* @param boolean $active
*/
public function setActive($active)
{
$this->active = $active;
}
/**
* @return boolean
*/
public function isHit()
{
return $this->hit;
}
/**
* @param boolean $hit
*/
public function setHit($hit)
{
$this->hit = $hit;
}
}

View File

@@ -0,0 +1,156 @@
<?php
namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Budget
*
* @package FireflyIII\Helpers\Collection
*/
class Budget
{
/** @var Collection */
protected $budgetLines;
/** @var string */
protected $budgeted = '0';
/** @var string */
protected $left = '0';
/** @var string */
protected $overspent = '0';
/** @var string */
protected $spent = '0';
/**
*
*/
public function __construct()
{
$this->budgetLines = new Collection;
}
/**
* @param BudgetLine $budgetLine
*/
public function addBudgetLine(BudgetLine $budgetLine)
{
$this->budgetLines->push($budgetLine);
}
/**
* @param float $add
*/
public function addBudgeted($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->budgeted = bcadd($this->budgeted, $add);
}
/**
* @param float $add
*/
public function addLeft($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->left = bcadd($this->left, $add);
}
/**
* @param float $add
*/
public function addOverspent($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->overspent = bcadd($this->overspent, $add);
}
/**
* @param float $add
*/
public function addSpent($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->spent = bcadd($this->spent, $add);
}
/**
* @return \Illuminate\Support\Collection
*/
public function getBudgetLines()
{
return $this->budgetLines;
}
/**
* @return string
*/
public function getBudgeted()
{
return $this->budgeted;
}
/**
* @param string $budgeted
*/
public function setBudgeted($budgeted)
{
$this->budgeted = $budgeted;
}
/**
* @return string
*/
public function getLeft()
{
return $this->left;
}
/**
* @param string $left
*/
public function setLeft($left)
{
$this->left = $left;
}
/**
* @return string
*/
public function getOverspent()
{
return $this->overspent;
}
/**
* @param string $overspent
*/
public function setOverspent($overspent)
{
$this->overspent = strval(round($overspent, 2));
}
/**
* @return string
*/
public function getSpent()
{
return $this->spent;
}
/**
* @param string $spent
*/
public function setSpent($spent)
{
$this->spent = strval(round($spent, 2));
}
}

View File

@@ -0,0 +1,128 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
/**
* @codeCoverageIgnore
*
* Class BudgetLine
*
* @package FireflyIII\Helpers\Collection
*/
class BudgetLine
{
/** @var BudgetModel */
protected $budget;
/** @var float */
protected $budgeted = 0;
/** @var float */
protected $left = 0;
/** @var float */
protected $overspent = 0;
/** @var LimitRepetition */
protected $repetition;
/** @var float */
protected $spent = 0;
/**
* @return BudgetModel
*/
public function getBudget()
{
return $this->budget;
}
/**
* @param BudgetModel $budget
*/
public function setBudget($budget)
{
$this->budget = $budget;
}
/**
* @return float
*/
public function getBudgeted()
{
return $this->budgeted;
}
/**
* @param float $budgeted
*/
public function setBudgeted($budgeted)
{
$this->budgeted = $budgeted;
}
/**
* @return float
*/
public function getLeft()
{
return $this->left;
}
/**
* @param float $left
*/
public function setLeft($left)
{
$this->left = $left;
}
/**
* @return float
*/
public function getOverspent()
{
return $this->overspent;
}
/**
* @param float $overspent
*/
public function setOverspent($overspent)
{
$this->overspent = $overspent;
}
/**
* @return LimitRepetition
*/
public function getRepetition()
{
return $this->repetition;
}
/**
* @param LimitRepetition $repetition
*/
public function setRepetition($repetition)
{
$this->repetition = $repetition;
}
/**
* @return float
*/
public function getSpent()
{
return $this->spent;
}
/**
* @param float $spent
*/
public function setSpent($spent)
{
$this->spent = $spent;
}
}

View File

@@ -0,0 +1,82 @@
<?php
/**
* Created by PhpStorm.
* User: sander
* Date: 16/05/15
* Time: 13:09
*/
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Category as CategoryModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Category
*
* @package FireflyIII\Helpers\Collection
*/
class Category
{
/** @var Collection */
protected $categories;
/** @var string */
protected $total = '0';
/**
*
*/
public function __construct()
{
$this->categories = new Collection;
}
/**
* @param CategoryModel $category
*/
public function addCategory(CategoryModel $category)
{
if ($category->spent > 0) {
$this->categories->push($category);
}
}
/**
* @param float $add
*/
public function addTotal($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->total = bcadd($this->total, $add);
}
/**
* @return Collection
*/
public function getCategories()
{
$this->categories->sortByDesc(
function (CategoryModel $category) {
return $category->spent;
}
);
return $this->categories;
}
/**
* @return string
*/
public function getTotal()
{
return strval(round($this->total, 2));
}
}

View File

@@ -0,0 +1,85 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use stdClass;
/**
* @codeCoverageIgnore
*
* Class Expense
*
* @package FireflyIII\Helpers\Collection
*/
class Expense
{
/** @var Collection */
protected $expenses;
/** @var string */
protected $total = '0';
/**
*
*/
public function __construct()
{
$this->expenses = new Collection;
}
/**
* @param TransactionJournal $entry
*/
public function addOrCreateExpense(TransactionJournal $entry)
{
$accountId = $entry->account_id;
if (!$this->expenses->has($accountId)) {
$newObject = new stdClass;
$newObject->amount = strval(round($entry->amount, 2));
$newObject->name = $entry->name;
$newObject->count = 1;
$newObject->id = $accountId;
$this->expenses->put($accountId, $newObject);
} else {
bcscale(2);
$existing = $this->expenses->get($accountId);
$existing->amount = bcadd($existing->amount, $entry->amount);
$existing->count++;
$this->expenses->put($accountId, $existing);
}
}
/**
* @param $add
*/
public function addToTotal($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->total = bcadd($this->total, $add);
}
/**
* @return Collection
*/
public function getExpenses()
{
$this->expenses->sortByDesc(
function (stdClass $object) {
return $object->amount;
}
);
return $this->expenses;
}
/**
* @return string
*/
public function getTotal()
{
return strval(round($this->total, 2));
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Support\Collection;
use stdClass;
/**
* @codeCoverageIgnore
*
* Class Income
*
* @package FireflyIII\Helpers\Collection
*/
class Income
{
/** @var Collection */
protected $incomes;
/** @var float */
protected $total;
/**
*
*/
public function __construct()
{
$this->incomes = new Collection;
}
/**
* @param TransactionJournal $entry
*/
public function addOrCreateIncome(TransactionJournal $entry)
{
$accountId = $entry->account_id;
if (!$this->incomes->has($accountId)) {
$newObject = new stdClass;
$newObject->amount = strval(round($entry->amount, 2));
$newObject->name = $entry->name;
$newObject->count = 1;
$newObject->id = $accountId;
$this->incomes->put($accountId, $newObject);
} else {
bcscale(2);
$existing = $this->incomes->get($accountId);
$existing->amount = bcadd($existing->amount, $entry->amount);
$existing->count++;
$this->incomes->put($accountId, $existing);
}
}
/**
* @param $add
*/
public function addToTotal($add)
{
$add = strval(round($add, 2));
bcscale(2);
$this->total = bcadd($this->total, $add);
}
/**
* @return Collection
*/
public function getIncomes()
{
$this->incomes->sortByDesc(
function (stdClass $object) {
return $object->amount;
}
);
return $this->incomes;
}
/**
* @return float
*/
public function getTotal()
{
return strval(round($this->total, 2));
}
}

97
app/Helpers/Help/Help.php Normal file
View File

@@ -0,0 +1,97 @@
<?php
namespace FireflyIII\Helpers\Help;
use Cache;
use ErrorException;
use League\CommonMark\CommonMarkConverter;
use Log;
use Route;
/**
* Class Help
*
* @package FireflyIII\Helpers\Help
*/
class Help implements HelpInterface
{
/**
* @codeCoverageIgnore
*
* @param $key
*
* @return string
*/
public function getFromCache($key)
{
return Cache::get($key);
}
/**
* @codeCoverageIgnore
*
* @param $route
*
* @return array
*/
public function getFromGithub($route)
{
$uri = 'https://raw.githubusercontent.com/JC5/firefly-iii-help/master/en/' . e($route) . '.md';
$content = [
'text' => '<p>There is no help for this route!</p>',
'title' => $route,
];
try {
$content['text'] = file_get_contents($uri);
} catch (ErrorException $e) {
Log::error(trim($e->getMessage()));
}
if (strlen(trim($content['text'])) == 0) {
$content['text'] = '<p>There is no help for this route.</p>';
}
$converter = new CommonMarkConverter();
$content['text'] = $converter->convertToHtml($content['text']);
return $content;
}
/**
* @codeCoverageIgnore
*
* @param $route
*
* @return bool
*/
public function hasRoute($route)
{
return Route::has($route);
}
/**
* @codeCoverageIgnore
*
* @param $route
* @param array $content
*
* @internal param $title
*/
public function putInCache($route, array $content)
{
Cache::put('help.' . $route . '.text', $content['text'], 10080); // a week.
Cache::put('help.' . $route . '.title', $content['title'], 10080);
}
/**
* @codeCoverageIgnore
*
* @param $route
*
* @return bool
*/
public function inCache($route)
{
return Cache::has('help.' . $route . '.title') && Cache::has('help.' . $route . '.text');
}
}

View File

@@ -0,0 +1,48 @@
<?php
namespace FireflyIII\Helpers\Help;
/**
* Interface HelpInterface
*
* @package FireflyIII\Helpers\Help
*/
interface HelpInterface
{
/**
* @param $key
*
* @return string
*/
public function getFromCache($key);
/**
* @param $route
*
* @return array
*/
public function getFromGithub($route);
/**
* @param $route
*
* @return bool
*/
public function hasRoute($route);
/**
* @param $route
*
* @return bool
*/
public function inCache($route);
/**
* @param $route
* @param array $content
*
* @return void
*/
public function putInCache($route, array $content);
}

View File

@@ -0,0 +1,167 @@
<?php
namespace FireflyIII\Helpers\Reminders;
use Amount;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder;
use Navigation;
/**
* Class ReminderHelper
*
* @package FireflyIII\Helpers\Reminders
*/
class ReminderHelper implements ReminderHelperInterface
{
/**
* @param PiggyBank $piggyBank
* @param Carbon $start
* @param Carbon $end
*
* @return Reminder
*/
public function createReminder(PiggyBank $piggyBank, Carbon $start, Carbon $end)
{
$reminder = Auth::user()->reminders()->where('remindersable_id', $piggyBank->id)->onDates($start, $end)->first();
if (is_null($reminder)) {
if (!is_null($piggyBank->targetdate)) {
// get ranges again, but now for the start date
$ranges = $this->getReminderRanges($piggyBank, $start);
$currentRep = $piggyBank->currentRelevantRep();
$left = $piggyBank->targetamount - $currentRep->currentamount;
$perReminder = count($ranges) == 0 ? $left : $left / count($ranges);
} else {
$perReminder = null;
$ranges = [];
$left = 0;
}
$metaData = [
'perReminder' => $perReminder,
'rangesCount' => count($ranges),
'ranges' => $ranges,
'leftToSave' => $left,
];
$reminder = new Reminder;
$reminder->user()->associate(Auth::user());
$reminder->startdate = $start;
$reminder->enddate = $end;
$reminder->active = true;
$reminder->metadata = $metaData;
$reminder->notnow = false;
$reminder->remindersable()->associate($piggyBank);
$reminder->save();
return $reminder;
} else {
return $reminder;
}
}
/**
* Create all reminders for a piggy bank for a given date.
*
* @param PiggyBank $piggyBank
*
* @param Carbon $date
*
* @return mixed
*/
public function createReminders(PiggyBank $piggyBank, Carbon $date)
{
$ranges = $this->getReminderRanges($piggyBank);
foreach ($ranges as $range) {
if ($date < $range['end'] && $date > $range['start']) {
// create a reminder here!
$this->createReminder($piggyBank, $range['start'], $range['end']);
// stop looping, we're done.
break;
}
}
}
/**
* This routine will return an array consisting of two dates which indicate the start
* and end date for each reminder that this piggy bank will have, if the piggy bank has
* any reminders. For example:
*
* [12 mar - 15 mar]
* [15 mar - 18 mar]
*
* etcetera.
*
* Array is filled with tiny arrays with Carbon objects in them.
*
* @param PiggyBank $piggyBank
* @param Carbon $date ;
*
* @return array
*/
public function getReminderRanges(PiggyBank $piggyBank, Carbon $date = null)
{
$ranges = [];
if (is_null($date)) {
$date = new Carbon;
}
if ($piggyBank->remind_me === false) {
return $ranges;
}
if (!is_null($piggyBank->targetdate)) {
// count back until now.
$start = $piggyBank->targetdate;
$end = $piggyBank->startdate;
while ($start > $end) {
$currentEnd = clone $start;
$start = Navigation::subtractPeriod($start, $piggyBank->reminder, 1);
$currentStart = clone $start;
$ranges[] = ['start' => clone $currentStart, 'end' => clone $currentEnd];
}
} else {
$start = clone $piggyBank->startdate;
while ($start < $date) {
$currentStart = clone $start;
$start = Navigation::addPeriod($start, $piggyBank->reminder, 0);
$currentEnd = clone $start;
$ranges[] = ['start' => clone $currentStart, 'end' => clone $currentEnd];
}
}
return $ranges;
}
/**
* Takes a reminder, finds the piggy bank and tells you what to do now.
* Aka how much money to put in.
*
*
* @param Reminder $reminder
*
* @return string
*/
public function getReminderText(Reminder $reminder)
{
/** @var PiggyBank $piggyBank */
$piggyBank = $reminder->remindersable;
if (is_null($piggyBank)) {
return 'Piggy bank no longer exists.';
}
if (is_null($piggyBank->targetdate)) {
return 'Add money to this piggy bank to reach your target of ' . Amount::format($piggyBank->targetamount);
}
return 'Add ' . Amount::format($reminder->metadata->perReminder) . ' to fill this piggy bank on ' . $piggyBank->targetdate->format('jS F Y');
}
}

View File

@@ -0,0 +1,64 @@
<?php
namespace FireflyIII\Helpers\Reminders;
use Carbon\Carbon;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankRepetition;
use FireflyIII\Models\Reminder;
/**
* Interface ReminderHelperInterface
*
* @package FireflyIII\Helpers\Reminders
*/
interface ReminderHelperInterface
{
/**
* Takes a reminder, finds the piggy bank and tells you what to do now.
* Aka how much money to put in.
*
* @param Reminder $reminder
*
* @return string
*/
public function getReminderText(Reminder $reminder);
/**
* This routine will return an array consisting of two dates which indicate the start
* and end date for each reminder that this piggy bank will have, if the piggy bank has
* any reminders. For example:
*
* [12 mar - 15 mar]
* [15 mar - 18 mar]
*
* etcetera.
*
* Array is filled with tiny arrays with Carbon objects in them.
*
* @param PiggyBank $piggyBank
*
* @return array
*/
public function getReminderRanges(PiggyBank $piggyBank);
/**
* @param PiggyBank $piggyBank
* @param Carbon $start
* @param Carbon $end
*
* @return Reminder
*/
public function createReminder(PiggyBank $piggyBank, Carbon $start, Carbon $end);
/**
* Create all reminders for a piggy bank for a given date.
*
* @param PiggyBank $piggyBank
*
* @param Carbon $date
*
* @return mixed
*/
public function createReminders(PiggyBank $piggyBank, Carbon $date);
}

View File

@@ -0,0 +1,399 @@
<?php
namespace FireflyIII\Helpers\Report;
use App;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account as AccountCollection;
use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\BalanceEntry;
use FireflyIII\Helpers\Collection\BalanceHeader;
use FireflyIII\Helpers\Collection\BalanceLine;
use FireflyIII\Helpers\Collection\Bill as BillCollection;
use FireflyIII\Helpers\Collection\BillLine;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\BudgetLine;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
/**
* Class ReportHelper
*
* @package FireflyIII\Helpers\Report
*/
class ReportHelper implements ReportHelperInterface
{
/** @var ReportQueryInterface */
protected $query;
/**
* @codeCoverageIgnore
*
* @param ReportQueryInterface $query
*
*/
public function __construct(ReportQueryInterface $query)
{
$this->query = $query;
}
/**
* This method generates a full report for the given period on all
* the users asset and cash accounts.
*
* @param Carbon $date
* @param Carbon $end
* @param $shared
*
* @return Account
*/
public function getAccountReport(Carbon $date, Carbon $end, $shared)
{
$accounts = $this->query->getAllAccounts($date, $end, $shared);
$start = 0;
$end = 0;
$diff = 0;
// remove cash account, if any:
$accounts = $accounts->filter(
function (Account $account) {
if ($account->accountType->type != 'Cash account') {
return $account;
}
} // @codeCoverageIgnore
);
// summarize:
foreach ($accounts as $account) {
$start += $account->startBalance;
$end += $account->endBalance;
$diff += ($account->endBalance - $account->startBalance);
}
$object = new AccountCollection;
$object->setStart($start);
$object->setEnd($end);
$object->setDifference($diff);
$object->setAccounts($accounts);
return $object;
}
/**
*
* The balance report contains a Balance object which in turn contains:
*
* A BalanceHeader object which contains all relevant user asset accounts for the report.
*
* A number of BalanceLine objects, which hold:
* - A budget
* - A number of BalanceEntry objects.
*
* The BalanceEntry object holds:
* - The same budget (again)
* - A user asset account as mentioned in the BalanceHeader
* - The amount of money spent on the budget by the user asset account
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Balance
*/
public function getBalanceReport(Carbon $start, Carbon $end, $shared)
{
$repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$tagRepository = App::make('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$balance = new Balance;
// build a balance header:
$header = new BalanceHeader;
$accounts = $this->query->getAllAccounts($start, $end, $shared);
$budgets = $repository->getBudgets();
foreach ($accounts as $account) {
$header->addAccount($account);
}
/** @var BudgetModel $budget */
foreach ($budgets as $budget) {
$line = new BalanceLine;
$line->setBudget($budget);
// get budget amount for current period:
$rep = $repository->getCurrentRepetition($budget, $start);
$line->setRepetition($rep);
// loop accounts:
foreach ($accounts as $account) {
$balanceEntry = new BalanceEntry;
$balanceEntry->setAccount($account);
// get spent:
$spent = $this->query->spentInBudgetCorrected($account, $budget, $start, $end); // I think shared is irrelevant.
$balanceEntry->setSpent($spent);
$line->addBalanceEntry($balanceEntry);
}
// add line to balance:
$balance->addBalanceLine($line);
}
// then a new line for without budget.
// and one for the tags:
$empty = new BalanceLine;
$tags = new BalanceLine;
$diffLine = new BalanceLine;
$tags->setRole(BalanceLine::ROLE_TAGROLE);
$diffLine->setRole(BalanceLine::ROLE_DIFFROLE);
foreach ($accounts as $account) {
$spent = $this->query->spentNoBudget($account, $start, $end);
$left = $tagRepository->coveredByBalancingActs($account, $start, $end);
$diff = $spent + $left;
// budget
$budgetEntry = new BalanceEntry;
$budgetEntry->setAccount($account);
$budgetEntry->setSpent($spent);
$empty->addBalanceEntry($budgetEntry);
// balanced by tags
$tagEntry = new BalanceEntry;
$tagEntry->setAccount($account);
$tagEntry->setLeft($left);
$tags->addBalanceEntry($tagEntry);
// difference:
$diffEntry = new BalanceEntry;
$diffEntry->setAccount($account);
$diffEntry->setSpent($diff);
$diffLine->addBalanceEntry($diffEntry);
}
$balance->addBalanceLine($empty);
$balance->addBalanceLine($tags);
$balance->addBalanceLine($diffLine);
$balance->setBalanceHeader($header);
return $balance;
}
/**
* This method generates a full report for the given period on all
* the users bills and their payments.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return BillCollection
*/
public function getBillReport(Carbon $start, Carbon $end, $shared)
{
/** @var \FireflyIII\Repositories\Bill\BillRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$bills = $repository->getBills();
$collection = new BillCollection;
/** @var Bill $bill */
foreach ($bills as $bill) {
$billLine = new BillLine;
$billLine->setBill($bill);
$billLine->setActive(intval($bill->active) == 1);
$billLine->setMin(floatval($bill->amount_min));
$billLine->setMax(floatval($bill->amount_max));
// is hit in period?
$set = $repository->getJournalsInRange($bill, $start, $end);
if ($set->count() == 0) {
$billLine->setHit(false);
} else {
$billLine->setHit(true);
$amount = 0;
foreach ($set as $entry) {
$amount += $entry->amount;
}
$billLine->setAmount($amount);
}
$collection->addBill($billLine);
}
return $collection;
}
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return BudgetCollection
*/
public function getBudgetReport(Carbon $start, Carbon $end, $shared)
{
$object = new BudgetCollection;
/** @var \FireflyIII\Repositories\Budget\BudgetRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$set = $repository->getBudgets();
foreach ($set as $budget) {
$repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
// no repetition(s) for this budget:
if ($repetitions->count() == 0) {
$spent = $repository->spentInPeriodCorrected($budget, $start, $end, $shared);
$budgetLine = new BudgetLine;
$budgetLine->setBudget($budget);
$budgetLine->setOverspent($spent);
$object->addOverspent($spent);
$object->addBudgetLine($budgetLine);
continue;
}
// one or more repetitions for budget:
/** @var LimitRepetition $repetition */
foreach ($repetitions as $repetition) {
$budgetLine = new BudgetLine;
$budgetLine->setBudget($budget);
$budgetLine->setRepetition($repetition);
$expenses = $repository->spentInPeriodCorrected($budget, $repetition->startdate, $repetition->enddate, $shared);
$left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? 0 : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$budgetLine->setLeft($left);
$budgetLine->setSpent($spent);
$budgetLine->setOverspent($overspent);
$budgetLine->setBudgeted($repetition->amount);
$object->addBudgeted($repetition->amount);
$object->addSpent($spent);
$object->addLeft($left);
$object->addOverspent($overspent);
$object->addBudgetLine($budgetLine);
}
}
// stuff outside of budgets:
$noBudget = $repository->getWithoutBudgetSum($start, $end);
$budgetLine = new BudgetLine;
$budgetLine->setOverspent($noBudget);
$object->addOverspent($noBudget);
$object->addBudgetLine($budgetLine);
return $object;
}
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return CategoryCollection
*/
public function getCategoryReport(Carbon $start, Carbon $end, $shared)
{
$object = new CategoryCollection;
/**
* GET CATEGORIES:
*/
/** @var \FireflyIII\Repositories\Category\CategoryRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Category\CategoryRepositoryInterface');
$set = $repository->getCategories();
foreach ($set as $category) {
$spent = $repository->spentInPeriodCorrected($category, $start, $end, $shared);
$category->spent = $spent;
$object->addCategory($category);
$object->addTotal($spent);
}
return $object;
}
/**
* Get a full report on the users expenses during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Expense
*/
public function getExpenseReport($start, $end, $shared)
{
$object = new Expense;
$set = $this->query->expenseInPeriodCorrected($start, $end, $shared);
foreach ($set as $entry) {
$object->addToTotal($entry->amount);
$object->addOrCreateExpense($entry);
}
return $object;
}
/**
* Get a full report on the users incomes during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Income
*/
public function getIncomeReport($start, $end, $shared)
{
$object = new Income;
$set = $this->query->incomeInPeriodCorrected($start, $end, $shared);
foreach ($set as $entry) {
$object->addToTotal($entry->amount);
$object->addOrCreateIncome($entry);
}
return $object;
}
/**
* @param Carbon $date
*
* @return array
*/
public function listOfMonths(Carbon $date)
{
$start = clone $date;
$end = Carbon::now();
$months = [];
while ($start <= $end) {
$year = $start->year;
$months[$year][] = [
'formatted' => $start->formatLocalized('%B %Y'),
'month' => $start->month,
'year' => $year,
];
$start->addMonth();
}
return $months;
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Helpers\Collection\Account;
use FireflyIII\Helpers\Collection\Balance;
use FireflyIII\Helpers\Collection\Budget as BudgetCollection;
use FireflyIII\Helpers\Collection\Category as CategoryCollection;
use FireflyIII\Helpers\Collection\Expense;
use FireflyIII\Helpers\Collection\Income;
/**
* Interface ReportHelperInterface
*
* @package FireflyIII\Helpers\Report
*/
interface ReportHelperInterface
{
/**
* This method generates a full report for the given period on all
* the users asset and cash accounts.
*
* @param Carbon $date
* @param Carbon $end
* @param boolean $shared
*
* @return Account
*/
public function getAccountReport(Carbon $date, Carbon $end, $shared);
/**
* This method generates a full report for the given period on all
* the users bills and their payments.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Account
*/
public function getBillReport(Carbon $start, Carbon $end, $shared);
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Balance
*/
public function getBalanceReport(Carbon $start, Carbon $end, $shared);
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return BudgetCollection
*/
public function getBudgetReport(Carbon $start, Carbon $end, $shared);
/**
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return CategoryCollection
*/
public function getCategoryReport(Carbon $start, Carbon $end, $shared);
/**
* Get a full report on the users expenses during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Expense
*/
public function getExpenseReport($start, $end, $shared);
/**
* Get a full report on the users incomes during the period.
*
* @param Carbon $start
* @param Carbon $end
* @param boolean $shared
*
* @return Income
*/
public function getIncomeReport($start, $end, $shared);
/**
* @param Carbon $date
*
* @return array
*/
public function listOfMonths(Carbon $date);
}

View File

@@ -0,0 +1,281 @@
<?php
namespace FireflyIII\Helpers\Report;
use Auth;
use Carbon\Carbon;
use Crypt;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Collection;
use Steam;
/**
* Class ReportQuery
*
* @package FireflyIII\Helpers\Report
*/
class ReportQuery implements ReportQueryInterface
{
/**
* See ReportQueryInterface::incomeInPeriodCorrected
*
* @param Carbon $start
* @param Carbon $end
* @param bool $includeShared
*
* @return Collection
*
*/
public function expenseInPeriodCorrected(Carbon $start, Carbon $end, $includeShared = false)
{
$query = $this->queryJournalsWithTransactions($start, $end);
if ($includeShared === false) {
$query->where(
function (Builder $query) {
$query->where(
function (Builder $q) { // only get withdrawals not from a shared account
$q->where('transaction_types.type', 'Withdrawal');
$q->where('acm_from.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function (Builder $q) { // and transfers from a shared account.
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_to.data', '=', '"sharedAsset"');
}
);
}
);
} else {
$query->where('transaction_types.type', 'Withdrawal'); // any withdrawal is fine.
}
$query->orderBy('transaction_journals.date');
// get everything
$data = $query->get(
['transaction_journals.*', 'transaction_types.type', 'ac_to.name as name', 'ac_to.id as account_id', 'ac_to.encrypted as account_encrypted']
);
$data->each(
function (TransactionJournal $journal) {
if (intval($journal->account_encrypted) == 1) {
$journal->name = Crypt::decrypt($journal->name);
}
}
);
$data = $data->filter(
function (TransactionJournal $journal) {
if ($journal->amount != 0) {
return $journal;
}
} // @codeCoverageIgnore
);
return $data;
}
/**
* Get a users accounts combined with various meta-data related to the start and end date.
*
* @param Carbon $start
* @param Carbon $end
* @param bool $includeShared
*
* @return Collection
*/
public function getAllAccounts(Carbon $start, Carbon $end, $includeShared = false)
{
$query = Auth::user()->accounts()->orderBy('accounts.name', 'ASC')
->accountTypeIn(['Default account', 'Asset account', 'Cash account']);
if ($includeShared === false) {
$query->leftJoin(
'account_meta', function (JoinClause $join) {
$join->on('account_meta.account_id', '=', 'accounts.id')->where('account_meta.name', '=', 'accountRole');
}
)
->orderBy('accounts.name', 'ASC')
->where(
function (Builder $query) {
$query->where('account_meta.data', '!=', '"sharedAsset"');
$query->orWhereNull('account_meta.data');
}
);
}
$set = $query->get(['accounts.*']);
$set->each(
function (Account $account) use ($start, $end) {
/**
* The balance for today always incorporates transactions
* made on today. So to get todays "start" balance, we sub one
* day.
*/
$yesterday = clone $start;
$yesterday->subDay();
/** @noinspection PhpParamsInspection */
$account->startBalance = Steam::balance($account, $yesterday);
$account->endBalance = Steam::balance($account, $end);
}
);
return $set;
}
/**
* This method works the same way as ReportQueryInterface::incomeInPeriod does, but instead of returning results
* will simply list the transaction journals only. This should allow any follow up counting to be accurate with
* regards to tags.
*
* This method returns all "income" journals in a certain period, which are both transfers from a shared account
* and "ordinary" deposits. The query used is almost equal to ReportQueryInterface::journalsByRevenueAccount but it does
* not group and returns different fields.
*
* @param Carbon $start
* @param Carbon $end
* @param bool $includeShared
*
* @return Collection
*/
public function incomeInPeriodCorrected(Carbon $start, Carbon $end, $includeShared = false)
{
$query = $this->queryJournalsWithTransactions($start, $end);
if ($includeShared === false) {
// only get deposits not to a shared account
// and transfers to a shared account.
$query->where(
function (Builder $query) {
$query->where(
function (Builder $q) {
$q->where('transaction_types.type', 'Deposit');
$q->where('acm_to.data', '!=', '"sharedAsset"');
}
);
$query->orWhere(
function (Builder $q) {
$q->where('transaction_types.type', 'Transfer');
$q->where('acm_from.data', '=', '"sharedAsset"');
}
);
}
);
} else {
// any deposit is fine.
$query->where('transaction_types.type', 'Deposit');
}
$query->orderBy('transaction_journals.date');
// get everything
$data = $query->get(
['transaction_journals.*', 'transaction_types.type', 'ac_from.name as name', 'ac_from.id as account_id', 'ac_from.encrypted as account_encrypted']
);
$data->each(
function (TransactionJournal $journal) {
if (intval($journal->account_encrypted) == 1) {
$journal->name = Crypt::decrypt($journal->name);
}
}
);
$data = $data->filter(
function (TransactionJournal $journal) {
if ($journal->amount != 0) {
return $journal;
}
} // @codeCoverageIgnore
);
return $data;
}
/**
* Covers tags
*
* @param Account $account
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
*
* @return float
*/
public function spentInBudgetCorrected(Account $account, Budget $budget, Carbon $start, Carbon $end)
{
return floatval(
Auth::user()->transactionjournals()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->transactionTypes(['Withdrawal'])
->where('transactions.account_id', $account->id)
->before($end)
->after($start)
->where('budget_transaction_journal.budget_id', $budget->id)
->get(['transaction_journals.*'])->sum('amount')
) * -1;
}
/**
* @param Account $account
* @param Carbon $start
* @param Carbon $end
* @param bool $shared
*
* @return float
*/
public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false)
{
return floatval(
Auth::user()->transactionjournals()
->leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
->leftJoin('budget_transaction_journal', 'budget_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id')
->transactionTypes(['Withdrawal'])
->where('transactions.account_id', $account->id)
->before($end)
->after($start)
->whereNull('budget_transaction_journal.budget_id')->get(['transaction_journals.*'])->sum('amount')
);
}
/**
* @param Carbon $start
* @param Carbon $end
*
* @return Builder
*/
protected function queryJournalsWithTransactions(Carbon $start, Carbon $end)
{
$query = TransactionJournal::
leftJoin(
'transactions as t_from', function (JoinClause $join) {
$join->on('t_from.transaction_journal_id', '=', 'transaction_journals.id')->where('t_from.amount', '<', 0);
}
)
->leftJoin('accounts as ac_from', 't_from.account_id', '=', 'ac_from.id')
->leftJoin(
'account_meta as acm_from', function (JoinClause $join) {
$join->on('ac_from.id', '=', 'acm_from.account_id')->where('acm_from.name', '=', 'accountRole');
}
)
->leftJoin(
'transactions as t_to', function (JoinClause $join) {
$join->on('t_to.transaction_journal_id', '=', 'transaction_journals.id')->where('t_to.amount', '>', 0);
}
)
->leftJoin('accounts as ac_to', 't_to.account_id', '=', 'ac_to.id')
->leftJoin(
'account_meta as acm_to', function (JoinClause $join) {
$join->on('ac_to.id', '=', 'acm_to.account_id')->where('acm_to.name', '=', 'accountRole');
}
)
->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id');
$query->before($end)->after($start)->where('transaction_journals.user_id', Auth::user()->id);
return $query;
}
}

View File

@@ -0,0 +1,81 @@
<?php
namespace FireflyIII\Helpers\Report;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use Illuminate\Support\Collection;
/**
* Interface ReportQueryInterface
*
* @package FireflyIII\Helpers\Report
*/
interface ReportQueryInterface
{
/**
* See ReportQueryInterface::incomeInPeriodCorrected
*
* This method returns all "expense" journals in a certain period, which are both transfers to a shared account
* and "ordinary" withdrawals. The query used is almost equal to ReportQueryInterface::journalsByRevenueAccount but it does
* not group and returns different fields.
*
* @param Carbon $start
* @param Carbon $end
* @param bool $includeShared
*
* @return Collection
*
*/
public function expenseInPeriodCorrected(Carbon $start, Carbon $end, $includeShared = false);
/**
* Get a users accounts combined with various meta-data related to the start and end date.
*
* @param Carbon $start
* @param Carbon $end
* @param bool $includeShared
*
* @return Collection
*/
public function getAllAccounts(Carbon $start, Carbon $end, $includeShared = false);
/**
* This method works the same way as ReportQueryInterface::incomeInPeriod does, but instead of returning results
* will simply list the transaction journals only. This should allow any follow up counting to be accurate with
* regards to tags.
*
* @param Carbon $start
* @param Carbon $end
* @param bool $includeShared
*
* @return Collection
*/
public function incomeInPeriodCorrected(Carbon $start, Carbon $end, $includeShared = false);
/**
* Covers tags as well.
*
* @param Account $account
* @param Budget $budget
* @param Carbon $start
* @param Carbon $end
*
* @return float
*/
public function spentInBudgetCorrected(Account $account, Budget $budget, Carbon $start, Carbon $end);
/**
* @param Account $account
* @param Carbon $start
* @param Carbon $end
* @param bool $shared
*
* @return float
*/
public function spentNoBudget(Account $account, Carbon $start, Carbon $end, $shared = false);
}

View File

@@ -0,0 +1,256 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use Config;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\AccountFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
use Redirect;
use Session;
use Steam;
use URL;
use View;
/**
* Class AccountController
*
* @package FireflyIII\Http\Controllers
*/
class AccountController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('mainTitleIcon', 'fa-credit-card');
View::share('title', trans('firefly.accounts'));
}
/**
* @param string $what
*
* @return \Illuminate\View\View
*/
public function create($what = 'asset')
{
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
$subTitle = 'Create a new ' . e($what) . ' account';
// put previous url in session if not redirect from store (not "create another").
if (Session::get('accounts.create.fromStore') !== true) {
Session::put('accounts.create.url', URL::previous());
}
Session::forget('accounts.create.fromStore');
return view('accounts.create', compact('subTitleIcon', 'what', 'subTitle'));
}
/**
* @param Account $account
*
* @return \Illuminate\View\View
*/
public function delete(Account $account)
{
$subTitle = 'Delete ' . strtolower(e($account->accountType->type)) . ' "' . e($account->name) . '"';
// put previous url in session
Session::put('accounts.delete.url', URL::previous());
return view('accounts.delete', compact('account', 'subTitle'));
}
/**
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(AccountRepositoryInterface $repository, Account $account)
{
$type = $account->accountType->type;
$typeName = Config::get('firefly.shortNamesByFullName.' . $type);
$name = $account->name;
$repository->destroy($account);
Session::flash('success', 'The ' . e($typeName) . ' account "' . e($name) . '" was deleted.');
return Redirect::to(Session::get('accounts.delete.url'));
}
/**
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
public function edit(AccountRepositoryInterface $repository, Account $account)
{
$what = Config::get('firefly.shortNamesByFullName')[$account->accountType->type];
$subTitle = trans('firefly.edit_' . $what . '_account', ['name' => $account->name]);
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
$openingBalance = $repository->openingBalanceTransaction($account);
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('accounts.edit.fromUpdate') !== true) {
Session::put('accounts.edit.url', URL::previous());
}
Session::forget('accounts.edit.fromUpdate');
// pre fill some useful values.
// the opening balance is tricky:
$openingBalanceAmount = null;
if ($openingBalance) {
$transaction = $repository->getFirstTransaction($openingBalance, $account);
$openingBalanceAmount = $transaction->amount;
}
$preFilled = [
'accountRole' => $account->getMeta('accountRole'),
'ccType' => $account->getMeta('ccType'),
'ccMonthlyPaymentDate' => $account->getMeta('ccMonthlyPaymentDate'),
'openingBalanceDate' => $openingBalance ? $openingBalance->date->format('Y-m-d') : null,
'openingBalance' => $openingBalanceAmount,
'virtualBalance' => floatval($account->virtual_balance)
];
Session::flash('preFilled', $preFilled);
return view('accounts.edit', compact('account', 'subTitle', 'subTitleIcon', 'openingBalance', 'what'));
}
/**
* @param AccountRepositoryInterface $repository
* @param $what
*
* @return View
*/
public function index(AccountRepositoryInterface $repository, $what)
{
$subTitle = trans('firefly.' . $what . '_accounts');
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
$types = Config::get('firefly.accountTypesByIdentifier.' . $what);
$accounts = $repository->getAccounts($types);
// last activity:
/**
* HERE WE ARE
*/
$start = clone Session::get('start', Carbon::now()->startOfMonth());
$start->subDay();
$accounts->each(
function (Account $account) use ($start, $repository) {
$account->lastActivityDate = $repository->getLastActivity($account);
$account->startBalance = Steam::balance($account, $start);
$account->endBalance = Steam::balance($account, clone Session::get('end', Carbon::now()->endOfMonth()));
}
);
return view('accounts.index', compact('what', 'subTitleIcon', 'subTitle', 'accounts'));
}
/**
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return View
*/
public function show(AccountRepositoryInterface $repository, Account $account)
{
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
$subTitleIcon = Config::get('firefly.subTitlesByIdentifier.' . $account->accountType->type);
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
$journals = $repository->getJournals($account, $page);
$subTitle = trans('firefly.details_for_' . $what, ['name' => $account->name]);
$journals->setPath('accounts/show/' . $account->id);
return view('accounts.show', compact('account', 'what', 'subTitleIcon', 'journals', 'subTitle'));
}
/**
* @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(AccountFormRequest $request, AccountRepositoryInterface $repository)
{
$accountData = [
'name' => $request->input('name'),
'accountType' => $request->input('what'),
'virtualBalance' => floatval($request->input('virtualBalance')),
'active' => true,
'user' => Auth::user()->id,
'accountRole' => $request->input('accountRole'),
'openingBalance' => floatval($request->input('openingBalance')),
'openingBalanceDate' => new Carbon($request->input('openingBalanceDate')),
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
];
$account = $repository->store($accountData);
Session::flash('success', 'New account "' . $account->name . '" stored!');
if (intval(Input::get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('accounts.create.fromStore', true);
return Redirect::route('accounts.create')->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('accounts.create.url'));
}
/**
* @param AccountFormRequest $request
* @param AccountRepositoryInterface $repository
* @param Account $account
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account)
{
$accountData = [
'name' => $request->input('name'),
'active' => $request->input('active'),
'user' => Auth::user()->id,
'accountRole' => $request->input('accountRole'),
'virtualBalance' => floatval($request->input('virtualBalance')),
'openingBalance' => floatval($request->input('openingBalance')),
'openingBalanceDate' => new Carbon($request->input('openingBalanceDate')),
'openingBalanceCurrency' => intval($request->input('balance_currency_id')),
'ccType' => $request->input('ccType'),
'ccMonthlyPaymentDate' => $request->input('ccMonthlyPaymentDate'),
];
$repository->update($account, $accountData);
Session::flash('success', 'Account "' . $account->name . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('accounts.edit.fromUpdate', true);
return Redirect::route('accounts.edit', $account->id)->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return Redirect::to(Session::get('accounts.edit.url'));
}
}

View File

@@ -0,0 +1,108 @@
<?php namespace FireflyIII\Http\Controllers\Auth;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\Registrar;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Mail\Message;
use Mail;
use Session;
use Twig;
/**
* Class AuthController
*
* @package FireflyIII\Http\Controllers\Auth
*/
class AuthController extends Controller
{
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers;
public $redirectTo = '/';
/**
* Create a new authentication controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\Registrar $registrar
*
* @codeCoverageIgnore
*
*/
public function __construct(Guard $auth, Registrar $registrar)
{
$this->auth = $auth;
$this->registrar = $registrar;
$this->middleware('guest', ['except' => 'getLogout']);
}
/**
* Show the application login form.
*
* @codeCoverageIgnore
* @return \Illuminate\Http\Response
*
*/
public function getLogin()
{
return Twig::render('auth.login');
}
/**
* Handle a registration request for the application.
*
* @param Request $request
*
* @return \Illuminate\Http\Response
*/
public function postRegister(Request $request)
{
$validator = $this->registrar->validator($request->all());
if ($validator->fails()) {
$this->throwValidationException(
$request, $validator
);
// @codeCoverageIgnoreStart
}
// @codeCoverageIgnoreEnd
$data = $request->all();
$data['password'] = bcrypt($data['password']);
$this->auth->login($this->registrar->create($data));
// get the email address
$email = $this->auth->user()->email;
// send email.
Mail::send(
'emails.registered', [], function (Message $message) use ($email) {
$message->to($email, $email)->subject('Welcome to Firefly III!');
}
);
// set flash message
Session::flash('success', 'You have registered successfully!');
Session::flash('gaEventCategory', 'user');
Session::flash('gaEventAction', 'new-registration');
return redirect($this->redirectPath());
}
}

View File

@@ -0,0 +1,51 @@
<?php namespace FireflyIII\Http\Controllers\Auth;
use FireflyIII\Http\Controllers\Controller;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Contracts\Auth\PasswordBroker;
use Illuminate\Foundation\Auth\ResetsPasswords;
/**
* Class PasswordController
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Controllers\Auth
*/
class PasswordController extends Controller
{
/*
|--------------------------------------------------------------------------
| Password Reset Controller
|--------------------------------------------------------------------------
|
| This controller is responsible for handling password reset requests
| and uses a simple trait to include this behavior. You're free to
| explore this trait and override any methods you wish to tweak.
|
*/
use ResetsPasswords;
protected $redirectPath = '/';
/**
* Create a new password controller instance.
*
* @param \Illuminate\Contracts\Auth\Guard $auth
* @param \Illuminate\Contracts\Auth\PasswordBroker $passwords
*
* @codeCoverageIgnore
*
*/
public function __construct(Guard $auth, PasswordBroker $passwords)
{
$this->auth = $auth;
$this->passwords = $passwords;
$this->middleware('guest');
}
}

View File

@@ -0,0 +1,211 @@
<?php namespace FireflyIII\Http\Controllers;
use Config;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BillFormRequest;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Input;
use Redirect;
use Session;
use URL;
use View;
/**
* Class BillController
*
* @package FireflyIII\Http\Controllers
*/
class BillController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.bills'));
View::share('mainTitleIcon', 'fa-calendar-o');
}
/**
* @return $this
*/
public function create()
{
$periods = Config::get('firefly.periods_to_text');
// put previous url in session if not redirect from store (not "create another").
if (Session::get('bills.create.fromStore') !== true) {
Session::put('bills.create.url', URL::previous());
}
Session::forget('bills.create.fromStore');
$subTitle = 'Create new bill';
return view('bills.create', compact('periods', 'subTitle'));
}
/**
* @param Bill $bill
*
* @return $this
*/
public function delete(Bill $bill)
{
// put previous url in session
Session::put('bills.delete.url', URL::previous());
$subTitle = 'Delete "' . e($bill->name) . '"';
return view('bills.delete', compact('bill', 'subTitle'));
}
/**
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(BillRepositoryInterface $repository, Bill $bill)
{
$repository->destroy($bill);
Session::flash('success', 'The bill was deleted.');
return Redirect::to(Session::get('bills.delete.url'));
}
/**
* @param Bill $bill
*
* @return $this
*/
public function edit(Bill $bill)
{
$periods = Config::get('firefly.periods_to_text');
$subTitle = 'Edit "' . e($bill->name) . '"';
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('bills.edit.fromUpdate') !== true) {
Session::put('bills.edit.url', URL::previous());
}
Session::forget('bills.edit.fromUpdate');
return view('bills.edit', compact('subTitle', 'periods', 'bill'));
}
/**
* @param BillRepositoryInterface $repository
*
* @return \Illuminate\View\View
*/
public function index(BillRepositoryInterface $repository)
{
$bills = $repository->getBills();
$bills->each(
function (Bill $bill) use ($repository) {
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
$bill->lastFoundMatch = $repository->lastFoundMatch($bill);
}
);
return view('bills.index', compact('bills'));
}
/**
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Illuminate\Http\RedirectResponse
*/
public function rescan(BillRepositoryInterface $repository, Bill $bill)
{
if (intval($bill->active) == 0) {
Session::flash('warning', 'Inactive bills cannot be scanned.');
return Redirect::to(URL::previous());
}
$journals = $repository->getPossiblyRelatedJournals($bill);
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
$repository->scan($bill, $journal);
}
Session::flash('success', 'Rescanned everything.');
return Redirect::to(URL::previous());
}
/**
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return mixed
*/
public function show(BillRepositoryInterface $repository, Bill $bill)
{
$journals = $repository->getJournals($bill);
$bill->nextExpectedMatch = $repository->nextExpectedMatch($bill);
$hideBill = true;
$subTitle = e($bill->name);
return view('bills.show', compact('journals', 'hideBill', 'bill', 'subTitle'));
}
/**
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(BillFormRequest $request, BillRepositoryInterface $repository)
{
$billData = $request->getBillData();
$bill = $repository->store($billData);
Session::flash('success', 'Bill "' . e($bill->name) . '" stored.');
if (intval(Input::get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('bills.create.fromStore', true);
return Redirect::route('bills.create')->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('bills.create.url'));
}
/**
* @param BillFormRequest $request
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(BillFormRequest $request, BillRepositoryInterface $repository, Bill $bill)
{
$billData = $request->getBillData();
$bill = $repository->update($bill, $billData);
Session::flash('success', 'Bill "' . e($bill->name) . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('bills.edit.fromUpdate', true);
return Redirect::route('bills.edit', $bill->id)->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return Redirect::to(Session::get('bills.edit.url'));
}
}

View File

@@ -0,0 +1,276 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\BudgetFormRequest;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Input;
use Preferences;
use Redirect;
use Response;
use Session;
use URL;
use View;
/**
* Class BudgetController
*
* @package FireflyIII\Http\Controllers
*/
class BudgetController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.budgets'));
View::share('mainTitleIcon', 'fa-tasks');
View::share('hideBudgets', true);
}
/**
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function amount(BudgetRepositoryInterface $repository, Budget $budget)
{
$amount = intval(Input::get('amount'));
$date = Session::get('start', Carbon::now()->startOfMonth());
$limitRepetition = $repository->updateLimitAmount($budget, $date, $amount);
return Response::json(['name' => $budget->name, 'repetition' => $limitRepetition ? $limitRepetition->id : 0]);
}
/**
* @return $this
*/
public function create()
{
// put previous url in session if not redirect from store (not "create another").
if (Session::get('budgets.create.fromStore') !== true) {
Session::put('budgets.create.url', URL::previous());
}
Session::forget('budgets.create.fromStore');
$subTitle = trans('firefly.create_new_budget');
return view('budgets.create', compact('subTitle'));
}
/**
* @param Budget $budget
*
* @return \Illuminate\View\View
*/
public function delete(Budget $budget)
{
$subTitle = 'Delete budget' . e($budget->name) . '"';
// put previous url in session
Session::put('budgets.delete.url', URL::previous());
return view('budgets.delete', compact('budget', 'subTitle'));
}
/**
* @param Budget $budget
* @param BudgetRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(Budget $budget, BudgetRepositoryInterface $repository)
{
$name = $budget->name;
$repository->destroy($budget);
Session::flash('success', 'The budget "' . e($name) . '" was deleted.');
return Redirect::to(Session::get('budgets.delete.url'));
}
/**
* @param Budget $budget
*
* @return $this
*/
public function edit(Budget $budget)
{
$subTitle = 'Edit budget "' . e($budget->name) . '"';
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('budgets.edit.fromUpdate') !== true) {
Session::put('budgets.edit.url', URL::previous());
}
Session::forget('budgets.edit.fromUpdate');
return view('budgets.edit', compact('budget', 'subTitle'));
}
/**
* @param BudgetRepositoryInterface $repository
*
* @return View
*/
public function index(BudgetRepositoryInterface $repository)
{
$budgets = $repository->getActiveBudgets();
$inactive = $repository->getInactiveBudgets();
/**
* Do some cleanup:
*/
$repository->cleanupBudgets();
// loop the budgets:
$budgets->each(
function (Budget $budget) use ($repository) {
$date = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$budget->spent = $repository->spentInPeriodCorrected($budget, $date, $end);
$budget->currentRep = $repository->getCurrentRepetition($budget, $date);
}
);
$dateAsString = Session::get('start', Carbon::now()->startOfMonth())->format('FY');
$spent = $budgets->sum('spent');
$amount = Preferences::get('budgetIncomeTotal' . $dateAsString, 1000)->data;
$overspent = $spent > $amount;
$spentPCT = $overspent ? ceil($amount / $spent * 100) : ceil($spent / $amount * 100);
$budgetMax = Preferences::get('budgetMaximum', 1000);
$budgetMaximum = $budgetMax->data;
return view('budgets.index', compact('budgetMaximum', 'inactive', 'budgets', 'spent', 'spentPCT', 'overspent', 'amount'));
}
/**
* @param BudgetRepositoryInterface $repository
*
* @return View
*/
public function noBudget(BudgetRepositoryInterface $repository)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->startOfMonth());
$list = $repository->getWithoutBudget($start, $end);
$subTitle = 'Transactions without a budget between ' . $start->format('jS F Y') . ' and ' . $end->format('jS F Y');
return view('budgets.noBudget', compact('list', 'subTitle'));
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postUpdateIncome()
{
$date = Session::get('start', Carbon::now()->startOfMonth())->format('FY');
Preferences::set('budgetIncomeTotal' . $date, intval(Input::get('amount')));
return Redirect::route('budgets.index');
}
/**
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @return View
*/
public function show(BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition = null)
{
if (!is_null($repetition->id) && $repetition->budgetLimit->budget->id != $budget->id) {
$message = 'Invalid selection.';
return view('error', compact('message'));
}
$journals = $repository->getJournals($budget, $repetition);
$limits = !is_null($repetition->id) ? [$repetition->budgetLimit] : $repository->getBudgetLimits($budget);
$subTitle = !is_null($repetition->id) ? e($budget->name) . ' in ' . $repetition->startdate->format('F Y') : e($budget->name);
$journals->setPath('/budgets/show/' . $budget->id);
return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle'));
}
/**
* @param BudgetFormRequest $request
* @param BudgetRepositoryInterface $repository
*
* @return \Illuminate\Http\RedirectResponse
*/
public function store(BudgetFormRequest $request, BudgetRepositoryInterface $repository)
{
$budgetData = [
'name' => $request->input('name'),
'user' => Auth::user()->id,
];
$budget = $repository->store($budgetData);
Session::flash('success', 'New budget "' . $budget->name . '" stored!');
if (intval(Input::get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('budgets.create.fromStore', true);
return Redirect::route('budgets.create')->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('budgets.create.url'));
}
/**
* @param BudgetFormRequest $request
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(BudgetFormRequest $request, BudgetRepositoryInterface $repository, Budget $budget)
{
$budgetData = [
'name' => $request->input('name'),
'active' => intval($request->input('active')) == 1
];
$repository->update($budget, $budgetData);
Session::flash('success', 'Budget "' . $budget->name . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('budgets.edit.fromUpdate', true);
return Redirect::route('budgets.edit', $budget->id)->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return Redirect::to(Session::get('budgets.edit.url'));
}
/**
* @return View
*/
public function updateIncome()
{
$date = Session::get('start', Carbon::now()->startOfMonth())->format('FY');
$amount = Preferences::get('budgetIncomeTotal' . $date, 1000);
return view('budgets.income', compact('amount'));
}
}

View File

@@ -0,0 +1,204 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use FireflyIII\Http\Requests\CategoryFormRequest;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Illuminate\Pagination\LengthAwarePaginator;
use Input;
use Redirect;
use Session;
use URL;
use View;
/**
* Class CategoryController
*
* @package FireflyIII\Http\Controllers
*/
class CategoryController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.categories'));
View::share('mainTitleIcon', 'fa-bar-chart');
}
/**
* @return $this
*/
public function create()
{
// put previous url in session if not redirect from store (not "create another").
if (Session::get('categories.create.fromStore') !== true) {
Session::put('categories.create.url', URL::previous());
}
Session::forget('categories.create.fromStore');
$subTitle = 'Create a new category';
return view('categories.create', compact('subTitle'));
}
/**
* @param Category $category
*
* @return \Illuminate\View\View
*/
public function delete(Category $category)
{
$subTitle = 'Delete category "' . e($category->name) . '"';
// put previous url in session
Session::put('categories.delete.url', URL::previous());
return view('categories.delete', compact('category', 'subTitle'));
}
/**
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(CategoryRepositoryInterface $repository, Category $category)
{
$name = $category->name;
$repository->destroy($category);
Session::flash('success', 'The category "' . e($name) . '" was deleted.');
return Redirect::to(Session::get('categories.delete.url'));
}
/**
* @param Category $category
*
* @return $this
*/
public function edit(Category $category)
{
$subTitle = 'Edit category "' . e($category->name) . '"';
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('categories.edit.fromUpdate') !== true) {
Session::put('categories.edit.url', URL::previous());
}
Session::forget('categories.edit.fromUpdate');
return view('categories.edit', compact('category', 'subTitle'));
}
/**
* @param CategoryRepositoryInterface $repository
*
* @return $this
*/
public function index(CategoryRepositoryInterface $repository)
{
$categories = $repository->getCategories();
$categories->each(
function (Category $category) use ($repository) {
$category->lastActivity = $repository->getLatestActivity($category);
}
);
return view('categories.index', compact('categories'));
}
/**
* @param CategoryRepositoryInterface $repository
*
* @return \Illuminate\View\View
*/
public function noCategory(CategoryRepositoryInterface $repository)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->startOfMonth());
$list = $repository->getWithoutCategory($start, $end);
$subTitle = 'Transactions without a category between ' . $start->format('jS F Y') . ' and ' . $end->format('jS F Y');
return view('categories.noCategory', compact('list', 'subTitle'));
}
/**
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return View
*/
public function show(CategoryRepositoryInterface $repository, Category $category)
{
$hideCategory = true; // used in list.
$page = intval(Input::get('page'));
$set = $repository->getJournals($category, $page);
$count = $repository->countJournals($category);
$journals = new LengthAwarePaginator($set, $count, 50, $page);
$journals->setPath('categories/show/' . $category->id);
return view('categories.show', compact('category', 'journals', 'hideCategory'));
}
/**
* @param CategoryFormRequest $request
* @param CategoryRepositoryInterface $repository
*
* @return mixed
*/
public function store(CategoryFormRequest $request, CategoryRepositoryInterface $repository)
{
$categoryData = [
'name' => $request->input('name'),
'user' => Auth::user()->id,
];
$category = $repository->store($categoryData);
Session::flash('success', 'New category "' . $category->name . '" stored!');
if (intval(Input::get('create_another')) === 1) {
Session::put('categories.create.fromStore', true);
return Redirect::route('categories.create')->withInput();
}
return Redirect::route('categories.index');
}
/**
* @param CategoryFormRequest $request
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(CategoryFormRequest $request, CategoryRepositoryInterface $repository, Category $category)
{
$categoryData = [
'name' => $request->input('name'),
];
$repository->update($category, $categoryData);
Session::flash('success', 'Category "' . $category->name . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('categories.edit.fromUpdate', true);
return Redirect::route('categories.edit', $category->id);
}
// redirect to previous URL.
return Redirect::to(Session::get('categories.edit.url'));
}
}

View File

@@ -0,0 +1,150 @@
<?php
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection;
use Preferences;
use Response;
use Session;
use Steam;
/**
* Class AccountController
*
* @package FireflyIII\Http\Controllers\Chart
*/
class AccountController extends Controller
{
/**
* Shows the balances for all the user's accounts.
*
* @param GChart $chart
* @param AccountRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function all(GChart $chart, AccountRepositoryInterface $repository, $year, $month, $shared = false)
{
$start = new Carbon($year . '-' . $month . '-01');
$end = clone $start;
$end->endOfMonth();
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
/** @var Collection $accounts */
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
if ($shared === false) {
// remove the shared accounts from the collection:
/** @var Account $account */
foreach ($accounts as $index => $account) {
if ($account->getMeta('accountRole') == 'sharedAsset') {
$accounts->forget($index);
}
}
}
$index = 1;
/** @var Account $account */
foreach ($accounts as $account) {
$chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
$chart->addCertainty($index);
$index++;
}
$current = clone $start;
$current->subDay();
$today = Carbon::now();
while ($end >= $current) {
$row = [clone $current];
$certain = $current < $today;
foreach ($accounts as $account) {
$row[] = Steam::balance($account, $current);
$row[] = $certain;
}
$chart->addRowArray($row);
$current->addDay();
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Shows the balances for all the user's frontpage accounts.
*
* @param GChart $chart
* @param AccountRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(GChart $chart, AccountRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
$frontPage = Preferences::get('frontPageAccounts', []);
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$accounts = $repository->getFrontpageAccounts($frontPage);
$index = 1;
/** @var Account $account */
foreach ($accounts as $account) {
$chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
$chart->addCertainty($index);
$index++;
}
$current = clone $start;
$current->subDay();
$today = Carbon::now();
while ($end >= $current) {
$row = [clone $current];
$certain = $current < $today;
foreach ($accounts as $account) {
$row[] = Steam::balance($account, $current);
$row[] = $certain;
}
$chart->addRowArray($row);
$current->addDay();
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Shows an account's balance for a single month.
*
* @param GChart $chart
* @param Account $account
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function single(GChart $chart, Account $account)
{
$chart->addColumn(trans('firefly.dayOfMonth'), 'date');
$chart->addColumn(trans('firefly.balanceFor', ['name' => $account->name]), 'number');
$chart->addCertainty(1);
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$current = clone $start;
$today = new Carbon;
while ($end >= $current) {
$certain = $current < $today;
$chart->addRow(clone $current, Steam::balance($account, $current), $certain);
$current->addDay();
}
$chart->generate();
return Response::json($chart->getData());
}
}

View File

@@ -0,0 +1,141 @@
<?php
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection;
use Response;
use Session;
use Steam;
/**
* Class BillController
*
* @package FireflyIII\Http\Controllers\Chart
*/
class BillController extends Controller
{
/**
* Shows the overview for a bill. The min/max amount and matched journals.
*
* @param GChart $chart
* @param BillRepositoryInterface $repository
* @param Bill $bill
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function single(GChart $chart, BillRepositoryInterface $repository, Bill $bill)
{
$chart->addColumn(trans('firefly.date'), 'date');
$chart->addColumn(trans('firefly.maxAmount'), 'number');
$chart->addColumn(trans('firefly.minAmount'), 'number');
$chart->addColumn(trans('firefly.billEntry'), 'number');
// get first transaction or today for start:
$results = $repository->getJournals($bill);
/** @var TransactionJournal $result */
foreach ($results as $result) {
$chart->addRow(clone $result->date, floatval($bill->amount_max), floatval($bill->amount_min), floatval($result->amount));
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Shows all bills and whether or not theyve been paid this month (pie chart).
*
* @param GChart $chart
*
* @param BillRepositoryInterface $repository
* @param AccountRepositoryInterface $accounts
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(GChart $chart, BillRepositoryInterface $repository, AccountRepositoryInterface $accounts)
{
$chart->addColumn(trans('firefly.name'), 'string');
$chart->addColumn(trans('firefly.amount'), 'number');
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$bills = $repository->getActiveBills();
$paid = new Collection; // journals.
$unpaid = new Collection; // bills
// loop paid and create single entry:
$paidDescriptions = [];
$paidAmount = 0;
$unpaidDescriptions = [];
$unpaidAmount = 0;
/** @var Bill $bill */
foreach ($bills as $bill) {
$ranges = $repository->getRanges($bill, $start, $end);
foreach ($ranges as $range) {
// paid a bill in this range?
$journals = $repository->getJournalsInRange($bill, $range['start'], $range['end']);
if ($journals->count() == 0) {
$unpaid->push([$bill, $range['start']]);
} else {
$paid = $paid->merge($journals);
}
}
}
$creditCards = $accounts->getCreditCards();
foreach ($creditCards as $creditCard) {
$balance = Steam::balance($creditCard, $end, true);
$date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate'));
if ($balance < 0) {
// unpaid! create a fake bill that matches the amount.
$description = $creditCard->name;
$amount = $balance * -1;
$fakeBill = $repository->createFakeBill($description, $date, $amount);
unset($description, $amount);
$unpaid->push([$fakeBill, $date]);
}
if ($balance == 0) {
// find transfer(s) TO the credit card which should account for
// anything paid. If not, the CC is not yet used.
$journals = $accounts->getTransfersInRange($creditCard, $start, $end);
$paid = $paid->merge($journals);
}
}
/** @var TransactionJournal $entry */
foreach ($paid as $entry) {
$paidDescriptions[] = $entry->description;
$paidAmount += floatval($entry->amount);
}
// loop unpaid:
/** @var Bill $entry */
foreach ($unpaid as $entry) {
$description = $entry[0]->name . ' (' . $entry[1]->format('jS M Y') . ')';
$amount = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
$unpaidDescriptions[] = $description;
$unpaidAmount += $amount;
unset($amount, $description);
}
$chart->addRow(trans('firefly.unpaid') . ': ' . join(', ', $unpaidDescriptions), $unpaidAmount);
$chart->addRow(trans('firefly.paid') . ': ' . join(', ', $paidDescriptions), $paidAmount);
$chart->generate();
return Response::json($chart->getData());
}
}

View File

@@ -0,0 +1,195 @@
<?php
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection;
use Navigation;
use Preferences;
use Response;
use Session;
/**
* Class BudgetController
*
* @package FireflyIII\Http\Controllers\Chart
*/
class BudgetController extends Controller
{
/**
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
*/
public function budget(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget)
{
$chart->addColumn(trans('firefly.period'), 'date');
$chart->addColumn(trans('firefly.spent'), 'number');
$first = $repository->getFirstBudgetLimitDate($budget);
$range = $viewRange = Preferences::get('viewRange', '1M')->data;
$last = Session::get('end', new Carbon);
$final = clone $last;
$final->addYears(2);
$last = Navigation::endOfX($last, $range, $final);
while ($first < $last) {
$end = Navigation::addPeriod($first, $range, 0);
$spent = $repository->spentInPeriodCorrected($budget, $first, $end);
$chart->addRow($end, $spent);
$first = Navigation::addPeriod($first, $range, 0);
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Shows the amount left in a specific budget limit.
*
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param Budget $budget
* @param LimitRepetition $repetition
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function budgetLimit(GChart $chart, BudgetRepositoryInterface $repository, Budget $budget, LimitRepetition $repetition)
{
$start = clone $repetition->startdate;
$end = $repetition->enddate;
$chart->addColumn(trans('firefly.day'), 'date');
$chart->addColumn(trans('firefly.left'), 'number');
$amount = $repetition->amount;
while ($start <= $end) {
/*
* Sum of expenses on this day:
*/
$sum = $repository->expensesOnDayCorrected($budget, $start);
$amount += $sum;
$chart->addRow(clone $start, $amount);
$start->addDay();
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Shows a budget list with spent/left/overspent.
*
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(GChart $chart, BudgetRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.budget'), 'string');
$chart->addColumn(trans('firefly.left'), 'number');
$chart->addColumn(trans('firefly.spent'), 'number');
$chart->addColumn(trans('firefly.overspent'), 'number');
$budgets = $repository->getBudgets();
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$allEntries = new Collection;
foreach ($budgets as $budget) {
$repetitions = $repository->getBudgetLimitRepetitions($budget, $start, $end);
if ($repetitions->count() == 0) {
$expenses = $repository->spentInPeriodCorrected($budget, $start, $end, true);
$allEntries->push([$budget->name, 0, 0, $expenses]);
continue;
}
/** @var LimitRepetition $repetition */
foreach ($repetitions as $repetition) {
$expenses = $repository->spentInPeriodCorrected($budget, $repetition->startdate, $repetition->enddate, true);
$left = $expenses < floatval($repetition->amount) ? floatval($repetition->amount) - $expenses : 0;
$spent = $expenses > floatval($repetition->amount) ? floatval($repetition->amount) : $expenses;
$overspent = $expenses > floatval($repetition->amount) ? $expenses - floatval($repetition->amount) : 0;
$allEntries->push(
[$budget->name . ' (' . $repetition->startdate->formatLocalized($this->monthAndDayFormat) . ')',
$left,
$spent,
$overspent
]
);
}
}
$noBudgetExpenses = $repository->getWithoutBudgetSum($start, $end);
$allEntries->push([trans('firefly.noBudget'), 0, 0, $noBudgetExpenses]);
foreach ($allEntries as $entry) {
if ($entry[1] != 0 || $entry[2] != 0 || $entry[3] != 0) {
$chart->addRow($entry[0], $entry[1], $entry[2], $entry[3]);
}
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Show a yearly overview for a budget.
*
* @param GChart $chart
* @param BudgetRepositoryInterface $repository
* @param $year
* @param bool $shared
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function year(GChart $chart, BudgetRepositoryInterface $repository, $year, $shared = false)
{
$start = new Carbon($year . '-01-01');
$end = new Carbon($year . '-12-31');
$shared = $shared == 'shared' ? true : false;
$budgets = $repository->getBudgets();
// add columns:
$chart->addColumn(trans('firefly.month'), 'date');
foreach ($budgets as $budget) {
$chart->addColumn($budget->name, 'number');
}
while ($start < $end) {
// month is the current end of the period:
$month = clone $start;
$month->endOfMonth();
// make a row:
$row = [clone $start];
// each budget, fill the row:
foreach ($budgets as $budget) {
$spent = $repository->spentInPeriodCorrected($budget, $start, $month, $shared);
$row[] = $spent;
}
$chart->addRowArray($row);
$start->addMonth();
}
$chart->generate();
return Response::json($chart->getData());
}
}

View File

@@ -0,0 +1,180 @@
<?php
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\Preference;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use Grumpydictator\Gchart\GChart;
use Navigation;
use Preferences;
use Response;
use Session;
/**
* Class CategoryController
*
* @package FireflyIII\Http\Controllers\Chart
*/
class CategoryController extends Controller
{
/**
* Show an overview for a category for all time, per month/week/year.
*
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function all(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{
// oldest transaction in category:
$start = $repository->getFirstActivityDate($category);
$range = Preferences::get('viewRange', '1M')->data;
// jump to start of week / month / year / etc
$start = Navigation::startOfPeriod($start, $range);
$chart->addColumn(trans('firefly.period'), 'date');
$chart->addColumn(trans('firefly.spent'), 'number');
$end = new Carbon;
while ($start <= $end) {
$currentEnd = Navigation::endOfPeriod($start, $range);
$spent = $repository->spentInPeriodCorrected($category, $start, $currentEnd);
$chart->addRow(clone $start, $spent);
$start = Navigation::addPeriod($start, $range, 0);
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Show this month's category overview.
*
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function frontpage(GChart $chart, CategoryRepositoryInterface $repository)
{
$chart->addColumn(trans('firefly.category'), 'string');
$chart->addColumn(trans('firefly.spent'), 'number');
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$set = $repository->getCategoriesAndExpensesCorrected($start, $end);
// sort by callback:
uasort(
$set,
function ($left, $right) {
if ($left['sum'] == $right['sum']) {
return 0;
}
return ($left['sum'] < $right['sum']) ? 1 : -1;
}
);
foreach ($set as $entry) {
$sum = floatval($entry['sum']);
if ($sum != 0) {
$chart->addRow($entry['name'], $sum);
}
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param Category $category
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function month(GChart $chart, CategoryRepositoryInterface $repository, Category $category)
{
$start = clone Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$chart->addColumn(trans('firefly.period'), 'date');
$chart->addColumn(trans('firefly.spent'), 'number');
while ($start <= $end) {
$spent = $repository->spentOnDaySumCorrected($category, $start);
$chart->addRow(clone $start, $spent);
$start->addDay();
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* This chart will only show expenses.
*
* @param GChart $chart
* @param CategoryRepositoryInterface $repository
* @param $year
* @param bool $shared
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function year(GChart $chart, CategoryRepositoryInterface $repository, $year, $shared = false)
{
$start = new Carbon($year . '-01-01');
$end = new Carbon($year . '-12-31');
$shared = $shared == 'shared' ? true : false;
$categories = $repository->getCategories();
// add columns:
$chart->addColumn(trans('firefly.month'), 'date');
foreach ($categories as $category) {
$chart->addColumn($category->name, 'number');
}
while ($start < $end) {
// month is the current end of the period:
$month = clone $start;
$month->endOfMonth();
// make a row:
$row = [clone $start];
// each budget, fill the row:
foreach ($categories as $category) {
$spent = $repository->spentInPeriodCorrected($category, $start, $month, $shared);
$row[] = $spent;
}
$chart->addRowArray($row);
$start->addMonth();
}
$chart->generate();
return Response::json($chart->getData());
}
}

View File

@@ -0,0 +1,58 @@
<?php
/**
* Created by PhpStorm.
* User: sander
* Date: 16/05/15
* Time: 09:36
*/
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Http\Controllers\Controller;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Grumpydictator\Gchart\GChart;
use Illuminate\Support\Collection;
use Response;
/**
* Class PiggyBankController
*
* @package FireflyIII\Http\Controllers\Chart
*/
class PiggyBankController extends Controller
{
/**
* Shows the piggy bank history.
*
* @param GChart $chart
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function history(GChart $chart, PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$chart->addColumn(trans('firefly.date'), 'date');
$chart->addColumn(trans('firefly.balance'), 'number');
/** @var Collection $set */
$set = $repository->getEventSummarySet($piggyBank);
$sum = 0;
foreach ($set as $entry) {
$sum += floatval($entry->sum);
$chart->addRow(new Carbon($entry->date), $sum);
}
$chart->generate();
return Response::json($chart->getData());
}
}

View File

@@ -0,0 +1,101 @@
<?php
namespace FireflyIII\Http\Controllers\Chart;
use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Http\Controllers\Controller;
use Grumpydictator\Gchart\GChart;
use Response;
/**
* Class ReportController
*
* @package FireflyIII\Http\Controllers\Chart
*/
class ReportController extends Controller
{
/**
* Summarizes all income and expenses, per month, for a given year.
*
* @param GChart $chart
* @param ReportQueryInterface $query
* @param $year
* @param bool $shared
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function yearInOut(GChart $chart, ReportQueryInterface $query, $year, $shared = false)
{
// get start and end of year
$start = new Carbon($year . '-01-01');
$end = new Carbon($year . '-12-31');
$shared = $shared == 'shared' ? true : false;
$chart->addColumn(trans('firefly.month'), 'date');
$chart->addColumn(trans('firefly.income'), 'number');
$chart->addColumn(trans('firefly.expenses'), 'number');
while ($start < $end) {
$month = clone $start;
$month->endOfMonth();
// total income and total expenses:
$incomeSum = floatval($query->incomeInPeriodCorrected($start, $month, $shared)->sum('amount'));
$expenseSum = floatval($query->expenseInPeriodCorrected($start, $month, $shared)->sum('amount'));
$chart->addRow(clone $start, $incomeSum, $expenseSum);
$start->addMonth();
}
$chart->generate();
return Response::json($chart->getData());
}
/**
* Summarizes all income and expenses for a given year. Gives a total and an average.
*
* @param GChart $chart
* @param ReportQueryInterface $query
* @param $year
* @param bool $shared
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function yearInOutSummarized(GChart $chart, ReportQueryInterface $query, $year, $shared = false)
{
$start = new Carbon($year . '-01-01');
$end = new Carbon($year . '-12-31');
$shared = $shared == 'shared' ? true : false;
$income = 0;
$expense = 0;
$count = 0;
$chart->addColumn(trans('firefly.summary'), 'string');
$chart->addColumn(trans('firefly.income'), 'number');
$chart->addColumn(trans('firefly.expenses'), 'number');
while ($start < $end) {
$month = clone $start;
$month->endOfMonth();
// total income and total expenses:
$income += floatval($query->incomeInPeriodCorrected($start, $month, $shared)->sum('amount'));
$expense += floatval($query->expenseInPeriodCorrected($start, $month, $shared)->sum('amount'));
$count++;
$start->addMonth();
}
// add total + average:
$chart->addRow(trans('firefly.sum'), $income, $expense);
$count = $count > 0 ? $count : 1;
$chart->addRow(trans('firefly.average'), ($income / $count), ($expense / $count));
$chart->generate();
return Response::json($chart->getData());
}
}

View File

@@ -0,0 +1,47 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Config;
use Illuminate\Foundation\Bus\DispatchesCommands;
use Illuminate\Foundation\Validation\ValidatesRequests;
use Illuminate\Routing\Controller as BaseController;
use Preferences;
use View;
/**
* Class Controller
*
* @package FireflyIII\Http\Controllers
*/
abstract class Controller extends BaseController
{
use DispatchesCommands, ValidatesRequests;
/** @var string */
protected $monthAndDayFormat;
/** @var string */
protected $monthFormat;
/**
* @codeCoverageIgnore
*/
public function __construct()
{
View::share('hideBudgets', false);
View::share('hideCategories', false);
View::share('hideBills', false);
View::share('hideTags', false);
if (Auth::check()) {
$pref = Preferences::get('language', 'en');
$lang = $pref->data;
$this->monthFormat = Config::get('firefly.month.' . $lang);
$this->monthAndDayFormat = Config::get('firefly.monthAndDay.' . $lang);
View::share('monthFormat', $this->monthFormat);
View::share('monthAndDayFormat', $this->monthAndDayFormat);
View::share('language', $lang);
}
}
}

View File

@@ -0,0 +1,201 @@
<?php namespace FireflyIII\Http\Controllers;
use Cache;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\CurrencyFormRequest;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use Input;
use Preferences;
use Redirect;
use Session;
use URL;
use View;
/**
* Class CurrencyController
*
* @package FireflyIII\Http\Controllers
*/
class CurrencyController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.currencies'));
View::share('mainTitleIcon', 'fa-usd');
}
/**
* @return \Illuminate\View\View
*/
public function create()
{
$subTitleIcon = 'fa-plus';
$subTitle = 'Create a new currency';
// put previous url in session if not redirect from store (not "create another").
if (Session::get('currency.create.fromStore') !== true) {
Session::put('currency.create.url', URL::previous());
}
Session::forget('currency.create.fromStore');
return view('currency.create', compact('subTitleIcon', 'subTitle'));
}
/**
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse
*/
public function defaultCurrency(TransactionCurrency $currency)
{
Preferences::set('currencyPreference', $currency->code);
Session::flash('success', $currency->name . ' is now the default currency.');
Cache::forget('FFCURRENCYSYMBOL');
Cache::forget('FFCURRENCYCODE');
return Redirect::route('currency.index');
}
/**
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse|View
*/
public function delete(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
if ($repository->countJournals($currency) > 0) {
Session::flash('error', 'Cannot delete ' . e($currency->name) . ' because there are still transactions attached to it.');
return Redirect::route('currency.index');
}
// put previous url in session
Session::put('currency.delete.url', URL::previous());
return view('currency.delete', compact('currency'));
}
/**
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function destroy(CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
if ($repository->countJournals($currency) > 0) {
Session::flash('error', 'Cannot destroy ' . e($currency->name) . ' because there are still transactions attached to it.');
return Redirect::route('currency.index');
}
Session::flash('success', 'Currency "' . e($currency->name) . '" deleted');
$currency->delete();
return Redirect::to(Session::get('currency.delete.url'));
}
/**
* @param TransactionCurrency $currency
*
* @return \Illuminate\View\View
*/
public function edit(TransactionCurrency $currency)
{
$subTitleIcon = 'fa-pencil';
$subTitle = 'Edit currency "' . e($currency->name) . '"';
$currency->symbol = htmlentities($currency->symbol);
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('currency.edit.fromUpdate') !== true) {
Session::put('currency.edit.url', URL::previous());
}
Session::forget('currency.edit.fromUpdate');
return view('currency.edit', compact('currency', 'subTitle', 'subTitleIcon'));
}
/**
* @param CurrencyRepositoryInterface $repository
*
* @return \Illuminate\View\View
*/
public function index(CurrencyRepositoryInterface $repository)
{
$currencies = $repository->get();
$defaultCurrency = $repository->getCurrencyByPreference(Preferences::get('currencyPreference', 'EUR'));
return view('currency.index', compact('currencies', 'defaultCurrency'));
}
/**
*
* @param CurrencyFormRequest $request
* @param CurrencyRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository)
{
$data = $request->getCurrencyData();
$currency = $repository->store($data);
Session::flash('success', 'Currency "' . $currency->name . '" created');
if (intval(Input::get('create_another')) === 1) {
Session::put('currency.create.fromStore', true);
return Redirect::route('currency.create')->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('currency.create.url'));
}
/**
* @param CurrencyFormRequest $request
* @param CurrencyRepositoryInterface $repository
* @param TransactionCurrency $currency
*
* @return \Illuminate\Http\RedirectResponse
*/
public function update(CurrencyFormRequest $request, CurrencyRepositoryInterface $repository, TransactionCurrency $currency)
{
$data = $request->getCurrencyData();
$currency = $repository->update($currency, $data);
Session::flash('success', 'Currency "' . e($currency->name) . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('currency.edit.fromUpdate', true);
return Redirect::route('currency.edit', $currency->id);
}
// redirect to previous URL.
return Redirect::to(Session::get('currency.edit.url'));
}
}

View File

@@ -0,0 +1,51 @@
<?php namespace FireflyIII\Http\Controllers;
use FireflyIII\Helpers\Help\HelpInterface;
use Log;
use Response;
/**
* Class HelpController
*
* @package FireflyIII\Http\Controllers
*/
class HelpController extends Controller
{
/**
* @param HelpInterface $help
* @param $route
*
* @return \Illuminate\Http\JsonResponse
*/
public function show(HelpInterface $help, $route)
{
$content = [
'text' => '<p>There is no help for this route!</p>',
'title' => 'Help',
];
if (!$help->hasRoute($route)) {
Log::error('No such route: ' . $route);
return Response::json($content);
}
if ($help->inCache($route)) {
$content = [
'text' => $help->getFromCache('help.' . $route . '.text'),
'title' => $help->getFromCache('help.' . $route . '.title'),
];
return Response::json($content);
}
$content = $help->getFromGithub($route);
$help->putInCache($route, $content);
return Response::json($content);
}
}

View File

@@ -0,0 +1,165 @@
<?php namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use Config;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
use Preferences;
use Redirect;
use Route;
use Session;
use Steam;
/**
* Class HomeController
*
* @package FireflyIII\Http\Controllers
*/
class HomeController extends Controller
{
public function dateRange()
{
$start = new Carbon(Input::get('start'));
$end = new Carbon(Input::get('end'));
$diff = $start->diffInDays($end);
if ($diff > 50) {
Session::flash('warning', $diff . ' days of data may take a while to load.');
}
Session::put('start', $start);
Session::put('end', $end);
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function flush()
{
Session::clear();
return Redirect::route('index');
}
/**
* @param AccountRepositoryInterface $repository
*
* @return \Illuminate\View\View
*/
public function index(AccountRepositoryInterface $repository)
{
$types = Config::get('firefly.accountTypesByIdentifier.asset');
$count = $repository->countAccounts($types);
$title = 'Firefly';
$subTitle = trans('firefly.welcomeBack');
$mainTitleIcon = 'fa-fire';
$transactions = [];
$frontPage = Preferences::get('frontPageAccounts', []);
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$accounts = $repository->getFrontpageAccounts($frontPage);
$savings = $repository->getSavingsAccounts();
$piggyBankAccounts = $repository->getPiggyBankAccounts();
$savingsTotal = 0;
foreach ($savings as $savingAccount) {
$savingsTotal += Steam::balance($savingAccount, $end);
}
$sum = $repository->sumOfEverything();
if ($sum != 0) {
Session::flash(
'error', 'Your transactions are unbalanced. This means a'
. ' withdrawal, deposit or transfer was not stored properly. '
. 'Please check your accounts and transactions for errors.'
);
}
foreach ($accounts as $account) {
$set = $repository->getFrontpageTransactions($account, $start, $end);
if (count($set) > 0) {
$transactions[] = [$set, $account];
}
}
return view('index', compact('count', 'title', 'savings', 'subTitle', 'mainTitleIcon', 'transactions', 'savingsTotal', 'piggyBankAccounts'));
}
/**
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function routes()
{
$directory = '/vagrant_data/Sites/firefly-iii-help';
$languages = array_keys(Config::get('firefly.lang'));
$routes = [];
$ignored = [
'debugbar.openhandler', 'debugbar.assets.css', 'debugbar.assets.js', 'register', 'routes', 'daterange',
'flush', 'delete-account-post', 'change-password-post', 'logout', 'login', 'tags.hideTagHelp',
'budgets.postIncome', 'flush'
];
$ignoreMatch = ['.store', '.update', '.destroy', 'json.'];
$routeCollection = Route::getRoutes();
/** @var \Illuminate\Routing\Route $object */
foreach ($routeCollection as $object) {
// get name:
$name = $object->getName();
// has name and not in ignore list?
if (strlen($name) > 0 && !in_array($name, $ignored)) {
// not in ignoreMatch?
$continue = true;
foreach ($ignoreMatch as $ignore) {
$match = strpos($name, $ignore);
if (!($match === false)) {
$continue = false;
}
}
unset($ignore, $match);
if ($continue) {
$routes[] = $name;
// check all languages:
foreach ($languages as $lang) {
$file = $directory . '/' . $lang . '/' . $name . '.md';
if (!file_exists($file)) {
touch($file);
echo $name . '<br />';
}
}
}
}
}
// loop directories with language file.
// tag the ones not in the list of approved routes.
foreach ($languages as $lang) {
$dir = $directory . '/' . $lang;
$set = scandir($dir);
foreach ($set as $entry) {
if ($entry != '.' && $entry != '..') {
$name = str_replace('.md', '', $entry);
if (!in_array($name, $routes)) {
$file = $dir . '/' . $entry;
unlink($file);
}
}
}
}
echo 'Done!';
}
}

View File

@@ -0,0 +1,247 @@
<?php namespace FireflyIII\Http\Controllers;
use Amount;
use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportQueryInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Preference;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Support\Collection;
use Response;
use Session;
use Steam;
/**
* Class JsonController
*
* @package FireflyIII\Http\Controllers
*/
class JsonController extends Controller
{
/**
* @param BillRepositoryInterface $repository
*
* @param AccountRepositoryInterface $accountRepository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function boxBillsPaid(BillRepositoryInterface $repository, AccountRepositoryInterface $accountRepository)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$amount = 0;
// these two functions are the same as the chart
$bills = $repository->getActiveBills();
/** @var Bill $bill */
foreach ($bills as $bill) {
$amount += $repository->billPaymentsInRange($bill, $start, $end);
}
unset($bill, $bills);
/**
* Find credit card accounts and possibly unpaid credit card bills.
*/
$creditCards = $accountRepository->getCreditCards();
// if the balance is not zero, the monthly payment is still underway.
/** @var Account $creditCard */
foreach ($creditCards as $creditCard) {
$balance = Steam::balance($creditCard, $end, true);
if ($balance == 0) {
// find a transfer TO the credit card which should account for
// anything paid. If not, the CC is not yet used.
$amount += $accountRepository->getTransfersInRange($creditCard, $start, $end)->sum('amount');
}
}
return Response::json(['box' => 'bills-paid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]);
}
/**
* @param BillRepositoryInterface $repository
* @param AccountRepositoryInterface $accountRepository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function boxBillsUnpaid(BillRepositoryInterface $repository, AccountRepositoryInterface $accountRepository)
{
$amount = 0;
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$bills = $repository->getActiveBills();
$unpaid = new Collection; // bills
/** @var Bill $bill */
foreach ($bills as $bill) {
$ranges = $repository->getRanges($bill, $start, $end);
foreach ($ranges as $range) {
$journals = $repository->getJournalsInRange($bill, $range['start'], $range['end']);
if ($journals->count() == 0) {
$unpaid->push([$bill, $range['start']]);
}
}
}
unset($bill, $bills, $range, $ranges);
$creditCards = $accountRepository->getCreditCards();
foreach ($creditCards as $creditCard) {
$balance = Steam::balance($creditCard, $end, true);
$date = new Carbon($creditCard->getMeta('ccMonthlyPaymentDate'));
if ($balance < 0) {
// unpaid! create a fake bill that matches the amount.
$description = $creditCard->name;
$fakeAmount = $balance * -1;
$fakeBill = $repository->createFakeBill($description, $date, $fakeAmount);
$unpaid->push([$fakeBill, $date]);
}
}
/** @var Bill $entry */
foreach ($unpaid as $entry) {
$current = ($entry[0]->amount_max + $entry[0]->amount_min) / 2;
$amount += $current;
}
return Response::json(['box' => 'bills-unpaid', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]);
}
/**
* @param ReportQueryInterface $reportQuery
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function boxIn(ReportQueryInterface $reportQuery)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$amount = $reportQuery->incomeInPeriodCorrected($start, $end, true)->sum('amount');
// $amount = 0;
// foreach($set as $entry) {
// //echo $entry->description.' ('.$entry->tags->count().'): ' . $entry->amount."\n";
// $amount += $entry->amount;
// }
return Response::json(['box' => 'in', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]);
}
/**
* @param ReportQueryInterface $reportQuery
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function boxOut(ReportQueryInterface $reportQuery)
{
$start = Session::get('start', Carbon::now()->startOfMonth());
$end = Session::get('end', Carbon::now()->endOfMonth());
$amount = $reportQuery->expenseInPeriodCorrected($start, $end, true)->sum('amount');
return Response::json(['box' => 'out', 'amount' => Amount::format($amount, false), 'amount_raw' => $amount]);
}
/**
* Returns a list of categories.
*
* @param CategoryRepositoryInterface $repository
*
* @return \Illuminate\Http\JsonResponse
*/
public function categories(CategoryRepositoryInterface $repository)
{
$list = $repository->getCategories();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
}
sort($return);
return Response::json($return);
}
/**
* Returns a JSON list of all beneficiaries.
*
* @param AccountRepositoryInterface $accountRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function expenseAccounts(AccountRepositoryInterface $accountRepository)
{
$list = $accountRepository->getAccounts(['Expense account', 'Beneficiary account']);
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
}
return Response::json($return);
}
/**
* @param AccountRepositoryInterface $accountRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function revenueAccounts(AccountRepositoryInterface $accountRepository)
{
$list = $accountRepository->getAccounts(['Revenue account']);
$return = [];
foreach ($list as $entry) {
$return[] = $entry->name;
}
return Response::json($return);
}
/**
* Returns a JSON list of all beneficiaries.
*
* @param TagRepositoryInterface $tagRepository
*
* @return \Illuminate\Http\JsonResponse
*/
public function tags(TagRepositoryInterface $tagRepository)
{
$list = $tagRepository->get();
$return = [];
foreach ($list as $entry) {
$return[] = $entry->tag;
}
return Response::json($return);
}
/**
* @param JournalRepositoryInterface $repository
* @param $what
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function transactionJournals(JournalRepositoryInterface $repository, $what)
{
$descriptions = [];
$dbType = $repository->getTransactionType($what);
$journals = $repository->getJournalsOfType($dbType);
foreach ($journals as $j) {
$descriptions[] = $j->description;
}
$descriptions = array_unique($descriptions);
sort($descriptions);
return Response::json($descriptions);
}
}

View File

@@ -0,0 +1,377 @@
<?php namespace FireflyIII\Http\Controllers;
use Amount;
use Carbon\Carbon;
use Config;
use ExpandedForm;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\PiggyBankFormRequest;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
use Illuminate\Support\Collection;
use Input;
use Redirect;
use Session;
use Steam;
use URL;
use View;
/**
* Class PiggyBankController
*
* @package FireflyIII\Http\Controllers
*/
class PiggyBankController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.piggyBanks'));
View::share('mainTitleIcon', 'fa-sort-amount-asc');
}
/**
* Add money to piggy bank
*
* @param AccountRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return $this
*/
public function add(AccountRepositoryInterface $repository, PiggyBank $piggyBank)
{
$date = Session::get('end', Carbon::now()->endOfMonth());
$leftOnAccount = $repository->leftOnAccount($piggyBank->account, $date);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
$leftToSave = $piggyBank->targetamount - $savedSoFar;
$maxAmount = min($leftOnAccount, $leftToSave);
return view('piggy-banks.add', compact('piggyBank', 'maxAmount'));
}
/**
* @param AccountRepositoryInterface $repository
*
* @return mixed
*/
public function create(AccountRepositoryInterface $repository)
{
$periods = Config::get('firefly.piggy_bank_periods');
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
$subTitle = 'Create new piggy bank';
$subTitleIcon = 'fa-plus';
// put previous url in session if not redirect from store (not "create another").
if (Session::get('piggy-banks.create.fromStore') !== true) {
Session::put('piggy-banks.create.url', URL::previous());
}
Session::forget('piggy-banks.create.fromStore');
return view('piggy-banks.create', compact('accounts', 'periods', 'subTitle', 'subTitleIcon'));
}
/**
* @param PiggyBank $piggyBank
*
* @return $this
*/
public function delete(PiggyBank $piggyBank)
{
$subTitle = 'Delete "' . e($piggyBank->name) . '"';
// put previous url in session
Session::put('piggy-banks.delete.url', URL::previous());
return view('piggy-banks.delete', compact('piggyBank', 'subTitle'));
}
/**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
Session::flash('success', 'Piggy bank "' . e($piggyBank->name) . '" deleted.');
$repository->destroy($piggyBank);
return Redirect::to(Session::get('piggy-banks.delete.url'));
}
/**
* @param AccountRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return View
*/
public function edit(AccountRepositoryInterface $repository, PiggyBank $piggyBank)
{
$periods = Config::get('firefly.piggy_bank_periods');
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
$subTitle = 'Edit piggy bank "' . e($piggyBank->name) . '"';
$subTitleIcon = 'fa-pencil';
/*
* Flash some data to fill the form.
*/
if (is_null($piggyBank->targetdate) || $piggyBank->targetdate == '') {
$targetDate = null;
} else {
$targetDate = new Carbon($piggyBank->targetdate);
$targetDate = $targetDate->format('Y-m-d');
}
$preFilled = ['name' => $piggyBank->name,
'account_id' => $piggyBank->account_id,
'targetamount' => $piggyBank->targetamount,
'targetdate' => $targetDate,
'reminder' => $piggyBank->reminder,
'remind_me' => intval($piggyBank->remind_me) == 1 && !is_null($piggyBank->reminder) ? true : false
];
Session::flash('preFilled', $preFilled);
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('piggy-banks.edit.fromUpdate') !== true) {
Session::put('piggy-banks.edit.url', URL::previous());
}
Session::forget('piggy-banks.edit.fromUpdate');
return view('piggy-banks.edit', compact('subTitle', 'subTitleIcon', 'piggyBank', 'accounts', 'periods', 'preFilled'));
}
/**
* @param AccountRepositoryInterface $repository
* @param PiggyBankRepositoryInterface $piggyRepository
*
* @return View
*/
public function index(AccountRepositoryInterface $repository, PiggyBankRepositoryInterface $piggyRepository)
{
/** @var Collection $piggyBanks */
$piggyBanks = $piggyRepository->getPiggyBanks();
$end = Session::get('end', Carbon::now()->endOfMonth());
$accounts = [];
/** @var PiggyBank $piggyBank */
foreach ($piggyBanks as $piggyBank) {
$piggyBank->savedSoFar = floatval($piggyBank->currentRelevantRep()->currentamount);
$piggyBank->percentage = $piggyBank->savedSoFar != 0 ? intval($piggyBank->savedSoFar / $piggyBank->targetamount * 100) : 0;
$piggyBank->leftToSave = $piggyBank->targetamount - $piggyBank->savedSoFar;
/*
* Fill account information:
*/
$account = $piggyBank->account;
if (!isset($accounts[$account->id])) {
$accounts[$account->id] = [
'name' => $account->name,
'balance' => Steam::balance($account, $end, true),
'leftForPiggyBanks' => $repository->leftOnAccount($account, $end),
'sumOfSaved' => $piggyBank->savedSoFar,
'sumOfTargets' => floatval($piggyBank->targetamount),
'leftToSave' => $piggyBank->leftToSave
];
} else {
$accounts[$account->id]['sumOfSaved'] += $piggyBank->savedSoFar;
$accounts[$account->id]['sumOfTargets'] += floatval($piggyBank->targetamount);
$accounts[$account->id]['leftToSave'] += $piggyBank->leftToSave;
}
}
return view('piggy-banks.index', compact('piggyBanks', 'accounts'));
}
/**
* @param PiggyBankRepositoryInterface $repository
*/
public function order(PiggyBankRepositoryInterface $repository)
{
$data = Input::get('order');
// set all users piggy banks to zero:
$repository->reset();
if (is_array($data)) {
foreach ($data as $order => $id) {
$repository->setOrder(intval($id), (intval($order) + 1));
}
}
}
/**
* @param PiggyBankRepositoryInterface $repository
* @param AccountRepositoryInterface $accounts
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postAdd(PiggyBankRepositoryInterface $repository, AccountRepositoryInterface $accounts, PiggyBank $piggyBank)
{
$amount = round(floatval(Input::get('amount')), 2);
$date = Session::get('end', Carbon::now()->endOfMonth());
$leftOnAccount = $accounts->leftOnAccount($piggyBank->account, $date);
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
$leftToSave = $piggyBank->targetamount - $savedSoFar;
$maxAmount = round(min($leftOnAccount, $leftToSave), 2);
if ($amount <= $maxAmount) {
$repetition = $piggyBank->currentRelevantRep();
$repetition->currentamount += $amount;
$repetition->save();
// create event
$repository->createEvent($piggyBank, $amount);
/*
* Create event!
*/
//Event::fire('piggy_bank.addMoney', [$piggyBank, $amount]); // new and used.
Session::flash('success', 'Added ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');
} else {
Session::flash('error', 'Could not add ' . Amount::format($amount, false) . ' to "' . e($piggyBank->name) . '".');
}
return Redirect::route('piggy-banks.index');
}
/**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postRemove(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$amount = floatval(Input::get('amount'));
$savedSoFar = $piggyBank->currentRelevantRep()->currentamount;
if ($amount <= $savedSoFar) {
$repetition = $piggyBank->currentRelevantRep();
$repetition->currentamount -= $amount;
$repetition->save();
// create event
$repository->createEvent($piggyBank, $amount * -1);
Session::flash('success', 'Removed ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".');
} else {
Session::flash('error', 'Could not remove ' . Amount::format($amount, false) . ' from "' . e($piggyBank->name) . '".');
}
return Redirect::route('piggy-banks.index');
}
/**
* @param PiggyBank $piggyBank
*
*
* @return \Illuminate\View\View
*/
public function remove(PiggyBank $piggyBank)
{
return view('piggy-banks.remove', compact('piggyBank'));
}
/**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBank $piggyBank
*
* @return View
*/
public function show(PiggyBankRepositoryInterface $repository, PiggyBank $piggyBank)
{
$events = $repository->getEvents($piggyBank);
/*
* Number of reminders:
*/
$subTitle = e($piggyBank->name);
return view('piggy-banks.show', compact('piggyBank', 'events', 'subTitle'));
}
/**
* @param PiggyBankFormRequest $request
* @param PiggyBankRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(PiggyBankFormRequest $request, PiggyBankRepositoryInterface $repository)
{
$piggyBankData = [
'name' => $request->get('name'),
'startdate' => new Carbon,
'account_id' => intval($request->get('account_id')),
'targetamount' => floatval($request->get('targetamount')),
'targetdate' => strlen($request->get('targetdate')) > 0 ? new Carbon($request->get('targetdate')) : null,
'reminder' => $request->get('reminder'),
'remind_me' => $request->get('remind_me'),
];
$piggyBank = $repository->store($piggyBankData);
Session::flash('success', 'Stored piggy bank "' . e($piggyBank->name) . '".');
if (intval(Input::get('create_another')) === 1) {
Session::put('piggy-banks.create.fromStore', true);
return Redirect::route('piggy-banks.create')->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('piggy-banks.create.url'));
}
/**
* @param PiggyBankRepositoryInterface $repository
* @param PiggyBankFormRequest $request
* @param PiggyBank $piggyBank
*
* @return $this
*/
public function update(PiggyBankRepositoryInterface $repository, PiggyBankFormRequest $request, PiggyBank $piggyBank)
{
$piggyBankData = [
'name' => $request->get('name'),
'startdate' => is_null($piggyBank->startdate) ? $piggyBank->created_at : $piggyBank->startdate,
'account_id' => intval($request->get('account_id')),
'targetamount' => floatval($request->get('targetamount')),
'targetdate' => strlen($request->get('targetdate')) > 0 ? new Carbon($request->get('targetdate')) : null,
'reminder' => $request->get('reminder'),
'remind_me' => $request->get('remind_me')
];
$piggyBank = $repository->update($piggyBank, $piggyBankData);
Session::flash('success', 'Updated piggy bank "' . e($piggyBank->name) . '".');
if (intval(Input::get('return_to_edit')) === 1) {
Session::put('piggy-banks.edit.fromUpdate', true);
return Redirect::route('piggy-banks.edit', $piggyBank->id);
}
// redirect to previous URL.
return Redirect::to(Session::get('piggy-banks.edit.url'));
}
}

View File

@@ -0,0 +1,85 @@
<?php namespace FireflyIII\Http\Controllers;
use Config;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Input;
use Preferences;
use Redirect;
use Session;
use View;
/**
* Class PreferencesController
*
* @package FireflyIII\Http\Controllers
*/
class PreferencesController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.preferences'));
View::share('mainTitleIcon', 'fa-gear');
}
/**
* @param AccountRepositoryInterface $repository
*
* @return $this|\Illuminate\View\View
*/
public function index(AccountRepositoryInterface $repository)
{
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
$viewRangePref = Preferences::get('viewRange', '1M');
$viewRange = $viewRangePref->data;
$frontPageAccounts = Preferences::get('frontPageAccounts', []);
$budgetMax = Preferences::get('budgetMaximum', 1000);
$languagePref = Preferences::get('language', 'en');
$language = $languagePref->data;
$budgetMaximum = $budgetMax->data;
return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange'));
}
/**
* @return \Illuminate\Http\RedirectResponse
*/
public function postIndex()
{
// front page accounts
$frontPageAccounts = [];
if (is_array(Input::get('frontPageAccounts'))) {
foreach (Input::get('frontPageAccounts') as $id) {
$frontPageAccounts[] = intval($id);
}
Preferences::set('frontPageAccounts', $frontPageAccounts);
}
// view range:
Preferences::set('viewRange', Input::get('viewRange'));
// forget session values:
Session::forget('start');
Session::forget('end');
Session::forget('range');
// budget maximum:
$budgetMaximum = intval(Input::get('budgetMaximum'));
Preferences::set('budgetMaximum', $budgetMaximum);
// language:
$lang = Input::get('language');
if (in_array($lang, array_keys(Config::get('firefly.lang')))) {
Preferences::set('language', $lang);
}
Session::flash('success', 'Preferences saved!');
return Redirect::route('preferences');
}
}

View File

@@ -0,0 +1,117 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\DeleteAccountFormRequest;
use FireflyIII\Http\Requests\ProfileFormRequest;
use Hash;
use Redirect;
use Session;
/**
* Class ProfileController
*
* @package FireflyIII\Http\Controllers
*/
class ProfileController extends Controller
{
/**
* @return \Illuminate\View\View
*/
public function changePassword()
{
return view('profile.change-password')->with('title', Auth::user()->email)->with('subTitle', 'Change your password')->with(
'mainTitleIcon', 'fa-user'
);
}
/**
* @return \Illuminate\View\View
*/
public function deleteAccount()
{
return view('profile.delete-account')->with('title', Auth::user()->email)->with('subTitle', 'Delete account')->with(
'mainTitleIcon', 'fa-user'
);
}
/**
* @return \Illuminate\View\View
*
*/
public function index()
{
return view('profile.index')->with('title', 'Profile')->with('subTitle', Auth::user()->email)->with('mainTitleIcon', 'fa-user');
}
/**
* @param ProfileFormRequest $request
*
* @return \Illuminate\Http\RedirectResponse|\Illuminate\View\View
*/
public function postChangePassword(ProfileFormRequest $request)
{
// old, new1, new2
if (!Hash::check($request->get('current_password'), Auth::user()->password)) {
Session::flash('error', 'Invalid current password!');
return Redirect::route('change-password');
}
$result = $this->validatePassword($request->get('current_password'), $request->get('new_password'));
if (!($result === true)) {
Session::flash('error', $result);
return Redirect::route('change-password');
}
// update the user with the new password.
Auth::user()->password = $request->get('new_password');
Auth::user()->save();
Session::flash('success', 'Password changed!');
return Redirect::route('profile');
}
/**
*
* @param string $old
* @param string $new1
*
* @return string|bool
*/
protected function validatePassword($old, $new1)
{
if ($new1 == $old) {
return 'The idea is to change your password.';
}
return true;
}
/**
* @param DeleteAccountFormRequest $request
*
* @return \Illuminate\Http\RedirectResponse
* @throws \Exception
*/
public function postDeleteAccount(DeleteAccountFormRequest $request)
{
// old, new1, new2
if (!Hash::check($request->get('password'), Auth::user()->password)) {
Session::flash('error', 'Invalid password!');
return Redirect::route('delete-account');
}
// DELETE!
Auth::user()->delete();
Session::flush();
return Redirect::route('index');
}
}

View File

@@ -0,0 +1,94 @@
<?php namespace FireflyIII\Http\Controllers;
use FireflyIII\Models\Reminder;
use FireflyIII\Repositories\Reminder\ReminderRepositoryInterface;
use Redirect;
use Session;
use URL;
/**
* Class ReminderController
*
* @package FireflyIII\Http\Controllers
*/
class ReminderController extends Controller
{
/**
* @param Reminder $reminder
*
* @return \Illuminate\Http\RedirectResponse
*/
public function act(Reminder $reminder)
{
$data = [
'description' => 'Money for piggy bank "' . $reminder->remindersable->name . '"',
'amount' => round($reminder->metadata->perReminder, 2),
'account_to_id' => $reminder->remindersable->account_id,
'piggy_bank_id' => $reminder->remindersable_id,
'reminder_id' => $reminder->id,
];
Session::flash('_old_input', $data);
return Redirect::route('transactions.create', 'transfer');
}
/**
* @param Reminder $reminder
*
* @return \Illuminate\Http\RedirectResponse
*/
public function dismiss(Reminder $reminder)
{
$reminder->notnow = true;
$reminder->save();
return Redirect::to(URL::previous());
}
/**
* @param ReminderRepositoryInterface $repository
*
* @return \Illuminate\View\View
*/
public function index(ReminderRepositoryInterface $repository)
{
$active = $repository->getActiveReminders();
$expired = $repository->getExpiredReminders();
$inactive = $repository->getInactiveReminders();
$dismissed = $repository->getDismissedReminders();
$title = 'Reminders';
$mainTitleIcon = 'fa-clock-o';
return view('reminders.index', compact('dismissed', 'expired', 'inactive', 'active', 'title', 'mainTitleIcon'));
}
/**
* @param Reminder $reminder
*
* @return \Illuminate\View\View
*/
public function show(Reminder $reminder)
{
$title = 'Reminder';
$mainTitleIcon = 'fa-clock-o';
if ($reminder->notnow === true) {
$subTitle = 'Dismissed reminder';
} else {
$subTitle = 'Reminder';
}
$subTitle .= ' for piggy bank "' . $reminder->remindersable->name . '"';
return view('reminders.show', compact('reminder', 'title', 'subTitle', 'mainTitleIcon'));
}
}

View File

@@ -0,0 +1,156 @@
<?php namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use FireflyIII\Helpers\Report\ReportHelperInterface;
use FireflyIII\Models\Account;
use FireflyIII\Models\Budget;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\Preference;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Session;
use View;
/**
* Class ReportController
*
* @package FireflyIII\Http\Controllers
*/
class ReportController extends Controller
{
/** @var ReportHelperInterface */
protected $helper;
/**
* @codeCoverageIgnore
*
* @param ReportHelperInterface $helper
*/
public function __construct(ReportHelperInterface $helper)
{
parent::__construct();
$this->helper = $helper;
View::share('title', trans('firefly.reports'));
View::share('mainTitleIcon', 'fa-line-chart');
}
/**
* @param AccountRepositoryInterface $repository
*
* @return View
* @internal param ReportHelperInterface $helper
*/
public function index(AccountRepositoryInterface $repository)
{
$start = Session::get('first');
$months = $this->helper->listOfMonths($start);
// does the user have shared accounts?
$accounts = $repository->getAccounts(['Default account', 'Asset account']);
$hasShared = false;
/** @var Account $account */
foreach ($accounts as $account) {
if ($account->getMeta('accountRole') == 'sharedAsset') {
$hasShared = true;
}
}
return view('reports.index', compact('months', 'hasShared'));
}
/**
* @param string $year
* @param string $month
*
* @param bool $shared
*
* @return \Illuminate\View\View
*/
public function month($year = '2014', $month = '1', $shared = false)
{
$start = new Carbon($year . '-' . $month . '-01');
$subTitle = trans('firefly.reportForMonth', ['date' => $start->formatLocalized($this->monthFormat)]);
$subTitleIcon = 'fa-calendar';
$end = clone $start;
$incomeTopLength = 8;
$expenseTopLength = 8;
if ($shared == 'shared') {
$shared = true;
$subTitle = trans('firefly.reportForMonthShared', ['date' => $start->formatLocalized($this->monthFormat)]);
}
$end->endOfMonth();
$accounts = $this->helper->getAccountReport($start, $end, $shared);
$incomes = $this->helper->getIncomeReport($start, $end, $shared);
$expenses = $this->helper->getExpenseReport($start, $end, $shared);
$budgets = $this->helper->getBudgetReport($start, $end, $shared);
$categories = $this->helper->getCategoryReport($start, $end, $shared);
$balance = $this->helper->getBalanceReport($start, $end, $shared);
$bills = $this->helper->getBillReport($start, $end, $shared);
return view(
'reports.month',
compact(
'start', 'shared',
'subTitle', 'subTitleIcon',
'accounts',
'incomes', 'incomeTopLength',
'expenses', 'expenseTopLength',
'budgets', 'balance',
'categories',
'bills'
)
);
}
/**
* @param $year
*
* @param bool $shared
*
* @return $this
*/
public function year($year, $shared = false)
{
$start = new Carbon('01-01-' . $year);
$end = clone $start;
$subTitle = trans('firefly.reportForYear', ['year' => $year]);
$subTitleIcon = 'fa-bar-chart';
$incomeTopLength = 8;
$expenseTopLength = 8;
if ($shared == 'shared') {
$shared = true;
$subTitle = trans('firefly.reportForYearShared', ['year' => $year]);
}
$end->endOfYear();
$accounts = $this->helper->getAccountReport($start, $end, $shared);
$incomes = $this->helper->getIncomeReport($start, $end, $shared);
$expenses = $this->helper->getExpenseReport($start, $end, $shared);
return view(
'reports.year',
compact(
'start', // the date for this report.
'shared', // is a shared report?
'accounts', // all accounts
'incomes', 'expenses', // expenses and incomes.
'subTitle', 'subTitleIcon', // subtitle and subtitle icon.
'incomeTopLength', // length of income top X
'expenseTopLength' // length of expense top X.
)
);
}
}

View File

@@ -0,0 +1,45 @@
<?php namespace FireflyIII\Http\Controllers;
use FireflyIII\Support\Search\SearchInterface;
use Input;
/**
* Class SearchController
*
* @package FireflyIII\Http\Controllers
*/
class SearchController extends Controller
{
/**
* Results always come in the form of an array [results, count, fullCount]
*
* @param SearchInterface $searcher
*
* @return $this
*/
public function index(SearchInterface $searcher)
{
$subTitle = null;
$rawQuery = null;
$result = [];
if (!is_null(Input::get('q')) && strlen(Input::get('q')) > 0) {
$rawQuery = trim(Input::get('q'));
$words = explode(' ', $rawQuery);
$subTitle = 'Results for "' . e($rawQuery) . '"';
$transactions = $searcher->searchTransactions($words);
$accounts = $searcher->searchAccounts($words);
$categories = $searcher->searchCategories($words);
$budgets = $searcher->searchBudgets($words);
$tags = $searcher->searchTags($words);
$result = ['transactions' => $transactions, 'accounts' => $accounts, 'categories' => $categories, 'budgets' => $budgets, 'tags' => $tags];
}
return view('search.index')->with('title', 'Search')->with('subTitle', $subTitle)->with(
'mainTitleIcon', 'fa-search'
)->with('query', $rawQuery)->with('result', $result);
}
}

View File

@@ -0,0 +1,325 @@
<?php
namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use FireflyIII\Http\Requests\TagFormRequest;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Input;
use Preferences;
use Redirect;
use Response;
use Session;
use URL;
use View;
/**
* Class TagController
*
* Remember: a balancingAct takes at most one expense and one transfer.
* an advancePayment takes at most one expense, infinite deposits and NO transfers.
*
* transaction can only have one advancePayment OR balancingAct.
* Other attempts to put in such a tag are blocked.
* also show an error when editing a tag and it becomes either
* of these two types. Or rather, block editing of the tag.
*
* @package FireflyIII\Http\Controllers
*/
class TagController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', 'Tags');
View::share('mainTitleIcon', 'fa-tags');
View::share('hideTags', true);
$tagOptions = [
'nothing' => 'Just a regular tag.',
'balancingAct' => 'The tag takes at most two transactions; an expense and a transfer. They\'ll balance each other out.',
'advancePayment' => 'The tag accepts one expense and any number of deposits aimed to repay the original expense.',
];
View::share('tagOptions', $tagOptions);
}
/**
* @return \Illuminate\View\View
*/
public function create()
{
$subTitle = 'New tag';
$subTitleIcon = 'fa-tag';
$preFilled = [
'tagMode' => 'nothing'
];
if (!Input::old('tagMode')) {
Session::flash('preFilled', $preFilled);
}
// put previous url in session if not redirect from store (not "create another").
if (Session::get('tags.create.fromStore') !== true) {
Session::put('tags.create.url', URL::previous());
}
Session::forget('tags.create.fromStore');
return view('tags.create', compact('subTitle', 'subTitleIcon'));
}
/**
* @param Tag $tag
*
* @return \Illuminate\View\View
*/
public function delete(Tag $tag)
{
$subTitle = 'Delete "' . e($tag->tag) . '"';
// put previous url in session
Session::put('tags.delete.url', URL::previous());
return view('tags.delete', compact('tag', 'subTitle'));
}
/**
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(TagRepositoryInterface $repository, Tag $tag)
{
$tagName = $tag->tag;
$repository->destroy($tag);
Session::flash('success', 'Tag "' . e($tagName) . '" was deleted.');
return Redirect::to(route('tags.index'));
}
/**
* @param Tag $tag
*
* @return View
*/
public function edit(Tag $tag)
{
$subTitle = 'Edit tag "' . e($tag->tag) . '"';
$subTitleIcon = 'fa-tag';
/*
* Default tag options (again)
*/
$tagOptions = [
'nothing' => 'Just a regular tag.',
'balancingAct' => 'The tag takes at most two transactions; an expense and a transfer. They\'ll balance each other out.',
'advancePayment' => 'The tag accepts one expense and any number of deposits aimed to repay the original expense.',
];
/*
* Can this tag become another type?
*/
$allowToAdvancePayment = true;
$allowToBalancingAct = true;
/*
* If this tag is a balancing act, and it contains transfers, it cannot be
* changes to an advancePayment.
*/
if ($tag->tagMode == 'balancingAct' || $tag->tagMode == 'nothing') {
foreach ($tag->transactionjournals as $journal) {
if ($journal->transactionType->type == 'Transfer') {
$allowToAdvancePayment = false;
}
}
}
/*
* If this tag contains more than one expenses, it cannot become an advance payment.
*/
$count = 0;
foreach ($tag->transactionjournals as $journal) {
if ($journal->transactionType->type == 'Withdrawal') {
$count++;
}
}
if ($count > 1) {
$allowToAdvancePayment = false;
}
/*
* If has more than two transactions already, cannot become a balancing act:
*/
if ($tag->transactionjournals->count() > 2) {
$allowToBalancingAct = false;
}
/*
* If any transaction is a deposit, cannot become a balancing act.
*/
$count = 0;
foreach ($tag->transactionjournals as $journal) {
if ($journal->transactionType->type == 'Deposit') {
$count++;
}
}
if ($count > 0) {
$allowToBalancingAct = false;
}
// edit tag options:
if ($allowToAdvancePayment === 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::get('tags.edit.fromUpdate') !== true) {
Session::put('tags.edit.url', URL::previous());
}
Session::forget('tags.edit.fromUpdate');
return view('tags.edit', compact('tag', 'subTitle', 'subTitleIcon', 'tagOptions'));
}
/**
* @param $state
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function hideTagHelp($state)
{
$state = $state == 'true' ? true : false;
Preferences::set('hideTagHelp', $state);
return Response::json(true);
}
/**
*
*/
public function index()
{
/** @var Preference $helpHiddenPref */
$helpHiddenPref = Preferences::get('hideTagHelp', false);
$title = 'Tags';
$mainTitleIcon = 'fa-tags';
$helpHidden = $helpHiddenPref->data;
$tags = Auth::user()->tags()->get();
return view('tags.index', compact('title', 'mainTitleIcon', 'helpHidden', 'tags'));
}
/**
* @param Tag $tag
*
* @return \Illuminate\View\View
*/
public function show(Tag $tag)
{
$subTitle = $tag->tag;
$subTitleIcon = 'fa-tag';
return view('tags.show', compact('tag', 'subTitle', 'subTitleIcon'));
}
/**
* @param TagFormRequest $request
*
* @param TagRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(TagFormRequest $request, TagRepositoryInterface $repository)
{
if (Input::get('setTag') == 'true') {
$latitude = strlen($request->get('latitude')) > 0 ? $request->get('latitude') : null;
$longitude = strlen($request->get('longitude')) > 0 ? $request->get('longitude') : null;
$zoomLevel = strlen($request->get('zoomLevel')) > 0 ? $request->get('zoomLevel') : null;
} else {
$latitude = null;
$longitude = null;
$zoomLevel = null;
}
$data = [
'tag' => $request->get('tag'),
'date' => strlen($request->get('date')) > 0 ? new Carbon($request->get('date')) : null,
'description' => strlen($request->get('description')) > 0 ? $request->get('description') : '',
'latitude' => $latitude,
'longitude' => $longitude,
'zoomLevel' => $zoomLevel,
'tagMode' => $request->get('tagMode'),
];
$repository->store($data);
Session::flash('success', 'The tag has been created!');
if (intval(Input::get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('tags.create.fromStore', true);
return Redirect::route('tags.create')->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('tags.create.url'));
}
/**
* @param TagFormRequest $request
* @param TagRepositoryInterface $repository
* @param Tag $tag
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(TagFormRequest $request, TagRepositoryInterface $repository, Tag $tag)
{
if (Input::get('setTag') == 'true') {
$latitude = $request->get('latitude');
$longitude = $request->get('longitude');
$zoomLevel = $request->get('zoomLevel');
} else {
$latitude = null;
$longitude = null;
$zoomLevel = null;
}
$data = [
'tag' => $request->get('tag'),
'date' => strlen($request->get('date')) > 0 ? new Carbon($request->get('date')) : null,
'description' => strlen($request->get('description')) > 0 ? $request->get('description') : '',
'latitude' => $latitude,
'longitude' => $longitude,
'zoomLevel' => $zoomLevel,
'tagMode' => $request->get('tagMode'),
];
$repository->update($tag, $data);
Session::flash('success', 'Tag "' . e($data['tag']) . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('tags.edit.fromUpdate', true);
return Redirect::route('tags.edit', $tag->id)->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return Redirect::to(Session::get('tags.edit.url'));
}
}

View File

@@ -0,0 +1,323 @@
<?php namespace FireflyIII\Http\Controllers;
use Auth;
use Carbon\Carbon;
use ExpandedForm;
use FireflyIII\Events\JournalCreated;
use FireflyIII\Events\JournalSaved;
use FireflyIII\Http\Requests;
use FireflyIII\Http\Requests\JournalFormRequest;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Input;
use Redirect;
use Response;
use Session;
use URL;
use View;
/**
* Class TransactionController
*
* @package FireflyIII\Http\Controllers
*/
class TransactionController extends Controller
{
/**
* @codeCoverageIgnore
*/
public function __construct()
{
parent::__construct();
View::share('title', trans('firefly.transactions'));
View::share('mainTitleIcon', 'fa-repeat');
}
/**
* @param AccountRepositoryInterface $repository
* @param string $what
*
* @return View
*/
public function create(AccountRepositoryInterface $repository, $what = 'deposit')
{
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
$budgets[0] = trans('form.noBudget');
$piggies = ExpandedForm::makeSelectList(Auth::user()->piggyBanks()->get());
$piggies[0] = trans('form.noPiggybank');
$preFilled = Session::has('preFilled') ? Session::get('preFilled') : [];
$respondTo = ['account_id', 'account_from_id'];
$subTitle = trans('form.add_new_' . $what);
foreach ($respondTo as $r) {
$preFilled[$r] = Input::get($r);
}
Session::put('preFilled', $preFilled);
// put previous url in session if not redirect from store (not "create another").
if (Session::get('transactions.create.fromStore') !== true) {
Session::put('transactions.create.url', URL::previous());
}
Session::forget('transactions.create.fromStore');
asort($piggies);
return view('transactions.create', compact('accounts', 'budgets', 'what', 'piggies', 'subTitle'));
}
/**
* Shows the form that allows a user to delete a transaction journal.
*
* @param TransactionJournal $journal
*
* @return $this
*/
public function delete(TransactionJournal $journal)
{
$type = strtolower($journal->transactionType->type);
$subTitle = 'Delete ' . e($type) . ' "' . e($journal->description) . '"';
// put previous url in session
Session::put('transactions.delete.url', URL::previous());
return view('transactions.delete', compact('journal', 'subTitle'));
}
/**
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $transactionJournal
*
* @return \Illuminate\Http\RedirectResponse
*/
public function destroy(JournalRepositoryInterface $repository, TransactionJournal $transactionJournal)
{
Session::flash('success', 'Transaction "' . e($transactionJournal->description) . '" destroyed.');
$repository->delete($transactionJournal);
// redirect to previous URL:
return Redirect::to(Session::get('transactions.delete.url'));
}
/**
* Shows the view to edit a transaction.
*
* @param AccountRepositoryInterface $repository
* @param TransactionJournal $journal
*
* @return $this
*/
public function edit(AccountRepositoryInterface $repository, TransactionJournal $journal)
{
$what = strtolower($journal->transactiontype->type);
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
$budgets = ExpandedForm::makeSelectList(Auth::user()->budgets()->get());
$budgets[0] = trans('form.noBudget');
$transactions = $journal->transactions()->orderBy('amount', 'DESC')->get();
$piggies = ExpandedForm::makeSelectList(Auth::user()->piggyBanks()->get());
$piggies[0] = trans('form.noPiggybank');
$subTitle = trans('breadcrumbs.edit_journal', ['description' => $journal->description]);
$preFilled = [
'date' => $journal->date->format('Y-m-d'),
'category' => '',
'budget_id' => 0,
'piggy_bank_id' => 0
];
// get tags:
$tags = [];
foreach ($journal->tags as $tag) {
$tags[] = $tag->tag;
}
$preFilled['tags'] = join(',', $tags);
$category = $journal->categories()->first();
if (!is_null($category)) {
$preFilled['category'] = $category->name;
}
$budget = $journal->budgets()->first();
if (!is_null($budget)) {
$preFilled['budget_id'] = $budget->id;
}
if ($journal->piggyBankEvents()->count() > 0) {
$preFilled['piggy_bank_id'] = $journal->piggyBankEvents()->orderBy('date', 'DESC')->first()->piggy_bank_id;
}
$preFilled['amount'] = $journal->actualAmount;
$preFilled['account_id'] = $journal->assetAccount->id;
$preFilled['expense_account'] = $transactions[0]->account->name;
$preFilled['revenue_account'] = $transactions[1]->account->name;
$preFilled['account_from_id'] = $transactions[1]->account->id;
$preFilled['account_to_id'] = $transactions[0]->account->id;
Session::flash('preFilled', $preFilled);
// put previous url in session if not redirect from store (not "return_to_edit").
if (Session::get('transactions.edit.fromUpdate') !== true) {
Session::put('transactions.edit.url', URL::previous());
}
Session::forget('transactions.edit.fromUpdate');
return View::make('transactions.edit', compact('journal', 'accounts', 'what', 'budgets', 'piggies', 'subTitle'))->with('data', $preFilled);
}
/**
* @param JournalRepositoryInterface $repository
* @param $what
*
* @return View
*/
public function index(JournalRepositoryInterface $repository, $what)
{
$types = [];
switch ($what) {
case 'expenses':
case 'withdrawal':
$subTitleIcon = 'fa-long-arrow-left';
$subTitle = trans('firefly.expenses');
$types = ['Withdrawal'];
break;
case 'revenue':
case 'deposit':
$subTitleIcon = 'fa-long-arrow-right';
$subTitle = trans('firefly.income');
$types = ['Deposit'];
break;
case 'transfer':
case 'transfers':
$subTitleIcon = 'fa-exchange';
$subTitle = trans('firefly.transfers');
$types = ['Transfer'];
break;
}
$page = intval(Input::get('page'));
$offset = $page > 0 ? ($page - 1) * 50 : 0;
$journals = $repository->getJournalsOfTypes($types, $offset, $page);
$journals->setPath('transactions/' . $what);
return view('transactions.index', compact('subTitle', 'what', 'subTitleIcon', 'journals'));
}
/**
* @param JournalRepositoryInterface $repository
*
* @return \Symfony\Component\HttpFoundation\Response
*/
public function reorder(JournalRepositoryInterface $repository)
{
$ids = Input::get('items');
$date = new Carbon(Input::get('date'));
if (count($ids) > 0) {
$order = 0;
foreach ($ids as $id) {
$journal = $repository->getWithDate($id, $date);
if ($journal) {
$journal->order = $order;
$order++;
$journal->save();
}
}
}
return Response::json(true);
}
/**
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal
*
* @return $this
*/
public function show(JournalRepositoryInterface $repository, TransactionJournal $journal)
{
$journal->transactions->each(
function (Transaction $t) use ($journal, $repository) {
$t->before = $repository->getAmountBefore($journal, $t);
$t->after = $t->before + $t->amount;
}
);
$subTitle = trans('firefly.' . $journal->transactiontype->type) . ' "' . e($journal->description) . '"';
return view('transactions.show', compact('journal', 'subTitle'));
}
/**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function store(JournalFormRequest $request, JournalRepositoryInterface $repository)
{
$journalData = $request->getJournalData();
$journal = $repository->store($journalData);
// rescan journal, UpdateJournalConnection
event(new JournalSaved($journal));
// ConnectJournalToPiggyBank
if ($journal->transactionType->type == 'Transfer' && intval($request->get('piggy_bank_id')) > 0) {
event(new JournalCreated($journal, intval($request->get('piggy_bank_id'))));
}
$repository->deactivateReminder($request->get('reminder_id'));
Session::flash('success', 'New transaction "' . $journal->description . '" stored!');
if (intval(Input::get('create_another')) === 1) {
// set value so create routine will not overwrite URL:
Session::put('transactions.create.fromStore', true);
return Redirect::route('transactions.create', $request->input('what'))->withInput();
}
// redirect to previous URL.
return Redirect::to(Session::get('transactions.create.url'));
}
/**
* @param JournalFormRequest $request
* @param JournalRepositoryInterface $repository
* @param TransactionJournal $journal
*
* @return $this|\Illuminate\Http\RedirectResponse
*/
public function update(JournalFormRequest $request, JournalRepositoryInterface $repository, TransactionJournal $journal)
{
$journalData = $request->getJournalData();
$repository->update($journal, $journalData);
event(new JournalSaved($journal));
// update, get events by date and sort DESC
Session::flash('success', 'Transaction "' . e($journalData['description']) . '" updated.');
if (intval(Input::get('return_to_edit')) === 1) {
// set value so edit routine will not overwrite URL:
Session::put('transactions.edit.fromUpdate', true);
return Redirect::route('transactions.edit', $journal->id)->withInput(['return_to_edit' => 1]);
}
// redirect to previous URL.
return Redirect::to(Session::get('transactions.edit.url'));
}
}

46
app/Http/Kernel.php Normal file
View File

@@ -0,0 +1,46 @@
<?php namespace FireflyIII\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
/**
* Class Kernel
*
* @package FireflyIII\Http
*/
class Kernel extends HttpKernel
{
/**
* The application's global HTTP middleware stack.
*
* @var array
*/
protected $middleware
= [
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode',
'Illuminate\Cookie\Middleware\EncryptCookies',
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse',
'Illuminate\Session\Middleware\StartSession',
'Illuminate\View\Middleware\ShareErrorsFromSession',
'FireflyIII\Http\Middleware\ReplaceTestVars',
'FireflyIII\Http\Middleware\VerifyCsrfToken',
];
/**
* The application's route middleware.
*
* @var array
*/
protected $routeMiddleware
= [
'auth' => 'FireflyIII\Http\Middleware\Authenticate',
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth',
'guest' => 'FireflyIII\Http\Middleware\RedirectIfAuthenticated',
'range' => 'FireflyIII\Http\Middleware\Range',
'cleanup' => 'FireflyIII\Http\Middleware\Cleanup',
'reminders' => 'FireflyIII\Http\Middleware\Reminders',
'piggybanks' => 'FireflyIII\Http\Middleware\PiggyBanks',
];
}

View File

@@ -0,0 +1,64 @@
<?php namespace FireflyIII\Http\Middleware;
use App;
use Closure;
use Config;
use FireflyIII\Models\Preference;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Preferences;
/**
* Class Authenticate
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Middleware
*/
class Authenticate
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
}
// if logged in, set user language:
$pref = Preferences::get('language', 'en');
App::setLocale($pref->data);
setlocale(LC_TIME, Config::get('firefly.locales.' . $pref->data));
return $next($request);
}
}

View File

@@ -0,0 +1,283 @@
<?php namespace FireflyIII\Http\Middleware;
use Closure;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\BudgetLimit;
use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankEvent;
use FireflyIII\Models\PiggyBankRepetition;
use FireflyIII\Models\Preference;
use FireflyIII\Models\Reminder;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Session;
/**
* Class Cleanup
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Middleware
*/
class Cleanup
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->guest()) {
if ($request->ajax()) {
return response('Unauthorized.', 401);
} else {
return redirect()->guest('auth/login');
}
}
$run = env('RUNCLEANUP') == 'true' ? true : false;
$count = 0;
if ($run) {
// encrypt account name
$set = Account::where('encrypted', 0)->take(5)->get();
/** @var Account $entry */
foreach ($set as $entry) {
$count++;
$name = $entry->name;
$entry->name = $name;
$entry->save();
}
unset($set, $entry, $name);
// encrypt bill name
$set = Bill::where('name_encrypted', 0)->take(5)->get();
/** @var Bill $entry */
foreach ($set as $entry) {
$count++;
$name = $entry->name;
$entry->name = $name;
$entry->save();
}
unset($set, $entry, $name);
// encrypt bill match
$set = Bill::where('match_encrypted', 0)->take(5)->get();
/** @var Bill $entry */
foreach ($set as $entry) {
$match = $entry->match;
$entry->match = $match;
$entry->save();
}
unset($set, $entry, $match);
// encrypt budget name
$set = Budget::where('encrypted', 0)->take(5)->get();
/** @var Budget $entry */
foreach ($set as $entry) {
$count++;
$name = $entry->name;
$entry->name = $name;
$entry->save();
}
unset($set, $entry, $name);
// encrypt category name
$set = Category::where('encrypted', 0)->take(5)->get();
/** @var Category $entry */
foreach ($set as $entry) {
$count++;
$name = $entry->name;
$entry->name = $name;
$entry->save();
}
unset($set, $entry, $name);
// encrypt piggy bank name
$set = PiggyBank::where('encrypted', 0)->take(5)->get();
/** @var PiggyBank $entry */
foreach ($set as $entry) {
$count++;
$name = $entry->name;
$entry->name = $name;
$entry->save();
}
unset($set, $entry, $name);
// encrypt transaction journal description
$set = TransactionJournal::where('encrypted', 0)->take(5)->get();
/** @var TransactionJournal $entry */
foreach ($set as $entry) {
$count++;
$description = $entry->description;
$entry->description = $description;
$entry->save();
}
unset($set, $entry, $description);
// encrypt reminder metadata
$set = Reminder::where('encrypted', 0)->take(5)->get();
/** @var Reminder $entry */
foreach ($set as $entry) {
$count++;
$metadata = $entry->metadata;
$entry->metadata = $metadata;
$entry->save();
}
unset($set, $entry, $metadata);
// encrypt account virtual balance amount
$set = Account::whereNull('virtual_balance_encrypted')->take(5)->get();
/** @var Account $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount;
$entry->virtual_balance = $amount;
$entry->save();
}
unset($set, $entry, $amount);
// encrypt bill amount_min
$set = Bill::whereNull('amount_min_encrypted')->take(5)->get();
/** @var Bill $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount_min;
$entry->amount_min = $amount;
$entry->save();
}
unset($set, $entry, $amount);
// encrypt bill amount_max
$set = Bill::whereNull('amount_max_encrypted')->take(5)->get();
/** @var Bill $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount_max;
$entry->amount_max = $amount;
$entry->save();
}
unset($set, $entry, $amount);
// encrypt budget limit amount
$set = BudgetLimit::whereNull('amount_encrypted')->take(5)->get();
/** @var BudgetLimit $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount;
$entry->amount = $amount;
$entry->save();
}
unset($set, $entry, $amount);
// encrypt limit repetition amount
$set = LimitRepetition::whereNull('amount_encrypted')->take(5)->get();
/** @var LimitRepetition $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount;
$entry->amount = $amount;
$entry->save();
}
unset($set, $entry, $amount);
//encrypt piggy bank event amount
$set = PiggyBankEvent::whereNull('amount_encrypted')->take(5)->get();
/** @var PiggyBankEvent $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount;
$entry->amount = $amount;
$entry->save();
}
unset($set, $entry, $amount);
// encrypt piggy bank repetition currentamount
$set = PiggyBankRepetition::whereNull('currentamount_encrypted')->take(5)->get();
/** @var PiggyBankRepetition $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->currentamount;
$entry->currentamount = $amount;
$entry->save();
}
unset($set, $entry, $amount);
// encrypt piggy bank targetamount
$set = PiggyBank::whereNull('targetamount_encrypted')->take(5)->get();
/** @var PiggyBank $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->targetamount;
$entry->targetamount = $amount;
$entry->save();
}
unset($set, $entry, $amount);
//encrypt preference name
$set = Preference::whereNull('name_encrypted')->take(5)->get();
/** @var Preference $entry */
foreach ($set as $entry) {
$count++;
$name = $entry->name;
$entry->name = $name;
$entry->save();
}
unset($set, $entry, $name);
//encrypt preference data (add field)
$set = Preference::whereNull('data_encrypted')->take(5)->get();
/** @var Preference $entry */
foreach ($set as $entry) {
$count++;
$data = $entry->data;
$entry->data = $data;
$entry->save();
}
unset($set, $entry, $data);
// encrypt transaction amount
$set = Transaction::whereNull('amount_encrypted')->take(5)->get();
/** @var Transaction $entry */
foreach ($set as $entry) {
$count++;
$amount = $entry->amount;
$entry->amount = $amount;
$entry->save();
}
unset($set, $entry, $amount);
}
if ($count == 0 && $run) {
Session::flash('warning', 'Please open the .env file and change RUNCLEANUP=true to RUNCLEANUP=false');
}
return $next($request);
}
}

View File

@@ -0,0 +1,70 @@
<?php
namespace FireflyIII\Http\Middleware;
use Closure;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\PiggyBankRepetition;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
/**
* Class PiggyBanks
*
* @package FireflyIII\Http\Middleware
*/
class PiggyBanks
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
// get piggy banks without a repetition:
/** @var Collection $set */
$set = $this->auth->user()->piggybanks()
->leftJoin('piggy_bank_repetitions', 'piggy_banks.id', '=', 'piggy_bank_repetitions.piggy_bank_id')
->whereNull('piggy_bank_repetitions.id')
->get(['piggy_banks.id', 'piggy_banks.startdate', 'piggy_banks.targetdate']);
/** @var PiggyBank $partialPiggy */
foreach ($set as $partialPiggy) {
$repetition = new PiggyBankRepetition;
$repetition->piggyBank()->associate($partialPiggy);
$repetition->startdate = $partialPiggy->startdate;
$repetition->targetdate = $partialPiggy->targetdate;
$repetition->currentamount = 0;
$repetition->save();
}
unset($partialPiggy, $set, $repetition);
}
return $next($request);
}
}

View File

@@ -0,0 +1,88 @@
<?php
namespace FireflyIII\Http\Middleware;
use App;
use Carbon\Carbon;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use Navigation;
use Preferences;
use Session;
use View;
/**
* Class SessionFilter
*
* @package FireflyIII\Http\Middleware
*/
class Range
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $theNext
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @return mixed
*/
public function handle(Request $request, Closure $theNext)
{
if ($this->auth->check()) {
// ignore preference. set the range to be the current month:
if (!Session::has('start') && !Session::has('end')) {
/** @var \FireflyIII\Models\Preference $viewRange */
$viewRange = Preferences::get('viewRange', '1M')->data;
$start = new Carbon;
$start = Navigation::updateStartDate($viewRange, $start);
$end = Navigation::updateEndDate($viewRange, $start);
Session::put('start', $start);
Session::put('end', $end);
}
if (!Session::has('first')) {
/** @var \FireflyIII\Repositories\Journal\JournalRepositoryInterface $repository */
$repository = App::make('FireflyIII\Repositories\Journal\JournalRepositoryInterface');
$journal = $repository->first();
if ($journal) {
Session::put('first', $journal->date);
} else {
Session::put('first', Carbon::now()->startOfYear());
}
}
$current = Carbon::now()->formatLocalized('%B %Y');
$next = Carbon::now()->endOfMonth()->addDay()->formatLocalized('%B %Y');
$prev = Carbon::now()->startOfMonth()->subDay()->formatLocalized('%B %Y');
View::share('currentMonthName', $current);
View::share('previousMonthName', $prev);
View::share('nextMonthName', $next);
}
return $theNext($request);
}
}

View File

@@ -0,0 +1,52 @@
<?php namespace FireflyIII\Http\Middleware;
use Closure;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
/**
* Class RedirectIfAuthenticated
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Middleware
*/
class RedirectIfAuthenticated
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->check()) {
return new RedirectResponse(url('/'));
}
return $next($request);
}
}

View File

@@ -0,0 +1,80 @@
<?php
namespace FireflyIII\Http\Middleware;
use App;
use Carbon\Carbon;
use Closure;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Http\Request;
use View;
/**
* Class Reminders
*
* @package FireflyIII\Http\Middleware
*/
class Reminders
{
/**
* The Guard implementation.
*
* @var Guard
*/
protected $auth;
/**
* Create a new filter instance.
*
* @param Guard $auth
*
*/
public function __construct(Guard $auth)
{
$this->auth = $auth;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ($this->auth->check() && !$request->isXmlHttpRequest()) {
// do reminders stuff.
$piggyBanks = $this->auth->user()->piggyBanks()->where('remind_me', 1)->get();
/** @var \FireflyIII\Helpers\Reminders\ReminderHelperInterface $helper */
$helper = App::make('FireflyIII\Helpers\Reminders\ReminderHelperInterface');
/** @var PiggyBank $piggyBank */
foreach ($piggyBanks as $piggyBank) {
$helper->createReminders($piggyBank, new Carbon);
}
// delete invalid reminders
// this is a construction SQLITE cannot handle :(
if (env('DB_CONNECTION') != 'sqlite') {
Reminder::whereUserId($this->auth->user()->id)
->leftJoin('piggy_banks', 'piggy_banks.id', '=', 'remindersable_id')
->whereNull('piggy_banks.id')
->delete();
}
// get and list active reminders:
$reminders = $this->auth->user()->reminders()->today()->get();
$reminders->each(
function (Reminder $reminder) use ($helper) {
$reminder->description = $helper->getReminderText($reminder);
}
);
View::share('reminders', $reminders);
}
return $next($request);
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace FireflyIII\Http\Middleware;
use Closure;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Http\Request;
use Log;
/**
* Class ReplaceTestVars
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Middleware
*/
class ReplaceTestVars
{
/**
* The application implementation.
*
* @var Application
*/
protected $app;
/**
* Create a new filter instance.
*
* @param Application $app
*
*/
public function __construct(Application $app)
{
$this->app = $app;
}
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle(Request $request, Closure $next)
{
if ('testing' === $this->app->environment() && $request->has('_token')) {
$input = $request->all();
$input['_token'] = $request->session()->token();
// we need to update _token value to make sure we get the POST / PUT tests passed.
Log::debug('Input token replaced (' . $input['_token'] . ').');
$request->replace($input);
}
return $next($request);
}
}

View File

@@ -0,0 +1,28 @@
<?php namespace FireflyIII\Http\Middleware;
use Closure;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
/**
* Class VerifyCsrfToken
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Middleware
*/
class VerifyCsrfToken extends BaseVerifier
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, Closure $next)
{
return parent::handle($request, $next);
}
}

View File

@@ -0,0 +1,57 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use Config;
use FireflyIII\Models\Account;
use Input;
/**
* Class AccountFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class AccountFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
$accountRoles = join(',', array_keys(Config::get('firefly.accountRoles')));
$types = join(',', array_keys(Config::get('firefly.subTitlesByIdentifier')));
$ccPaymentTypes = join(',', array_keys(Config::get('firefly.ccTypes')));
$nameRule = 'required|min:1|uniqueAccountForUser';
$idRule = '';
if (Account::find(Input::get('id'))) {
$idRule = 'belongsToUser:accounts';
$nameRule = 'required|min:1|uniqueAccountForUser:' . Input::get('id');
}
return [
'id' => $idRule,
'name' => $nameRule,
'openingBalance' => 'numeric',
'virtualBalance' => 'numeric',
'openingBalanceDate' => 'date',
'accountRole' => 'in:' . $accountRoles,
'active' => 'boolean',
'ccType' => 'in:' . $ccPaymentTypes,
'ccMonthlyPaymentDate' => 'date',
'balance_currency_id' => 'exists:transaction_currencies,id',
'what' => 'in:' . $types
];
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use Carbon\Carbon;
use Input;
/**
* Class BillFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class BillFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function getBillData()
{
return [
'name' => $this->get('name'),
'match' => $this->get('match'),
'amount_min' => floatval($this->get('amount_min')),
'amount_currency_id' => floatval($this->get('amount_currency_id')),
'amount_max' => floatval($this->get('amount_max')),
'date' => new Carbon($this->get('date')),
'user' => Auth::user()->id,
'repeat_freq' => $this->get('repeat_freq'),
'skip' => intval($this->get('skip')),
'automatch' => intval($this->get('automatch')) === 1,
'active' => intval($this->get('active')) === 1,
];
}
/**
* @return array
*/
public function rules()
{
$nameRule = 'required|between:1,255|uniqueObjectForUser:bills,name,name_encrypted';
$matchRule = 'required|between:1,255|uniqueObjectForUser:bills,match,match_encrypted';
if (intval(Input::get('id')) > 0) {
$nameRule .= ',' . intval(Input::get('id'));
$matchRule .= ',' . intval(Input::get('id'));
}
$rules = [
'name' => $nameRule,
'match' => $matchRule,
'amount_min' => 'required|numeric|min:0.01',
'amount_max' => 'required|numeric|min:0.01',
'amount_currency_id' => 'required|exists:transaction_currencies,id',
'date' => 'required|date',
'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly',
'skip' => 'required|between:0,31',
'automatch' => 'in:1',
'active' => 'in:1',
];
return $rules;
}
}

View File

@@ -0,0 +1,42 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use FireflyIII\Models\Budget;
use Input;
/**
* Class BudgetFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class BudgetFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,encrypted';
if (Budget::find(Input::get('id'))) {
$nameRule = 'required|between:1,100|uniqueObjectForUser:budgets,name,encrypted,' . intval(Input::get('id'));
}
return [
'name' => $nameRule,
'active' => 'numeric|between:0,1'
];
}
}

View File

@@ -0,0 +1,41 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use FireflyIII\Models\Category;
use Input;
/**
* Class CategoryFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class CategoryFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,encrypted';
if (Category::find(Input::get('id'))) {
$nameRule = 'required|between:1,100|uniqueObjectForUser:categories,name,encrypted,' . intval(Input::get('id'));
}
return [
'name' => $nameRule,
];
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use Input;
/**
* Class BillFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class CurrencyFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function getCurrencyData()
{
return [
'name' => $this->get('name'),
'code' => $this->get('code'),
'symbol' => $this->get('symbol'),
];
}
/**
* @return array
*/
public function rules()
{
$rules = [
'code' => 'required|min:3|max:3|unique:transaction_currencies,code',
'name' => 'required|max:48|min:1|unique:transaction_currencies,name',
'symbol' => 'required|min:1|max:8|unique:transaction_currencies,symbol',
];
if (intval(Input::get('id')) > 0) {
$rules = [
'code' => 'required|min:3|max:3',
'name' => 'required|max:48|min:1',
'symbol' => 'required|min:1|max:8',
];
}
return $rules;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
/**
* Class DeleteAccountFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class DeleteAccountFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
return [
'password' => 'required',
];
}
}

View File

@@ -0,0 +1,94 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use Carbon\Carbon;
use Exception;
use Input;
/**
* Class JournalFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class JournalFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function getJournalData()
{
return [
'what' => $this->get('what'),
'description' => $this->get('description'),
'account_id' => intval($this->get('account_id')),
'account_from_id' => intval($this->get('account_from_id')),
'account_to_id' => intval($this->get('account_to_id')),
'expense_account' => $this->get('expense_account'),
'revenue_account' => $this->get('revenue_account'),
'amount' => floatval($this->get('amount')),
'user' => Auth::user()->id,
'amount_currency_id' => intval($this->get('amount_currency_id')),
'date' => new Carbon($this->get('date')),
'budget_id' => intval($this->get('budget_id')),
'category' => $this->get('category'),
'tags' => explode(',', $this->get('tags')),
];
}
/**
* @return array
* @throws Exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function rules()
{
$what = Input::get('what');
$rules = [
'description' => 'required|min:1,max:255',
'what' => 'required|in:withdrawal,deposit,transfer',
'amount' => 'numeric|required|min:0.01',
'date' => 'required|date',
'reminder_id' => 'numeric|exists:reminders,id',
'amount_currency_id' => 'required|exists:transaction_currencies,id',
];
switch ($what) {
case 'withdrawal':
$rules['account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
$rules['expense_account'] = 'between:1,255';
$rules['category'] = 'between:1,255';
if (intval(Input::get('budget_id')) != 0) {
$rules['budget_id'] = 'exists:budgets,id|belongsToUser:budgets';
}
break;
case 'deposit':
$rules['category'] = 'between:1,255';
$rules['account_id'] = 'required|exists:accounts,id|belongsToUser:accounts';
$rules['revenue_account'] = 'between:1,255';
break;
case 'transfer':
$rules['account_from_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:account_to_id';
$rules['account_to_id'] = 'required|exists:accounts,id|belongsToUser:accounts|different:account_from_id';
$rules['category'] = 'between:1,255';
break;
default:
throw new Exception('Cannot handle ' . $what);
break;
}
return $rules;
}
}

View File

@@ -0,0 +1,54 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
use Input;
/**
* Class PiggyBankFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class PiggyBankFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
$nameRule = 'required|between:1,255|uniquePiggyBankForUser';
$targetDateRule = 'date';
if (intval(Input::get('id'))) {
$nameRule = 'required|between:1,255|uniquePiggyBankForUser:' . intval(Input::get('id'));
}
$rules = [
'name' => $nameRule,
'account_id' => 'required|belongsToUser:accounts',
'targetamount' => 'required|min:0.01',
'amount_currency_id' => 'exists:transaction_currencies,id',
'startdate' => 'date',
'targetdate' => $targetDateRule,
'reminder' => 'in:day,week,quarter,month,year',
'reminder_skip' => 'integer|min:0|max:99',
'remind_me' => 'boolean|piggyBankReminder',
'order' => 'integer|min:1',
];
return $rules;
}
}

View File

@@ -0,0 +1,35 @@
<?php
namespace FireflyIII\Http\Requests;
use Auth;
/**
* Class ProfileFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class ProfileFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
return [
'current_password' => 'required',
'new_password' => 'required|confirmed',
'new_password_confirmation' => 'required',
];
}
}

View File

@@ -0,0 +1,16 @@
<?php namespace FireflyIII\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
/**
* Class Request
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
abstract class Request extends FormRequest
{
//
}

View File

@@ -0,0 +1,55 @@
<?php
/**
* Created by PhpStorm.
* User: sander
* Date: 27/04/15
* Time: 12:50
*/
namespace FireflyIII\Http\Requests;
use Auth;
use FireflyIII\Models\Tag;
use Input;
/**
* Class TagFormRequest
*
* @codeCoverageIgnore
* @package FireflyIII\Http\Requests
*/
class TagFormRequest extends Request
{
/**
* @return bool
*/
public function authorize()
{
// Only allow logged in users
return Auth::check();
}
/**
* @return array
*/
public function rules()
{
$idRule = '';
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,TRUE';
if (Tag::find(Input::get('id'))) {
$idRule = 'belongsToUser:tags';
$tagRule = 'required|min:1|uniqueObjectForUser:tags,tag,TRUE,' . Input::get('id');
}
return [
'tag' => $tagRule,
'id' => $idRule,
'description' => 'min:1',
'date' => 'date',
'latitude' => 'numeric|min:-90|max:90',
'longitude' => 'numeric|min:-90|max:90',
'zoomLevel' => 'numeric|min:0|max:80',
'tagMode' => 'required|in:nothing,balancingAct,advancePayment'
];
}
}

414
app/Http/breadcrumbs.php Normal file
View File

@@ -0,0 +1,414 @@
<?php
use Carbon\Carbon;
use DaveJamesMiller\Breadcrumbs\Generator;
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
/*
* Back home.
*/
Breadcrumbs::register(
'home',
function (Generator $breadcrumbs) {
$breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
}
);
Breadcrumbs::register(
'index',
function (Generator $breadcrumbs) {
$breadcrumbs->push(trans('breadcrumbs.home'), route('index'));
}
);
//trans('breadcrumbs.')
// accounts
Breadcrumbs::register(
'accounts.index', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . strtolower(e($what)) . '_accounts'), route('accounts.index', $what));
}
);
Breadcrumbs::register(
'accounts.create', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('accounts.index', $what);
$breadcrumbs->push(trans('breadcrumbs.new_' . strtolower(e($what)) . '_account'), route('accounts.create', $what));
}
);
Breadcrumbs::register(
'accounts.show', function (Generator $breadcrumbs, Account $account) {
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->parent('accounts.index', $what);
$breadcrumbs->push(e($account->name), route('accounts.show', $account->id));
}
);
Breadcrumbs::register(
'accounts.delete', function (Generator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account);
$breadcrumbs->push(trans('breadcrumbs.delete_account', ['name' => e($account->name)]), route('accounts.delete', $account->id));
}
);
Breadcrumbs::register(
'accounts.edit', function (Generator $breadcrumbs, Account $account) {
$breadcrumbs->parent('accounts.show', $account);
$what = Config::get('firefly.shortNamesByFullName.' . $account->accountType->type);
$breadcrumbs->push(trans('breadcrumbs.edit_' . $what . '_account', ['name' => e($account->name)]), route('accounts.edit', $account->id));
}
);
// budgets.
Breadcrumbs::register(
'budgets.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.budgets'), route('budgets.index'));
}
);
Breadcrumbs::register(
'budgets.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('budgets.index');
$breadcrumbs->push(trans('breadcrumbs.newBudget'), route('budgets.create'));
}
);
Breadcrumbs::register(
'budgets.edit', function (Generator $breadcrumbs, Budget $budget) {
$breadcrumbs->parent('budgets.show', $budget);
$breadcrumbs->push(trans('breadcrumbs.edit_budget', ['name' => e($budget->name)]), route('budgets.edit', $budget->id));
}
);
Breadcrumbs::register(
'budgets.delete', function (Generator $breadcrumbs, Budget $budget) {
$breadcrumbs->parent('budgets.show', $budget);
$breadcrumbs->push(trans('breadcrumbs.delete_budget', ['name' => e($budget->name)]), route('budgets.delete', $budget->id));
}
);
Breadcrumbs::register(
'budgets.noBudget', function (Generator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('budgets.index');
$breadcrumbs->push($subTitle, route('budgets.noBudget'));
}
);
Breadcrumbs::register(
'budgets.show', function (Generator $breadcrumbs, Budget $budget, LimitRepetition $repetition = null) {
$breadcrumbs->parent('budgets.index');
$breadcrumbs->push(e($budget->name), route('budgets.show', $budget->id));
if (!is_null($repetition) && !is_null($repetition->id)) {
$breadcrumbs->push(
Navigation::periodShow($repetition->startdate, $repetition->budgetlimit->repeat_freq), route('budgets.show', $budget->id, $repetition->id)
);
}
}
);
// categories
Breadcrumbs::register(
'categories.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.categories'), route('categories.index'));
}
);
Breadcrumbs::register(
'categories.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push(trans('breadcrumbs.newCategory'), route('categories.create'));
}
);
Breadcrumbs::register(
'categories.edit', function (Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('breadcrumbs.edit_category', ['name' => e($category->name)]), route('categories.edit', $category->id));
}
);
Breadcrumbs::register(
'categories.delete', function (Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('breadcrumbs.delete_category', ['name' => e($category->name)]), route('categories.delete', $category->id));
}
);
Breadcrumbs::register(
'categories.show', function (Generator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push(e($category->name), route('categories.show', $category->id));
}
);
Breadcrumbs::register(
'categories.noCategory', function (Generator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push($subTitle, route('categories.noCategory'));
}
);
// currencies.
Breadcrumbs::register(
'currency.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.currencies'), route('currency.index'));
}
);
Breadcrumbs::register(
'currency.edit', function (Generator $breadcrumbs, TransactionCurrency $currency) {
$breadcrumbs->parent('currency.index');
$breadcrumbs->push(trans('breadcrumbs.edit_currency', ['name' => e($currency->name)]), route('currency.edit', $currency->id));
}
);
Breadcrumbs::register(
'currency.delete', function (Generator $breadcrumbs, TransactionCurrency $currency) {
$breadcrumbs->parent('currency.index');
$breadcrumbs->push(trans('breadcrumbs.delete_currency', ['name' => e($currency->name)]), route('currency.delete', $currency->id));
}
);
// piggy banks
Breadcrumbs::register(
'piggy-banks.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.piggyBanks'), route('piggy-banks.index'));
}
);
Breadcrumbs::register(
'piggy-banks.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('piggy-banks.index');
$breadcrumbs->push(trans('breadcrumbs.newPiggyBank'), route('piggy-banks.create'));
}
);
Breadcrumbs::register(
'piggy-banks.edit', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(trans('breadcrumbs.edit_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.edit', $piggyBank->id));
}
);
Breadcrumbs::register(
'piggy-banks.delete', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.show', $piggyBank);
$breadcrumbs->push(trans('breadcrumbs.delete_piggyBank', ['name' => e($piggyBank->name)]), route('piggy-banks.delete', $piggyBank->id));
}
);
Breadcrumbs::register(
'piggy-banks.show', function (Generator $breadcrumbs, PiggyBank $piggyBank) {
$breadcrumbs->parent('piggy-banks.index');
$breadcrumbs->push(e($piggyBank->name), route('piggy-banks.show', $piggyBank->id));
}
);
// preferences
Breadcrumbs::register(
'preferences', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.preferences'), route('preferences'));
}
);
// profile
Breadcrumbs::register(
'profile', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.profile'), route('profile'));
}
);
Breadcrumbs::register(
'change-password', function (Generator $breadcrumbs) {
$breadcrumbs->parent('profile');
$breadcrumbs->push(trans('breadcrumbs.changePassword'), route('change-password'));
}
);
// bills
Breadcrumbs::register(
'bills.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.bills'), route('bills.index'));
}
);
Breadcrumbs::register(
'bills.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('bills.index');
$breadcrumbs->push(trans('breadcrumbs.newBill'), route('bills.create'));
}
);
Breadcrumbs::register(
'bills.edit', function (Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.show', $bill);
$breadcrumbs->push(trans('breadcrumbs.edit_bill', ['name' => e($bill->name)]), route('bills.edit', $bill->id));
}
);
Breadcrumbs::register(
'bills.delete', function (Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.show', $bill);
$breadcrumbs->push(trans('breadcrumbs.delete_bill', ['name' => e($bill->name)]), route('bills.delete', $bill->id));
}
);
Breadcrumbs::register(
'bills.show', function (Generator $breadcrumbs, Bill $bill) {
$breadcrumbs->parent('bills.index');
$breadcrumbs->push(e($bill->name), route('bills.show', $bill->id));
}
);
// reminders
Breadcrumbs::register(
'reminders.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reminders'), route('reminders.index'));
}
);
// reminders
Breadcrumbs::register(
'reminders.show', function (Generator $breadcrumbs, Reminder $reminder) {
$breadcrumbs->parent('reminders.index');
$breadcrumbs->push(trans('breadcrumbs.reminder', ['id' => e($reminder->id)]), route('reminders.show', $reminder->id));
}
);
// reports
Breadcrumbs::register(
'reports.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index'));
}
);
Breadcrumbs::register(
'reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.index');
if ($shared) {
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
} else {
$title = trans('breadcrumbs.yearly_report', ['date' => $date->year]);
}
$breadcrumbs->push($title, route('reports.year', $date->year));
}
);
Breadcrumbs::register(
'reports.month', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.year', $date, $shared);
if ($shared) {
$title = trans('breadcrumbs.monthly_report_shared', ['date' => $date->year]);
} else {
$title = trans('breadcrumbs.monthly_report', ['date' => $date->year]);
}
$breadcrumbs->push($title, route('reports.month', [$date->year, $date->month]));
}
);
// search
Breadcrumbs::register(
'search', function (Generator $breadcrumbs, $query) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search'));
}
);
// transactions
Breadcrumbs::register(
'transactions.index', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.' . $what . '_list'), route('transactions.index', $what));
}
);
Breadcrumbs::register(
'transactions.create', function (Generator $breadcrumbs, $what) {
$breadcrumbs->parent('transactions.index', $what);
$breadcrumbs->push(trans('breadcrumbs.create_' . e($what)), route('transactions.create', $what));
}
);
Breadcrumbs::register(
'transactions.edit', function (Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(trans('breadcrumbs.edit_journal', ['description' => $journal->description]), route('transactions.edit', $journal->id));
}
);
Breadcrumbs::register(
'transactions.delete', function (Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.show', $journal);
$breadcrumbs->push(trans('breadcrumbs.delete_journal', ['description' => e($journal->description)]), route('transactions.delete', $journal->id));
}
);
Breadcrumbs::register(
'transactions.show', function (Generator $breadcrumbs, TransactionJournal $journal) {
$breadcrumbs->parent('transactions.index', strtolower($journal->transactionType->type));
$breadcrumbs->push($journal->description, route('transactions.show', $journal->id));
}
);
// tags
Breadcrumbs::register(
'tags.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.tags'), route('tags.index'));
}
);
Breadcrumbs::register(
'tags.create', function (Generator $breadcrumbs) {
$breadcrumbs->parent('tags.index');
$breadcrumbs->push(trans('breadcrumbs.createTag'), route('tags.create'));
}
);
Breadcrumbs::register(
'tags.edit', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.edit_tag', ['tag' => e($tag->tag)]), route('tags.edit', $tag->id));
}
);
Breadcrumbs::register(
'tags.delete', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.show', $tag);
$breadcrumbs->push(trans('breadcrumbs.delete_tag', ['tag' => e($tag->tag)]), route('tags.delete', $tag->id));
}
);
Breadcrumbs::register(
'tags.show', function (Generator $breadcrumbs, Tag $tag) {
$breadcrumbs->parent('tags.index');
$breadcrumbs->push(e($tag->tag), route('tags.show', $tag->id));
}
);

431
app/Http/routes.php Normal file
View File

@@ -0,0 +1,431 @@
<?php
use FireflyIII\Models\Account;
use FireflyIII\Models\Bill;
use FireflyIII\Models\Budget;
use FireflyIII\Models\Category;
use FireflyIII\Models\LimitRepetition;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Models\Reminder;
use FireflyIII\Models\Tag;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
// models
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'account',
function ($value, $route) {
if (Auth::check()) {
$object = Account::leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->where('account_types.editable', 1)
->where('accounts.id', $value)
->where('user_id', Auth::user()->id)
->first(['accounts.*']);
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'tj', function ($value, $route) {
if (Auth::check()) {
$object = TransactionJournal::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'currency', function ($value, $route) {
if (Auth::check()) {
$object = TransactionCurrency::find($value);
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'bill', function ($value, $route) {
if (Auth::check()) {
$object = Bill::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'budget', function ($value, $route) {
if (Auth::check()) {
$object = Budget::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'reminder', function ($value, $route) {
if (Auth::check()) {
$object = Reminder::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'limitrepetition', function ($value, $route) {
if (Auth::check()) {
$object = LimitRepetition::where('limit_repetitions.id', $value)
->leftjoin('budget_limits', 'budget_limits.id', '=', 'limit_repetitions.budget_limit_id')
->leftJoin('budgets', 'budgets.id', '=', 'budget_limits.budget_id')
->where('budgets.user_id', Auth::user()->id)
->first(['limit_repetitions.*']);
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'piggyBank', function ($value, $route) {
if (Auth::check()) {
$object = PiggyBank::where('piggy_banks.id', $value)
->leftJoin('accounts', 'accounts.id', '=', 'piggy_banks.account_id')
->where('accounts.user_id', Auth::user()->id)
->first(['piggy_banks.*']);
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'category', function ($value, $route) {
if (Auth::check()) {
$object = Category::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'reminder', function ($value, $route) {
if (Auth::check()) {
/** @var \FireflyIII\Models\Reminder $object */
$object = Reminder::find($value);
if ($object) {
if ($object->remindersable->account->user_id == Auth::user()->id) {
return $object;
}
}
}
throw new NotFoundHttpException;
}
);
/** @noinspection PhpUnusedParameterInspection */
Route::bind(
'tag', function ($value, $route) {
if (Auth::check()) {
$object = Tag::where('id', $value)->where('user_id', Auth::user()->id)->first();
if ($object) {
return $object;
}
}
throw new NotFoundHttpException;
}
);
/**
* Auth\AuthController
*/
Route::get('/register', ['uses' => 'Auth\AuthController@getRegister', 'as' => 'register']);
Route::controllers(
[
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController',
]
);
Route::get('/routes', ['uses' => 'HomeController@routes', 'as' => 'routes']);
/**
* Home Controller
*/
Route::group(
['middleware' => ['auth', 'range', 'reminders', 'piggybanks']], function () {
Route::get('/', ['uses' => 'HomeController@index', 'as' => 'index', 'middleware' => 'cleanup']);
Route::get('/home', ['uses' => 'HomeController@index', 'as' => 'home']);
Route::post('/daterange', ['uses' => 'HomeController@dateRange', 'as' => 'daterange']);
Route::get('/flush', ['uses' => 'HomeController@flush', 'as' => 'flush']);
/**
* Account Controller
*/
Route::get('/accounts/{what}', ['uses' => 'AccountController@index', 'as' => 'accounts.index'])->where('what', 'revenue|asset|expense');
Route::get('/accounts/create/{what}', ['uses' => 'AccountController@create', 'as' => 'accounts.create'])->where('what', 'revenue|asset|expense');
Route::get('/accounts/edit/{account}', ['uses' => 'AccountController@edit', 'as' => 'accounts.edit']);
Route::get('/accounts/delete/{account}', ['uses' => 'AccountController@delete', 'as' => 'accounts.delete']);
Route::get('/accounts/show/{account}/{view?}', ['uses' => 'AccountController@show', 'as' => 'accounts.show']);
Route::post('/accounts/store', ['uses' => 'AccountController@store', 'as' => 'accounts.store']);
Route::post('/accounts/update/{account}', ['uses' => 'AccountController@update', 'as' => 'accounts.update']);
Route::post('/accounts/destroy/{account}', ['uses' => 'AccountController@destroy', 'as' => 'accounts.destroy']);
/**
* Bills Controller
*/
Route::get('/bills', ['uses' => 'BillController@index', 'as' => 'bills.index']);
Route::get('/bills/rescan/{bill}', ['uses' => 'BillController@rescan', 'as' => 'bills.rescan']); # rescan for matching.
Route::get('/bills/create', ['uses' => 'BillController@create', 'as' => 'bills.create']);
Route::get('/bills/edit/{bill}', ['uses' => 'BillController@edit', 'as' => 'bills.edit']);
Route::get('/bills/delete/{bill}', ['uses' => 'BillController@delete', 'as' => 'bills.delete']);
Route::get('/bills/show/{bill}', ['uses' => 'BillController@show', 'as' => 'bills.show']);
Route::post('/bills/store', ['uses' => 'BillController@store', 'as' => 'bills.store']);
Route::post('/bills/update/{bill}', ['uses' => 'BillController@update', 'as' => 'bills.update']);
Route::post('/bills/destroy/{bill}', ['uses' => 'BillController@destroy', 'as' => 'bills.destroy']);
/**
* Budget Controller
*/
Route::get('/budgets', ['uses' => 'BudgetController@index', 'as' => 'budgets.index']);
Route::get('/budgets/income', ['uses' => 'BudgetController@updateIncome', 'as' => 'budgets.income']); # extra.
Route::get('/budgets/create', ['uses' => 'BudgetController@create', 'as' => 'budgets.create']);
Route::get('/budgets/edit/{budget}', ['uses' => 'BudgetController@edit', 'as' => 'budgets.edit']);
Route::get('/budgets/delete/{budget}', ['uses' => 'BudgetController@delete', 'as' => 'budgets.delete']);
Route::get('/budgets/show/{budget}/{limitrepetition?}', ['uses' => 'BudgetController@show', 'as' => 'budgets.show']);
Route::get('/budgets/list/noBudget', ['uses' => 'BudgetController@noBudget', 'as' => 'budgets.noBudget']);
Route::post('/budgets/income', ['uses' => 'BudgetController@postUpdateIncome', 'as' => 'budgets.postIncome']);
Route::post('/budgets/store', ['uses' => 'BudgetController@store', 'as' => 'budgets.store']);
Route::post('/budgets/update/{budget}', ['uses' => 'BudgetController@update', 'as' => 'budgets.update']);
Route::post('/budgets/destroy/{budget}', ['uses' => 'BudgetController@destroy', 'as' => 'budgets.destroy']);
Route::post('budgets/amount/{budget}', ['uses' => 'BudgetController@amount']);
/**
* Category Controller
*/
Route::get('/categories', ['uses' => 'CategoryController@index', 'as' => 'categories.index']);
Route::get('/categories/create', ['uses' => 'CategoryController@create', 'as' => 'categories.create']);
Route::get('/categories/edit/{category}', ['uses' => 'CategoryController@edit', 'as' => 'categories.edit']);
Route::get('/categories/delete/{category}', ['uses' => 'CategoryController@delete', 'as' => 'categories.delete']);
Route::get('/categories/show/{category}', ['uses' => 'CategoryController@show', 'as' => 'categories.show']);
Route::get('/categories/list/noCategory', ['uses' => 'CategoryController@noCategory', 'as' => 'categories.noCategory']);
Route::post('/categories/store', ['uses' => 'CategoryController@store', 'as' => 'categories.store']);
Route::post('/categories/update/{category}', ['uses' => 'CategoryController@update', 'as' => 'categories.update']);
Route::post('/categories/destroy/{category}', ['uses' => 'CategoryController@destroy', 'as' => 'categories.destroy']);
/**
* Currency Controller
*/
Route::get('/currency', ['uses' => 'CurrencyController@index', 'as' => 'currency.index']);
Route::get('/currency/create', ['uses' => 'CurrencyController@create', 'as' => 'currency.create']);
Route::get('/currency/edit/{currency}', ['uses' => 'CurrencyController@edit', 'as' => 'currency.edit']);
Route::get('/currency/delete/{currency}', ['uses' => 'CurrencyController@delete', 'as' => 'currency.delete']);
Route::get('/currency/default/{currency}', ['uses' => 'CurrencyController@defaultCurrency', 'as' => 'currency.default']);
Route::post('/currency/store', ['uses' => 'CurrencyController@store', 'as' => 'currency.store']);
Route::post('/currency/update/{currency}', ['uses' => 'CurrencyController@update', 'as' => 'currency.update']);
Route::post('/currency/destroy/{currency}', ['uses' => 'CurrencyController@destroy', 'as' => 'currency.destroy']);
/**
* ALL CHART Controllers
*/
// accounts:
Route::get('/chart/account/frontpage', ['uses' => 'Chart\AccountController@frontpage']);
Route::get('/chart/account/month/{year}/{month}/{shared?}', ['uses' => 'Chart\AccountController@all'])->where(
['year' => '[0-9]{4}', 'month' => '[0-9]{1,2}', 'shared' => 'shared']
);
Route::get('/chart/account/{account}', ['uses' => 'Chart\AccountController@single']);
// bills:
Route::get('/chart/bill/frontpage', ['uses' => 'Chart\BillController@frontpage']);
Route::get('/chart/bill/{bill}', ['uses' => 'Chart\BillController@single']);
// budgets:
Route::get('/chart/budget/frontpage', ['uses' => 'Chart\BudgetController@frontpage']);
Route::get('/chart/budget/year/{year}/{shared?}', ['uses' => 'Chart\BudgetController@year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
Route::get('/chart/budget/{budget}/{limitrepetition}', ['uses' => 'Chart\BudgetController@budgetLimit']);
Route::get('/chart/budget/{budget}', ['uses' => 'Chart\BudgetController@budget']);
// categories:
Route::get('/chart/category/frontpage', ['uses' => 'Chart\CategoryController@frontpage']);
Route::get('/chart/category/year/{year}/{shared?}', ['uses' => 'Chart\CategoryController@year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
Route::get('/chart/category/{category}/month', ['uses' => 'Chart\CategoryController@month']); // should be period.
Route::get('/chart/category/{category}/all', ['uses' => 'Chart\CategoryController@all']);
// piggy banks:
Route::get('/chart/piggyBank/{piggyBank}', ['uses' => 'Chart\PiggyBankController@history']);
// reports:
Route::get('/chart/report/in-out/{year}/{shared?}', ['uses' => 'Chart\ReportController@yearInOut'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
Route::get('/chart/report/in-out-sum/{year}/{shared?}', ['uses' => 'Chart\ReportController@yearInOutSummarized'])->where(
['year' => '[0-9]{4}', 'shared' => 'shared']
);
/**
* Help Controller
*/
Route::get('/help/{route}', ['uses' => 'HelpController@show', 'as' => 'help.show']);
/**
* JSON Controller
*/
Route::get('/json/expense-accounts', ['uses' => 'JsonController@expenseAccounts', 'as' => 'json.expense-accounts']);
Route::get('/json/revenue-accounts', ['uses' => 'JsonController@revenueAccounts', 'as' => 'json.revenue-accounts']);
Route::get('/json/categories', ['uses' => 'JsonController@categories', 'as' => 'json.categories']);
Route::get('/json/tags', ['uses' => 'JsonController@tags', 'as' => 'json.tags']);
Route::get('/json/box/in', ['uses' => 'JsonController@boxIn', 'as' => 'json.box.in']);
Route::get('/json/box/out', ['uses' => 'JsonController@boxOut', 'as' => 'json.box.out']);
Route::get('/json/box/bills-unpaid', ['uses' => 'JsonController@boxBillsUnpaid', 'as' => 'json.box.paid']);
Route::get('/json/box/bills-paid', ['uses' => 'JsonController@boxBillsPaid', 'as' => 'json.box.unpaid']);
Route::get('/json/transaction-journals/{what}', 'JsonController@transactionJournals');
/**
* Piggy Bank Controller
*/
Route::get('/piggy-banks', ['uses' => 'PiggyBankController@index', 'as' => 'piggy-banks.index']);
Route::get('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@add', 'as' => 'piggy-banks.addMoney']); # add money
Route::get('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@remove', 'as' => 'piggy-banks.removeMoney']); #remove money
Route::get('/piggy-banks/create', ['uses' => 'PiggyBankController@create', 'as' => 'piggy-banks.create']);
Route::get('/piggy-banks/edit/{piggyBank}', ['uses' => 'PiggyBankController@edit', 'as' => 'piggy-banks.edit']);
Route::get('/piggy-banks/delete/{piggyBank}', ['uses' => 'PiggyBankController@delete', 'as' => 'piggy-banks.delete']);
Route::get('/piggy-banks/show/{piggyBank}', ['uses' => 'PiggyBankController@show', 'as' => 'piggy-banks.show']);
Route::post('/piggy-banks/store', ['uses' => 'PiggyBankController@store', 'as' => 'piggy-banks.store']);
Route::post('/piggy-banks/update/{piggyBank}', ['uses' => 'PiggyBankController@update', 'as' => 'piggy-banks.update']);
Route::post('/piggy-banks/destroy/{piggyBank}', ['uses' => 'PiggyBankController@destroy', 'as' => 'piggy-banks.destroy']);
Route::post('/piggy-banks/add/{piggyBank}', ['uses' => 'PiggyBankController@postAdd', 'as' => 'piggy-banks.add']); # add money
Route::post('/piggy-banks/remove/{piggyBank}', ['uses' => 'PiggyBankController@postRemove', 'as' => 'piggy-banks.remove']); # remove money.
Route::post('/piggy-banks/sort', ['uses' => 'PiggyBankController@order', 'as' => 'piggy-banks.order']);
/**
* Preferences Controller
*/
Route::get('/preferences', ['uses' => 'PreferencesController@index', 'as' => 'preferences']);
Route::post('/preferences', ['uses' => 'PreferencesController@postIndex']);
/**
* Profile Controller
*/
Route::get('/profile', ['uses' => 'ProfileController@index', 'as' => 'profile']);
Route::get('/profile/change-password', ['uses' => 'ProfileController@changePassword', 'as' => 'change-password']);
Route::get('/profile/delete-account', ['uses' => 'ProfileController@deleteAccount', 'as' => 'delete-account']);
Route::post('/profile/delete-account', ['uses' => 'ProfileController@postDeleteAccount', 'as' => 'delete-account-post']);
Route::post('/profile/change-password', ['uses' => 'ProfileController@postChangePassword', 'as' => 'change-password-post']);
/**
* Reminder Controller
*/
Route::get('/reminders', ['uses' => 'ReminderController@index', 'as' => 'reminders.index']);
Route::get('/reminder/dismiss/{reminder}', ['uses' => 'ReminderController@dismiss', 'as' => 'reminders.dismiss']);
Route::get('/reminder/act/{reminder}', ['uses' => 'ReminderController@act', 'as' => 'reminders.act']);
Route::get('/reminder/{reminder}', ['uses' => 'ReminderController@show', 'as' => 'reminders.show']);
/**
* Report Controller
*/
Route::get('/reports', ['uses' => 'ReportController@index', 'as' => 'reports.index']);
//Route::get('/reports/{year}', ['uses' => 'ReportController@year', 'as' => 'reports.year'])->where(['year' => '[0-9]{4}']);
Route::get('/reports/{year}/{shared?}', ['uses' => 'ReportController@year', 'as' => 'reports.year'])->where(['year' => '[0-9]{4}', 'shared' => 'shared']);
Route::get('/reports/{year}/{month}/{shared?}', ['uses' => 'ReportController@month', 'as' => 'reports.month'])->where(
['year' => '[0-9]{4}', 'month' => '[0-9]{1,2}', 'shared' => 'shared']
);
// pop ups for budget report:
/**
* Search Controller
*/
Route::get('/search', ['uses' => 'SearchController@index', 'as' => 'search']);
/**
* Tag Controller
*/
Route::get('/tags', ['uses' => 'TagController@index', 'as' => 'tags.index']);
Route::get('/tags/create', ['uses' => 'TagController@create', 'as' => 'tags.create']);
Route::get('/tags/show/{tag}', ['uses' => 'TagController@show', 'as' => 'tags.show']);
Route::get('/tags/edit/{tag}', ['uses' => 'TagController@edit', 'as' => 'tags.edit']);
Route::get('/tags/delete/{tag}', ['uses' => 'TagController@delete', 'as' => 'tags.delete']);
Route::post('/tags/store', ['uses' => 'TagController@store', 'as' => 'tags.store']);
Route::post('/tags/update/{tag}', ['uses' => 'TagController@update', 'as' => 'tags.update']);
Route::post('/tags/destroy/{tag}', ['uses' => 'TagController@destroy', 'as' => 'tags.destroy']);
Route::post('/tags/hideTagHelp/{state}', ['uses' => 'TagController@hideTagHelp', 'as' => 'tags.hideTagHelp']);
/**
* Transaction Controller
*/
Route::get('/transactions/{what}', ['uses' => 'TransactionController@index', 'as' => 'transactions.index'])->where(
['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']
);
Route::get('/transactions/create/{what}', ['uses' => 'TransactionController@create', 'as' => 'transactions.create'])->where(
['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']
);
Route::get('/transaction/edit/{tj}', ['uses' => 'TransactionController@edit', 'as' => 'transactions.edit']);
Route::get('/transaction/delete/{tj}', ['uses' => 'TransactionController@delete', 'as' => 'transactions.delete']);
Route::get('/transaction/show/{tj}', ['uses' => 'TransactionController@show', 'as' => 'transactions.show']);
// transaction controller:
Route::post('/transactions/store/{what}', ['uses' => 'TransactionController@store', 'as' => 'transactions.store'])->where(
['what' => 'expenses|revenue|withdrawal|deposit|transfer|transfers']
);
Route::post('/transaction/update/{tj}', ['uses' => 'TransactionController@update', 'as' => 'transactions.update']);
Route::post('/transaction/destroy/{tj}', ['uses' => 'TransactionController@destroy', 'as' => 'transactions.destroy']);
Route::post('/transaction/reorder', ['uses' => 'TransactionController@reorder', 'as' => 'transactions.reorder']);
/**
* Auth\Auth Controller
*/
Route::get('/logout', ['uses' => 'Auth\AuthController@getLogout', 'as' => 'logout']);
}
);

228
app/Models/Account.php Normal file
View File

@@ -0,0 +1,228 @@
<?php namespace FireflyIII\Models;
use Crypt;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Query\JoinClause;
use Watson\Validating\ValidatingTrait;
/**
* Class Account
*
* @package FireflyIII\Models
*/
class Account extends Model
{
use SoftDeletes, ValidatingTrait;
protected $fillable = ['user_id', 'account_type_id', 'name', 'active', 'virtual_balance'];
protected $hidden = ['virtual_balance_encrypted', 'encrypted'];
protected $rules
= [
'user_id' => 'required|exists:users,id',
'account_type_id' => 'required|exists:account_types,id',
'name' => 'required|between:1,1024|uniqueAccountForUser',
'active' => 'required|boolean'
];
/**
* @param array $fields
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @return Account|null
*/
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
$query = Account::orderBy('id');
foreach ($fields as $name => $value) {
if ($name != 'name') {
$query->where($name, $value);
}
}
$set = $query->get(['accounts.*']);
/** @var Account $account */
foreach ($set as $account) {
if ($account->name == $fields['name']) {
return $account;
}
}
// create it!
$account = Account::create($fields);
return $account;
}
/**
* @param array $fields
*
* @return Account|null
*/
public static function firstOrNullEncrypted(array $fields)
{
// everything but the name:
$query = Account::orderBy('id');
foreach ($fields as $name => $value) {
if ($name != 'name') {
$query->where($name, $value);
}
}
$set = $query->get(['accounts.*']);
/** @var Account $account */
foreach ($set as $account) {
if ($account->name == $fields['name']) {
return $account;
}
}
return null;
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function accountMeta()
{
return $this->hasMany('FireflyIII\Models\AccountMeta');
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function accountType()
{
return $this->belongsTo('FireflyIII\Models\AccountType');
}
/**
* @codeCoverageIgnore
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at'];
}
/**
*
* @param $fieldName
*
* @codeCoverageIgnore
*
* @return string|null
*/
public function getMeta($fieldName)
{
foreach ($this->accountMeta as $meta) {
if ($meta->name == $fieldName) {
return $meta->data;
}
}
return null;
}
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
*/
public function getNameAttribute($value)
{
if (intval($this->encrypted) == 1) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function piggyBanks()
{
return $this->hasMany('FireflyIII\Models\PiggyBank');
}
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param array $types
*/
public function scopeAccountTypeIn(EloquentBuilder $query, array $types)
{
if (is_null($this->joinedAccountTypes)) {
$query->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id');
$this->joinedAccountTypes = true;
}
$query->whereIn('account_types.type', $types);
}
/**
* @codeCoverageIgnore
*
* @param EloquentBuilder $query
* @param string $name
* @param string $value
*/
public function scopeHasMetaValue(EloquentBuilder $query, $name, $value)
{
$joinName = str_replace('.', '_', $name);
$query->leftJoin(
'account_meta as ' . $joinName, function (JoinClause $join) use ($joinName, $name) {
$join->on($joinName . '.account_id', '=', 'accounts.id')->where($joinName . '.name', '=', $name);
}
);
$query->where($joinName . '.data', json_encode($value));
}
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setNameAttribute($value)
{
$this->attributes['name'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}
/**
* @param $value
*
* @codeCoverageIgnore
*/
public function setVirtualBalanceAttribute($value)
{
$this->attributes['virtual_balance'] = strval(round($value, 2));
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactions()
{
return $this->hasMany('FireflyIII\Models\Transaction');
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('FireflyIII\User');
}
}

View File

@@ -0,0 +1,61 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Watson\Validating\ValidatingTrait;
/**
* Class AccountMeta
*
* @codeCoverageIgnore
* @package FireflyIII\Models
*/
class AccountMeta extends Model
{
use ValidatingTrait;
protected $fillable = ['account_id', 'name', 'data'];
protected $rules
= [
'account_id' => 'required|exists:accounts,id',
'name' => 'required|between:1,100',
'data' => 'required'
];
protected $table = 'account_meta';
/**
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function account()
{
return $this->belongsTo('FireflyIII\Models\Account');
}
/**
* @param $value
*
* @return mixed
*/
public function getDataAttribute($value)
{
return json_decode($value);
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at'];
}
/**
* @param $value
*/
public function setDataAttribute($value)
{
$this->attributes['data'] = json_encode($value);
}
}

View File

@@ -0,0 +1,30 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class AccountType
*
* @codeCoverageIgnore
* @package FireflyIII\Models
*/
class AccountType extends Model
{
//
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function accounts()
{
return $this->hasMany('FireflyIII\Models\Account');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at'];
}
}

109
app/Models/Bill.php Normal file
View File

@@ -0,0 +1,109 @@
<?php namespace FireflyIII\Models;
use Crypt;
use Illuminate\Database\Eloquent\Model;
/**
* @codeCoverageIgnore
* Class Bill
*
* @package FireflyIII\Models
*/
class Bill extends Model
{
protected $fillable
= ['name', 'match', 'amount_min', 'match_encrypted', 'name_encrypted', 'user_id', 'amount_max', 'date', 'repeat_freq', 'skip', 'automatch', 'active',];
protected $hidden = ['amount_min_encrypted', 'amount_max_encrypted', 'name_encrypted', 'match_encrypted'];
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'date'];
}
/**
* @param $value
*
* @return string
*/
public function getMatchAttribute($value)
{
if (intval($this->match_encrypted) == 1) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* @param $value
*
* @return string
*/
public function getNameAttribute($value)
{
if (intval($this->name_encrypted) == 1) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* @param $value
*/
public function setAmountMaxAttribute($value)
{
$this->attributes['amount_max'] = strval(round($value, 2));
}
/**
* @param $value
*/
public function setAmountMinAttribute($value)
{
$this->attributes['amount_min'] = strval(round($value, 2));
}
/**
* @param $value
*/
public function setMatchAttribute($value)
{
$this->attributes['match'] = Crypt::encrypt($value);
$this->attributes['match_encrypted'] = true;
}
/**
* @param $value
*/
public function setNameAttribute($value)
{
$this->attributes['name'] = Crypt::encrypt($value);
$this->attributes['name_encrypted'] = true;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function transactionjournals()
{
return $this->hasMany('FireflyIII\Models\TransactionJournal');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('FireflyIII\User');
}
}

87
app/Models/Budget.php Normal file
View File

@@ -0,0 +1,87 @@
<?php namespace FireflyIII\Models;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Budget
*
* @codeCoverageIgnore
* @package FireflyIII\Models
*/
class Budget extends Model
{
use SoftDeletes;
protected $fillable = ['user_id', 'name', 'active'];
protected $hidden = ['encrypted'];
/**
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function budgetlimits()
{
return $this->hasMany('FireflyIII\Models\BudgetLimit');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at'];
}
/**
* @param $value
*
* @return string
*/
public function getNameAttribute($value)
{
if (intval($this->encrypted) == 1) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasManyThrough
*/
public function limitrepetitions()
{
return $this->hasManyThrough('FireflyIII\Models\LimitRepetition', 'FireflyIII\Models\BudgetLimit', 'budget_id');
}
/**
* @param $value
*/
public function setNameAttribute($value)
{
$this->attributes['name'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function transactionjournals()
{
return $this->belongsToMany('FireflyIII\Models\TransactionJournal', 'budget_transaction_journal', 'budget_id');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('FireflyIII\User');
}
}

View File

@@ -0,0 +1,48 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class BudgetLimit
*
* @codeCoverageIgnore
* @package FireflyIII\Models
*/
class BudgetLimit extends Model
{
protected $hidden = ['amount_encrypted'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function budget()
{
return $this->belongsTo('FireflyIII\Models\Budget');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'startdate'];
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function limitrepetitions()
{
return $this->hasMany('FireflyIII\Models\LimitRepetition');
}
/**
* @param $value
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = strval(round($value, 2));
}
}

104
app/Models/Category.php Normal file
View File

@@ -0,0 +1,104 @@
<?php namespace FireflyIII\Models;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Category
*
*
* @package FireflyIII\Models
*/
class Category extends Model
{
use SoftDeletes;
protected $fillable = ['user_id', 'name'];
protected $hidden = ['encrypted'];
/**
* @param array $fields
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
* @return Account|null
*/
public static function firstOrCreateEncrypted(array $fields)
{
// everything but the name:
$query = Category::orderBy('id');
foreach ($fields as $name => $value) {
if ($name != 'name') {
$query->where($name, $value);
}
}
$set = $query->get(['categories.*']);
/** @var Category $category */
foreach ($set as $category) {
if ($category->name == $fields['name']) {
return $category;
}
}
// create it!
$category = Category::create($fields);
return $category;
}
/**
* @codeCoverageIgnore
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at'];
}
/**
* @codeCoverageIgnore
*
* @param $value
*
* @return string
*/
public function getNameAttribute($value)
{
if (intval($this->encrypted) == 1) {
return Crypt::decrypt($value);
}
return $value;
}
/**
* @codeCoverageIgnore
*
* @param $value
*/
public function setNameAttribute($value)
{
$this->attributes['name'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function transactionjournals()
{
return $this->belongsToMany('FireflyIII\Models\TransactionJournal', 'category_transaction_journal', 'category_id');
}
/**
* @codeCoverageIgnore
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo('FireflyIII\User');
}
}

25
app/Models/Component.php Normal file
View File

@@ -0,0 +1,25 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class Component
*
* @codeCoverageIgnore
* @package FireflyIII\Models
*/
class Component extends Model
{
use SoftDeletes;
protected $fillable = ['user_id', 'name', 'class'];
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at'];
}
}

View File

@@ -0,0 +1,41 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class LimitRepetition
*
* @codeCoverageIgnore
*
* @package FireflyIII\Models
*/
class LimitRepetition extends Model
{
protected $hidden = ['amount_encrypted'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function budgetLimit()
{
return $this->belongsTo('FireflyIII\Models\BudgetLimit');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'startdate', 'enddate'];
}
/**
* @param $value
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = strval(round($value, 2));
}
}

125
app/Models/PiggyBank.php Normal file
View File

@@ -0,0 +1,125 @@
<?php namespace FireflyIII\Models;
use Crypt;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
/**
* Class PiggyBank
*
* @codeCoverageIgnore
*
* @package FireflyIII\Models
*/
class PiggyBank extends Model
{
use SoftDeletes;
protected $fillable
= ['name', 'account_id', 'order', 'reminder_skip', 'targetamount', 'startdate', 'targetdate', 'reminder', 'remind_me'];
protected $hidden = ['targetamount_encrypted', 'encrypted'];
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function account()
{
return $this->belongsTo('FireflyIII\Models\Account');
}
/**
* Grabs the PiggyBankRepetition that's currently relevant / active
*
* @returns PiggyBankRepetition
*/
public function currentRelevantRep()
{
if (!is_null($this->currentRep)) {
return $this->currentRep;
}
// repeating piggy banks are no longer supported.
$rep = $this->piggyBankRepetitions()->first(['piggy_bank_repetitions.*']);
$this->currentRep = $rep;
return $rep;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function piggyBankRepetitions()
{
return $this->hasMany('FireflyIII\Models\PiggyBankRepetition');
}
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'deleted_at', 'startdate', 'targetdate'];
}
/**
*
* @param $value
*
* @return string
*/
public function getNameAttribute($value)
{
if (intval($this->encrypted) == 1) {
return Crypt::decrypt($value);
}
return $value;
}
/**
*
* @param $value
*
* @return int
*/
public function getRemindMeAttribute($value)
{
return intval($value) == 1;
}
/**
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function piggyBankEvents()
{
return $this->hasMany('FireflyIII\Models\PiggyBankEvent');
}
/**
* @return \Illuminate\Database\Eloquent\Relations\MorphMany
*/
public function reminders()
{
return $this->morphMany('FireflyIII\Models\Reminder', 'remindersable');
}
/**
*
* @param $value
*/
public function setNameAttribute($value)
{
$this->attributes['name'] = Crypt::encrypt($value);
$this->attributes['encrypted'] = true;
}
/**
* @param $value
*/
public function setTargetamountAttribute($value)
{
$this->attributes['targetamount'] = strval(round($value, 2));
}
}

View File

@@ -0,0 +1,50 @@
<?php namespace FireflyIII\Models;
use Illuminate\Database\Eloquent\Model;
/**
* Class PiggyBankEvent
*
* @codeCoverageIgnore
*
* @package FireflyIII\Models
*/
class PiggyBankEvent extends Model
{
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'amount'];
protected $hidden = ['amount_encrypted'];
/**
* @return array
*/
public function getDates()
{
return ['created_at', 'updated_at', 'date'];
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function piggyBank()
{
return $this->belongsTo('FireflyIII\Models\PiggyBank');
}
/**
* @param $value
*/
public function setAmountAttribute($value)
{
$this->attributes['amount'] = strval(round($value, 2));
}
/**
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function transactionJournal()
{
return $this->belongsTo('FireflyIII\Models\TransactionJournal');
}
}

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