Compare commits

...

157 Commits

Author SHA1 Message Date
James Cole
f090a9534f Merge branch 'release/4.8.0.3' 2019-08-23 14:25:17 +02:00
James Cole
ad289bc8cd Updated composer file. 2019-08-23 14:11:26 +02:00
James Cole
6f5b6e536d Updated version. 2019-08-23 14:11:18 +02:00
James Cole
c810bad97c New translations. 2019-08-23 14:11:10 +02:00
James Cole
a172c51495 Update changelog. 2019-08-23 13:54:51 +02:00
James Cole
633c776ebf Fix for #2438 2019-08-23 13:53:05 +02:00
James Cole
19bd295c71 Version update. 2019-08-23 13:52:36 +02:00
James Cole
3b39fb93e7 Fix tag overview. 2019-08-23 13:09:38 +02:00
James Cole
e3a338db0e Fix some view issues reported in #2436 2019-08-23 13:06:00 +02:00
James Cole
02df24bbc9 Possible fix for #2437 2019-08-23 09:41:31 +02:00
James Cole
4f6ba1e706 Re-order two columns #2437 2019-08-23 06:42:49 +02:00
James Cole
a1f57a0949 Fix #2467 2019-08-23 06:40:48 +02:00
James Cole
3d444eb833 Fix #2465 and #2463 2019-08-23 06:10:03 +02:00
James Cole
57b2a8d459 Add a note 2019-08-23 06:03:40 +02:00
James Cole
8a06507003 Fix #2459 2019-08-22 19:14:26 +02:00
James Cole
04d7137dff More code for #2457 2019-08-22 19:10:57 +02:00
James Cole
a2be71499f Add autocomplete #2457 2019-08-22 19:07:01 +02:00
James Cole
effba42ac2 Typo fix in budget helper and add debug info. #2451 2019-08-22 18:07:42 +02:00
James Cole
aea8603ca1 Typo fix in budget helper and add debug info. #2451 2019-08-22 18:07:33 +02:00
James Cole
fdb2abdf92 Some notes for future releases. #2443 2019-08-22 18:04:26 +02:00
James Cole
4b1d66bcf6 Merge pull request #2444 from GeoffreyFrogeye/availablebudgets
Fix wrong indexes in BudgetRepository
2019-08-22 18:03:34 +02:00
James Cole
248e393405 Merge pull request #2442 from GeoffreyFrogeye/currencycharlimit
Fix consistency in symbol character limit
2019-08-22 17:58:12 +02:00
James Cole
967ea6a181 Another fix for #2440 2019-08-22 17:56:48 +02:00
James Cole
a11f876c49 Fix return type #2440 2019-08-22 17:09:08 +02:00
James Cole
2a4051fe92 Fix for #2439 2019-08-22 17:06:43 +02:00
James Cole
10737d10a5 Merge pull request #2458 from jlauwers/patch-1
typo in readme
2019-08-22 04:43:42 +02:00
James Cole
6f75e0df3c Fix for #2451 2019-08-21 18:07:15 +02:00
James Cole
24a2238134 Fix #2456 2019-08-21 18:01:57 +02:00
James Cole
c7931f2b72 Fix for #2460 2019-08-21 17:27:59 +02:00
Jonathan
852584b6a8 typo in readme 2019-08-21 08:39:21 +02:00
James Cole
21a9e981a2 Fix for #2446 2019-08-21 05:15:47 +02:00
James Cole
ecc37b2ed3 Some undocumented changes for #2445 and #2447 2019-08-21 04:59:35 +02:00
James Cole
c0935e192d Fix #2448 2019-08-21 04:46:17 +02:00
James Cole
92a2404b61 Fix for invoice date #2449 2019-08-21 04:45:00 +02:00
James Cole
d9a2bd3e5f Update composer file with new command. 2019-08-21 04:37:27 +02:00
James Cole
22f110df8d Round the search time and make sure the count is shown #2453 2019-08-21 04:37:17 +02:00
James Cole
c76337926b Fix general docker file. 2019-08-21 04:18:37 +02:00
Geoffrey “Frogeye” Preud'homme
bf57dec07c Fix wrong indexes in BudgetRepository
Closes #2443
2019-08-18 17:58:42 +02:00
Geoffrey “Frogeye” Preud'homme
10d760a614 Fix consistency in symbol character limit
Closes #2441
2019-08-18 17:16:10 +02:00
James Cole
7b813065da Remove log debug things. 2019-08-18 13:01:47 +02:00
James Cole
c218a12af7 New command to make sure opening balance currency information is correct. 2019-08-18 13:01:38 +02:00
James Cole
98ae0efb16 SQL issue in piggy banks 2019-08-18 11:19:25 +02:00
James Cole
98cff18efa Fix email message for new transactions 2019-08-18 11:16:33 +02:00
James Cole
a7b2fbbf10 Budget box is back. 2019-08-18 09:07:08 +02:00
James Cole
ccc12171d6 Make sure all account meta data is deleted properly. 2019-08-18 09:00:15 +02:00
James Cole
525f69cf63 Inform user on currency disabling and where a currency may still be used. #2432 2019-08-18 08:46:36 +02:00
James Cole
4d2c5c1b58 Build both images using base image. 2019-08-18 08:10:30 +02:00
James Cole
450d07580e Push build from other base image. 2019-08-18 07:16:30 +02:00
James Cole
246100f2b7 Debug info for #2437 2019-08-17 21:02:02 +02:00
James Cole
9974e0229d Merge tag '4.8.0.2' into develop
4.8.0.2
2019-08-17 12:38:06 +02:00
James Cole
ad44f99dbf Merge branch 'release/4.8.0.2' 2019-08-17 12:38:04 +02:00
James Cole
12a64fefc8 Fix test. 2019-08-17 12:31:55 +02:00
James Cole
2ee8cbbae4 Update change logs and files for new version. 2019-08-17 12:27:15 +02:00
James Cole
34c19b145c Updated strings. 2019-08-17 12:24:16 +02:00
James Cole
c5e047ea02 Update copyright 2019-08-17 12:13:02 +02:00
James Cole
fc78c32fca Add newline to files 2019-08-17 12:09:03 +02:00
James Cole
b53cbbe469 Fix test coverage. 2019-08-17 12:08:09 +02:00
James Cole
1d4434698e Fix some tests. 2019-08-17 11:32:05 +02:00
James Cole
6d1bfd3956 Code cleanup 2019-08-17 10:54:16 +02:00
James Cole
1974d5f1e3 Code cleanup 2019-08-17 10:48:28 +02:00
James Cole
c235e42d6c Bill report URL must be set. 2019-08-17 10:48:09 +02:00
James Cole
342985d52a Code cleanup 2019-08-17 10:47:51 +02:00
James Cole
c2296c3ad5 Code cleanup 2019-08-17 10:47:29 +02:00
James Cole
23479790fe Code cleanup 2019-08-17 10:47:10 +02:00
James Cole
44823c6fec Code cleanup 2019-08-17 10:46:55 +02:00
James Cole
acfdf7dc90 Code cleanup 2019-08-17 10:46:40 +02:00
James Cole
6038a68ba9 Code cleanup 2019-08-17 10:46:32 +02:00
James Cole
79cf61b653 Fix #2434 2019-08-17 08:29:35 +02:00
James Cole
b97d3d3627 And fix sorting. 2019-08-17 08:04:41 +02:00
James Cole
7f887e294a Fix some charts. 2019-08-17 08:00:27 +02:00
James Cole
6f78735bc5 Fix some report issues. 2019-08-17 07:47:39 +02:00
James Cole
3e242aaca6 Clean up login controller. 2019-08-17 06:35:45 +02:00
James Cole
0796e422d4 Cleanup showLoginForm() 2019-08-17 06:24:49 +02:00
James Cole
fbd7c9ae07 Remove logout method (is the same) 2019-08-17 06:23:12 +02:00
James Cole
5cfb1b63dc Remove inspection warnings. 2019-08-17 06:22:42 +02:00
James Cole
f09d0e87e4 Remove inspection, add TODO's, make code a bit simpler. 2019-08-16 21:38:35 +02:00
James Cole
820358af73 Remove unused code. 2019-08-16 21:23:20 +02:00
James Cole
5a2998c80e Simplify bill overview. 2019-08-16 21:21:38 +02:00
James Cole
a32df0066e Fix form inconsistencies. 2019-08-16 19:08:20 +02:00
James Cole
02db333d46 Update for balance box in report. 2019-08-16 17:54:38 +02:00
James Cole
070f46c755 Budget box is multi-currency. 2019-08-16 08:27:08 +02:00
James Cole
b4a732bf77 Namespace errors, spotted by @davids3 #2392 2019-08-16 07:24:04 +02:00
James Cole
d8eb59736e Improve report boxes one by one #2428 2019-08-16 06:21:10 +02:00
James Cole
41c15b0cf8 Forgot auth in API 2019-08-16 06:20:16 +02:00
James Cole
fdf99400bc Some TODO's for the future. 2019-08-16 06:20:07 +02:00
James Cole
1ba45afeab Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop 2019-08-16 05:22:24 +02:00
James Cole
1819ece55d Merge pull request #2429 from GeoffreyFrogeye/emd_date
Fix typo in BudgetRepository (emd_date)
2019-08-16 05:15:50 +02:00
James Cole
78335210db Cleanup API middleware. 2019-08-16 05:08:56 +02:00
Geoffrey “Frogeye” Preud'homme
ca23bb6272 Fix typo in BudgetRepository (emd_date) 2019-08-15 23:23:06 +02:00
James Cole
eed84e18bb Fix #2423 2019-08-14 20:25:38 +02:00
James Cole
12641f96b1 Fix #2422 2019-08-14 20:23:11 +02:00
James Cole
1b97c4d58f Fix date for recurring transactions #2407 2019-08-14 20:06:16 +02:00
James Cole
ee3a2ef41c Fix report issues. 2019-08-14 19:51:46 +02:00
James Cole
084ceb0c4e Report fixes for #2418 2019-08-14 19:06:05 +02:00
James Cole
2497c4ee5c Fix #2426 2019-08-14 17:54:15 +02:00
James Cole
757a118f87 Change comment [skip ci] 2019-08-14 06:16:44 +02:00
James Cole
97908932e6 Fix #2393 2019-08-13 19:01:30 +02:00
James Cole
4c73ad8306 Fix #2402 2019-08-13 18:50:18 +02:00
James Cole
10a2078661 Fix #2404 2019-08-13 18:45:44 +02:00
James Cole
3fb09136cf Fix #2410 2019-08-13 18:38:15 +02:00
James Cole
843cced454 Fix #2405 2019-08-13 16:45:04 +02:00
James Cole
71a501868f Fix docker build back to original script. 2019-08-13 16:26:27 +02:00
James Cole
0a0ad8200a Fix #2414 2019-08-13 16:24:36 +02:00
James Cole
a9baf54b12 Fix #2416 2019-08-13 16:02:28 +02:00
James Cole
ed565136fc Fix #2415 2019-08-13 16:00:35 +02:00
James Cole
4719b87314 Try the ARM thing with my own version of the script. 2019-08-12 19:53:54 +02:00
James Cole
24b30af018 Install extension. 2019-08-12 19:31:42 +02:00
James Cole
e9f4695355 Fix ARM script. 2019-08-12 18:44:57 +02:00
James Cole
5b969fa014 Fix LDAP in ARM 2019-08-12 18:34:32 +02:00
James Cole
499e713683 Remove unused methods. 2019-08-12 18:24:33 +02:00
James Cole
5eadb51b78 Some refactoring. 2019-08-12 18:19:13 +02:00
James Cole
713a962005 Log errors instead of giving exceptions 2019-08-12 18:19:06 +02:00
James Cole
d96e77a3ec Use new methods from category repository 2019-08-12 18:18:51 +02:00
James Cole
bc68c367c8 Refactor earnedInperiod and spentInPeriod 2019-08-12 18:18:26 +02:00
James Cole
33e241d39a Remove initial balance accounts from auto-complete. 2019-08-12 18:17:43 +02:00
James Cole
e67812bf64 Method is no longer used. 2019-08-12 18:17:15 +02:00
James Cole
1090ce6597 Remove sum, make multi-currency 2019-08-12 18:16:28 +02:00
James Cole
e358f19548 Make method static 2019-08-12 18:16:12 +02:00
James Cole
eac406d62d Merge tag '4.8.0.1' into develop
4.8.0.1
2019-08-12 18:12:03 +02:00
James Cole
142a488ab3 Merge branch 'release/4.8.0.1' 2019-08-12 18:12:02 +02:00
James Cole
893c83e086 Fix tests. 2019-08-12 17:36:37 +02:00
James Cole
76dad84ba6 Updated translations. 2019-08-12 17:12:11 +02:00
James Cole
6e78d4efa7 Update version. 2019-08-12 17:11:05 +02:00
James Cole
66ffbf9e47 Rename version so Ctrl-F doesn't pick them up 2019-08-12 17:10:58 +02:00
James Cole
c499899988 Update version and changelog. 2019-08-12 17:10:33 +02:00
James Cole
77ea246fc3 New files for future release. 2019-08-12 16:59:23 +02:00
James Cole
80f9896f2a Remove unused lines. 2019-08-12 16:58:45 +02:00
James Cole
90c60e55f7 Fix #2401 2019-08-12 16:54:48 +02:00
James Cole
b085ee3437 Fix #2395 2019-08-11 19:14:13 +02:00
James Cole
3b3f24fe56 Fix #2399 2019-08-11 18:58:30 +02:00
James Cole
1d2c834b2c Code for #2397 2019-08-11 17:32:00 +02:00
James Cole
cc243f9fb7 Remove unused methods. 2019-08-11 07:29:13 +02:00
James Cole
788bde5562 Fix some tag related issues. 2019-08-11 07:29:05 +02:00
James Cole
f67a9547cc Box is now positive. 2019-08-11 07:26:06 +02:00
James Cole
8545d73119 Fix tests 2019-08-11 07:25:59 +02:00
James Cole
c4964cf603 Merge pull request #2382 from mfix22/patch-1
Fix ranger.yml config
2019-08-11 07:25:30 +02:00
James Cole
903b4e520c New Docker files. 2019-08-10 17:21:58 +02:00
James Cole
c0033ae56b Code cleanup in AccountForm. 2019-08-10 17:11:57 +02:00
James Cole
3daddd690f Fix all views. 2019-08-10 16:50:37 +02:00
James Cole
0d9bae6ec2 Fix the references for AccountForm. 2019-08-10 16:36:15 +02:00
James Cole
6e2978231b Refactor the expandedform methods. First commit to see how Scrutinizer likes this. This commit will break most views. 2019-08-10 15:09:44 +02:00
James Cole
0097c66522 Refactor journal repositories. 2019-08-10 14:41:08 +02:00
James Cole
93f1854be0 Refactor journal repository and fix tests. 2019-08-10 13:42:33 +02:00
James Cole
b7f3c53688 Fix #2388 2019-08-10 11:17:23 +02:00
James Cole
94b8bb8f66 Cleanup journal repository 2019-08-10 08:42:46 +02:00
James Cole
edb038c822 Update composer file. 2019-08-10 08:42:14 +02:00
James Cole
b6a9204c4f See what happens in the build now. 2019-08-10 07:19:37 +02:00
James Cole
1d1b335cac Fix #2384 2019-08-10 07:18:18 +02:00
James Cole
0516065f5a Cleanup todo's [skip ci] 2019-08-10 07:05:19 +02:00
James Cole
606f33ceeb Add disclaimer for Firefly III analytics code. 2019-08-10 07:05:07 +02:00
James Cole
cb1db06a7c Remove unnecessary loops. 2019-08-10 07:04:54 +02:00
James Cole
7b0ccdbdb4 Split request 2019-08-10 07:04:31 +02:00
James Cole
55cf9fa9d0 Update link in readme. 2019-08-10 06:16:58 +02:00
James Cole
b3156e9798 New command for php config in ARM image. 2019-08-10 06:16:50 +02:00
Michael Fix
8e51b3edef Fix ranger.yml config 2019-08-09 13:40:11 -07:00
James Cole
6f8b1f3b9d Fix link in readme [skip ci] 2019-08-09 21:06:59 +02:00
James Cole
3b81b7a904 Merge tag '4.8.0' into develop
4.8.0
2019-08-09 21:03:15 +02:00
805 changed files with 20668 additions and 19834 deletions

View File

@@ -70,7 +70,7 @@ php artisan firefly-iii:cc-liabilities
php artisan firefly-iii:back-to-journals
php artisan firefly-iii:rename-account-meta
# there are 13 verify commands
# there are 14 verify commands
php artisan firefly-iii:fix-piggies
php artisan firefly-iii:create-link-types
php artisan firefly-iii:create-access-tokens
@@ -80,10 +80,11 @@ php artisan firefly-iii:fix-transfer-budgets
php artisan firefly-iii:fix-uneven-amount
php artisan firefly-iii:delete-zero-amount
php artisan firefly-iii:delete-orphaned-transactions
php artisan firefly-iii:delete-empty-journals
php artisan firefly-iii:delete-empty-journals
php artisan firefly-iii:delete-empty-groups
php artisan firefly-iii:fix-account-types
php artisan firefly-iii:rename-meta-fields
php artisan firefly-iii:fix-ob-currencies
# report commands
php artisan firefly-iii:report-empty-objects

View File

@@ -40,6 +40,7 @@ APP_LOG_LEVEL=notice
# Database credentials. Make sure the database exists. I recommend a dedicated user for Firefly III
# For other database types, please see the FAQ: http://firefly-iii.readthedocs.io/en/latest/support/faq.html
DB_CONNECTION=mysql
# If you use DOCKER COMPOSE, change this variable to "firefly_iii_db"
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=homestead

12
.github/ranger.yml vendored
View File

@@ -1,6 +1,8 @@
# in .github/ranger.yml
comments:
- action: delete_comment
pattern: +1
- action: delete_comment
pattern: ":+1:"
comments:
-
action: delete_comment
pattern: 1
-
action: delete_comment
pattern: ":+1:"

View File

@@ -1,3 +1,62 @@
# 4.8.0.3 (API 0.10.1)
- #2438 Some balance issues when working with multiple currencies (a known issue)
- #2425 Transaction edit/create form is weird with the enter button
- #2424 auto complete tab doesn't work.
- #2441 Inconsistent character limit for currencies.
- #2443 500 error when submitting budgets
- #2446 Can't update current amount for piggy bank
- #2440 Errors when interacting with recurring transactions
- #2439 SQL error in API post new user
- Transaction report (after import, over email) is mostly empty
- Mass edit checkboxes doesn't work in a tag overview
- #2437 CPU issues when viewing accounts, probably run-away queries.
- #2432 Can't disable all currencies except one / can't disable EUR and switch to something else.
- Option to edit the budget is gone from edit transaction form.
- #2453 Search view things
- #2449 Can't add invoice date.
- #2448 Bad link in transaction overview
- #2447 Bad link in bill overview
- Improvements to various API end-points. Docs are updated.
# 4.8.0.2 (API 0.10.0)
- [Issue 2203](https://github.com/firefly-iii/firefly-iii/issues/2203) Reconciliation inconsistencies.
- [Issue 2392](https://github.com/firefly-iii/firefly-iii/issues/2392) Bad namespace leads to installation errors.
- [Issue 2393](https://github.com/firefly-iii/firefly-iii/issues/2393) Missing budget selector.
- [Issue 2402](https://github.com/firefly-iii/firefly-iii/issues/2402) bad amounts in default report
- [Issue 2405](https://github.com/firefly-iii/firefly-iii/issues/2405) Due date can't be edited.
- [Issue 2404](https://github.com/firefly-iii/firefly-iii/issues/2404) bad page indicator in the "no category" transaction overview.
- [Issue 2407](https://github.com/firefly-iii/firefly-iii/issues/2407) Fix recurring transaction dates
- [Issue 2410](https://github.com/firefly-iii/firefly-iii/issues/2410) Transaction links inconsistent
- [Issue 2414](https://github.com/firefly-iii/firefly-iii/issues/2414) Can't edit recurring transactions
- [Issue 2415](https://github.com/firefly-iii/firefly-iii/issues/2415) Return here + reset form results in empty transaction form
- [Issue 2416](https://github.com/firefly-iii/firefly-iii/issues/2416) Some form inconsistencies.
- [Issue 2418](https://github.com/firefly-iii/firefly-iii/issues/2418) Reports are inaccurate or broken.
- [Issue 2422](https://github.com/firefly-iii/firefly-iii/issues/2422) PHP error when matching transactions.
- [Issue 2423](https://github.com/firefly-iii/firefly-iii/issues/2423) Reports are inaccurate or broken.
- [Issue 2426](https://github.com/firefly-iii/firefly-iii/issues/2426) Inconsistent documentation and instructions.
- [Issue 2427](https://github.com/firefly-iii/firefly-iii/issues/2427) Deleted account and "initial balance" accounts may appear in dropdowns.
- [Issue 2428](https://github.com/firefly-iii/firefly-iii/issues/2428) Reports are inaccurate or broken.
- [Issue 2429](https://github.com/firefly-iii/firefly-iii/issues/2429) Typo leads to SQL errors in available budgets API
- [Issue 2431](https://github.com/firefly-iii/firefly-iii/issues/2431) Issues creating new recurring transactions.
- [Issue 2434](https://github.com/firefly-iii/firefly-iii/issues/2434) You can edit the initial balance transaction but it fails to save.
- ARM build should work now.
# 4.8.0.1 (API 0.10.0)
- The balance box on the dashboard shows only negative numbers, skewing the results.
- Selecting or using tags in new transactions results in an error.
- Editing a transaction with tags will drop the tags from the transaction.
- [Issue 2382](https://github.com/firefly-iii/firefly-iii/issues/2382) Ranger config
- [Issue 2384](https://github.com/firefly-iii/firefly-iii/issues/2384) When upgrading manually, you may see: `The command "generate-keys" does not exist.`
- [Issue 2385](https://github.com/firefly-iii/firefly-iii/issues/2385) When upgrading manually, the firefly:verify command may fail to run.
- [Issue 2388](https://github.com/firefly-iii/firefly-iii/issues/2388) When registering as a new user, leaving the opening balance at 0 will give you an error.
- [Issue 2395](https://github.com/firefly-iii/firefly-iii/issues/2395) Editing split transactions is broken.
- [Issue 2397](https://github.com/firefly-iii/firefly-iii/issues/2397) Transfers are stored the wrong way around.
- [Issue 2399](https://github.com/firefly-iii/firefly-iii/issues/2399) Not all account balances are updated after you create a new transaction.
- [Issue 2401](https://github.com/firefly-iii/firefly-iii/issues/2401) Could not delete a split from a split transaction.
# 4.8.0 (API 0.10.0)
- Hungarian translation!

View File

@@ -15,8 +15,8 @@ const pkgdef :Spk.PackageDefinition = (
manifest = (
appTitle = (defaultText = "Firefly III"),
appVersion = 32,
appMarketingVersion = (defaultText = "4.7.17.6"),
appVersion = 35,
appMarketingVersion = (defaultText = "4.8.0.3"),
actions = [
# Define your "new document" handlers here.

View File

@@ -1,7 +1,7 @@
sudo: required
language: bash
env:
- VERSION=4.8.0
- VERSION=4.8.0.3
dist: xenial
@@ -26,4 +26,4 @@ script:
# build everything
- .deploy/docker/build-amd64.sh
- .deploy/docker/build-arm.sh
- .deploy/docker/manifest.sh
- .deploy/docker/manifest.sh

View File

@@ -1,36 +1,10 @@
FROM php:7.2-apache
FROM jc5x/firefly-iii-base-image:latest
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
# Create volumes
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
RUN apt-get update && apt-get install -y libpng-dev \
libicu-dev \
unzip \
gettext-base \
libldap2-dev \
libpq-dev \
locales \
libmemcached-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ && \
docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl opcache && \
pecl install memcached-3.1.3 && \
docker-php-ext-enable memcached && \
a2enmod rewrite && a2enmod ssl && \
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen && \
locale-gen && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# configure PHP
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /usr/local/etc/php/php.ini && \
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /usr/local/etc/php/php.ini
# Copy in Firefly III source
WORKDIR $FIREFLY_PATH
ADD . $FIREFLY_PATH
@@ -40,15 +14,6 @@ RUN chown -R www-data:www-data /var/www && \
chmod -R 775 $FIREFLY_PATH/storage && \
composer install --prefer-dist --no-dev --no-scripts --no-suggest
# copy ca certs to correct location
COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem
# copy Apache config to correct spot.
COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf
# Enable default site (Firefly III)
COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf
# Expose port 80
EXPOSE 80

View File

@@ -1,37 +1,10 @@
FROM php:7.2-apache
ARG ARCH
FROM jc5x/firefly-iii-base-image:latest
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
# Create volumes
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
RUN apt-get update && apt-get install -y libpng-dev \
libicu-dev \
unzip \
gettext-base \
libldap2-dev \
libpq-dev \
locales \
libmemcached-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ && \
docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl opcache && \
pecl install memcached-3.1.3 && \
docker-php-ext-enable memcached && \
a2enmod rewrite && a2enmod ssl && \
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen && \
locale-gen && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# configure PHP
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /usr/local/etc/php/php.ini && \
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /usr/local/etc/php/php.ini
# Copy in Firefly III source
WORKDIR $FIREFLY_PATH
ADD . $FIREFLY_PATH
@@ -41,15 +14,6 @@ RUN chown -R www-data:www-data /var/www && \
chmod -R 775 $FIREFLY_PATH/storage && \
composer install --prefer-dist --no-dev --no-scripts --no-suggest
# copy ca certs to correct location
COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem
# copy Apache config to correct spot.
COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf
# Enable default site (Firefly III)
COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf
# Expose port 80
EXPOSE 80

View File

@@ -1,38 +1,10 @@
FROM arm32v7/php:7.2.8-apache-stretch
ARG ARCH
COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static
FROM jc5x/firefly-iii-base-image:latest
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
# Create volumes
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
RUN apt-get update && apt-get install -y libpng-dev \
libicu-dev \
unzip \
gettext-base \
libldap2-dev \
libpq-dev \
locales \
libmemcached-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ && \
docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl opcache && \
pecl install memcached-3.1.3 && \
docker-php-ext-enable memcached && \
a2enmod rewrite && a2enmod ssl && \
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen && \
locale-gen && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# configure PHP
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /usr/local/etc/php/php.ini && \
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /usr/local/etc/php/php.ini
# Copy in Firefly III source
WORKDIR $FIREFLY_PATH
ADD . $FIREFLY_PATH
@@ -42,15 +14,6 @@ RUN chown -R www-data:www-data /var/www && \
chmod -R 775 $FIREFLY_PATH/storage && \
composer install --prefer-dist --no-dev --no-scripts --no-suggest
# copy ca certs to correct location
COPY ./.deploy/docker/cacert.pem /usr/local/ssl/cert.pem
# copy Apache config to correct spot.
COPY ./.deploy/docker/apache2.conf /etc/apache2/apache2.conf
# Enable default site (Firefly III)
COPY ./.deploy/docker/apache-firefly.conf /etc/apache2/sites-available/000-default.conf
# Expose port 80
EXPOSE 80

View File

@@ -1,37 +1,24 @@
FROM arm32v7/php:7.2.8-apache-stretch
FROM arm32v7/php:7.2-apache-stretch
ARG ARCH
COPY tmp/qemu-arm-static /usr/bin/qemu-arm-static
ENV FIREFLY_PATH=/var/www/firefly-iii COMPOSER_ALLOW_SUPERUSER=1
LABEL version="1.4" maintainer="thegrumpydictator@gmail.com"
LABEL version="1.5" maintainer="thegrumpydictator@gmail.com"
# Create volumes
VOLUME $FIREFLY_PATH/storage/export $FIREFLY_PATH/storage/upload
# Install stuff Firefly III runs with & depends on: php extensions, locales, dev headers and composer
RUN apt-get update && apt-get install -y libpng-dev \
libicu-dev \
unzip \
gettext-base \
libldap2-dev \
libpq-dev \
locales \
libmemcached-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN apt-get update && apt-get install -y locales unzip && apt-get clean && rm -rf /var/lib/apt/lists/*
RUN docker-php-ext-configure ldap --with-libdir=lib/$(gcc -dumpmachine)/ && \
docker-php-ext-install -j$(nproc) zip bcmath ldap gd pdo_pgsql pdo_mysql intl opcache && \
pecl install memcached-3.1.3 && \
docker-php-ext-enable memcached && \
a2enmod rewrite && a2enmod ssl && \
echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen && \
locale-gen && \
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
ADD https://raw.githubusercontent.com/mlocati/docker-php-extension-installer/master/install-php-extensions /usr/local/bin/
# configure PHP
RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini && \
sed -i 's/max_execution_time = 30/max_execution_time = 600/' /usr/local/etc/php/php.ini && \
sed -i 's/memory_limit = 128M/memory_limit = 512M/' /usr/local/etc/php/php.ini
RUN chmod uga+x /usr/local/bin/install-php-extensions && sync && \
install-php-extensions --cleanup bcmath ldap gd pdo_pgsql pdo_sqlite pdo_mysql intl opcache memcached
RUN a2enmod rewrite && a2enmod ssl
RUN echo "hu_HU.UTF-8 UTF-8\nro_RO.UTF-8 UTF-8\nnb_NO.UTF-8 UTF-8\nde_DE.UTF-8 UTF-8\ncs_CZ.UTF-8 UTF-8\nen_US.UTF-8 UTF-8\nes_ES.UTF-8 UTF-8\nfr_FR.UTF-8 UTF-8\nid_ID.UTF-8 UTF-8\nit_IT.UTF-8 UTF-8\nnl_NL.UTF-8 UTF-8\npl_PL.UTF-8 UTF-8\npt_BR.UTF-8 UTF-8\nru_RU.UTF-8 UTF-8\ntr_TR.UTF-8 UTF-8\nzh_TW.UTF-8 UTF-8\nzh_CN.UTF-8 UTF-8\n\n" > /etc/locale.gen
RUN locale-gen
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
# Copy in Firefly III source
WORKDIR $FIREFLY_PATH

View File

@@ -47,7 +47,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class AccountController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class AccountController extends Controller
{
@@ -234,8 +234,6 @@ class AccountController extends Controller
*
* @return JsonResponse
*
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
public function transactions(Request $request, Account $account): JsonResponse
{

View File

@@ -23,7 +23,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers;
use FireflyIII\Api\V1\Requests\AttachmentRequest;
use FireflyIII\Api\V1\Requests\AttachmentStoreRequest;
use FireflyIII\Api\V1\Requests\AttachmentUpdateRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
use FireflyIII\Models\Attachment;
@@ -44,7 +45,7 @@ use function strlen;
/**
* Class AttachmentController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class AttachmentController extends Controller
{
@@ -182,12 +183,12 @@ class AttachmentController extends Controller
/**
* Store a newly created resource in storage.
*
* @param AttachmentRequest $request
* @param AttachmentStoreRequest $request
*
* @return JsonResponse
* @throws FireflyException
*/
public function store(AttachmentRequest $request): JsonResponse
public function store(AttachmentStoreRequest $request): JsonResponse
{
$data = $request->getAll();
$attachment = $this->repository->store($data);
@@ -207,12 +208,12 @@ class AttachmentController extends Controller
/**
* Update the specified resource in storage.
*
* @param AttachmentRequest $request
* @param AttachmentUpdateRequest $request
* @param Attachment $attachment
*
* @return JsonResponse
*/
public function update(AttachmentRequest $request, Attachment $attachment): JsonResponse
public function update(AttachmentUpdateRequest $request, Attachment $attachment): JsonResponse
{
$data = $request->getAll();
$this->repository->update($attachment, $data);

View File

@@ -42,7 +42,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class AvailableBudgetController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class AvailableBudgetController extends Controller
{

View File

@@ -48,7 +48,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class BillController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class BillController extends Controller
{

View File

@@ -47,7 +47,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class BudgetController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class BudgetController extends Controller
{
@@ -79,8 +79,6 @@ class BudgetController extends Controller
/**
* Display a listing of the resource.
*
*
* @param Request $request
* @param Budget $budget
*

View File

@@ -46,7 +46,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class BudgetLimitController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class BudgetLimitController extends Controller
{

View File

@@ -44,7 +44,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class CategoryController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class CategoryController extends Controller
{

View File

@@ -65,7 +65,7 @@ class CategoryController extends Controller
*
* @return JsonResponse
*
* TODO after 4.8.0, simplify
* TODO after 4.8,0, simplify
*/
public function overview(DateRequest $request): JsonResponse
{

View File

@@ -37,7 +37,7 @@ use Symfony\Component\HttpFoundation\ParameterBag;
* Class Controller.
*
* @codeCoverageIgnore
* @SuppressWarnings(PHPMD.NumberOfChildren)
*
*/
class Controller extends BaseController
{

View File

@@ -66,7 +66,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class CurrencyController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class CurrencyController extends Controller
{

View File

@@ -45,7 +45,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class LinkTypeController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class LinkTypeController extends Controller
{

View File

@@ -42,7 +42,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class PiggyBankController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class PiggyBankController extends Controller
{
@@ -226,7 +226,14 @@ class PiggyBankController extends Controller
*/
public function update(PiggyBankRequest $request, PiggyBank $piggyBank): JsonResponse
{
$piggyBank = $this->repository->update($piggyBank, $request->getAll());
$data = $request->getAll();
$piggyBank = $this->repository->update($piggyBank, $data);
if ('' !== $data['current_amount']) {
$this->repository->setCurrentAmount($piggyBank, $data['current_amount']);
}
$manager = new Manager();
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
$manager->setSerializer(new JsonApiSerializer($baseUrl));

View File

@@ -48,7 +48,7 @@ use Log;
/**
* Class RuleController
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class RuleController extends Controller
{

View File

@@ -231,7 +231,7 @@ class RuleGroupController extends Controller
*
* @return JsonResponse
* @throws FireflyException
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*/
public function testGroup(RuleGroupTestRequest $request, RuleGroup $group): JsonResponse
{

View File

@@ -32,6 +32,7 @@ use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalAPIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Repositories\TransactionGroup\TransactionGroupRepositoryInterface;
use FireflyIII\Support\Http\Api\TransactionFilter;
@@ -61,6 +62,9 @@ class TransactionController extends Controller
/** @var JournalRepositoryInterface The journal repository */
private $repository;
/** @var JournalAPIRepositoryInterface Journal API repos */
private $journalAPIRepository;
/**
* TransactionController constructor.
*
@@ -74,10 +78,12 @@ class TransactionController extends Controller
/** @var User $admin */
$admin = auth()->user();
$this->repository = app(JournalRepositoryInterface::class);
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
$this->repository = app(JournalRepositoryInterface::class);
$this->groupRepository = app(TransactionGroupRepositoryInterface::class);
$this->journalAPIRepository = app(JournalAPIRepositoryInterface::class);
$this->repository->setUser($admin);
$this->groupRepository->setUser($admin);
$this->journalAPIRepository->setUser($admin);
return $next($request);
}
@@ -97,7 +103,7 @@ class TransactionController extends Controller
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$attachments = $this->repository->getAttachments($transactionJournal);
$attachments = $this->journalAPIRepository->getAttachments($transactionJournal);
/** @var AttachmentTransformer $transformer */
$transformer = app(AttachmentTransformer::class);
@@ -206,7 +212,7 @@ class TransactionController extends Controller
$baseUrl = $request->getSchemeAndHttpHost() . '/api/v1';
$manager->setSerializer(new JsonApiSerializer($baseUrl));
$events = $this->repository->getPiggyBankEvents($transactionJournal);
$events = $this->journalAPIRepository->getPiggyBankEvents($transactionJournal);
/** @var PiggyBankEventTransformer $transformer */
$transformer = app(PiggyBankEventTransformer::class);

View File

@@ -24,7 +24,8 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Controllers;
use FireflyIII\Api\V1\Requests\UserRequest;
use FireflyIII\Api\V1\Requests\UserStoreRequest;
use FireflyIII\Api\V1\Requests\UserUpdateRequest;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Transformers\UserTransformer;
@@ -42,7 +43,7 @@ use League\Fractal\Serializer\JsonApiSerializer;
/**
* Class UserController.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*
*/
class UserController extends Controller
{
@@ -155,11 +156,11 @@ class UserController extends Controller
/**
* Store a new user.
*
* @param UserRequest $request
* @param UserStoreRequest $request
*
* @return JsonResponse
*/
public function store(UserRequest $request): JsonResponse
public function store(UserStoreRequest $request): JsonResponse
{
$data = $request->getAll();
$user = $this->repository->store($data);
@@ -183,12 +184,12 @@ class UserController extends Controller
/**
* Update a user.
*
* @param UserRequest $request
* @param UserUpdateRequest $request
* @param User $user
*
* @return JsonResponse
*/
public function update(UserRequest $request, User $user): JsonResponse
public function update(UserUpdateRequest $request, User $user): JsonResponse
{
$data = $request->getAll();
$user = $this->repository->update($user, $data);

View File

@@ -1,7 +1,7 @@
<?php
/**
* AttachmentRequest.php
* Copyright (c) 2018 thegrumpydictator@gmail.com
* AttachmentStoreRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
@@ -29,11 +29,10 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Rules\IsValidAttachmentModel;
/**
* Class AttachmentRequest
* Class AttachmentStoreRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
*/
class AttachmentRequest extends Request
class AttachmentStoreRequest extends Request
{
/**
* Authorize logged in users.
@@ -78,23 +77,12 @@ class AttachmentRequest extends Request
]
);
$model = $this->string('model');
$rules = [
return [
'filename' => 'required|between:1,255',
'title' => 'between:1,255',
'notes' => 'between:1,65000',
'model' => sprintf('required|in:%s', $models),
'model_id' => ['required', 'numeric', new IsValidAttachmentModel($model)],
];
switch ($this->method()) {
default:
break;
case 'PUT':
case 'PATCH':
unset($rules['model'], $rules['model_id']);
$rules['filename'] = 'between:1,255';
break;
}
return $rules;
}
}

View File

@@ -0,0 +1,73 @@
<?php
/**
* AttachmentUpdateRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
/**
* ClassAttachmentUpdateRequest
*
* @codeCoverageIgnore
*/
class AttachmentUpdateRequest extends Request
{
/**
* Authorize logged in users.
*
* @return bool
*/
public function authorize(): bool
{
// Only allow authenticated users
return auth()->check();
}
/**
* Get all data from the request.
*
* @return array
*/
public function getAll(): array
{
return [
'filename' => $this->string('filename'),
'title' => $this->string('title'),
'notes' => $this->string('notes'),
'model' => $this->string('model'),
'model_id' => $this->integer('model_id'),
];
}
/**
* The rules that the incoming request must be matched against.
*
* @return array
*/
public function rules(): array
{
return [
'filename' => 'between:1,255',
'title' => 'between:1,255',
'notes' => 'between:1,65000',
];
}
}

View File

@@ -30,7 +30,7 @@ use Illuminate\Validation\Validator;
/**
* Class BillRequest
*
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*
* @codeCoverageIgnore
*/

View File

@@ -27,7 +27,7 @@ namespace FireflyIII\Api\V1\Requests;
* Class BudgetLimitRequest
*
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class BudgetLimitRequest extends Request
{

View File

@@ -29,7 +29,7 @@ use FireflyIII\Rules\IsBoolean;
/**
* Class BudgetRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class BudgetRequest extends Request
{

View File

@@ -28,7 +28,7 @@ use FireflyIII\Models\Category;
/**
* Class CategoryRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class CategoryRequest extends Request
{

View File

@@ -29,7 +29,7 @@ use FireflyIII\Rules\IsBoolean;
/**
* Class CurrencyRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class CurrencyRequest extends Request
{
@@ -80,7 +80,7 @@ class CurrencyRequest extends Request
$rules = [
'name' => 'required|between:1,255|unique:transaction_currencies,name',
'code' => 'required|between:3,3|unique:transaction_currencies,code',
'symbol' => 'required|between:1,5|unique:transaction_currencies,symbol',
'symbol' => 'required|between:1,8|unique:transaction_currencies,symbol',
'decimal_places' => 'between:0,20|numeric|min:0|max:20',
'enabled' => [new IsBoolean()],
'default' => [new IsBoolean()],
@@ -94,8 +94,8 @@ class CurrencyRequest extends Request
case 'PATCH':
$currency = $this->route()->parameter('currency_code');
$rules['name'] = 'required|between:1,255|unique:transaction_currencies,name,' . $currency->id;
$rules['code'] = 'required|between:1,255|unique:transaction_currencies,code,' . $currency->id;
$rules['symbol'] = 'required|between:1,255|unique:transaction_currencies,symbol,' . $currency->id;
$rules['code'] = 'required|between:3,3|unique:transaction_currencies,code,' . $currency->id;
$rules['symbol'] = 'required|between:1,8|unique:transaction_currencies,symbol,' . $currency->id;
break;
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* DateRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -19,6 +20,8 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -65,4 +68,4 @@ class DateRequest extends Request
'end' => 'required|date|after:start',
];
}
}
}

View File

@@ -30,7 +30,7 @@ use Illuminate\Validation\Rule;
*
* Class LinkTypeRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class LinkTypeRequest extends Request
{

View File

@@ -25,13 +25,14 @@ namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Models\PiggyBank;
use FireflyIII\Rules\IsAssetAccountId;
use FireflyIII\Rules\LessThanPiggyTarget;
use FireflyIII\Rules\ZeroOrMore;
/**
*
* Class PiggyBankRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class PiggyBankRequest extends Request
{
@@ -53,14 +54,11 @@ class PiggyBankRequest extends Request
*/
public function getAll(): array
{
$current = $this->string('current_amount');
$current = '' === $current ? '0' : $current;
return [
'name' => $this->string('name'),
'account_id' => $this->integer('account_id'),
'targetamount' => $this->string('target_amount'),
'current_amount' => $current,
'current_amount' => $this->string('current_amount'),
'startdate' => $this->date('start_date'),
'targetdate' => $this->date('target_date'),
'notes' => $this->string('notes'),
@@ -76,8 +74,6 @@ class PiggyBankRequest extends Request
{
$rules = [
'name' => 'required|between:1,255|uniquePiggyBankForUser',
'account_id' => ['required', 'belongsToUser:accounts', new IsAssetAccountId],
'target_amount' => 'required|numeric|more:0',
'current_amount' => ['numeric', new ZeroOrMore, 'lte:target_amount'],
'start_date' => 'date|nullable',
'target_date' => 'date|nullable|after:start_date',
@@ -90,8 +86,11 @@ class PiggyBankRequest extends Request
case 'PUT':
case 'PATCH':
/** @var PiggyBank $piggyBank */
$piggyBank = $this->route()->parameter('piggyBank');
$rules['name'] = 'required|between:1,255|uniquePiggyBankForUser:' . $piggyBank->id;
$piggyBank = $this->route()->parameter('piggyBank');
$rules['name'] = 'between:1,255|uniquePiggyBankForUser:' . $piggyBank->id;
$rules['account_id'] = ['belongsToUser:accounts', new IsAssetAccountId];
$rules['target_amount'] = 'numeric|more:0';
$rules['current_amount'] = ['numeric', new ZeroOrMore, new LessThanPiggyTarget];
break;
}

View File

@@ -23,6 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use Carbon\Carbon;
use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Validation\RecurrenceValidation;
use FireflyIII\Validation\TransactionValidation;
use Illuminate\Validation\Validator;
@@ -52,7 +55,37 @@ class RecurrenceStoreRequest extends Request
*/
public function rules(): array
{
return $this->rulesRecurrence();
$today = Carbon::now()->addDay();
return [
'type' => 'required|in:withdrawal,transfer,deposit',
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'description' => 'between:1,65000',
'first_date' => sprintf('required|date|after:%s', $today->format('Y-m-d')),
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => sprintf('date|after:%s', $today->format('Y-m-d')),
'nr_of_repetitions' => 'numeric|between:1,31',
'tags' => 'between:1,64000',
'piggy_bank_id' => 'numeric',
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
'repetitions.*.moment' => 'between:0,10',
'repetitions.*.skip' => 'required|numeric|between:0,31',
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|more:0',
'transactions.*.foreign_amount' => 'numeric|more:0',
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
'transactions.*.category_name' => 'between:1,255|nullable',
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
'transactions.*.source_name' => 'between:1,255|nullable',
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
'transactions.*.destination_name' => 'between:1,255|nullable',
];
}
/**

View File

@@ -23,6 +23,10 @@ declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use Carbon\Carbon;
use FireflyIII\Models\Recurrence;
use FireflyIII\Rules\BelongsUser;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\Validation\RecurrenceValidation;
use FireflyIII\Validation\TransactionValidation;
use Illuminate\Validation\Validator;
@@ -52,7 +56,40 @@ class RecurrenceUpdateRequest extends Request
*/
public function rules(): array
{
return $this->rulesRecurrence();
/** @var Recurrence $recurrence */
$recurrence = $this->route()->parameter('recurrence');
$first = clone $recurrence->first_date;
$first->subDay();
return [
'type' => 'required|in:withdrawal,transfer,deposit',
'title' => sprintf('required|between:1,255|uniqueObjectForUser:recurrences,title,%d', $recurrence->id),
'description' => 'between:1,65000',
'first_date' => sprintf('required|date|after:%s', $first->format('Y-m-d')),
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => sprintf('date|after:%s', $first->format('Y-m-d')),
'nr_of_repetitions' => 'numeric|between:1,31',
'tags' => 'between:1,64000',
'piggy_bank_id' => 'numeric',
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
'repetitions.*.moment' => 'between:0,10',
'repetitions.*.skip' => 'required|numeric|between:0,31',
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|more:0',
'transactions.*.foreign_amount' => 'numeric|more:0',
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
'transactions.*.category_name' => 'between:1,255|nullable',
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
'transactions.*.source_name' => 'between:1,255|nullable',
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
'transactions.*.destination_name' => 'between:1,255|nullable',
];
}
/**

View File

@@ -121,48 +121,6 @@ class Request extends FireflyIIIRequest
return $return;
}
/**
* The rules that the incoming request must be matched against.
*
* @return array
*/
protected function rulesRecurrence(): array
{
$today = Carbon::now()->addDay();
return [
'type' => 'required|in:withdrawal,transfer,deposit',
'title' => 'required|between:1,255|uniqueObjectForUser:recurrences,title',
'description' => 'between:1,65000',
'first_date' => sprintf('required|date|after:%s', $today->format('Y-m-d')),
'apply_rules' => [new IsBoolean],
'active' => [new IsBoolean],
'repeat_until' => sprintf('date|after:%s', $today->format('Y-m-d')),
'nr_of_repetitions' => 'numeric|between:1,31',
'tags' => 'between:1,64000',
'piggy_bank_id' => 'numeric',
'repetitions.*.type' => 'required|in:daily,weekly,ndom,monthly,yearly',
'repetitions.*.moment' => 'between:0,10',
'repetitions.*.skip' => 'required|numeric|between:0,31',
'repetitions.*.weekend' => 'required|numeric|min:1|max:4',
'transactions.*.description' => 'required|between:1,255',
'transactions.*.amount' => 'required|numeric|more:0',
'transactions.*.foreign_amount' => 'numeric|more:0',
'transactions.*.currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.foreign_currency_id' => 'numeric|exists:transaction_currencies,id',
'transactions.*.foreign_currency_code' => 'min:3|max:3|exists:transaction_currencies,code',
'transactions.*.budget_id' => ['mustExist:budgets,id', new BelongsUser],
'transactions.*.category_name' => 'between:1,255|nullable',
'transactions.*.source_id' => ['numeric', 'nullable', new BelongsUser],
'transactions.*.source_name' => 'between:1,255|nullable',
'transactions.*.destination_id' => ['numeric', 'nullable', new BelongsUser],
'transactions.*.destination_name' => 'between:1,255|nullable',
];
}
/**
* Returns the repetition data as it is found in the submitted data.
*

View File

@@ -30,7 +30,7 @@ use FireflyIII\Rules\IsBoolean;
/**
* @codeCoverageIgnore
* Class RuleGroupRequest
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class RuleGroupRequest extends Request
{

View File

@@ -1,4 +1,5 @@
<?php
/**
* RuleGroupTestRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -19,6 +20,9 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -141,4 +145,4 @@ class RuleGroupTestRequest extends Request
return null !== $account && AccountType::ASSET === $account->accountType->type;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* RuleGroupTriggerRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -19,6 +20,9 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -116,4 +120,4 @@ class RuleGroupTriggerRequest extends Request
return null !== $account && AccountType::ASSET === $account->accountType->type;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* RuleTestRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -19,6 +20,9 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -141,4 +145,4 @@ class RuleTestRequest extends Request
return null !== $account && AccountType::ASSET === $account->accountType->type;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
/**
* RuleTriggerRequest.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -19,6 +20,8 @@
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
@@ -116,4 +119,4 @@ class RuleTriggerRequest extends Request
return null !== $account && AccountType::ASSET === $account->accountType->type;
}
}
}

View File

@@ -31,7 +31,7 @@ use FireflyIII\Models\Tag;
*
* @codeCoverageIgnore
*
* TODO AFTER 4.8.0: split this into two request classes.
* TODO AFTER 4.8,0: split this into two request classes.
*/
class TagRequest extends Request
{

View File

@@ -1,7 +1,7 @@
<?php
/**
* UserRequest.php
* UserStoreRequest.php
* Copyright (c) 2018 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
@@ -30,11 +30,9 @@ use FireflyIII\User;
/**
* Class UserRequest
* @codeCoverageIgnore
* TODO AFTER 4.8.0: split this into two request classes.
* Class UserStoreRequest
*/
class UserRequest extends Request
class UserStoreRequest extends Request
{
/**
* Authorize logged in users.
@@ -68,7 +66,7 @@ class UserRequest extends Request
public function getAll(): array
{
$blocked = false;
if (null === $this->get('blocked')) {
if (null !== $this->get('blocked')) {
$blocked = $this->boolean('blocked');
}
$data = [
@@ -88,23 +86,12 @@ class UserRequest extends Request
*/
public function rules(): array
{
$rules = [
return [
'email' => 'required|email|unique:users,email,',
'blocked' => [new IsBoolean],
'blocked_code' => 'in:email_changed',
'role' => 'in:owner,demo',
];
switch ($this->method()) {
default:
break;
case 'PUT':
case 'PATCH':
$user = $this->route()->parameter('user');
$rules['email'] = 'required|email|unique:users,email,' . $user->id;
break;
}
return $rules;
}
}

View File

@@ -0,0 +1,100 @@
<?php
/**
* UserUpdateRequest.php
* Copyright (c) 2018 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
declare(strict_types=1);
namespace FireflyIII\Api\V1\Requests;
use FireflyIII\Repositories\User\UserRepositoryInterface;
use FireflyIII\Rules\IsBoolean;
use FireflyIII\User;
/**
* Class UserUpdateRequest
*/
class UserUpdateRequest extends Request
{
/**
* Authorize logged in users.
*
* @return bool
*/
public function authorize(): bool
{
$result = false;
// Only allow authenticated users
if (auth()->check()) {
/** @var User $user */
$user = auth()->user();
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
if ($repository->hasRole($user, 'owner')) {
$result = true; // @codeCoverageIgnore
}
}
return $result;
}
/**
* Get all data from the request.
*
* @return array
*/
public function getAll(): array
{
$blocked = false;
if (null !== $this->get('blocked')) {
$blocked = $this->boolean('blocked');
}
$data = [
'email' => $this->string('email'),
'blocked' => $blocked,
'blocked_code' => $this->string('blocked_code'),
'role' => $this->string('role'),
];
return $data;
}
/**
* The rules that the incoming request must be matched against.
*
* @return array
*/
public function rules(): array
{
$user = $this->route()->parameter('user');
$rules = [
'email' => sprintf('email|unique:users,email,%d', $user->id),
'blocked' => [new IsBoolean],
'blocked_code' => 'in:email_changed',
'role' => 'in:owner,demo,',
];
return $rules;
}
}

View File

@@ -70,6 +70,7 @@ class CorrectDatabase extends Command
'firefly-iii:delete-empty-groups',
'firefly-iii:fix-account-types',
'firefly-iii:rename-meta-fields',
'firefly-iii:fix-ob-currencies'
];
foreach ($commands as $command) {
$this->line(sprintf('Now executing %s', $command));
@@ -80,4 +81,4 @@ class CorrectDatabase extends Command
return 0;
}
}
}

View File

@@ -0,0 +1,158 @@
<?php
/**
* CorrectOpeningBalanceCurrencies.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
*
* This file is part of Firefly III.
*
* Firefly III is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Firefly III is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Firefly III. If not, see <http://www.gnu.org/licenses/>.
*/
namespace FireflyIII\Console\Commands\Correction;
use FireflyIII\Models\Account;
use FireflyIII\Models\AccountType;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Illuminate\Console\Command;
use Log;
/**
* Class CorrectOpeningBalanceCurrencies
*/
class CorrectOpeningBalanceCurrencies extends Command
{
/**
* The console command description.
*
* @var string
*/
protected $description = 'Will make sure that opening balance transaction currencies match the account they\'re for.';
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'firefly-iii:fix-ob-currencies';
/**
* Execute the console command.
*
* @return int
*/
public function handle(): int
{
// get all OB journals:
$set = TransactionJournal
::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id')
->whereNull('transaction_journals.deleted_at')
->where('transaction_types.type', TransactionType::OPENING_BALANCE)->get(['transaction_journals.*']);
$this->line(sprintf('Going to verify %d opening balance transactions.', $set->count()));
$count = 0;
/** @var TransactionJournal $journal */
foreach ($set as $journal) {
$count += $this->correctJournal($journal);
}
if ($count > 0) {
$this->line(sprintf('Corrected %d opening balance transactions.', $count));
}
if (0 === $count) {
$this->info('There was nothing to fix in the opening balance transactions.');
}
return 0;
}
/**
* @param TransactionJournal $journal
*
* @return int
*/
private function correctJournal(TransactionJournal $journal): int
{
Log::debug(sprintf('Going to correct journal #%d', $journal->id));
// get the asset account for this opening balance:
$account = $this->getAccount($journal);
if (null === $account) {
$this->warn(sprintf('Transaction journal #%d has no valid account. Cant fix this line.', $journal->id));
return 0;
}
Log::debug(sprintf('Found %s #%d "%s".', $account->accountType->type, $account->id, $account->name));
$currency = $this->getCurrency($account);
Log::debug(sprintf('Found currency #%d (%s)', $currency->id, $currency->code));
// update journal and all transactions:
$this->setCurrency($journal, $currency);
return 1;
}
/**
* @param TransactionJournal $journal
*
* @return Account|null
*/
private function getAccount(TransactionJournal $journal): ?Account
{
$excluded = [];
$transactions = $journal->transactions()->with(['account', 'account.accountType'])->get();
/** @var Transaction $transaction */
foreach ($transactions as $transaction) {
$account = $transaction->account;
if (null !== $account) {
if (AccountType::INITIAL_BALANCE !== $account->accountType->type) {
return $account;
}
}
}
return null;
}
/**
* @param Account $account
*
* @return TransactionCurrency
*/
private function getCurrency(Account $account): TransactionCurrency
{
/** @var AccountRepositoryInterface $repos */
$repos = app(AccountRepositoryInterface::class);
$repos->setUser($account->user);
return $repos->getAccountCurrency($account) ?? app('amount')->getDefaultCurrencyByUser($account->user);
}
/**
* @param TransactionJournal $journal
* @param TransactionCurrency $currency
*/
private function setCurrency(TransactionJournal $journal, TransactionCurrency $currency): void
{
$journal->transaction_currency_id = $currency->id;
$journal->save();
/** @var Transaction $transaction */
foreach ($journal->transactions as $transaction) {
$transaction->transaction_currency_id = $currency->id;
$transaction->save();
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* CreateAccessTokens.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* CreateLinkTypes.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* DeleteEmptyGroups.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* DeleteEmptyJournals.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* DeleteOrphanedTransactions.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* DeleteZeroAmount.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* EnableCurrencies.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* FixAccountTypes.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* FixPiggies.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* FixUnevenAmount.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* RemoveBills.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* RenameMetaFields.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* TransferBudgets.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* ReportEmptyObjects.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -70,4 +70,4 @@ class ReportIntegrity extends Command
return 0;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* ReportSum.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

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

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* AccountCurrencies.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* BackToJournals.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -116,4 +116,4 @@ class BudgetLimitCurrency extends Command
{
app('fireflyconfig')->set(self::CONFIG_NAME, true);
}
}
}

View File

@@ -115,4 +115,4 @@ class CCLiabilities extends Command
{
app('fireflyconfig')->set(self::CONFIG_NAME, true);
}
}
}

View File

@@ -125,4 +125,4 @@ class MigrateAttachments extends Command
{
app('fireflyconfig')->set(self::CONFIG_NAME, true);
}
}
}

View File

@@ -124,4 +124,4 @@ class MigrateJournalNotes extends Command
{
app('fireflyconfig')->set(self::CONFIG_NAME, true);
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* MigrateToGroups.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -26,6 +27,7 @@ use Exception;
use FireflyIII\Factory\TransactionGroupFactory;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use FireflyIII\Services\Internal\Destroy\JournalDestroyService;
use Illuminate\Console\Command;
@@ -58,6 +60,8 @@ class MigrateToGroups extends Command
private $groupFactory;
/** @var JournalRepositoryInterface */
private $journalRepository;
/** @var JournalCLIRepositoryInterface */
private $cliRepository;
/** @var JournalDestroyService */
private $service;
private $count;
@@ -122,6 +126,7 @@ class MigrateToGroups extends Command
$this->journalRepository = app(JournalRepositoryInterface::class);
$this->service = app(JournalDestroyService::class);
$this->groupFactory = app(TransactionGroupFactory::class);
$this->cliRepository = app(JournalCLIRepositoryInterface::class);
}
/**
@@ -195,7 +200,7 @@ class MigrateToGroups extends Command
*/
private function makeGroupsFromAll(): void
{
$orphanedJournals = $this->journalRepository->getJournalsWithoutGroup();
$orphanedJournals = $this->cliRepository->getJournalsWithoutGroup();
$count = count($orphanedJournals);
if ($count > 0) {
Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $count));
@@ -215,7 +220,7 @@ class MigrateToGroups extends Command
*/
private function makeGroupsFromSplitJournals(): void
{
$splitJournals = $this->journalRepository->getSplitJournals();
$splitJournals = $this->cliRepository->getSplitJournals();
if ($splitJournals->count() > 0) {
$this->info(sprintf('Going to convert %d split transaction(s). Please hold..', $splitJournals->count()));
/** @var TransactionJournal $journal */
@@ -232,7 +237,7 @@ class MigrateToGroups extends Command
* @param TransactionJournal $journal
*
* @throws Exception
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*/
private function makeMultiGroup(TransactionJournal $journal): void
{
@@ -248,6 +253,7 @@ class MigrateToGroups extends Command
$this->journalRepository->setUser($journal->user);
$this->groupFactory->setUser($journal->user);
$this->cliRepository->setUser($journal->user);
$data = [
// mandatory fields.
@@ -255,32 +261,31 @@ class MigrateToGroups extends Command
'transactions' => [],
];
$destTransactions = $this->getDestinationTransactions($journal);
$budgetId = $this->journalRepository->getJournalBudgetId($journal);
$categoryId = $this->journalRepository->getJournalCategoryId($journal);
$notes = $this->journalRepository->getNoteText($journal);
$tags = $this->journalRepository->getTags($journal);
$internalRef = $this->journalRepository->getMetaField($journal, 'internal-reference');
$sepaCC = $this->journalRepository->getMetaField($journal, 'sepa_cc');
$sepaCtOp = $this->journalRepository->getMetaField($journal, 'sepa_ct_op');
$sepaCtId = $this->journalRepository->getMetaField($journal, 'sepa_ct_id');
$sepaDb = $this->journalRepository->getMetaField($journal, 'sepa_db');
$sepaCountry = $this->journalRepository->getMetaField($journal, 'sepa_country');
$sepaEp = $this->journalRepository->getMetaField($journal, 'sepa_ep');
$sepaCi = $this->journalRepository->getMetaField($journal, 'sepa_ci');
$sepaBatchId = $this->journalRepository->getMetaField($journal, 'sepa_batch_id');
$externalId = $this->journalRepository->getMetaField($journal, 'external-id');
$originalSource = $this->journalRepository->getMetaField($journal, 'original-source');
$recurrenceId = $this->journalRepository->getMetaField($journal, 'recurrence_id');
$bunq = $this->journalRepository->getMetaField($journal, 'bunq_payment_id');
$hash = $this->journalRepository->getMetaField($journal, 'import_hash');
$hashTwo = $this->journalRepository->getMetaField($journal, 'import_hash_v2');
$interestDate = $this->journalRepository->getMetaDate($journal, 'interest_date');
$bookDate = $this->journalRepository->getMetaDate($journal, 'book_date');
$processDate = $this->journalRepository->getMetaDate($journal, 'process_date');
$dueDate = $this->journalRepository->getMetaDate($journal, 'due_date');
$paymentDate = $this->journalRepository->getMetaDate($journal, 'payment_date');
$invoiceDate = $this->journalRepository->getMetaDate($journal, 'invoice_date');
$budgetId = $this->cliRepository->getJournalBudgetId($journal);
$categoryId = $this->cliRepository->getJournalCategoryId($journal);
$notes = $this->cliRepository->getNoteText($journal);
$tags = $this->cliRepository->getTags($journal);
$internalRef = $this->cliRepository->getMetaField($journal, 'internal-reference');
$sepaCC = $this->cliRepository->getMetaField($journal, 'sepa_cc');
$sepaCtOp = $this->cliRepository->getMetaField($journal, 'sepa_ct_op');
$sepaCtId = $this->cliRepository->getMetaField($journal, 'sepa_ct_id');
$sepaDb = $this->cliRepository->getMetaField($journal, 'sepa_db');
$sepaCountry = $this->cliRepository->getMetaField($journal, 'sepa_country');
$sepaEp = $this->cliRepository->getMetaField($journal, 'sepa_ep');
$sepaCi = $this->cliRepository->getMetaField($journal, 'sepa_ci');
$sepaBatchId = $this->cliRepository->getMetaField($journal, 'sepa_batch_id');
$externalId = $this->cliRepository->getMetaField($journal, 'external-id');
$originalSource = $this->cliRepository->getMetaField($journal, 'original-source');
$recurrenceId = $this->cliRepository->getMetaField($journal, 'recurrence_id');
$bunq = $this->cliRepository->getMetaField($journal, 'bunq_payment_id');
$hash = $this->cliRepository->getMetaField($journal, 'import_hash');
$hashTwo = $this->cliRepository->getMetaField($journal, 'import_hash_v2');
$interestDate = $this->cliRepository->getMetaDate($journal, 'interest_date');
$bookDate = $this->cliRepository->getMetaDate($journal, 'book_date');
$processDate = $this->cliRepository->getMetaDate($journal, 'process_date');
$dueDate = $this->cliRepository->getMetaDate($journal, 'due_date');
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
Log::debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));

View File

@@ -246,4 +246,4 @@ class MigrateToRules extends Command
$this->billRepository->update($bill, $newBillData);
$this->count++;
}
}
}

View File

@@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Console\Command;
@@ -61,6 +62,8 @@ class OtherCurrenciesCorrections extends Command
private $currencyRepos;
/** @var JournalRepositoryInterface */
private $journalRepos;
/** @var JournalCLIRepositoryInterface */
private $cliRepos;
/** @var int */
private $count;
@@ -105,6 +108,7 @@ class OtherCurrenciesCorrections extends Command
$this->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
$this->journalRepos = app(JournalRepositoryInterface::class);
$this->cliRepos = app(JournalCLIRepositoryInterface::class);
}
/**
@@ -121,6 +125,7 @@ class OtherCurrenciesCorrections extends Command
if (isset($this->accountCurrencies[$accountId]) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
return $this->accountCurrencies[$accountId]; // @codeCoverageIgnore
}
// TODO we can use getAccountCurrency() instead
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
$result = $this->currencyRepos->findNull($currencyId);
if (null === $result) {
@@ -166,6 +171,7 @@ class OtherCurrenciesCorrections extends Command
$this->accountRepos->setUser($journal->user);
$this->journalRepos->setUser($journal->user);
$this->currencyRepos->setUser($journal->user);
$this->cliRepos->setUser($journal->user);
$leadTransaction = $this->getLeadTransaction($journal);
@@ -223,7 +229,7 @@ class OtherCurrenciesCorrections extends Command
private function updateOtherJournalsCurrencies(): void
{
$set =
$this->journalRepos->getAllJournals(
$this->cliRepos->getAllJournals(
[
TransactionType::WITHDRAWAL,
TransactionType::DEPOSIT,
@@ -242,8 +248,8 @@ class OtherCurrenciesCorrections extends Command
* Gets the transaction that determines the transaction that "leads" and will determine
* the currency to be used by all transactions, and the journal itself.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @param TransactionJournal $journal
*
* @return Transaction|null
*/
private function getLeadTransaction(TransactionJournal $journal): ?Transaction
@@ -277,4 +283,4 @@ class OtherCurrenciesCorrections extends Command
return $lead;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* RenameAccountMeta.php
* Copyright (c) 2019 thegrumpydictator@gmail.com

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* TransactionIdentifier.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -23,6 +24,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
use FireflyIII\Models\Transaction;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Console\Command;
use Illuminate\Database\QueryException;
@@ -51,6 +53,9 @@ class TransactionIdentifier extends Command
/** @var JournalRepositoryInterface */
private $journalRepository;
/** @var JournalCLIRepositoryInterface */
private $cliRepository;
/** @var int */
private $count;
@@ -81,7 +86,7 @@ class TransactionIdentifier extends Command
return 0;
}
// @codeCoverageIgnoreEnd
$journals = $this->journalRepository->getSplitJournals();
$journals = $this->cliRepository->getSplitJournals();
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {
$this->updateJournalIdentifiers($journal);
@@ -111,6 +116,7 @@ class TransactionIdentifier extends Command
private function stupidLaravel(): void
{
$this->journalRepository = app(JournalRepositoryInterface::class);
$this->cliRepository = app(JournalCLIRepositoryInterface::class);
$this->count = 0;
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* TransferCurrenciesCorrections.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -29,6 +30,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Console\Command;
use Log;
@@ -60,6 +62,8 @@ class TransferCurrenciesCorrections extends Command
private $currencyRepos;
/** @var JournalRepositoryInterface */
private $journalRepos;
/** @var JournalCLIRepositoryInterface */
private $cliRepos;
/** @var int */
private $count;
@@ -125,6 +129,7 @@ class TransferCurrenciesCorrections extends Command
$this->accountRepos = app(AccountRepositoryInterface::class);
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
$this->journalRepos = app(JournalRepositoryInterface::class);
$this->cliRepos = app(JournalCLIRepositoryInterface::class);
$this->accountCurrencies = [];
$this->resetInformation();
}
@@ -143,6 +148,7 @@ class TransferCurrenciesCorrections extends Command
if (isset($this->accountCurrencies[$accountId]) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) {
return $this->accountCurrencies[$accountId]; // @codeCoverageIgnore
}
// TODO we can use getAccountCurrency() instead
$currencyId = (int)$this->accountRepos->getMetaValue($account, 'currency_id');
$result = $this->currencyRepos->findNull($currencyId);
if (null === $result) {
@@ -238,7 +244,7 @@ class TransferCurrenciesCorrections extends Command
*/
private function startUpdateRoutine(): void
{
$set = $this->journalRepos->getAllJournals([TransactionType::TRANSFER]);
$set = $this->cliRepos->getAllJournals([TransactionType::TRANSFER]);
/** @var TransactionJournal $journal */
foreach ($set as $journal) {
$this->updateTransferCurrency($journal);
@@ -286,8 +292,6 @@ class TransferCurrenciesCorrections extends Command
}
/**
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
* @param TransactionJournal $transfer
*/
private function updateTransferCurrency(TransactionJournal $transfer): void
@@ -571,4 +575,4 @@ class TransferCurrenciesCorrections extends Command
return false;
}
}
}

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* UpgradeDatabase.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -52,6 +53,7 @@ class UpgradeDatabase extends Command
*/
public function handle(): int
{
$this->callInitialCommands();
@@ -70,7 +72,7 @@ class UpgradeDatabase extends Command
'firefly-iii:back-to-journals',
'firefly-iii:rename-account-meta',
// there are 13 verify commands.
// there are 14 verify commands.
'firefly-iii:fix-piggies',
'firefly-iii:create-link-types',
'firefly-iii:create-access-tokens',
@@ -84,6 +86,7 @@ class UpgradeDatabase extends Command
'firefly-iii:delete-empty-groups',
'firefly-iii:fix-account-types',
'firefly-iii:rename-meta-fields',
'firefly-iii:fix-ob-currencies',
// two report commands
'firefly-iii:report-empty-objects',
@@ -102,8 +105,8 @@ class UpgradeDatabase extends Command
$result = Artisan::output();
echo $result;
}
// set new DB version.
app('fireflyconfig')->set('db_version', (int)config('firefly.db_version'));
// index will set FF3 version.
app('fireflyconfig')->set('ff3_version', (string)config('firefly.version'));
@@ -112,8 +115,21 @@ class UpgradeDatabase extends Command
private function callInitialCommands(): void
{
Artisan::call('migrate', ['--seed' => true]);
$this->line('Now seeding the database...');
Artisan::call('migrate', ['--seed' => true, '--force' => true]);
$result = Artisan::output();
echo $result;
$this->line('Now decrypting the database (if necessary)...');
Artisan::call('firefly-iii:decrypt-all');
Artisan::call('generate-keys');
$result = Artisan::output();
echo $result;
$this->line('Now installing OAuth2 keys...');
Artisan::call('passport:install');
$result = Artisan::output();
echo $result;
$this->line('Done!');
}
}

View File

@@ -60,8 +60,8 @@ class RequestedReportOnJournals
{
use Dispatchable, InteractsWithSockets, SerializesModels;
/** @var Collection The journals to report on. */
public $journals;
/** @var Collection The transaction groups to report on. */
public $groups;
/** @var int The ID of the user. */
public $userId;
@@ -69,13 +69,13 @@ class RequestedReportOnJournals
* Create a new event instance.
*
* @param int $userId
* @param Collection $journals
* @param Collection $groups
*/
public function __construct(int $userId, Collection $journals)
public function __construct(int $userId, Collection $groups)
{
Log::debug('In event RequestedReportOnJournals.');
$this->userId = $userId;
$this->journals = $journals;
$this->groups = $groups;
}
/**

View File

@@ -36,16 +36,15 @@ class StoredTransactionGroup extends Event
{
use SerializesModels;
public $applyRules;
/** @var TransactionGroup The group that was stored. */
public $transactionGroup;
public $applyRules;
/**
* Create a new event instance.
*
* @param TransactionGroup $transactionGroup
* @param bool $applyRules
* @param bool $applyRules
*/
public function __construct(TransactionGroup $transactionGroup, bool $applyRules = true)
{

View File

@@ -29,6 +29,7 @@ use Illuminate\Queue\SerializesModels;
/**
* Class UpdatedTransactionGroup.
*
* @codeCoverageIgnore
*
*/

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/**
* GracefulNotFoundHandler.php
* Copyright (c) 2019 thegrumpydictator@gmail.com
@@ -43,9 +44,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
*
* @param Request $request
* @param Exception $exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
* @return mixed
*/
@@ -225,4 +224,4 @@ class GracefulNotFoundHandler extends ExceptionHandler
}
}
}

View File

@@ -48,9 +48,7 @@ class Handler extends ExceptionHandler
*
* @param Request $request
* @param Exception $exception
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
*
* @return mixed
*/
@@ -112,7 +110,7 @@ class Handler extends ExceptionHandler
*
* This is a great spot to send exceptions to Sentry etc.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five its fine.
* // it's five its fine.
*
* @param Exception $exception
*

View File

@@ -189,7 +189,7 @@ class AccountFactory
* @param null|string $accountType
*
* @return AccountType|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function getAccountType(?int $accountTypeId, ?string $accountType): ?AccountType
{

View File

@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Budget;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
/**
@@ -53,7 +52,7 @@ class BudgetFactory
* @param null|string $budgetName
*
* @return Budget|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function find(?int $budgetId, ?string $budgetName): ?Budget
{
@@ -90,17 +89,7 @@ class BudgetFactory
*/
public function findByName(string $name): ?Budget
{
/** @var Collection $collection */
$collection = $this->user->budgets()->get();
// TODO no longer need to loop like this
/** @var Budget $budget */
foreach ($collection as $budget) {
if ($budget->name === $name) {
return $budget;
}
}
return null;
return $this->user->budgets()->where('name', $name)->first();
}
/**

View File

@@ -26,7 +26,6 @@ namespace FireflyIII\Factory;
use FireflyIII\Models\Category;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
/**
@@ -55,21 +54,7 @@ class CategoryFactory
*/
public function findByName(string $name): ?Category
{
$result = null;
/** @var Collection $collection */
$collection = $this->user->categories()->get();
// TODO no longer need to loop like this
/** @var Category $category */
foreach ($collection as $category) {
if ($category->name === $name) {
$result = $category;
break;
}
}
return $result;
return $this->user->categories()->where('name', $name)->first();
}
/**
@@ -77,7 +62,7 @@ class CategoryFactory
* @param null|string $categoryName
*
* @return Category|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function findOrCreate(?int $categoryId, ?string $categoryName): ?Category
{

View File

@@ -53,7 +53,7 @@ class PiggyBankEventFactory
* @param PiggyBank|null $piggyBank
*
* @return PiggyBankEvent|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function create(TransactionJournal $journal, ?PiggyBank $piggyBank): ?PiggyBankEvent
{

View File

@@ -52,7 +52,7 @@ class PiggyBankFactory
* @param null|string $piggyBankName
*
* @return PiggyBank|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function find(?int $piggyBankId, ?string $piggyBankName): ?PiggyBank
{
@@ -90,18 +90,7 @@ class PiggyBankFactory
*/
public function findByName(string $name): ?PiggyBank
{
$set = $this->user->piggyBanks()->get();
// TODO no longer need to loop like this
/** @var PiggyBank $piggy */
foreach ($set as $piggy) {
if ($piggy->name === $name) {
return $piggy;
}
}
return null;
return $this->user->piggyBanks()->where('piggy_banks.name', $name)->first();
}
/**

View File

@@ -79,7 +79,7 @@ class TransactionCurrencyFactory
* @param null|string $currencyCode
*
* @return TransactionCurrency|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function find(?int $currencyId, ?string $currencyCode): ?TransactionCurrency
{

View File

@@ -23,9 +23,7 @@ declare(strict_types=1);
namespace FireflyIII\Factory;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Models\TransactionGroup;
use FireflyIII\Models\TransactionJournal;
use FireflyIII\User;
/**
@@ -60,10 +58,8 @@ class TransactionGroupFactory
$collection = $this->journalFactory->create($data);
$title = $data['group_title'] ?? null;
$title = '' === $title ? null : $title;
/** @var TransactionJournal $first */
$first = $collection->first();
$group = new TransactionGroup;
$group->user()->associate($first->user);
$group = new TransactionGroup;
$group->user()->associate($this->user);
$group->title = $title;
$group->save();
@@ -81,4 +77,4 @@ class TransactionGroupFactory
{
$this->user = $user;
}
}
}

View File

@@ -143,6 +143,9 @@ class TransactionJournalFactory
if (null !== $journal) {
$collection->push($journal);
}
if(null === $journal) {
Log::error('The createJournal() method returned NULL. This may indicate an error.');
}
}
return $collection;
@@ -247,13 +250,14 @@ class TransactionJournalFactory
$destinationAccount = $this->getAccount($type->type, 'destination', (int)$row['destination_id'], $row['destination_name']);
// @codeCoverageIgnoreStart
} catch (FireflyException $e) {
Log::error('Could not validate source or destination.');
Log::error($e->getMessage());
return null;
}
// @codeCoverageIgnoreEnd
// TODO After 4.8.0 better handling below:
// TODO AFTER 4.8,0 better handling below:
/** double check currencies. */
$sourceCurrency = $currency;
@@ -261,7 +265,7 @@ class TransactionJournalFactory
$sourceForeignCurrency = $foreignCurrency;
$destForeignCurrency = $foreignCurrency;
if ('Withdrawal' === $type->type) {
if (TransactionType::WITHDRAWAL === $type->type) {
// make sure currency is correct.
$currency = $this->getCurrency($currency, $sourceAccount);
// make sure foreign currency != currency.
@@ -273,7 +277,7 @@ class TransactionJournalFactory
$sourceForeignCurrency = $foreignCurrency;
$destForeignCurrency = $foreignCurrency;
}
if ('Deposit' === $type->type) {
if (TransactionType::DEPOSIT === $type->type) {
// make sure currency is correct.
$currency = $this->getCurrency($currency, $destinationAccount);
// make sure foreign currency != currency.
@@ -293,14 +297,9 @@ class TransactionJournalFactory
$foreignCurrency = $this->getCurrency($foreignCurrency, $destinationAccount);
$sourceCurrency = $currency;
$destCurrency = $foreignCurrency;
$destCurrency = $currency;
$sourceForeignCurrency = $foreignCurrency;
$destForeignCurrency = $currency;
}
// if transfer, switch accounts:
if (TransactionType::TRANSFER === $type->type) {
[$sourceAccount, $destinationAccount] = [$destinationAccount, $sourceAccount];
$destForeignCurrency = $foreignCurrency;
}
/** Create a basic journal. */

View File

@@ -49,8 +49,6 @@ class TransactionJournalMetaFactory
* @param array $data
*
* @return TransactionJournalMeta|null
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*/
public function updateOrCreate(array $data): ?TransactionJournalMeta
{

View File

@@ -109,7 +109,7 @@ class ChartJsGenerator implements GeneratorInterface
* ]
* ]
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
* // it's five.
*
* @param array $data
*

View File

@@ -60,7 +60,7 @@ interface GeneratorInterface
* ]
* ]
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's five.
* // it's five.
*
* @param array $data
*

View File

@@ -24,7 +24,6 @@ namespace FireflyIII\Generator\Report\Standard;
use Carbon\Carbon;
use FireflyIII\Generator\Report\ReportGeneratorInterface;
use FireflyIII\Helpers\Report\ReportHelperInterface;
use Illuminate\Support\Collection;
use Log;
use Throwable;
@@ -50,17 +49,11 @@ class MonthReportGenerator implements ReportGeneratorInterface
*/
public function generate(): string
{
/** @var ReportHelperInterface $helper */
$helper = app(ReportHelperInterface::class);
$bills = $helper->getBillReport($this->start, $this->end, $this->accounts);
$accountIds = implode(',', $this->accounts->pluck('id')->toArray());
$reportType = 'default';
try {
return view(
'reports.default.month',
compact('bills', 'accountIds', 'reportType')
)->with('start', $this->start)->with('end', $this->end)->render();
return view('reports.default.month', compact('accountIds', 'reportType'))->with('start', $this->start)->with('end', $this->end)->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render reports.default.month: %s', $e->getMessage()));
$result = 'Could not render report view.';

View File

@@ -112,7 +112,7 @@ class Support
/**
* Summarize collection by earned and spent data.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity) // it's exactly five.
* // it's exactly five.
*
* @param array $spent
* @param array $earned

View File

@@ -55,10 +55,10 @@ class AutomationHandler
/** @var UserRepositoryInterface $repository */
$repository = app(UserRepositoryInterface::class);
$user = $repository->findNull($event->userId);
if (null !== $user && 0 !== $event->journals->count()) {
if (null !== $user && 0 !== $event->groups->count()) {
try {
Log::debug('Trying to mail...');
Mail::to($user->email)->send(new ReportNewJournalsMail($user->email, '127.0.0.1', $event->journals));
Mail::to($user->email)->send(new ReportNewJournalsMail($user->email, '127.0.0.1', $event->groups));
// @codeCoverageIgnoreStart
} catch (Exception $e) {
Log::debug('Send message failed! :(');

View File

@@ -43,9 +43,7 @@ class VersionCheckEventHandler
/**
* Checks with GitHub to see if there is a new version.
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
* @SuppressWarnings(PHPMD.NPathComplexity)
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
*
* @param RequestedVersionCheckStatus $event
*/
public function checkForUpdates(RequestedVersionCheckStatus $event): void

View File

@@ -98,7 +98,7 @@ class MetaPieChart implements MetaPieChartInterface
* @param string $group
*
* @return array
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
public function generate(string $direction, string $group): array
{
@@ -181,8 +181,6 @@ class MetaPieChart implements MetaPieChartInterface
*
* @return array
*
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
*
*/
protected function groupByFields(array $array, array $fields): array
{

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